From 8d8245ee4a48edbf8ea97aad9c50cdd5f1d02e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Fri, 6 Feb 2026 16:23:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 2 +- pages/approval/return_approval.vue | 9 +- pages/approval/return_approval_detail.vue | 623 ++++++++++++---------- pages/approval/return_approval_detils.vue | 130 ++++- pages/borrow/borrow.vue | 24 +- pages/borrow/borrow_list.vue | 2 +- pages/index/index.vue | 14 +- pages/login/index.vue | 12 +- 8 files changed, 474 insertions(+), 342 deletions(-) diff --git a/manifest.json b/manifest.json index a33f6b4..7b6e4b1 100644 --- a/manifest.json +++ b/manifest.json @@ -1,5 +1,5 @@ { - "name" : "uniapp", + "name" : "物品领用", "appid" : "__UNI__C9A60ED", "description" : "应用描述", "versionName" : "1.0.0", diff --git a/pages/approval/return_approval.vue b/pages/approval/return_approval.vue index f74c6fd..3c1ffc1 100644 --- a/pages/approval/return_approval.vue +++ b/pages/approval/return_approval.vue @@ -35,8 +35,8 @@ - 申请人: {{ item.apply_user_name }} - 归还时间: {{ item.return_at || '-' }} + 申请人: {{ item.applicant_name }} + 归还时间: {{ formatDate(item.return_at) }} @@ -128,6 +128,11 @@ } return actionMap[status] || '' }, + // 格式化日期,只显示年月日 + formatDate(dateStr) { + if (!dateStr) return '-' + return dateStr.split(' ')[0] + }, handleAction(item) { uni.navigateTo({ url: '/pages/approval/return_approval_detils?id='+item.id diff --git a/pages/approval/return_approval_detail.vue b/pages/approval/return_approval_detail.vue index 509c3df..4690229 100644 --- a/pages/approval/return_approval_detail.vue +++ b/pages/approval/return_approval_detail.vue @@ -1,308 +1,349 @@ \ No newline at end of file diff --git a/pages/approval/return_approval_detils.vue b/pages/approval/return_approval_detils.vue index 32d66c6..42d3abf 100644 --- a/pages/approval/return_approval_detils.vue +++ b/pages/approval/return_approval_detils.vue @@ -21,9 +21,10 @@ - 申请人{{ detail.apply_user_name || '-' }} - 归还时间{{ detail.return_at || '-' }} - + 单号{{ detail.order_no || '-' }} + 申请人{{ detail.applicant_name || detail.apply_user_name || '-' }} + 归还时间{{ formatDate(detail.return_at) }} + 归还备注 {{ detail.apply_remark || '-' }} @@ -35,16 +36,40 @@ 归还物品 - 暂无物品 + 暂无物品 - + - {{ it.item_name }} - 规格:{{ it.spec_model }} + {{ it.requisition_item && it.requisition_item.item_name_snap ? it.requisition_item.item_name_snap : '-' }} + 规格:{{ it.requisition_item.spec_model_snap }} - 归还数量 - {{ detail.return_qty || 0 }} + + + 借用数量 + {{ it.requisition_item && it.requisition_item.request_qty ? it.requisition_item.request_qty : 0 }} + + + 本次归还 + {{ it.return_qty || 0 }} + + + + + + + + + + 附件信息 + + + + + + {{ attach.file_name || '-' }} + + @@ -85,7 +110,6 @@ return { id: '', detail: {}, - approveItems: [], auditRemark: '' } }, @@ -116,18 +140,13 @@ 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 || '' + if (res.data && res.data.code === 200) { + this.detail = res.data.data || {} + // 兜底,避免 v-for 报错 + this.detail.item_return = Array.isArray(this.detail.item_return) ? this.detail.item_return : [] + this.detail.return_attachment = Array.isArray(this.detail.return_attachment) ? this.detail.return_attachment : [] + } else { + showToast({ title: res.data.message || '获取详情失败' }) } }) }, @@ -139,7 +158,7 @@ } }, doSubmit(action) { - if (!this.approveItems.length) { + if (!this.detail.item_return || this.detail.item_return.length === 0) { showToast({ title: '没有可审核的物品' }) return } @@ -187,6 +206,27 @@ if (r.confirm) this.doSubmit('2') } }) + }, + // 格式化日期,只显示年月日 + formatDate(dateStr) { + if (!dateStr) return '-' + if (typeof dateStr === 'number') { + const date = new Date(dateStr * 1000) + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + return `${year}-${month}-${day}` + } + return dateStr.split(' ')[0] + }, + // 预览附件 + previewAttachment(url) { + if (!url) return + // 去除可能的多余空格和引号 + url = url.trim().replace(/^["'`]+|["'`]+$/g, '') + uni.previewImage({ + urls: [url] + }) } } } @@ -342,7 +382,45 @@ color: #344054; } .btn-primary { - background: rgb(48, 116, 247); - color: #fff; - } + background: rgb(48, 116, 247); + color: #fff; + } + .qty-info { + display: flex; + flex-direction: column; + gap: 8rpx; + } + .qty-row { + display: flex; + align-items: center; + gap: 8rpx; + } + .attachment-list { + display: flex; + flex-direction: column; + gap: 16rpx; + } + .attachment-item { + display: flex; + align-items: center; + gap: 16rpx; + padding: 12rpx 0; + } + .attachment-info { + flex: 1; + min-width: 0; + } + .attachment-name { + display: block; + font-size: 26rpx; + color: #101828; + margin-bottom: 4rpx; + word-break: break-all; + } + .attachment-img { + width: 120rpx; + height: 120rpx; + border-radius: 12rpx; + flex-shrink: 0; + } \ No newline at end of file diff --git a/pages/borrow/borrow.vue b/pages/borrow/borrow.vue index 6e8c4ed..8450d3b 100644 --- a/pages/borrow/borrow.vue +++ b/pages/borrow/borrow.vue @@ -46,14 +46,15 @@ 计划归还时间 + ref="returnTimePicker" + type="date" + v-model="formData.use_end_date" + placeholder="请选择时间" + :border="false" + :clear-icon="false" + :start="formData.use_start_date" + @change="onReturnTimeChange" + > {{ formData.use_end_date || '请选择时间' }} @@ -168,6 +169,13 @@ onLoad() { this.getinfo() this.getItemNameOptions() + // 设置借用时间默认当天 + const today = new Date() + const year = today.getFullYear() + const month = String(today.getMonth() + 1).padStart(2, '0') + const day = String(today.getDate()).padStart(2, '0') + const todayStr = `${year}-${month}-${day}` + this.formData.use_start_date = todayStr }, methods: { leftClick(){ diff --git a/pages/borrow/borrow_list.vue b/pages/borrow/borrow_list.vue index b29b56d..265c77d 100644 --- a/pages/borrow/borrow_list.vue +++ b/pages/borrow/borrow_list.vue @@ -112,7 +112,7 @@ current:pageNo, size:10, applicant_id:'self', - status: this.currentTab === 0 ? '' : (this.currentTab === 1 ? 'repaid' : (this.currentTab === 2 ? 'unreturned' : 'approve')) + phase: this.currentTab === 0 ? '' : (this.currentTab === 1 ? 'repaid' : (this.currentTab === 2 ? 'unreturned' : 'approve')) }; request({ url:'mobile/inv/requisition/list', diff --git a/pages/index/index.vue b/pages/index/index.vue index 6034e75..ca6c816 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -1,6 +1,6 @@ @@ -51,10 +51,10 @@ data() { return { list: [ - { - title: '备货单审批', - url:'' - }, + // { + // title: '备货单审批', + // url:'' + // }, { title: '借用审批', url:'/pages/approval/borrow_approval' diff --git a/pages/login/index.vue b/pages/login/index.vue index 65630eb..b0ba161 100644 --- a/pages/login/index.vue +++ b/pages/login/index.vue @@ -67,12 +67,12 @@ async silentAuth() { try { // 1) 如果本地已有 token,直接进首页(丝滑) - const token = uni.getStorageSync('token') - if (token) { - this.title = '已登录' - this.desc = '正在进入首页' - return this.goHomeSmooth() - } + // const token = uni.getStorageSync('token') + // if (token) { + // this.title = '已登录' + // this.desc = '正在进入首页' + // return this.goHomeSmooth() + // } // 2) 获取飞书授权跳转地址(静默授权/免登) this.title = '正在跳转飞书授权'