Răsfoiți Sursa

fix: 活动详情 服务对象校验 转移到点击按钮时校验

mcc 6 luni în urmă
părinte
comite
a082b6cf76

+ 0 - 8
components/pay/pay.vue

@@ -180,7 +180,6 @@
 			this.getMyReceiveList()
 		},
 		methods: {
-
 			change(e){
 				console.log(this.loveCardId)
 				console.log(e)
@@ -194,14 +193,7 @@
 				this.password = ''
 				this.$refs.popup.open()
 			},
-
 			payLoveItem(num,index,loveCard){
-				// console.log(loveCard.totalBalance*1, this.totalAmount*1)
-				// if (loveCard.totalBalance*1 < this.totalAmount*1 && num == 0){
-				// 	console.log(this.totalAmount)
-				// 	uni.$u.toast('余额不足')
-				// 	return
-				// }
 				this.curServiceTab = num
 				this.loveCardList.forEach(item=>{
 					item.select = false

+ 8 - 3
myPages/serviceObjectFaceAuth/index.vue

@@ -147,7 +147,6 @@ import cropper  from '@/components/lxiaoxiao-cropper/lxiaoxiao-cropper.vue';
       },
       //头像上传
       uploadImg() {
-        console.log(1111111111111111111111)
         let that = this;
         uni.chooseImage({
           count: 1,
@@ -183,8 +182,15 @@ import cropper  from '@/components/lxiaoxiao-cropper/lxiaoxiao-cropper.vue';
                 'Authorization': 'Bearer ' + uni.getStorageInfo('accessToken'),
               },
               success: (uploadFileRes) => {
-                console.log("uploadFileRes:"+uploadFileRes)
                 let res = JSON.parse(uploadFileRes.data)
+                console.log(res,'成功回调')
+                if(res.code !== 200){
+                  uni.showToast({
+                    icon: 'none',
+                    duration: 3000,
+                    title: res.msg || '系统繁忙,请重试!'
+                  });
+                }
                 this.ossId = res.data.ossId;
                 this.facePhotoUrl =  res.data.url.replace("http", "https");
                 this.reqParm.facePath = res.data.ossId;
@@ -192,7 +198,6 @@ import cropper  from '@/components/lxiaoxiao-cropper/lxiaoxiao-cropper.vue';
             });
           }
         })
-
       }
     }
   }

+ 62 - 44
orderPages/activityDetail/activityDetail.vue

@@ -217,7 +217,7 @@ export default {
   },
   data() {
     return {
-      selectServiceObjectIndex:-1,
+      selectServiceObjectIndex: -1,
       showRemarkId: '',
       userInfo: {},
       subOrderNo: '',
@@ -297,7 +297,6 @@ export default {
 
   onShow() {
     this.userInfo = uni.getStorageSync('userInfo')
-    this.listServiceObject()
   },
 
   methods: {
@@ -322,39 +321,46 @@ export default {
     },
     // 查询服务对像信息列表
     listServiceObject() {
-      let serviceObjectList = []
-      this.$api.listServiceObject(this.reqParm).then((res) => {
+      return this.$api.listServiceObject(this.reqParm).then((res) => {
+        let serviceObjectList = [];
         res.data.data.forEach(i => {
           if (i.isSelf != 1) {
-            serviceObjectList.push(i)
+            serviceObjectList.push(i);
           }
-        })
-        // this.serviceObjectList[0] = serviceObjectList
-
-        this.$set(this.serviceObjectList, 0, serviceObjectList)
+        });
+        this.$set(this.serviceObjectList, 0, serviceObjectList);
         this.getImgUrlByBannerOssId(this.serviceObjectList[0]);
-        console.log('执行了+++++++++++++++++++', this.serviceObjectList)
+        console.log('执行了+++++++++++++++++++', this.serviceObjectList);
 
-        // if (this.isShare) {
         if (serviceObjectList.length === 0) {
+          // 无服务对象:执行跳转逻辑,返回 false 表示不继续后续操作
           uni.showToast({
-            duration: 2500,
+            duration: 1500, // 与 setTimeout 时间一致,避免提示残留
             title: '当前账号没有服务对象,即将跳转服务对象绑定',
             icon: 'none',
           });
           setTimeout(() => {
             uni.hideToast();
-            //关闭提示后跳转
             uni.navigateTo({
               url: '/myPages/serviceObjectFaceAuth/index'
-            })
-          }, 1500)
+            });
+          }, 1500);
+          return false; // 关键:告诉 beforeCommitOrder 不需要继续执行
         }
-        // }
 
-      })
+        // 有服务对象:返回 true 表示可以继续后续操作
+        return true;
+      }).catch((err) => {
+        console.error('获取服务对象列表失败', err);
+        uni.showToast({
+          title: '获取服务信息失败,请重试',
+          icon: 'none',
+          duration: 2000
+        });
+        return false; // 接口失败也不继续后续逻辑
+      });
     },
-    closeSelectServiceObjectPopup(){
+    closeSelectServiceObjectPopup() {
       this.selectServiceObjectIndex = -1
       this.$refs.popup.close()
     },
@@ -387,27 +393,41 @@ export default {
 
     },
 
-    beforeCommitOrder() {
-      if (!this.userInfo.phone) {
-        uni.showModal({
-          title: '温馨提示',
-          content: '请先绑定手机号',
-          success: res => {
-            if (res.confirm) {
-              uni.navigateTo({
-                url: '/myPages/setting/setting-telphone',
-              })
+    async beforeCommitOrder() {
+      try {
+        // 等待 listServiceObject 完全执行(包括数据处理、弹窗提示注册),拿到是否继续的标记
+        const isContinue = await this.listServiceObject();
+
+        // 关键:如果不需要继续(无服务对象/接口失败),直接终止,不执行后续 popup 逻辑
+        if (!isContinue) return;
+
+        // 以下逻辑仅在「有服务对象」时才执行
+        if (!this.userInfo.phone) {
+          uni.showModal({
+            title: '温馨提示',
+            content: '请先绑定手机号',
+            success: res => {
+              if (res.confirm) {
+                uni.navigateTo({
+                  url: '/myPages/setting/setting-telphone',
+                });
+              }
             }
-          }
-        })
-        return
-      }
+          });
+          return;
+        }
 
-      if (this.activity.isAddServiceObject == 1) {
-        // this.show = true
-        this.$refs.popup.open()
-      } else {
-        this.commitOrder()
+        if (this.activity.isAddServiceObject == 1) {
+          this.$refs.popup.open(); // 只有有服务对象+手机号已绑定,才打开 popup
+        } else {
+          this.commitOrder();
+        }
+      } catch (err) {
+        uni.showToast({
+          title: '操作失败,请重试',
+          icon: 'none',
+          duration: 2000
+        });
       }
     },
 
@@ -415,7 +435,7 @@ export default {
       // console.log(e)
       // this.serviceObjectId = e.value[0].id
       console.log(e)
-      if(!e){
+      if (!e) {
         uni.showToast({
           duration: 2000,
           title: '请选择一个服务对象',
@@ -453,8 +473,8 @@ export default {
         console.log('++++++++++++++++++订单提交+++++++++++', res)
         uni.hideLoading();
         this.subOrderNo = res.data.data.orderNo
-        if(this.isShare){
-          if (this.activity.sharePrice * 1 > 0 ) {
+        if (this.isShare) {
+          if (this.activity.sharePrice * 1 > 0) {
             this.$refs.myPay.openPopup()
           } else {
             uni.showToast({
@@ -463,8 +483,8 @@ export default {
             });
             this.isActivityCheck = true
           }
-        }else {
-          if (this.activity.salePrice * 1 > 0 ) {
+        } else {
+          if (this.activity.salePrice * 1 > 0) {
             this.$refs.myPay.openPopup()
           } else {
             uni.showToast({
@@ -516,8 +536,6 @@ export default {
         this.isActivityCheck = res.data.data
       })
     }
-
-
   }
 }
 </script>

+ 0 - 1
pages/order/index.vue

@@ -155,7 +155,6 @@
 				</view>
 			</view>
 		</uni-popup>
-
 	</view>
 </template>