From adf5bc4d20de7bc1f2346dce12d79ae3f7c90a92 Mon Sep 17 00:00:00 2001 From: dzq Date: Thu, 10 Apr 2025 08:19:05 +0800 Subject: [PATCH] =?UTF-8?q?refactor(approval):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F=E5=92=8C?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除不必要的 `height: 100px` 样式 - 调整审批状态选项的文本 - 增加退款金额的验证逻辑 - 添加商品封面显示和历史审批数据填充功能 - 优化表单字段的只读状态和样式 - 调整提交按钮的定位和样式 --- src/pages/approval/handle.vue | 120 +++++++++++++++++++++++++++++----- src/pages/cabinet/index.vue | 1 - 2 files changed, 103 insertions(+), 18 deletions(-) diff --git a/src/pages/approval/handle.vue b/src/pages/approval/handle.vue index c6f6b88..885daa1 100644 --- a/src/pages/approval/handle.vue +++ b/src/pages/approval/handle.vue @@ -12,9 +12,9 @@ const statusMap: { [key: number]: string } = { } const statusOptions = [ - { text: '已通过', value: 1 }, - { text: '待审核', value: 2 }, - { text: '已驳回', value: 3 } + { text: '待审核', value: 1 }, + { text: '通过', value: 2 }, + { text: '驳回', value: 3 } ] import axios from "axios" import { handleApprovalApi } from '@/common/apis/approval' @@ -44,8 +44,13 @@ const validateForm = () => { showConfirmDialog({ title: '错误', message: '审批单ID参数错误' }) return false } - if (formData.value.returnAmount < 0) { - showConfirmDialog({ title: '提示', message: '退款金额不能为负数' }) + if (formData.value.returnAmount <= 0) { + showConfirmDialog({ title: '提示', message: '退款金额需大于0' }) + return false + } + if (null != approvalStore.currentApproval && + formData.value.returnAmount > approvalStore.currentApproval.goodsPrice) { + showConfirmDialog({ title: '提示', message: '退款金额不能超过商品价格' }) return false } if (formData.value.status === 3 && !formData.value.auditRemark) { @@ -122,6 +127,24 @@ const previewImage = (url: string) => { onMounted(() => { if (!approvalStore.currentApproval) { router.push('/approval/list') + } else if (approvalStore.currentApproval.status !== 1) { + // 填充历史审批数据 + formData.value = { + ...formData.value, + status: approvalStore.currentApproval.status, + returnAmount: approvalStore.currentApproval.returnAmount, + auditRemark: approvalStore.currentApproval.auditRemark, + auditImages: approvalStore.currentApproval.auditImages + } + + // 处理文件回显 + if (approvalStore.currentApproval.auditImages) { + fileList.value = approvalStore.currentApproval.auditImages.split(',').map(url => ({ + url, + status: 'done', + message: '已上传' + })) + } } }) @@ -159,9 +182,20 @@ const handleSubmit = async () => {
+ + + + @@ -176,13 +210,31 @@ const handleSubmit = async () => { - - - - - + + + @@ -204,8 +256,15 @@ const handleSubmit = async () => { -
- +
+ 提交审批
@@ -250,12 +309,39 @@ const handleSubmit = async () => { } .submit-bar { - position: fixed; - bottom: 0; - left: 0; - right: 0; + position: sticky; + bottom: 20px; padding: 16px; background: #fff; box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1); + border-radius: 8px; + margin: 0 16px; + z-index: 1; +} + +.content-wrapper { + padding-bottom: 100px; +} + +.audit-remark-field::v-deep .van-field__control { + background-color: #fffbe6; + padding: 8px; + border-radius: 4px; +} + +.clickable-status-field:not(:disabled)::v-deep .van-field__control { + cursor: pointer; + transition: all 0.3s ease; + background-color: #f7f8fa; +} + +.clickable-status-field:not(:disabled):hover::v-deep .van-field__control { + background-color: #f2f3f5; + box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); +} + +.clickable-status-field:not(:disabled):active::v-deep .van-field__control { + background-color: #ebedf0; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); } \ No newline at end of file diff --git a/src/pages/cabinet/index.vue b/src/pages/cabinet/index.vue index 237f2a5..634cb1c 100644 --- a/src/pages/cabinet/index.vue +++ b/src/pages/cabinet/index.vue @@ -251,7 +251,6 @@ loadCabinetDetail() display: flex; flex-direction: column; justify-content: space-between; - height: 100px; position: relative; padding-left: 3px; }