From ee60321a0392e287f13bbe730be436b464a0d76d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AF=85?= <1335909236@qq.com> Date: Fri, 12 Sep 2025 15:07:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=94=AE=E5=90=8E=E9=A1=B5?= =?UTF-8?q?=E5=92=8C=E5=A4=84=E7=90=86=E9=A1=B5=E9=9D=A2=E7=9A=84=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/afterSale.js | 1 + packages/myOrders/afterSale/index.vue | 6 +- packages/myOrders/apply/index.vue | 82 ++++++++++++++++----------- packages/myOrders/index/index.vue | 1 + packages/myOrders/pending/index.vue | 15 ++++- 5 files changed, 66 insertions(+), 39 deletions(-) diff --git a/api/afterSale.js b/api/afterSale.js index a1440aca..0259ea76 100644 --- a/api/afterSale.js +++ b/api/afterSale.js @@ -6,4 +6,5 @@ export const apiArr = { isAllow: "/api/v2/wechat/commodity/after-sales/is-allow", //判断订单是否能申请售后 revokeApply: "/api/v2/wechat/commodity/after-sales/revoke-apply", //撤销售后申请 changeGoodsList: "/api/v2/wechat/commodity/after-sales/change-goods-list", //商品售后换货商品列表 + updateApply: "/api/v2/wechat/commodity/after-sales/update-apply", //商品订单售后修改申请 }; diff --git a/packages/myOrders/afterSale/index.vue b/packages/myOrders/afterSale/index.vue index 7b62a43c..6beddabd 100644 --- a/packages/myOrders/afterSale/index.vue +++ b/packages/myOrders/afterSale/index.vue @@ -42,7 +42,7 @@ - + @@ -121,8 +121,8 @@ export default { const seconds = String(date.getSeconds()).padStart(2, '0'); return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; }, - modifyApplication() { - console.log('修改申请'); + modifyApplication(item) { + NavgateTo(`../apply/index?item=${JSON.stringify(item)}`); }, cancelApplication(item) { uni.showModal({ diff --git a/packages/myOrders/apply/index.vue b/packages/myOrders/apply/index.vue index de39391b..5302697d 100644 --- a/packages/myOrders/apply/index.vue +++ b/packages/myOrders/apply/index.vue @@ -72,7 +72,7 @@ 退货退款 - 退货 + 退款 @@ -103,14 +103,15 @@ import { upload, NavgateTo } from '../../../utils'; +import { apiArr } from "../../../api/afterSale"; + export default { data() { return { currentAfterSale: null, afterSalePopup2: false, - afterSalePopup3: false, - selectedAfterSaleType2: 0, // 0:退货/退款, 1:退货 + selectedAfterSaleType2: 0, // 0:退货/退款, 1:退款 selectedAsReason: 0, selectedServiceType: '', selectedRefundReason: '', @@ -119,9 +120,10 @@ export default { postage: 0, refundDescription: '', refundMethod: '自行寄回', - merchantAddress: '衡水市路北街道中心北大街世纪名城41号楼', - merchantContact: '高尚 18032753127', + merchantAddress: '', + merchantContact: '', imgList: [], + afterSalesType: 2, applyRefundReasons: [ '商品质量问题', '商品与描述不符', @@ -143,8 +145,10 @@ export default { this.currentAfterSale = item; // 设置初始退款金额等数据 if (item) { - this.refundAmount = item.sales_price || 0; + this.refundAmount = item.refund_amount || 0; this.maxRefundAmount = item.sales_price || 0; + this.merchantAddress = item.supplier_address || '未设置'; + this.merchantContact = `${item.supplier_name} ${item.supplier_phone}` || '未设置'; } }, methods: { @@ -153,12 +157,13 @@ export default { this.afterSalePopup2 = false; }, - closeAfterSalePopup3() { - this.afterSalePopup3 = false; - }, - // 选择售后类型 selectAfterSaleType2(index) { + if (index == 0) { + this.afterSalesType = 2; + } else { + this.afterSalesType = 1; + } this.selectedAfterSaleType2 = index; }, @@ -169,7 +174,7 @@ export default { // 确认退款原因选择 confirmAfterSaleCancel2() { - const afterSaleTypes = ['退货退款', '退货']; + const afterSaleTypes = ['退货退款', '退款']; const selectedType = afterSaleTypes[this.selectedAfterSaleType2]; console.log('选中的售后类型:', selectedType); @@ -191,7 +196,6 @@ export default { // 打开选择服务类型或退款原因弹窗 openAfterSalePopup2(type) { - this.afterSalePopup3 = false; this.afterSalePopup2 = true; }, @@ -213,16 +217,14 @@ export default { // 修改退款金额 modifyRefundAmount() { console.log('修改退款金额'); - // 这里可以添加修改退款金额的逻辑 }, // 查看地址详情 viewAddressDetails() { console.log('查看地址详情'); - // 这里可以添加查看地址详情的逻辑 }, - // 提交退款申请 + // 提交修改申请 submitRefundApplication() { if (!this.selectedServiceType || !this.selectedRefundReason) { uni.showToast({ @@ -232,26 +234,38 @@ export default { return; } - // 输出弹窗中的所有内容 - const refundInfo = { - serviceType: this.selectedServiceType, - refundReason: this.selectedRefundReason, - refundAmount: this.refundAmount, - maxRefundAmount: this.maxRefundAmount, - postage: this.postage, - refundDescription: this.refundDescription, - refundMethod: this.refundMethod, - merchantAddress: this.merchantAddress, - merchantContact: this.merchantContact, - imgList: this.imgList - }; - console.log('提交退款申请:', refundInfo); + const params = { + id: this.currentAfterSale.id, + after_sales_type: this.afterSalesType, + after_sales_reason: this.selectedRefundReason, + refund_amount: this.refundAmount, + application_description: this.refundDescription, + application_images: this.imgList && this.imgList.length > 0 ? + this.imgList.map(img => img.url).join(',') : '', + receiving_address: this.merchantAddress + } + console.log("🚀 ~ submitRefundApplication ~ params:", params) + request(apiArr.updateApply, "POST", params).then((res) => { + uni.showToast({ + title: '申请提交成功', + icon: 'success' + }); - this.afterSalePopup3 = false; - // 这里可以添加提交后的处理逻辑 - uni.showToast({ - title: '退款申请提交成功', - icon: 'success' + // 构造更新后的数据 + const updatedAfterSale = { + ...this.currentAfterSale, + after_sales_type: this.afterSalesType, + after_sales_reason: this.selectedRefundReason, + refund_amount: this.refundAmount, + application_description: this.refundDescription, + application_images: this.imgList && this.imgList.length > 0 ? + this.imgList.map(img => img.url).join(',') : '' + }; + + setTimeout(() => { + this.currentAfterSale = updatedAfterSale; + uni.setStorageSync('afterSaleItem', updatedAfterSale); + }, 1500); }); } } diff --git a/packages/myOrders/index/index.vue b/packages/myOrders/index/index.vue index 11746670..41900ee1 100644 --- a/packages/myOrders/index/index.vue +++ b/packages/myOrders/index/index.vue @@ -365,6 +365,7 @@ export default { }, onShow() { this.getOrderList(); + uni.removeStorageSync('afterSaleItem') }, }; diff --git a/packages/myOrders/pending/index.vue b/packages/myOrders/pending/index.vue index 54980ef4..7d5b9286 100644 --- a/packages/myOrders/pending/index.vue +++ b/packages/myOrders/pending/index.vue @@ -117,7 +117,6 @@