This commit is contained in:
浅念
2026-02-06 14:39:37 +08:00
parent 423fc8b7e1
commit bf3d85de0d
28 changed files with 5631 additions and 1164 deletions
+274
View File
@@ -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>