From a66959fd224840ee63f3907f9b0dc554dbd7b740 Mon Sep 17 00:00:00 2001 From: chenhao <852066789@qq.com> Date: Fri, 19 Sep 2025 18:46:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(order):=20=E6=96=B0=E5=A2=9E=E7=A8=8E?= =?UTF-8?q?=E7=8E=87=E8=AE=BE=E7=BD=AE=E5=8A=9F=E8=83=BD=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在订单详情页面添加税率输入框,支持修改产品税率 - 新增 FileType 类型用于区分文件类型- 优化订单信息展示布局,调整部分字段显示位置 - 添加文件类型前缀到文件列表显示 - 重构部分代码以支持新的税率设置功能 --- src/api/order.ts | 9 +++ src/types/index.ts | 1 + src/views/Detail/index.vue | 155 ++++++++++++++++++++++++++++++------- vite.config.ts | 2 +- 4 files changed, 139 insertions(+), 28 deletions(-) diff --git a/src/api/order.ts b/src/api/order.ts index df1d381..736f20c 100644 --- a/src/api/order.ts +++ b/src/api/order.ts @@ -46,6 +46,15 @@ export const submitApproval = (params: any): Promise { + Object.keys(item).forEach(itemKey => { + if (item[itemKey] !== undefined && item[itemKey] !== null) { + formData.append(`taxRateData[${index}].${itemKey}`, item[itemKey].toString()); + } + }); + }); } else { formData.append(key, params[key].toString()) } diff --git a/src/types/index.ts b/src/types/index.ts index 7424307..71fa40b 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -15,6 +15,7 @@ export interface LoginParams { // 订单状态类型 export type OrderStatus = '0' | '1' | '2' // 待审批、已审批、已拒绝 +export type FileType = '0' | '1' | '2' // 待审批、已审批、已拒绝 export type PayMethod = '1-1' | '1-2' | '2-1' | '2-2' | '2-3' // 待审批、已审批、已拒绝 // 审批状态类型 diff --git a/src/views/Detail/index.vue b/src/views/Detail/index.vue index 118d257..123342b 100644 --- a/src/views/Detail/index.vue +++ b/src/views/Detail/index.vue @@ -135,24 +135,17 @@
联系方式 {{ currentOrderInfo.notifierPhone}} -
- 其他特别说明 - {{ currentOrderInfo.remark}} -
-
- 付款方式 - {{ getPayMethod(currentOrderInfo.paymentMethod) }} -
-
- 付款比例 - {{ currentOrderInfo.paymentRatio }}%
+
付款说明 {{ currentOrderInfo.paymentDescription }}
- +
+ 其他特别说明 + {{ currentOrderInfo.remark }} +
@@ -192,6 +185,18 @@ 单价 {{ formatAmount(product.price) }} +
+ 税率 + + + +
@@ -225,6 +230,18 @@ 单价 {{ formatAmount(product.price) }} +
+ 税率 + + + +
@@ -258,6 +275,18 @@ 单价 {{ formatAmount(product.price) }} +
+ 税率 + + + +
@@ -301,7 +330,7 @@
{{ file.fileName }}
-
{{ file.uploadUserName }} · {{ formatDate(file.uploadTime) }}
+
{{getFileType(file.fileSort)}}.{{ file.uploadUserName }} · {{ formatDate(file.uploadTime) }}
@@ -465,7 +494,7 @@ import { getApprovalStatusColor, getFilePreviewUrl } from '@/utils' -import type {OrderStatus, ApprovalStatus, AttachmentFile, payMethod, PayMethod} from '@/types' +import type {OrderStatus, ApprovalStatus, AttachmentFile, payMethod, PayMethod, FileType} from '@/types' const route = useRoute() const router = useRouter() @@ -479,6 +508,11 @@ const currentApprovalStatus = ref(3) const submitting = ref(false) const selectedTag = ref('') const selectedDiscount = ref('') // 现金折扣率选择 +const taxRateData = ref([]) + +const isBusinessApproval = computed(() => { + return currentOrder.value?.todo?.taskName?.startsWith('商务') +}) // Tab页签 const activeTab = ref('order') @@ -517,7 +551,14 @@ const getPayMethod= (method: PayMethod) => { } return methodMap[method] || '' } - +const getFileType = (type: FileType) => { + const fileTypeMap = { + '0': '商务折扣审批', + '1': '合同', + '2': '补充附件' + } + return fileTypeMap[type] || '补充附件' +} // 获取步骤图标 const getStepIcon = (status?: ApprovalStatus) => { if (status === undefined || status === null) return 'clock' @@ -620,26 +661,56 @@ const getOpinionTags = () => { if (currentApprovalStatus.value === 0) { // 驳回常用意见 return [ - '资料不齐全,请补充相关文件', - '订单金额需要重新核实', - '客户信息有误,请修正', - '产品配置不符合要求', - '需要提供更多技术细节', - '合同条款需要调整' + '经审查有问题,驳回' ] } else { // 通过常用意见 return [ - '审核通过,订单信息完整', - '符合公司政策,同意执行', - '客户资质良好,建议通过', - '产品配置合理,批准发货', - '风险可控,同意此订单', - '经审查无误,予以批准' + '所有信息已阅,审核通过' ] } } +const initializeTaxRates = () => { + if (!currentOrderInfo.value) return; + + const allProducts = [ + ...(currentOrderInfo.value.softwareProjectProductInfoList || []), + ...(currentOrderInfo.value.hardwareProjectProductInfoList || []), + ...(currentOrderInfo.value.maintenanceProjectProductInfoList || []) + ]; + + // Initialize taxRate on product objects for v-model + if (currentOrderInfo.value.softwareProjectProductInfoList) { + currentOrderInfo.value.softwareProjectProductInfoList.forEach(p => p.taxRate = p.taxRate ?? null); + } + if (currentOrderInfo.value.hardwareProjectProductInfoList) { + currentOrderInfo.value.hardwareProjectProductInfoList.forEach(p => p.taxRate = p.taxRate ?? null); + } + if (currentOrderInfo.value.maintenanceProjectProductInfoList) { + currentOrderInfo.value.maintenanceProjectProductInfoList.forEach(p => p.taxRate = p.taxRate ?? null); + } + + taxRateData.value = allProducts.map(p => ({ + productId: p.id, + projectId: currentOrderInfo.value.projectId, + taxRate: p.taxRate + })); +}; + +const updateTaxRate = (product: any) => { + const existing = taxRateData.value.find(item => item.productId === product.id); + if (existing) { + existing.taxRate = product.taxRate; + } else if (currentOrderInfo.value) { + taxRateData.value.push({ + productId: product.id, + projectId: currentOrderInfo.value.projectId, + taxRate: product.taxRate + }); + } +}; + // 选择标签 const selectTag = (tag: string) => { if (selectedTag.value === tag) { @@ -686,6 +757,7 @@ const submitApproval = async () => { try { const params = { + taxRateData, ...currentOrder.value.todo, // 展开todo中的所有参数 approveOpinion: opinion || undefined, // 添加审批意见 @@ -701,6 +773,11 @@ const submitApproval = async () => { params.allPriceCountValue = selectedDiscount.value } + // 如果是商务审批,则添加税率数据 + if (isBusinessApproval.value && taxRateData.value.length > 0) { + params.taxRateData = taxRateData.value; + } + console.log('提交审批参数:', params) await submitApprovalApi(params) @@ -733,6 +810,7 @@ onMounted(async () => { console.log('获取订单详情结果:', result) console.log('当前订单信息:', currentOrder.value) console.log('当前订单基本信息:', currentOrderInfo.value) + initializeTaxRates() // 检查订单详情中是否包含现金折扣率值 if (currentOrder.value && currentOrder.value.projectOrderInfo) { @@ -1209,6 +1287,29 @@ onMounted(async () => { } } +.tax-rate-input { + width: 80px; + text-align: right; + border: 1px solid var(--divider-color); + border-radius: var(--border-radius-sm); + padding: 4px 8px; + font-size: 14px; + color: var(--text-color-primary); + background-color: var(--background-color-primary); + transition: border-color 0.2s; + + &:disabled { + background-color: var(--background-color-secondary); + color: var(--text-color-tertiary); + cursor: not-allowed; + } + + &:focus { + outline: none; + border-color: var(--primary-color); + } +} + .discount-options { :deep(.van-radio-group) { display: flex; diff --git a/vite.config.ts b/vite.config.ts index 246d6b6..ced2587 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -27,7 +27,7 @@ export default defineConfig({ open: true, proxy: { '/api': { - target: 'http://192.168.2.134:28080', + target: 'http://localhost:28080', changeOrigin: true, secure: false, rewrite: (path) => path.replace(/^\/api/, ''),