调整
This commit is contained in:
@@ -0,0 +1,344 @@
|
||||
<template>
|
||||
<view class="home-page">
|
||||
<z-paging ref="paging" v-model="borrowList" @query="queryList" empty-view-text="暂无数据!">
|
||||
<template #top>
|
||||
<uni-nav-bar leftText=" " :fixed="true" leftIcon="back" :border="false" @clickLeft="leftClick" color="#fff" backgroundColor="rgb(48, 116, 247)" :statusBar="true" title="审批列表"></uni-nav-bar>
|
||||
<!-- Tab栏 -->
|
||||
<view class="tab-bar">
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ 'tab-item-active': currentTab === index }"
|
||||
v-for="(tab, index) in tabList"
|
||||
:key="index"
|
||||
@click="switchTab(index)"
|
||||
>
|
||||
<text class="tab-text">{{ tab }}</text>
|
||||
<view v-if="currentTab === index" class="tab-underline"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<!-- 列表内容 -->
|
||||
<view class="list-container">
|
||||
<view
|
||||
class="borrow-card"
|
||||
v-for="(item, index) in borrowList"
|
||||
:key="index"
|
||||
>
|
||||
<!-- 状态标签(右上角旋转丝带) -->
|
||||
<view class="status-ribbon" :class="'ribbon-' + item.status">
|
||||
<text class="ribbon-text">{{ getStatusText(item.status) }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 卡片内容 -->
|
||||
<view class="card-content" @click="handleCardClick(item)">
|
||||
<view class="card-title">
|
||||
<uni-tag :text="item1.item_name_snap" size="mini" type="primary" v-for="(item1, index) in item.item" :key="index"/>
|
||||
</view>
|
||||
<view class="card-info">
|
||||
<text class="info-item">申请人: {{ item.applicant_name }}</text>
|
||||
<text class="info-item">借用时间: {{ item.use_start_date || '-' }} ~ {{ item.use_end_date || '-' }}</text>
|
||||
|
||||
</view>
|
||||
<view class="action-btns">
|
||||
<!-- <text class="info-item">公司名称: {{ item.companyName }}</text> -->
|
||||
<text class="info-item"></text>
|
||||
<!-- 操作按钮 -->
|
||||
<view class="card-actions" v-if="item.status !== 'returned'">
|
||||
<button
|
||||
class="action-btn"
|
||||
:class="'btn-' + item.status"
|
||||
v-if="item.status==10"
|
||||
@click.stop="handleAction(item)"
|
||||
>
|
||||
{{ getActionText(item.status) }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</z-paging>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { request,showToast } from '@/api/apiT.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
currentTab: 0,
|
||||
tabList: ['全部', '待审核', '已通过', '未通过'],
|
||||
borrowList: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filteredList() {
|
||||
if (this.currentTab === 0) {
|
||||
return this.borrowList
|
||||
} else if (this.currentTab === 1) {
|
||||
return this.borrowList.filter(item => item.status === 'returned')
|
||||
} else if (this.currentTab === 2) {
|
||||
return this.borrowList.filter(item => item.status === 'notReturned')
|
||||
} else if (this.currentTab === 3) {
|
||||
return this.borrowList.filter(item => item.status === 'pendingReview')
|
||||
}
|
||||
return []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
leftClick(){
|
||||
uni.navigateBack({})
|
||||
},
|
||||
switchTab(index) {
|
||||
this.currentTab = index
|
||||
// 重置分页并重新加载数据
|
||||
if (this.$refs.paging) {
|
||||
this.$refs.paging.reload()
|
||||
}
|
||||
},
|
||||
queryList(pageNo, pageSize, from) {
|
||||
this.loading = true;
|
||||
var that = this;
|
||||
const params = {
|
||||
current:pageNo,
|
||||
size:10,
|
||||
status: this.currentTab === 0 ? '' : (this.currentTab === 1 ? '10' : (this.currentTab === 2 ? '12' : '13'))
|
||||
};
|
||||
request({
|
||||
url:'mobile/inv/requisition/list',
|
||||
method:'get',
|
||||
data: params
|
||||
}).then(res => {
|
||||
if(res.data.code ==200){
|
||||
var datas = res.data.data.records;
|
||||
this.$refs.paging.complete(datas);
|
||||
}else{
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
//
|
||||
})
|
||||
},
|
||||
getStatusText(status) {
|
||||
const statusMap = {
|
||||
'12': '待归还',
|
||||
'13': '拒绝',
|
||||
'14': '申请归还',
|
||||
'15': '归还审核中',
|
||||
'16': '部分归还',
|
||||
'17': '已归还',
|
||||
'18': '归还拒绝',
|
||||
'11': '审批中',
|
||||
'10': '待审核',
|
||||
'19': '损耗品'
|
||||
}
|
||||
return statusMap[status] || ''
|
||||
},
|
||||
getActionText(status) {
|
||||
const actionMap = {
|
||||
'12': '待归还',
|
||||
'13': '拒绝',
|
||||
'14': '申请归还',
|
||||
'15': '归还审核中',
|
||||
'16': '部分归还',
|
||||
'17': '已归还',
|
||||
'18': '归还拒绝',
|
||||
'11': '审批中',
|
||||
'10': '去审核',
|
||||
'19': '损耗品'
|
||||
}
|
||||
return actionMap[status] || ''
|
||||
},
|
||||
handleCardClick(item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/approval/borrow_approval_detail?id=' + item.id
|
||||
});
|
||||
},
|
||||
handleAction(item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/approval/borrow_approval_detils?id='+item.id
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.home-page {
|
||||
min-height: 100vh;
|
||||
background: rgb(244, 246, 248);
|
||||
}
|
||||
|
||||
.content-wrapper {
|
||||
}
|
||||
|
||||
// Tab栏样式
|
||||
.tab-bar {
|
||||
display: flex;
|
||||
background: #F4F6F8;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
padding: 24rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tab-text {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.tab-item-active .tab-text {
|
||||
color: #3074F7;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tab-underline {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 60rpx;
|
||||
height: 4rpx;
|
||||
background: #3074F7;
|
||||
border-radius: 2rpx;
|
||||
}
|
||||
|
||||
// 列表容器
|
||||
.list-container {
|
||||
padding: 24rpx 28rpx;
|
||||
}
|
||||
|
||||
// 借用卡片
|
||||
.borrow-card {
|
||||
position: relative;
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
margin-bottom: 24rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
// 状态标签(旋转丝带效果)
|
||||
.status-ribbon {
|
||||
position: absolute;
|
||||
top: -4px;
|
||||
right: -32px;
|
||||
width: 100px;
|
||||
height: 47px;
|
||||
background: #08A400;
|
||||
transform: rotate(45deg);
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.ribbon-notReturned {
|
||||
background: #BD0000; // 红色
|
||||
}
|
||||
.ribbon-10 {
|
||||
background: #3471FF; // 蓝色
|
||||
}
|
||||
.ribbon-11 {
|
||||
background: #FA8C16;
|
||||
}
|
||||
.ribbon-12 {
|
||||
background: #722ED1;
|
||||
}
|
||||
.ribbon-13 {
|
||||
background: #F5222D;
|
||||
}
|
||||
.ribbon-14 {
|
||||
background: #13C2C2;
|
||||
}
|
||||
.ribbon-15 {
|
||||
background: #FAAD14;
|
||||
}
|
||||
.ribbon-16 {
|
||||
background: #52C41A;
|
||||
}
|
||||
.ribbon-17 {
|
||||
background: #389E0D;
|
||||
}
|
||||
.ribbon-18 {
|
||||
background: #A8071A;
|
||||
}
|
||||
.ribbon-19 {
|
||||
background: #8C8C8C;
|
||||
}
|
||||
.ribbon-text {
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
font-weight: 500;
|
||||
transform: rotate(0deg);
|
||||
transform-origin: center;
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin-top: 16rpx;
|
||||
white-space: nowrap;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
|
||||
// 卡片内容
|
||||
.card-content {
|
||||
padding: 28rpx;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-bottom: 24rpx;
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.card-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
// 操作按钮
|
||||
.card-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.action-btns{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
padding: 14rpx 40rpx;
|
||||
background: #3074F7;
|
||||
color: #fff;
|
||||
border-radius: 8rpx;
|
||||
font-size: 26rpx;
|
||||
border: none;
|
||||
line-height: 1;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-notReturned {
|
||||
background: #3074F7;
|
||||
}
|
||||
|
||||
.btn-pendingReview {
|
||||
background: #3074F7;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,274 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<uni-nav-bar
|
||||
leftText=" "
|
||||
:fixed="true"
|
||||
leftIcon="back"
|
||||
background-color="rgb(48, 116, 247)"
|
||||
color="#fff"
|
||||
:statusBar="true"
|
||||
title="借用审核详情"
|
||||
@clickLeft="onBack"
|
||||
/>
|
||||
|
||||
<view class="content">
|
||||
<!-- 基本信息 -->
|
||||
<view class="card">
|
||||
<view class="card-head">
|
||||
<text class="card-title">借用信息</text>
|
||||
<view class="status-tag" :class="'s' + (detail.status || 0)">
|
||||
<text class="status-text">{{ statusText }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="row"><text class="label">单号</text><text class="value">{{ detail.order_no || '-' }}</text></view>
|
||||
<view class="row"><text class="label">申请人</text><text class="value">{{ detail.applicant_name || '-' }}</text></view>
|
||||
<view class="row">
|
||||
<text class="label">借用时间</text>
|
||||
<text class="value">{{ detail.use_start_date || '-' }} ~ {{ detail.use_end_date || '-' }}</text>
|
||||
</view>
|
||||
<view class="row"><text class="label">借用事由</text><text class="value">{{ detail.borrow_reason || '-' }}</text></view>
|
||||
<view class="row" v-if="detail.remark !== undefined">
|
||||
<text class="label">备注</text>
|
||||
<text class="value">{{ detail.remark || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 物品明细 -->
|
||||
<view class="card">
|
||||
<view class="card-head">
|
||||
<text class="card-title">物品明细</text>
|
||||
</view>
|
||||
|
||||
<view v-if="detail.item && detail.item.length === 0" class="empty">暂无物品</view>
|
||||
|
||||
<view v-for="(it, idx) in detail.item" :key="it.id" class="item">
|
||||
<view class="item-left">
|
||||
<text class="item-name">{{ it.item_name_snap || '-' }}</text>
|
||||
<text class="item-meta" v-if="it.spec_model_snap">规格:{{ it.spec_model_snap }}</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="qty-label">申请数量</text>
|
||||
<text class="qty-val">{{ it.request_qty || 0 }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 申请附件 -->
|
||||
<view class="card" v-if="(detail.attachment || []).length">
|
||||
<view class="card-head">
|
||||
<text class="card-title">申请附件</text>
|
||||
</view>
|
||||
<view class="img-grid">
|
||||
<image
|
||||
v-for="(a, i) in detail.attachment"
|
||||
:key="a.id || i"
|
||||
class="img"
|
||||
:src="a.file_path_pull || ''"
|
||||
mode="aspectFill"
|
||||
@click="previewAttachment(i)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 审核信息 -->
|
||||
<view class="card" v-if="detail.audit_info">
|
||||
<view class="card-head">
|
||||
<text class="card-title">审核信息</text>
|
||||
</view>
|
||||
<view class="row"><text class="label">审核人</text><text class="value">{{ detail.audit_info.handler_name || '-' }}</text></view>
|
||||
<view class="row"><text class="label">审核时间</text><text class="value">{{ detail.audit_info.handle_time || '-' }}</text></view>
|
||||
<view class="row" v-if="detail.audit_info.handle_remark">
|
||||
<text class="label">审核意见</text>
|
||||
<text class="value">{{ detail.audit_info.handle_remark }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { request, showToast } from '@/api/apiT.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
detail: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
statusText() {
|
||||
const s = Number(this.detail.status || 0)
|
||||
if (this.detail.is_returned === 1) return '已归还'
|
||||
if (s === 10) return '待审核'
|
||||
if (s === 11) return '审批中'
|
||||
if (s === 12) return '待归还'
|
||||
if (s === 13) return '借用拒绝'
|
||||
if (s === 14) return '归还待审核'
|
||||
if (s === 15) return '归还审批中'
|
||||
if (s === 16) return '部分归还'
|
||||
if (s === 17) return '已归还'
|
||||
if (s === 18) return '归还拒绝'
|
||||
return '处理中'
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.id = option.id || option.requisition_id || option.requisitionId || ''
|
||||
if (!this.id) {
|
||||
showToast({ title: '缺少id参数' })
|
||||
return
|
||||
}
|
||||
this.getDetail()
|
||||
},
|
||||
methods: {
|
||||
onBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
getDetail() {
|
||||
request({
|
||||
url: 'admin/inv/requisition/show',
|
||||
method: 'GET',
|
||||
data: { id: this.id }
|
||||
}).then((res) => {
|
||||
if (res.data && res.data.code === 200) {
|
||||
this.detail = res.data.data || {}
|
||||
// 兜底,避免 v-for 报错
|
||||
this.detail.item = Array.isArray(this.detail.item) ? this.detail.item : []
|
||||
this.detail.attachment = Array.isArray(this.detail.attachment) ? this.detail.attachment : []
|
||||
} else {
|
||||
showToast({ title: res.data.message || '获取详情失败' })
|
||||
}
|
||||
})
|
||||
},
|
||||
previewAttachment(index) {
|
||||
const urls = (this.detail.attachment || [])
|
||||
.map((a) => a.file_path_pull)
|
||||
.filter(Boolean)
|
||||
if (!urls.length) return
|
||||
uni.previewImage({
|
||||
current: urls[index] || urls[0],
|
||||
urls
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: rgb(244, 246, 248);
|
||||
}
|
||||
.content {
|
||||
padding: 20rpx;
|
||||
}
|
||||
.card {
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
padding: 22rpx;
|
||||
margin-bottom: 18rpx;
|
||||
box-shadow: 0 6rpx 18rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
.card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.card-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #1f2d3d;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
padding: 10rpx 0;
|
||||
border-bottom: 1rpx solid #f1f3f5;
|
||||
}
|
||||
.row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.label {
|
||||
width: 160rpx;
|
||||
font-size: 26rpx;
|
||||
color: #667085;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
font-size: 26rpx;
|
||||
color: #101828;
|
||||
}
|
||||
.status-tag {
|
||||
padding: 6rpx 14rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(48, 116, 247, 0.12);
|
||||
}
|
||||
.status-text {
|
||||
font-size: 24rpx;
|
||||
color: rgb(48, 116, 247);
|
||||
}
|
||||
.empty {
|
||||
padding: 24rpx 0;
|
||||
text-align: center;
|
||||
color: #98a2b3;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.item {
|
||||
padding: 16rpx 0;
|
||||
border-top: 1rpx dashed #eef2f6;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.item-left {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
.item-right {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 10rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.qty-label {
|
||||
font-size: 22rpx;
|
||||
color: #667085;
|
||||
}
|
||||
.qty-val {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #101828;
|
||||
}
|
||||
.item:first-child {
|
||||
border-top: none;
|
||||
padding-top: 0;
|
||||
}
|
||||
.item-name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #101828;
|
||||
}
|
||||
.item-meta {
|
||||
font-size: 24rpx;
|
||||
color: #98a2b3;
|
||||
}
|
||||
.img-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12rpx;
|
||||
}
|
||||
.img {
|
||||
width: 210rpx;
|
||||
height: 210rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #f2f4f7;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,450 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<uni-nav-bar
|
||||
leftText=" "
|
||||
:fixed="true"
|
||||
leftIcon="back"
|
||||
background-color="rgb(48, 116, 247)"
|
||||
color="#fff"
|
||||
:statusBar="true"
|
||||
title="借用审核"
|
||||
@clickLeft="onBack"
|
||||
/>
|
||||
|
||||
<view class="content">
|
||||
<!-- 基本信息 -->
|
||||
<view class="card">
|
||||
<view class="card-head">
|
||||
<text class="card-title">借用信息</text>
|
||||
<view class="status-tag" :class="'s' + (detail.status || 0)">
|
||||
<text class="status-text">{{ statusText }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="row"><text class="label">单号</text><text class="value">{{ detail.order_no || '-' }}</text></view>
|
||||
<view class="row"><text class="label">申请人</text><text class="value">{{ detail.applicant_name || '-' }}</text></view>
|
||||
<view class="row">
|
||||
<text class="label">借用时间</text>
|
||||
<text class="value">{{ detail.use_start_date || '-' }} ~ {{ detail.use_end_date || '-' }}</text>
|
||||
</view>
|
||||
<view class="row"><text class="label">借用事由</text><text class="value">{{ detail.borrow_reason || '-' }}</text></view>
|
||||
<view class="row" v-if="detail.remark !== undefined">
|
||||
<text class="label">备注</text>
|
||||
<text class="value">{{ detail.remark || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 物品明细 -->
|
||||
<view class="card">
|
||||
<view class="card-head">
|
||||
<text class="card-title">物品明细</text>
|
||||
</view>
|
||||
|
||||
<view v-if="approveItems.length === 0" class="empty">暂无物品</view>
|
||||
|
||||
<view v-for="(it, idx) in approveItems" :key="it.requisition_item_id" class="item">
|
||||
<view class="item-left">
|
||||
<text class="item-name">{{ it.requisition_item_name }}</text>
|
||||
<text class="item-meta" v-if="it.spec_model_snap">规格:{{ it.spec_model_snap }}</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="qty-label">申请数量</text>
|
||||
<text class="qty-val">{{ it.request_qty }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 申请附件 -->
|
||||
<view class="card" v-if="(detail.attachment || []).length">
|
||||
<view class="card-head">
|
||||
<text class="card-title">申请附件</text>
|
||||
</view>
|
||||
<view class="img-grid">
|
||||
<image
|
||||
v-for="(a, i) in detail.attachment"
|
||||
:key="a.id || i"
|
||||
class="img"
|
||||
:src="a.file_path_pull || ''"
|
||||
mode="aspectFill"
|
||||
@click="previewAttachment(i)"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 审核意见 -->
|
||||
<view class="card">
|
||||
<view class="card-head">
|
||||
<text class="card-title">审核意见</text>
|
||||
</view>
|
||||
<textarea
|
||||
class="textarea"
|
||||
v-model="auditRemark"
|
||||
placeholder="请输入审核备注(可选)"
|
||||
:auto-height="true"
|
||||
maxlength="500"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view style="height: 120rpx;"></view>
|
||||
</view>
|
||||
|
||||
<!-- 底部操作 -->
|
||||
<view class="footer">
|
||||
<button class="btn btn-ghost" @click="onReject">驳回</button>
|
||||
<button class="btn btn-primary" @click="onApprove">同意</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { request, showToast } from '@/api/apiT.js'
|
||||
|
||||
// ⚠️ 你需要把这里改成真实的“审核提交接口”
|
||||
// 如果你后端有具体字段/接口名,发我,我可以帮你对齐成完全可用。
|
||||
const AUDIT_API = 'admin/inv/requisition/approve'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
detail: {},
|
||||
approveItems: [],
|
||||
auditRemark: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
statusText() {
|
||||
// 你返回里 status=10;这里做个兼容显示
|
||||
const s = Number(this.detail.status || 0)
|
||||
if (this.detail.is_returned === 1) return '已归还'
|
||||
if (s === 10) return '待审核'
|
||||
if (s === 11) return '审批中'
|
||||
if (s === 12) return '待归还'
|
||||
if (s === 13) return '借用拒绝'
|
||||
if (s === 14) return '归还待审核'
|
||||
if (s === 15) return '归还审批中'
|
||||
if (s === 16) return '部分归还'
|
||||
if (s === 17) return '已归还'
|
||||
if (s === 18) return '归还拒绝'
|
||||
return '处理中'
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.id = option.id || option.requisition_id || option.requisitionId || ''
|
||||
if (!this.id) {
|
||||
showToast({ title: '缺少id参数' })
|
||||
return
|
||||
}
|
||||
this.getDetail()
|
||||
},
|
||||
methods: {
|
||||
onBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
getDetail() {
|
||||
request({
|
||||
url: 'admin/inv/requisition/show',
|
||||
method: 'GET',
|
||||
data: { id: this.id }
|
||||
}).then((res) => {
|
||||
this.detail = (res.data && res.data.data) || {}
|
||||
this.initApproveItems()
|
||||
})
|
||||
},
|
||||
initApproveItems() {
|
||||
const list = Array.isArray(this.detail.item) ? this.detail.item : []
|
||||
this.approveItems = list.map((it) => {
|
||||
// approved_qty 可能后端已经给了;没有就默认=申请数量
|
||||
const req = Number(it.request_qty || 0)
|
||||
const approved = it.approved_qty === undefined || it.approved_qty === null ? req : Number(it.approved_qty || 0)
|
||||
return {
|
||||
requisition_item_id: it.id,
|
||||
requisition_item_name: it.item_name_snap || '',
|
||||
spec_model_snap: it.spec_model_snap || '',
|
||||
unit_snap: it.unit_snap || '',
|
||||
request_qty: req,
|
||||
returned_qty: Number(it.returned_qty || 0),
|
||||
approved_qty: this.clamp(approved, 0, req)
|
||||
}
|
||||
})
|
||||
},
|
||||
clamp(v, min, max) {
|
||||
const n = Number(v || 0)
|
||||
if (n < min) return min
|
||||
if (n > max) return max
|
||||
return n
|
||||
},
|
||||
onApprovedQtyChange(idx, val) {
|
||||
const it = this.approveItems[idx]
|
||||
if (!it) return
|
||||
it.approved_qty = this.clamp(val, 0, it.request_qty)
|
||||
// 触发视图更新
|
||||
this.$set(this.approveItems, idx, it)
|
||||
},
|
||||
previewAttachment(startIndex) {
|
||||
const urls = (this.detail.attachment || [])
|
||||
.map((a) => a.file_path_pull)
|
||||
.filter(Boolean)
|
||||
if (!urls.length) return
|
||||
uni.previewImage({
|
||||
current: urls[startIndex] || urls[0],
|
||||
urls
|
||||
})
|
||||
},
|
||||
buildPayload(action) {
|
||||
return {
|
||||
requisition_id: this.detail.id || this.id,
|
||||
action, // 'approve' | 'reject'
|
||||
approve_id:this.detail.approve_id,
|
||||
comment: this.auditRemark || ''
|
||||
// items: this.approveItems.map((it) => ({
|
||||
// requisition_item_id: it.requisition_item_id,
|
||||
// requisition_item_name: it.requisition_item_name,
|
||||
// approved_qty: it.approved_qty
|
||||
// }))
|
||||
}
|
||||
},
|
||||
doSubmit(action) {
|
||||
if (!this.approveItems.length) {
|
||||
showToast({ title: '没有可审核的物品' })
|
||||
return
|
||||
}
|
||||
const payload = this.buildPayload(action)
|
||||
|
||||
request({
|
||||
url: AUDIT_API,
|
||||
method: 'POST',
|
||||
data: payload
|
||||
}).then((res) => {
|
||||
const msg = (res.data && (res.data.message || res.data.msg)) || '操作完成'
|
||||
showToast({ title: msg })
|
||||
if (res.data && Number(res.data.code) === 200) {
|
||||
setTimeout(() => {
|
||||
// 回到上一页并传递刷新参数
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
success: function() {
|
||||
// 触发上一页的刷新
|
||||
const pages = getCurrentPages()
|
||||
const prevPage = pages[pages.length - 2]
|
||||
if (prevPage && prevPage.$refs.paging) {
|
||||
prevPage.$refs.paging.reload()
|
||||
}
|
||||
}
|
||||
})
|
||||
}, 600)
|
||||
}
|
||||
})
|
||||
},
|
||||
onApprove() {
|
||||
uni.showModal({
|
||||
title: '确认通过',
|
||||
content: '确认同意该借用申请?',
|
||||
success: (r) => {
|
||||
if (r.confirm) this.doSubmit('1')
|
||||
}
|
||||
})
|
||||
},
|
||||
onReject() {
|
||||
uni.showModal({
|
||||
title: '确认驳回',
|
||||
content: '确认驳回该借用申请?',
|
||||
success: (r) => {
|
||||
if (r.confirm) this.doSubmit('2')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: rgb(244, 246, 248);
|
||||
}
|
||||
.content {
|
||||
padding: 20rpx;
|
||||
}
|
||||
.card {
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
padding: 22rpx;
|
||||
margin-bottom: 18rpx;
|
||||
box-shadow: 0 6rpx 18rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
.card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.card-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #1f2d3d;
|
||||
}
|
||||
.card-sub {
|
||||
font-size: 24rpx;
|
||||
color: #98a2b3;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
padding: 10rpx 0;
|
||||
border-bottom: 1rpx solid #f1f3f5;
|
||||
}
|
||||
.row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.label {
|
||||
width: 160rpx;
|
||||
font-size: 26rpx;
|
||||
color: #667085;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
font-size: 26rpx;
|
||||
color: #101828;
|
||||
}
|
||||
.status-tag {
|
||||
padding: 6rpx 14rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(48, 116, 247, 0.12);
|
||||
}
|
||||
.status-text {
|
||||
font-size: 24rpx;
|
||||
color: rgb(48, 116, 247);
|
||||
}
|
||||
.empty {
|
||||
padding: 24rpx 0;
|
||||
text-align: center;
|
||||
color: #98a2b3;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.item {
|
||||
padding: 16rpx 0;
|
||||
border-top: 1rpx dashed #eef2f6;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.item-left {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
.item-right {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 10rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.qty-label {
|
||||
font-size: 22rpx;
|
||||
color: #667085;
|
||||
}
|
||||
.qty-val {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #101828;
|
||||
}
|
||||
.item:first-child {
|
||||
border-top: none;
|
||||
padding-top: 0;
|
||||
}
|
||||
.item-top {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.item-name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #101828;
|
||||
}
|
||||
.item-meta {
|
||||
font-size: 24rpx;
|
||||
color: #98a2b3;
|
||||
}
|
||||
.grid {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.cell {
|
||||
flex: 1;
|
||||
background: #f8fafc;
|
||||
border-radius: 16rpx;
|
||||
padding: 14rpx;
|
||||
}
|
||||
.k {
|
||||
display: block;
|
||||
font-size: 22rpx;
|
||||
color: #667085;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
.v {
|
||||
font-size: 26rpx;
|
||||
color: #101828;
|
||||
}
|
||||
.hint {
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
color: #667085;
|
||||
}
|
||||
.img-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12rpx;
|
||||
}
|
||||
.img {
|
||||
width: 210rpx;
|
||||
height: 210rpx;
|
||||
border-radius: 16rpx;
|
||||
background: #f2f4f7;
|
||||
}
|
||||
.textarea {
|
||||
width: 100%;
|
||||
min-height: 140rpx;
|
||||
font-size: 26rpx;
|
||||
line-height: 1.6;
|
||||
background: #f8fafc;
|
||||
border-radius: 16rpx;
|
||||
padding: 16rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.footer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 16rpx 20rpx calc(16rpx + env(safe-area-inset-bottom));
|
||||
background: rgba(255, 255, 255, 0.98);
|
||||
border-top: 1rpx solid #eef2f6;
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 84rpx;
|
||||
line-height: 84rpx;
|
||||
border-radius: 18rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.btn-ghost {
|
||||
background: #fff;
|
||||
border: 2rpx solid #d0d5dd;
|
||||
color: #344054;
|
||||
}
|
||||
.btn-primary {
|
||||
background: rgb(48, 116, 247);
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,298 @@
|
||||
<template>
|
||||
<view class="home-page">
|
||||
<z-paging ref="paging" :auto="false" v-model="borrowList" @query="queryList" empty-view-text="暂无数据!">
|
||||
<template #top>
|
||||
<uni-nav-bar leftText=" " :fixed="true" leftIcon="back" :border="false" @clickLeft="leftClick" color="#fff" backgroundColor="rgb(48, 116, 247)" :statusBar="true" title="归还审批"></uni-nav-bar>
|
||||
<!-- Tab栏 -->
|
||||
<view class="tab-bar">
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ 'tab-item-active': currentTab === index }"
|
||||
v-for="(tab, index) in tabList"
|
||||
:key="index"
|
||||
@click="switchTab(index)"
|
||||
>
|
||||
<text class="tab-text">{{ tab }}</text>
|
||||
<view v-if="currentTab === index" class="tab-underline"></view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<!-- 列表内容 -->
|
||||
<view class="list-container">
|
||||
<view
|
||||
class="borrow-card"
|
||||
v-for="(item, index) in borrowList"
|
||||
:key="index"
|
||||
>
|
||||
<!-- 状态标签(右上角旋转丝带) -->
|
||||
<view class="status-ribbon" :class="'ribbon-' + item.status">
|
||||
<text class="ribbon-text">{{ getStatusText(item.status) }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 卡片内容 -->
|
||||
<view class="card-content" @click="handleCardClick(item)">
|
||||
<view class="card-title">
|
||||
<uni-tag :text="item1.item_name" size="mini" type="primary" v-for="(item1, index) in item.item" :key="index"/>
|
||||
</view>
|
||||
<view class="card-info">
|
||||
<text class="info-item">申请人: {{ item.apply_user_name }}</text>
|
||||
<text class="info-item">归还时间: {{ item.return_at || '-' }}</text>
|
||||
|
||||
</view>
|
||||
<view class="action-btns">
|
||||
<!-- <text class="info-item">公司名称: {{ item.companyName }}</text> -->
|
||||
<text class="info-item"></text>
|
||||
<!-- 操作按钮 -->
|
||||
<view class="card-actions" v-if="item.status !== 'returned'">
|
||||
<button
|
||||
class="action-btn"
|
||||
:class="'btn-' + item.status"
|
||||
v-if="item.status==0"
|
||||
@click.stop="handleAction(item)"
|
||||
>
|
||||
{{ getActionText(item.status) }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</z-paging>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { request,showToast } from '@/api/apiT.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
currentTab: 0,
|
||||
tabList: ['全部', '待审核', '已通过', '未通过'],
|
||||
borrowList: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 页面加载时初始化数据
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.paging) {
|
||||
this.$refs.paging.reload()
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
leftClick(){
|
||||
uni.navigateBack({})
|
||||
},
|
||||
switchTab(index) {
|
||||
this.currentTab = index
|
||||
// 重置分页并重新加载数据
|
||||
if (this.$refs.paging) {
|
||||
this.$refs.paging.reload()
|
||||
}
|
||||
},
|
||||
queryList(pageNo, pageSize, from) {
|
||||
this.loading = true;
|
||||
var that = this;
|
||||
const params = {
|
||||
current:pageNo,
|
||||
size:10,
|
||||
status: this.currentTab === 0 ? '' : (this.currentTab === 1 ? '0' : (this.currentTab === 2 ? '1' : '2'))
|
||||
};
|
||||
request({
|
||||
url:'mobile/inv/requisition/return/list',
|
||||
method:'get',
|
||||
data: params
|
||||
}).then(res => {
|
||||
if(res.data.code ==200){
|
||||
var datas = res.data.data.records;
|
||||
this.$refs.paging.complete(datas);
|
||||
}else{
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
//
|
||||
})
|
||||
},
|
||||
getStatusText(status) {
|
||||
const statusMap = {
|
||||
'0': '待审核',
|
||||
'1': '已通过',
|
||||
'2': '未通过'
|
||||
}
|
||||
return statusMap[status] || ''
|
||||
},
|
||||
getActionText(status) {
|
||||
const actionMap = {
|
||||
'0': '去审核',
|
||||
'1': '已通过',
|
||||
'2': '未通过'
|
||||
}
|
||||
return actionMap[status] || ''
|
||||
},
|
||||
handleAction(item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/approval/return_approval_detils?id='+item.id
|
||||
});
|
||||
},
|
||||
handleCardClick(item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/approval/return_approval_detail?id='+item.id
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.home-page {
|
||||
min-height: 100vh;
|
||||
background: rgb(244, 246, 248);
|
||||
}
|
||||
|
||||
.content-wrapper {
|
||||
}
|
||||
|
||||
// Tab栏样式
|
||||
.tab-bar {
|
||||
display: flex;
|
||||
background: #F4F6F8;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
padding: 24rpx 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tab-text {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.tab-item-active .tab-text {
|
||||
color: #3074F7;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tab-underline {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 60rpx;
|
||||
height: 4rpx;
|
||||
background: #3074F7;
|
||||
border-radius: 2rpx;
|
||||
}
|
||||
|
||||
// 列表容器
|
||||
.list-container {
|
||||
padding: 24rpx 28rpx;
|
||||
}
|
||||
|
||||
// 借用卡片
|
||||
.borrow-card {
|
||||
position: relative;
|
||||
background: #fff;
|
||||
border-radius: 12rpx;
|
||||
margin-bottom: 24rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
// 状态标签(旋转丝带效果)
|
||||
.status-ribbon {
|
||||
position: absolute;
|
||||
top: -4px;
|
||||
right: -32px;
|
||||
width: 100px;
|
||||
height: 47px;
|
||||
background: #08A400;
|
||||
transform: rotate(45deg);
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.ribbon-0 {
|
||||
background: #3471FF; // 蓝色
|
||||
}
|
||||
.ribbon-2 {
|
||||
background: #F5222D;
|
||||
}
|
||||
.ribbon-1 {
|
||||
background: #389E0D;
|
||||
}
|
||||
|
||||
.ribbon-text {
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
font-weight: 500;
|
||||
transform: rotate(0deg);
|
||||
transform-origin: center;
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin-top: 16rpx;
|
||||
white-space: nowrap;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
|
||||
// 卡片内容
|
||||
.card-content {
|
||||
padding: 28rpx;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.card-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12rpx;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
// 操作按钮
|
||||
.card-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.action-btns{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
padding: 14rpx 40rpx;
|
||||
background: #3074F7;
|
||||
color: #fff;
|
||||
border-radius: 8rpx;
|
||||
font-size: 26rpx;
|
||||
border: none;
|
||||
line-height: 1;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-notReturned {
|
||||
background: #3074F7;
|
||||
}
|
||||
|
||||
.btn-pendingReview {
|
||||
background: #3074F7;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,308 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<uni-nav-bar
|
||||
leftText=" "
|
||||
:fixed="true"
|
||||
leftIcon="back"
|
||||
background-color="rgb(48, 116, 247)"
|
||||
color="#fff"
|
||||
:statusBar="true"
|
||||
title="归还详情"
|
||||
@clickLeft="onBack"
|
||||
/>
|
||||
|
||||
<view class="content">
|
||||
<!-- 基本信息 -->
|
||||
<view class="card">
|
||||
<view class="card-head">
|
||||
<text class="card-title">归还信息</text>
|
||||
<view class="status-tag" :class="'s' + (detail.status || 0)">
|
||||
<text class="status-text">{{ statusText }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="row"><text class="label">申请人</text><text class="value">{{ detail.apply_user_name || '-' }}</text></view>
|
||||
<view class="row"><text class="label">归还时间</text><text class="value">{{ detail.return_at || '-' }}</text></view>
|
||||
<view class="row" v-if="detail.apply_remark !== undefined">
|
||||
<text class="label">归还备注</text>
|
||||
<text class="value">{{ detail.apply_remark || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 物品明细 -->
|
||||
<view class="card">
|
||||
<view class="card-head">
|
||||
<text class="card-title">归还物品</text>
|
||||
</view>
|
||||
|
||||
<view v-if="detail.item && detail.item.length === 0" class="empty">暂无物品</view>
|
||||
|
||||
<view v-for="(it, idx) in detail.item" :key="it.id" class="item">
|
||||
<view class="item-left">
|
||||
<text class="item-name">{{ it.item_name || '-' }}</text>
|
||||
<text class="item-meta" v-if="it.spec_model">规格:{{ it.spec_model }}</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="qty-label">归还数量</text>
|
||||
<text class="qty-val">{{ detail.return_qty || 0 }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 借用详情 -->
|
||||
<view class="card" v-if="borrowDetail.id">
|
||||
<view class="card-head">
|
||||
<text class="card-title">借用信息</text>
|
||||
</view>
|
||||
|
||||
<view class="row"><text class="label">申请人</text><text class="value">{{ borrowDetail.applicant_name || '-' }}</text></view>
|
||||
<view class="row"><text class="label">借用时间</text><text class="value">{{ borrowDetail.use_start_date || '-' }} ~ {{ borrowDetail.use_end_date || '-' }}</text></view>
|
||||
<view class="row" v-if="borrowDetail.borrow_reason !== undefined">
|
||||
<text class="label">借用事由</text>
|
||||
<text class="value">{{ borrowDetail.borrow_reason || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 借用物品明细 -->
|
||||
<view class="card" v-if="borrowDetail.id">
|
||||
<view class="card-head">
|
||||
<text class="card-title">借用物品明细</text>
|
||||
</view>
|
||||
|
||||
<view v-if="!borrowDetail.item || borrowDetail.item.length === 0" class="empty">暂无物品</view>
|
||||
|
||||
<view v-for="(it, idx) in borrowDetail.item" :key="it.id || idx" class="item">
|
||||
<view class="item-left">
|
||||
<text class="item-name">{{ it.item_name_snap || '-' }}</text>
|
||||
<text class="item-meta" v-if="String(it.is_consumable_snap) === '1'">耗材</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<view class="grid-cell">
|
||||
<text class="g-label">数量</text>
|
||||
<text class="g-val">{{ safeNum(it.request_qty) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 审核信息 -->
|
||||
<view class="card" v-if="detail.audit_info">
|
||||
<view class="card-head">
|
||||
<text class="card-title">审核信息</text>
|
||||
</view>
|
||||
<view class="row"><text class="label">审核人</text><text class="value">{{ detail.audit_info.handler_name || '-' }}</text></view>
|
||||
<view class="row"><text class="label">审核时间</text><text class="value">{{ detail.audit_info.handle_time || '-' }}</text></view>
|
||||
<view class="row" v-if="detail.audit_info.handle_remark">
|
||||
<text class="label">审核意见</text>
|
||||
<text class="value">{{ detail.audit_info.handle_remark }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { request, showToast } from '@/api/apiT.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
detail: {},
|
||||
borrowDetail: {} // 借用详情数据
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
statusText() {
|
||||
const s = Number(this.detail.status || 0)
|
||||
if (s === 0) return '待审核'
|
||||
if (s === 1) return '已通过'
|
||||
if (s === 2) return '已驳回'
|
||||
return '处理中'
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.id = option.id || ''
|
||||
if (!this.id) {
|
||||
showToast({ title: '缺少id参数' })
|
||||
return
|
||||
}
|
||||
this.getDetail()
|
||||
},
|
||||
methods: {
|
||||
onBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
getDetail() {
|
||||
request({
|
||||
url: 'mobile/inv/requisition/return/show',
|
||||
method: 'GET',
|
||||
data: { id: this.id }
|
||||
}).then((res) => {
|
||||
if (res.data && res.data.code === 200) {
|
||||
this.detail = res.data.data || {}
|
||||
// 兜底,避免 v-for 报错
|
||||
this.detail.item = Array.isArray(this.detail.item) ? this.detail.item : []
|
||||
|
||||
// 如果有借用详情的id,则获取借用详情数据
|
||||
const borrowId = this.detail.requisition_item_id || this.detail.item_id
|
||||
if (borrowId) {
|
||||
this.getBorrowDetail(borrowId)
|
||||
}
|
||||
} else {
|
||||
showToast({ title: res.data.message || '获取详情失败' })
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取借用详情数据
|
||||
getBorrowDetail(borrowId) {
|
||||
request({
|
||||
url: 'mobile/inv/requisition/show',
|
||||
method: 'GET',
|
||||
data: { id: borrowId }
|
||||
}).then((res) => {
|
||||
if (res.data && res.data.code === 200) {
|
||||
this.borrowDetail = res.data.data || {}
|
||||
// 兜底,避免 v-for 报错
|
||||
this.borrowDetail.item = Array.isArray(this.borrowDetail.item) ? this.borrowDetail.item : []
|
||||
} else {
|
||||
showToast({ title: res.data.message || '获取借用详情失败' })
|
||||
}
|
||||
})
|
||||
},
|
||||
// 安全处理数字显示
|
||||
safeNum(v) {
|
||||
const n = Number(v)
|
||||
return Number.isFinite(n) ? n : 0
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: rgb(244, 246, 248);
|
||||
}
|
||||
.content {
|
||||
padding: 20rpx;
|
||||
}
|
||||
.card {
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
padding: 22rpx;
|
||||
margin-bottom: 18rpx;
|
||||
box-shadow: 0 6rpx 18rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
.card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.card-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #1f2d3d;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
padding: 10rpx 0;
|
||||
border-bottom: 1rpx solid #f1f3f5;
|
||||
}
|
||||
.row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.label {
|
||||
width: 160rpx;
|
||||
font-size: 26rpx;
|
||||
color: #667085;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
font-size: 26rpx;
|
||||
color: #101828;
|
||||
}
|
||||
.status-tag {
|
||||
padding: 6rpx 14rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(48, 116, 247, 0.12);
|
||||
}
|
||||
.status-text {
|
||||
font-size: 24rpx;
|
||||
color: rgb(48, 116, 247);
|
||||
}
|
||||
.empty {
|
||||
padding: 24rpx 0;
|
||||
text-align: center;
|
||||
color: #98a2b3;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.item {
|
||||
padding: 16rpx 0;
|
||||
border-top: 1rpx dashed #eef2f6;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.item-left {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
.item-right {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 10rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.qty-label {
|
||||
font-size: 22rpx;
|
||||
color: #667085;
|
||||
}
|
||||
.qty-val {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #101828;
|
||||
}
|
||||
.item:first-child {
|
||||
border-top: none;
|
||||
padding-top: 0;
|
||||
}
|
||||
.item-name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #101828;
|
||||
}
|
||||
.item-meta {
|
||||
font-size: 24rpx;
|
||||
color: #98a2b3;
|
||||
}
|
||||
/* 借用物品明细样式 */
|
||||
.grid-cell {
|
||||
// background: #fafbff;
|
||||
border-radius: 10rpx;
|
||||
padding: 14rpx 10rpx;
|
||||
text-align: center;
|
||||
// border: 1rpx solid #f0f0f0;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.g-label {
|
||||
display: block;
|
||||
font-size: 22rpx;
|
||||
color: #888;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
.g-val {
|
||||
display: block;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #222;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,348 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<uni-nav-bar
|
||||
leftText=" "
|
||||
:fixed="true"
|
||||
leftIcon="back"
|
||||
background-color="rgb(48, 116, 247)"
|
||||
color="#fff"
|
||||
:statusBar="true"
|
||||
title="归还审核"
|
||||
@clickLeft="onBack"
|
||||
/>
|
||||
|
||||
<view class="content">
|
||||
<!-- 基本信息 -->
|
||||
<view class="card">
|
||||
<view class="card-head">
|
||||
<text class="card-title">归还信息</text>
|
||||
<view class="status-tag" :class="'s' + (detail.status || 0)">
|
||||
<text class="status-text">{{ statusText }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="row"><text class="label">申请人</text><text class="value">{{ detail.apply_user_name || '-' }}</text></view>
|
||||
<view class="row"><text class="label">归还时间</text><text class="value">{{ detail.return_at || '-' }}</text></view>
|
||||
<view class="row" v-if="detail.apply_remark !== undefined">
|
||||
<text class="label">归还备注</text>
|
||||
<text class="value">{{ detail.apply_remark || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 物品明细 -->
|
||||
<view class="card">
|
||||
<view class="card-head">
|
||||
<text class="card-title">归还物品</text>
|
||||
</view>
|
||||
|
||||
<view v-if="approveItems.length === 0" class="empty">暂无物品</view>
|
||||
|
||||
<view v-for="(it, idx) in approveItems" :key="it.item_id" class="item">
|
||||
<view class="item-left">
|
||||
<text class="item-name">{{ it.item_name }}</text>
|
||||
<text class="item-meta" v-if="it.spec_model">规格:{{ it.spec_model }}</text>
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="qty-label">归还数量</text>
|
||||
<text class="qty-val">{{ detail.return_qty || 0 }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 审核意见 -->
|
||||
<view class="card">
|
||||
<view class="card-head">
|
||||
<text class="card-title">审核意见</text>
|
||||
</view>
|
||||
<textarea
|
||||
class="textarea"
|
||||
v-model="auditRemark"
|
||||
placeholder="请输入审核备注(可选)"
|
||||
:auto-height="true"
|
||||
maxlength="500"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<view style="height: 120rpx;"></view>
|
||||
</view>
|
||||
|
||||
<!-- 底部操作 -->
|
||||
<view class="footer">
|
||||
<button class="btn btn-ghost" @click="onReject">驳回</button>
|
||||
<button class="btn btn-primary" @click="onApprove">同意</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { request, showToast } from '@/api/apiT.js'
|
||||
|
||||
// 归还审核提交接口
|
||||
const AUDIT_API = 'mobile/inv/requisition/return/confirm'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
detail: {},
|
||||
approveItems: [],
|
||||
auditRemark: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
statusText() {
|
||||
const s = Number(this.detail.status || 0)
|
||||
if (s === 0) return '待审核'
|
||||
if (s === 1) return '已通过'
|
||||
if (s === 2) return '已驳回'
|
||||
return '处理中'
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.id = option.id || ''
|
||||
if (!this.id) {
|
||||
showToast({ title: '缺少id参数' })
|
||||
return
|
||||
}
|
||||
this.getDetail()
|
||||
},
|
||||
methods: {
|
||||
onBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
getDetail() {
|
||||
request({
|
||||
url: 'mobile/inv/requisition/return/show',
|
||||
method: 'GET',
|
||||
data: { id: this.id }
|
||||
}).then((res) => {
|
||||
this.detail = (res.data && res.data.data) || {}
|
||||
this.initApproveItems()
|
||||
})
|
||||
},
|
||||
initApproveItems() {
|
||||
const list = Array.isArray(this.detail.item) ? this.detail.item : []
|
||||
this.approveItems = list.map((it) => {
|
||||
return {
|
||||
item_id: it.id,
|
||||
item_name: it.item_name || '',
|
||||
spec_model: it.spec_model || '',
|
||||
unit: it.unit || ''
|
||||
}
|
||||
})
|
||||
},
|
||||
buildPayload(action) {
|
||||
return {
|
||||
requisition_item_return_id: this.id,
|
||||
status: action, // '1' 同意 | '2' 驳回
|
||||
handle_remark: this.auditRemark || ''
|
||||
}
|
||||
},
|
||||
doSubmit(action) {
|
||||
if (!this.approveItems.length) {
|
||||
showToast({ title: '没有可审核的物品' })
|
||||
return
|
||||
}
|
||||
const payload = this.buildPayload(action)
|
||||
|
||||
request({
|
||||
url: AUDIT_API,
|
||||
method: 'POST',
|
||||
data: payload
|
||||
}).then((res) => {
|
||||
const msg = (res.data && (res.data.message || res.data.msg)) || '操作完成'
|
||||
showToast({ title: msg })
|
||||
if (res.data && Number(res.data.code) === 200) {
|
||||
setTimeout(() => {
|
||||
// 回到上一页并传递刷新参数
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
success: function() {
|
||||
// 触发上一页的刷新
|
||||
const pages = getCurrentPages()
|
||||
const prevPage = pages[pages.length - 2]
|
||||
if (prevPage && prevPage.$refs.paging) {
|
||||
prevPage.$refs.paging.reload()
|
||||
}
|
||||
}
|
||||
})
|
||||
}, 600)
|
||||
}
|
||||
})
|
||||
},
|
||||
onApprove() {
|
||||
uni.showModal({
|
||||
title: '确认通过',
|
||||
content: '确认同意该归还申请?',
|
||||
success: (r) => {
|
||||
if (r.confirm) this.doSubmit('1')
|
||||
}
|
||||
})
|
||||
},
|
||||
onReject() {
|
||||
uni.showModal({
|
||||
title: '确认驳回',
|
||||
content: '确认驳回该归还申请?',
|
||||
success: (r) => {
|
||||
if (r.confirm) this.doSubmit('2')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: rgb(244, 246, 248);
|
||||
}
|
||||
.content {
|
||||
padding: 20rpx;
|
||||
}
|
||||
.card {
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
padding: 22rpx;
|
||||
margin-bottom: 18rpx;
|
||||
box-shadow: 0 6rpx 18rpx rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
.card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.card-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #1f2d3d;
|
||||
}
|
||||
.card-sub {
|
||||
font-size: 24rpx;
|
||||
color: #98a2b3;
|
||||
}
|
||||
.row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
padding: 10rpx 0;
|
||||
border-bottom: 1rpx solid #f1f3f5;
|
||||
}
|
||||
.row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.label {
|
||||
width: 160rpx;
|
||||
font-size: 26rpx;
|
||||
color: #667085;
|
||||
}
|
||||
.value {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
font-size: 26rpx;
|
||||
color: #101828;
|
||||
}
|
||||
.status-tag {
|
||||
padding: 6rpx 14rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(48, 116, 247, 0.12);
|
||||
}
|
||||
.status-text {
|
||||
font-size: 24rpx;
|
||||
color: rgb(48, 116, 247);
|
||||
}
|
||||
.empty {
|
||||
padding: 24rpx 0;
|
||||
text-align: center;
|
||||
color: #98a2b3;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.item {
|
||||
padding: 16rpx 0;
|
||||
border-top: 1rpx dashed #eef2f6;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.item-left {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
.item-right {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 10rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.qty-label {
|
||||
font-size: 22rpx;
|
||||
color: #667085;
|
||||
}
|
||||
.qty-val {
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
color: #101828;
|
||||
}
|
||||
.item:first-child {
|
||||
border-top: none;
|
||||
padding-top: 0;
|
||||
}
|
||||
.item-top {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
.item-name {
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #101828;
|
||||
}
|
||||
.item-meta {
|
||||
font-size: 24rpx;
|
||||
color: #98a2b3;
|
||||
}
|
||||
.textarea {
|
||||
width: 100%;
|
||||
min-height: 140rpx;
|
||||
font-size: 26rpx;
|
||||
line-height: 1.6;
|
||||
background: #f8fafc;
|
||||
border-radius: 16rpx;
|
||||
padding: 16rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.footer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 16rpx 20rpx calc(16rpx + env(safe-area-inset-bottom));
|
||||
background: rgba(255, 255, 255, 0.98);
|
||||
border-top: 1rpx solid #eef2f6;
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
}
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 84rpx;
|
||||
line-height: 84rpx;
|
||||
border-radius: 18rpx;
|
||||
font-size: 30rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
.btn-ghost {
|
||||
background: #fff;
|
||||
border: 2rpx solid #d0d5dd;
|
||||
color: #344054;
|
||||
}
|
||||
.btn-primary {
|
||||
background: rgb(48, 116, 247);
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user