Просмотр исходного кода

feat(mall): 实现退款撤销、超时发货补偿和降价补差功能

在退款详情页添加撤销退款申请的完整流程,包括确认弹窗、API调用和状态刷新
在商城API模块新增三个接口:refundCancelAjax、sendTimeoutCompensationAjax和priceReductionCompensationAjax
在订单列表页和订单详情页添加超时发货补偿和降价补差的申请入口
ylong 2 недель назад
Родитель
Сommit
1e861c25d1

+ 9 - 0
api/modules/mall.js

@@ -64,6 +64,12 @@ export const useMallApi = (Vue, vm) => {
 
         // 催发货
         urgeSendAjax: (orderId) => vm.$u.post('/token/shop/order/urgeSend?orderId=' + orderId),
+        
+        // 超时发货补偿
+        sendTimeoutCompensationAjax: (orderId) => vm.$u.post('/token/shop/order/sendTimeoutCompensation?orderId=' + orderId),
+        
+        // 降价补差申请
+        priceReductionCompensationAjax: (orderId) => vm.$u.post('/token/shop/order/priceReductionCompensation?orderId=' + orderId),
 
         // 修改订单地址
         modifyOrderAddressAjax: (data) => vm.$u.post('/token/shop/order/orderModifyAddress', data),
@@ -73,6 +79,9 @@ export const useMallApi = (Vue, vm) => {
 
         // 修改退款申请
         refundApplyModifyAjax: (data) => vm.$u.post('/token/shop/order/refundApplyModify', data),
+        
+        // 撤销退款申请
+        refundCancelAjax: (data) => vm.$u.post('/token/shop/order/refundCancel', data),
 
         // 减钱分享信息
         clickReduceInviteAjax: (params) => vm.$u.get('/token/shop/order/clickReduceInvite', params),

+ 38 - 0
pages-car/pages/my-order.vue

@@ -152,6 +152,44 @@
                     });
                 } else if (type === 'remind') {
                     this.$refs.urgeDialog.open(order);
+                } else if (type === 'overtime') {
+                    // 超时发货补偿
+                    uni.showModal({
+                        title: '提示',
+                        content: '确认申请超时发货补偿?',
+                        success: (res) => {
+                            if (res.confirm) {
+                                this.$u.api.sendTimeoutCompensationAjax(order.orderId).then(res => {
+                                    if (res.code == 200) {
+                                        uni.showToast({
+                                            title: '申请成功',
+                                            icon: 'success'
+                                        });
+                                        this.loadOrders(true, this.params);
+                                    }
+                                });
+                            }
+                        }
+                    });
+                } else if (type === 'priceMatch') {
+                    // 降价补差
+                    uni.showModal({
+                        title: '提示',
+                        content: '确认申请降价补差?',
+                        success: (res) => {
+                            if (res.confirm) {
+                                this.$u.api.priceReductionCompensationAjax(order.orderId).then(res => {
+                                    if (res.code == 200) {
+                                        uni.showToast({
+                                            title: '申请成功',
+                                            icon: 'success'
+                                        });
+                                        this.loadOrders(true, this.params);
+                                    }
+                                });
+                            }
+                        }
+                    });
                 } else if (type === 'refund') {
                     if (order.status == '2') {
                         this.$refs.refundDialog.open(order);

+ 44 - 0
pages-car/pages/order-detail.vue

@@ -242,6 +242,50 @@
                     this.$refs.urgeDialog.open(this.orderInfo);
                     return;
                 }
+                if (type === 'overtime') {
+                    // 超时发货补偿
+                    uni.showModal({
+                        title: '提示',
+                        content: '确认申请超时发货补偿?',
+                        success: (res) => {
+                            if (res.confirm) {
+                                this.$u.api.sendTimeoutCompensationAjax(this.orderInfo.orderId).then(res => {
+                                    if (res.code == 200) {
+                                        uni.showToast({
+                                            title: '申请成功',
+                                            icon: 'success'
+                                        });
+                                        // 刷新订单详情
+                                        this.loadOrderDetail(this.orderInfo.orderId);
+                                    }
+                                });
+                            }
+                        }
+                    });
+                    return;
+                }
+                if (type === 'priceMatch') {
+                    // 降价补差
+                    uni.showModal({
+                        title: '提示',
+                        content: '确认申请降价补差?',
+                        success: (res) => {
+                            if (res.confirm) {
+                                this.$u.api.priceReductionCompensationAjax(this.orderInfo.orderId).then(res => {
+                                    if (res.code == 200) {
+                                        uni.showToast({
+                                            title: '申请成功',
+                                            icon: 'success'
+                                        });
+                                        // 刷新订单详情
+                                        this.loadOrderDetail(this.orderInfo.orderId);
+                                    }
+                                });
+                            }
+                        }
+                    });
+                    return;
+                }
                 if (type === 'address') {
                     this.isModifyingAddress = true;
                     // 兼容可能的字段差异

+ 17 - 3
pages-car/pages/refund-detail.vue

@@ -239,9 +239,22 @@
 							content: '确定要撤销退款申请吗?',
 							success: (res) => {
 								if (res.confirm) {
-									// 调用撤销接口 (需确认接口名)
-									// 假设: cancelRefundAjax
-									uni.showToast({ title: '撤销申请', icon: 'none' });
+									uni.showLoading({
+										title: '处理中'
+									});
+									this.$u.api.refundCancelAjax({
+										refundOrderId: this.refundOrderId
+									}).then(res => {
+										uni.hideLoading();
+										if (res.code == 200) {
+											uni.showToast({
+												title: '撤销成功',
+												icon: 'success'
+											});
+											// 刷新页面
+											this.getDetail();
+										}
+									});
 								}
 							}
 						});
@@ -272,6 +285,7 @@
 		height: max-content;
 		background-color: transparent;
 		padding: 0;
+
 		&::after {
 			border: none;
 		}