فهرست منبع

取消订单;
取消退单申请;
_callDataPromise处理报错

lishanshan 7 ماه پیش
والد
کامیت
2133064922
3فایلهای تغییر یافته به همراه147 افزوده شده و 15 حذف شده
  1. 10 1
      src/api/order.js
  2. 129 11
      src/pages/order/order.vue
  3. 8 3
      src/uni_modules/z-paging/components/z-paging/js/modules/data-handle.js

+ 10 - 1
src/api/order.js

@@ -13,7 +13,16 @@ export function orderDeatails(data) {
 export function cancleOrder(data) {
     return request({
         method: 'post',
-        url: '/api/order/v1/wx/cancle',
+        url: '/api/order/v1/wx/applyCancle',
+        data
+    });
+}
+
+// 取消退单申请
+export function cancleApply(data) {
+    return request({
+        method: 'post',
+        url: '/api/order/v1/wx/cancelApplyCancle',
         data
     });
 }

+ 129 - 11
src/pages/order/order.vue

@@ -13,7 +13,7 @@
 					</view>
 				</view>
 			</template>
-			<view class="list-box" v-if="dataList.length > 0">
+			<view class="list-box" v-if="dataList && dataList.length > 0">
 				<view class="item" v-for="(item,index) in dataList" :key="index">
 					<view class="lTitle" @click="goDetails(item.cId)">
 						<view style="font-weight: bold;">上门时间:{{item.dtCreateTime}}</view>
@@ -39,7 +39,8 @@
 							<!-- 剩余<u-count-down :time="item.remainingTime" @finish="" v-if="item.dtCreateTime>0"></u-count-down> -->
 						</view>
 						<view class="button">
-							<text class="cancel" @click="onCancleOrder(item)" v-if="item.nStatus > -2 && item.nStatus < 1">取消订单</text>
+							<text class="pay" @click="onCancleOrder(item)" v-if="[-1, 0, 1, 2, 3, 6].includes(item.nStatus)">取消订单</text>
+							<text class="pay" @click="onCancleApply(item)" v-if="item.nStatus == 7">取消申请</text>
 							<text class="pay" @click="onPayOrder(item)" v-if="item.nStatus == -1 && item.nStatus < 1">支付订单</text>
 							<text class="pay" @click="goEvaluate(item)" v-if="item.nStatus == 4">去评价</text>
 							<text class="pay" @click="onDelOrder(item)" v-if="item.nStatus <= -2 || item.nStatus == 5">删除订单</text>
@@ -65,6 +66,34 @@
 				</u-empty>
 			</template>
 		</z-paging>
+    <!-- 取消订单弹窗 -->
+    <u-popup :show="cancelOrderPopup.show" mode="center" :width="700" :round="10" closeable @close="closePopup">
+      <view class="popup-content">
+        <view v-if="cancelOrderPopup.isOk" class="success-tip">{{ cancelOrderPopup.successTip }}</view>
+        <view v-else>
+          <uni-table border stripe>
+	    	    <uni-tr class="table-header">
+	    	    	<uni-th width="200rpx" align="center">项目</uni-th>
+	    	    	<uni-th width="150rpx" align="center">实付金额</uni-th>
+	    	    	<uni-th width="180rpx" align="center">已服务时间</uni-th>
+	    	    </uni-tr>
+	    	    <uni-tr v-for="(item, index) in cancelOrderPopup.orderList" :key="index">
+	    	    	<uni-td align="center"> {{ item.cTitle }} </uni-td>
+	    	    	<uni-td align="center"> {{ item.dYuanPrice }} </uni-td>
+	    	    	<uni-td align="center"> {{ item.nMinute }} </uni-td>
+	    	    </uni-tr>
+	        </uni-table>
+          <u--textarea v-model="cancelOrderPopup.reason" placeholder="请输入退单原因" count maxlength="50" class="reson"></u--textarea>
+        </view>
+        <view v-if="!cancelOrderPopup.isOk" class="popup-btn">
+          <u-button size="small" plain shape="circle" text="取消" style="margin-right: 50rpx;" @click="closePopup"></u-button>
+          <u-button size="small" shape="circle" type="error" text="提交申请" @click="onSubmitApply"></u-button>
+        </view>
+        <view class="popup-btn">
+          <u-button v-if="cancelOrderPopup.isOk" size="small" shape="circle" color="linear-gradient(135deg, #1AD8CF 0%, #21C8C0 100%)" text="确认" @click="closePopup"></u-button>
+        </view>
+      </view>
+	  </u-popup>
 	</view>
 </template>
 
@@ -75,6 +104,7 @@ import {
 import {
 	delOrder,
 	cancleOrder,
+	cancleApply,
 	orderDeatails,
 } from '@/api/order.js';
 export default {
@@ -85,6 +115,16 @@ export default {
 			statusList: [],
 			nStatus: '',
 			isLogin: false,
+      // 取消订单
+      cancelOrderPopup: {
+				show: false, // 弹窗显示状态
+        isOk: false, // 是否确认
+        successTip: '您的申请已提交,客服审核中,请注意接听客服电话:19936963696',
+        orderList: [],
+				orderInfo: null, // 当前要取消的订单信息
+				cId: '', // 订单ID
+				reason: '' // 用户输入的取消原因
+			}
 		}
 	},
 	onLoad(query) {
@@ -103,10 +143,11 @@ export default {
 			}
 			orderDeatails(params).then(res => {
 				if (res.data.code === 200) {
-					let data = res.data.data.records.forEach(item => {
-						item.dtCreateTime = item.dtCreateTime.replace('T', ' ')
-					});
-					this.$refs.paging.complete(data);
+          this.dataList = res.data.data.records;
+					// let data = res.data.data.records.forEach(item => {
+					// 	item.dtCreateTime = item.dtCreateTime.replace('T', ' ')
+					// });
+					this.$refs.paging.complete(this.dataList);
 				} else {
 					this.$refs.paging.complete(false);
 				}
@@ -129,10 +170,53 @@ export default {
 			}
 
 		},
-		// 取消订单
+    // 取消退单申请
+    onCancleApply(item) {
+			uni.showModal({
+				title: '提示',
+				content: '确定取消退单申请吗?',
+				showCancel: true,
+				success: (res) => {
+					if (res.confirm) {
+						let params = {
+							cId: item.cId
+						}
+						cancleApply(params).then(res => {
+							if (res.data.code == 200) {
+								this.$refs.paging.reload();
+								uni.showToast({
+									title: '已取消',
+									icon: 'none'
+								})
+							} else {
+								uni.showToast({
+									title: res.data.msg,
+									icon: 'none'
+								})
+							}
+						})
+					}
+				}
+			})
+		},
+    // 取消订单
 		onCancleOrder(item) {
-			let params = {
-				cId: item.cId
+      this.cancelOrderPopup.cId = item.cId
+      this.cancelOrderPopup.orderList = item.cGoods || []
+      this.cancelOrderPopup.show = true;
+		},
+    // 提交退单申请
+    onSubmitApply() {
+      if (this.cancelOrderPopup.reason === '') {
+        uni.showToast({
+          title: '请输入退单原因',
+          icon: 'none'
+        })
+        return
+      }
+      let params = {
+				cId: this.cancelOrderPopup.cId,
+        cNote: this.cancelOrderPopup.reason
 			}
 			cancleOrder(params).then(res => {
 				if (res.data.code == 200) {
@@ -140,6 +224,7 @@ export default {
 						title: '已取消',
 						icon: 'none'
 					})
+          this.cancelOrderPopup.isOk = true
 					this.$refs.paging.reload();
 				} else {
 					uni.showToast({
@@ -148,7 +233,13 @@ export default {
 					})
 				}
 			})
-		},
+    },
+    // 关闭弹窗
+    closePopup() {
+      this.cancelOrderPopup.show = false;
+      this.cancelOrderPopup.isOk = false;
+      this.cancelOrderPopup.reason = '';
+    },
 		// 删除订单
 		onDelOrder(item) {
 			uni.showModal({
@@ -324,7 +415,7 @@ export default {
 						background-color: rgb(46, 188, 215);
 						color: #fff;
 						margin-left: 20rpx;
-						padding: 5rpx 30rpx;
+						padding: 0rpx 30rpx;
 						height: 48rpx;
 						line-height: 48rpx;
 						background: linear-gradient(135deg, #1AD8CF 0%, #21C8C0 100%);
@@ -342,5 +433,32 @@ export default {
 			}
 		}
 	}
+
+  .popup-content {
+    width: 90vw;
+  	padding: 100rpx 30rpx 30rpx;
+  	box-sizing: border-box;
+
+    .table-header {
+      background-color: #FBFBFB;
+    }
+
+    .success-tip {
+      padding: 50rpx;
+      font-size: 32rpx;
+      text-align: center;
+      margin-bottom: 30rpx;
+    }
+
+    .reson {
+      margin: 30rpx;
+    }
+
+    .popup-btn {
+      padding: 0 80rpx;
+      display: flex;
+      justify-content: space-between;
+    }
+  }
 }
 </style>

+ 8 - 3
src/uni_modules/z-paging/components/z-paging/js/modules/data-handle.js

@@ -426,7 +426,7 @@ export default {
 			this.insideOfPaging = -1;
 			this.cacheScrollNodeHeight = -1;
 			this.pageNo = this.defaultPageNo;
-			this._cleanRefresherEndTimeout();
+this._cleanRefresherEndTimeout();
 			!this.privateShowRefresherWhenReload && !isClean && this._startLoading(true);
 			this.firstPageLoaded = true;
 			this.isTotalChangeFromAddData = false;
@@ -725,7 +725,12 @@ export default {
 			for (const key in this.dataPromiseResultMap) {
 				const obj = this.dataPromiseResultMap[key];
 				if (!obj) continue;
-				success ? obj.resolve({ totalList, noMore: this.loadingStatus === Enum.More.NoMore }) : this.callNetworkReject && obj.reject(`z-paging-${key}-error`);
+				try {
+					success ? obj.resolve({ totalList, noMore: this.loadingStatus === Enum.More.NoMore }) : 
+					(this.callNetworkReject || false) && obj.reject(`z-paging-${key}-error`);
+				} catch (error) {
+					console.error('z-paging promise处理错误:', error);
+				}
 			}
 		},
 		// 检查complete data的类型
@@ -743,4 +748,4 @@ export default {
 			return { data, success };
 		},
 	}
-}
+}