Browse Source

feat(退款): 添加退款协商处理功能

- 在 API 模块中新增同意协商和拒绝协商的接口调用方法
- 在退款详情页面中,根据协商状态动态展示标题和倒计时提示
- 实现协商金额的展示,并使用新增的 API 接口处理用户接受或拒绝协商的操作
- 优化退货地址的显示,使用接口返回的实际收货人信息
ylong 4 ngày trước cách đây
mục cha
commit
25fc019f52
2 tập tin đã thay đổi với 88 bổ sung55 xóa
  1. 6 0
      api/modules/mall.js
  2. 82 55
      pages-car/pages/refund-detail.vue

+ 6 - 0
api/modules/mall.js

@@ -86,6 +86,12 @@ export const useMallApi = (Vue, vm) => {
         // 填写退货物流
         refundFillExpressAjax: (data) => vm.$u.post('/token/shop/order/refundFillExpress', data),
 
+        // 退款申请-同意协商
+        refundDisposeAgreeAjax: (data) => vm.$u.post('/token/shop/order/refundDisposeAgree', data),
+
+        // 退款申请-拒绝协商
+        refundDisposeRefuseAjax: (data) => vm.$u.post('/token/shop/order/refundDisposeRefuse', data),
+
         // 减钱分享信息
         clickReduceInviteAjax: (params) => vm.$u.get('/token/shop/order/clickReduceInvite', params),
         

+ 82 - 55
pages-car/pages/refund-detail.vue

@@ -2,29 +2,41 @@
 	<view class="refund-detail-page">
 		<!-- 状态头部 -->
 		<view class="status-header">
+			<view class="status-title"
+				v-if="orderInfo.disposeType && orderInfo.disposeType == 2 && orderInfo.status == 2">退货商品异常</view>
+			<view class="status-title" v-else>{{ getStatusText(orderInfo.status) }}</view>
+
+			<!-- 倒计时 -->
+			<view class="status-desc" v-if="orderInfo.restAuditSecond > 0">
+				<u-count-down :timestamp="orderInfo.restAuditSecond" separator="zh" :show-seconds="false"
+					@end="getDetail" font-size="26" color="#999" bg-color="transparent"></u-count-down>
+				<template>
+					<view class="status-desc" v-if="orderInfo.status == 1">后平台未处理将自动同意</view>
+					<view class="status-desc" v-if="orderInfo.status == 2">后买家未处理将自动撤销</view>
+					<view class="status-desc" v-if="orderInfo.status == 3">后平台处理将自动同意退款</view>
+					<view class="status-desc" v-if="orderInfo.status == 4">后未寄出平台将自动撤销退货申请</view>
+				</template>
+			</view>
+
 			<template v-if="orderInfo.status == '1'">
-				<view class="status-title">请等待平台处理</view>
-				<!-- 倒计时 -->
-				<view class="status-desc" v-if="orderInfo.restAuditSecond > 0">
-					<u-count-down :timestamp="orderInfo.restAuditSecond" separator="zh" :show-seconds="false"
-						@end="getDetail" font-size="26" color="#999" bg-color="transparent"></u-count-down>后平台未处理将自动同意
-				</view>
 				<view class="status-tip">您已成功发起退款申请,请耐心等待平台处理</view>
 			</template>
 			<template v-else>
-				<view class="status-title">{{ getStatusText(orderInfo.status) }}</view>
 				<!-- 协商UI -->
 				<view class="negotiation-card" v-if="orderInfo.status == '2'">
 					<view class="negotiation-content">
 						<u-icon name="file-text-fill" color="#FF6600" size="40" class="negotiation-icon"></u-icon>
 						<view class="negotiation-text">
-							<view class="negotiation-title">协商修改退款金额为{{ orderInfo.refundMoney }}元</view>
+							<view class="negotiation-title">协商修改退款金额为{{ orderInfo.disposeMoney || orderInfo.refundMoney
+							}}元</view>
 							<view class="negotiation-desc">我们愿意支持退款,若您接受修改金额,我们将立刻退款给您</view>
 						</view>
 					</view>
 					<view class="negotiation-actions">
-						<u-button size="mini" :custom-style="rejectBtnStyle" @click="handleNegotiation(false)">拒绝协商</u-button>
-						<u-button size="mini" :custom-style="acceptBtnStyle" @click="handleNegotiation(true)">接受协商</u-button>
+						<u-button size="mini" :custom-style="rejectBtnStyle"
+							@click="handleNegotiation(false)">拒绝协商</u-button>
+						<u-button size="mini" :custom-style="acceptBtnStyle"
+							@click="handleNegotiation(true)">接受协商</u-button>
 					</view>
 				</view>
 				<!-- 退款成功金额展示 -->
@@ -41,7 +53,7 @@
 		<view class="info-card return-method-card" v-if="orderInfo.status == '4'">
 			<view class="card-title">请选择退货方式</view>
 			<!-- 这里可以加倒计时,类似:1天11时57分后未寄出平台将自动撤销退货申请,需根据接口返回字段 -->
-			
+
 			<view class="method-tabs">
 				<view class="tab-item disabled">
 					<view class="tab-name">上门取件</view>
@@ -56,21 +68,24 @@
 					<view class="tab-desc">(需填写单号)</view>
 				</view>
 			</view>
-			
+
 			<view class="warning-box">
 				需您自行联系快递公司退回,请不要邮寄到付
 			</view>
-			
+
 			<view class="address-box">
 				<view class="address-label">平台地址</view>
 				<view class="address-content">
-					<view class="name">{{ orderInfo.platformReceiveName || '张三' }}</view>
-					<view class="detail">{{ orderInfo.platformReceiveAddress || '河南省鹤壁市浚县即可获得发货单收到单方事故师范号到' }} <image src="/pages-mine/static/copy.png" class="copy-icon" @click="copyAddress"></image></view>
+					<view class="name">{{ orderInfo.receiverName }} {{ orderInfo.receiverMobile }}</view>
+					<view class="detail">{{ orderInfo.receiverAddress }} <image
+							src="/pages-mine/static/copy.png" class="copy-icon" @click="copyAddress"></image>
+					</view>
 				</view>
 				<u-icon name="arrow-right" color="#ccc" size="28"></u-icon>
 			</view>
-			
-			<u-button type="success" shape="circle" :custom-style="fillBtnStyle" @click="goToFillLogistics">填写单号</u-button>
+
+			<u-button type="success" shape="circle" :custom-style="fillBtnStyle"
+				@click="goToFillLogistics">填写单号</u-button>
 		</view>
 
 		<!-- 商品列表 -->
@@ -278,7 +293,7 @@
 				// 状态 1-申请退款 2-审核通过 3-审核驳回 4-超时关闭 5-卖家已发货 6-已完成
 				// 状态 1-申请退款 2-协商中待用户确认 3-协商中待商家确认 4-审核通过 5-审核驳回 6-超时关闭 7-卖家已发货 8-已完成
 				const map = {
-					'1': '待卖家处理',
+					'1': '请等待平台处理',
 					'2': '协商中待用户确认',
 					'3': '协商中待商家确认',
 					'4': '审核已通过,请您把书籍自行寄回',
@@ -290,7 +305,7 @@
 				return map[status] || '处理中';
 			},
 			copyAddress() {
-				const address = (this.orderInfo.platformReceiveName || '张三') + ' ' + (this.orderInfo.platformReceiveAddress || '河南省鹤壁市浚县即可获得发货单收到单方事故师范号到');
+				const address = (this.orderInfo.receiverName || '张三') + ' ' + (this.orderInfo.receiverMobile || '') + ' ' + (this.orderInfo.receiverAddress || '河南省鹤壁市浚县即可获得发货单收到单方事故师范号到');
 				uni.setClipboardData({
 					data: address,
 					success: () => {
@@ -332,21 +347,26 @@
 					content: title,
 					success: (res) => {
 						if (res.confirm) {
-							// TODO: Call API
-							// const api = accept ? this.$u.api.refundNegotiateAgreeAjax : this.$u.api.refundNegotiateRefuseAjax;
-							// api(...)
-							
-							// 模拟成功
 							uni.showLoading({ title: '处理中' });
-							setTimeout(() => {
+							const api = accept ? this.$u.api.refundDisposeAgreeAjax : this.$u.api.refundDisposeRefuseAjax;
+							api({ refundOrderId: this.refundOrderId }).then(res => {
 								uni.hideLoading();
-								uni.showToast({
-									title: accept ? '已接受协商' : '已拒绝协商',
-									icon: 'success'
-								});
-								// 刷新详情
-								this.getDetail();
-							}, 1000);
+								if (res.code == 200) {
+									uni.showToast({
+										title: accept ? '已接受协商' : '已拒绝协商',
+										icon: 'success'
+									});
+									// 刷新详情
+									this.getDetail();
+								} else {
+									uni.showToast({
+										title: res.msg || '操作失败',
+										icon: 'none'
+									});
+								}
+							}).catch(() => {
+								uni.hideLoading();
+							});
 						}
 					}
 				});
@@ -444,27 +464,27 @@
 			.negotiation-card {
 				margin-top: 30rpx;
 				text-align: left;
-				
+
 				.negotiation-content {
 					display: flex;
 					align-items: flex-start;
 					margin-bottom: 30rpx;
-					
+
 					.negotiation-icon {
 						margin-right: 20rpx;
 						margin-top: 6rpx;
 					}
-					
+
 					.negotiation-text {
 						flex: 1;
-						
+
 						.negotiation-title {
 							font-size: 30rpx;
 							font-weight: bold;
 							color: #333;
 							margin-bottom: 10rpx;
 						}
-						
+
 						.negotiation-desc {
 							font-size: 26rpx;
 							color: #999;
@@ -472,7 +492,7 @@
 						}
 					}
 				}
-				
+
 				.negotiation-actions {
 					display: flex;
 					justify-content: flex-end;
@@ -506,7 +526,7 @@
 			margin: 20rpx;
 			border-radius: 16rpx;
 			padding: 30rpx;
-			
+
 			&.return-method-card {
 				.card-title {
 					font-size: 32rpx;
@@ -515,12 +535,12 @@
 					text-align: center;
 					margin-bottom: 30rpx;
 				}
-				
+
 				.method-tabs {
 					display: flex;
 					justify-content: space-between;
 					margin-bottom: 30rpx;
-					
+
 					.tab-item {
 						flex: 1;
 						background-color: #F8F8F8;
@@ -529,36 +549,43 @@
 						text-align: center;
 						margin-right: 20rpx;
 						border: 2rpx solid transparent;
-						
+
 						&:last-child {
 							margin-right: 0;
 						}
-						
+
 						&.active {
 							background-color: #F0F9F1;
 							border-color: #38C148;
-							.tab-name { color: #38C148; }
-							.tab-desc { color: #38C148; opacity: 0.8; }
+
+							.tab-name {
+								color: #38C148;
+							}
+
+							.tab-desc {
+								color: #38C148;
+								opacity: 0.8;
+							}
 						}
-						
+
 						&.disabled {
 							opacity: 0.5;
 						}
-						
+
 						.tab-name {
 							font-size: 30rpx;
 							font-weight: bold;
 							color: #333;
 							margin-bottom: 6rpx;
 						}
-						
+
 						.tab-desc {
 							font-size: 22rpx;
 							color: #999;
 						}
 					}
 				}
-				
+
 				.warning-box {
 					background-color: #E8F5E9;
 					color: #38C148;
@@ -568,36 +595,36 @@
 					text-align: center;
 					margin-bottom: 30rpx;
 				}
-				
+
 				.address-box {
 					display: flex;
 					align-items: center;
 					padding: 20rpx 0;
 					border-top: 1rpx solid #F5F5F5;
-					
+
 					.address-label {
 						width: 140rpx;
 						font-size: 28rpx;
 						color: #333;
 						font-weight: bold;
 					}
-					
+
 					.address-content {
 						flex: 1;
 						padding-right: 20rpx;
-						
+
 						.name {
 							font-size: 30rpx;
 							font-weight: bold;
 							color: #333;
 							margin-bottom: 10rpx;
 						}
-						
+
 						.detail {
 							font-size: 26rpx;
 							color: #666;
 							line-height: 1.4;
-							
+
 							.copy-icon {
 								width: 28rpx;
 								height: 28rpx;