Przeglądaj źródła

fix:支付加锁。选择优惠按钮修改

zhanghui 2 lat temu
rodzic
commit
9c122fc3ab

+ 5 - 0
orderPages/bookService/index.vue

@@ -388,7 +388,12 @@ export default {
     },
 
     commonGeneralOrder() {
+      if(this.requestStatus){
+        return;
+      }
+      this.requestStatus=true
       this.$refs.popup.close()
+      this.requestStatus=false
       this.$api.commonGeneralOrder({
         orderType: 1,
         serviceObjectId: this.serviceObject.id,

+ 22 - 3
orderPages/orderDetail/index.vue

@@ -279,7 +279,8 @@ export default {
             curServiceTab:2,
             userInfo:{},
             tradeNo:'',
-            password:''
+            password:'',
+            requestStatus : false
         }
     },
     onLoad(e) {
@@ -311,13 +312,21 @@ export default {
                 tradeNo: this.tradeNo,
                 password: ''
             }).then((res)=>{
+                this.requestStatus=false
+                uni.hideLoading();
                 uni.showToast({
                     title: '支付成功!'
                 });
                 that.$refs.popup.close()
                 that.getOrderDetailByOrderId(that.orderId)
+            }).catch((err)=>{
+                this.requestStatus=false
+                uni.hideLoading();
+                uni.showToast({
+                    title: err.msg,
+                    icon:'error'
+                })
             })
-
         },
 
         scanCodeOrder(order){
@@ -341,6 +350,13 @@ export default {
         },
 
         commonGeneralOrder(){
+            if(this.requestStatus){
+                return;
+            }
+            this.requestStatus=true
+            uni.showLoading({
+                title: '支付中'
+            });
             let that =this
             if (this.curServiceTab===1){
                 // that.password = '';
@@ -360,6 +376,8 @@ export default {
                         signType: "RSA",
                         paySign: param.sign,
                         success: res => {
+                            this.requestStatus=false
+                            uni.hideLoading();
                             uni.showToast({
                                 title: '支付成功!'
                             });
@@ -367,7 +385,8 @@ export default {
                             that.$refs.popup.close()
                         },
                         fail: res => {
-                            console.log(res)
+                            this.requestStatus=false
+                            uni.hideLoading();
                             uni.showModal({
                                 content: '支付失败',
                                 showCancel: false

+ 20 - 4
orderPages/serviceItems/index.rpx.scss

@@ -342,15 +342,31 @@
   height: 300rpx;
 }
 
+.submitButtonLeft{
+  width: 536rpx;
+  text-align: center;
+  line-height: 84rpx;
+  //width: 686rpx;
+  height: 84rpx;
+  background: #FFE05C;
+  //margin-top: 24rpx;
+  border-top-left-radius: 54rpx;
+  border-bottom-left-radius: 54rpx;
+
+}
 
   .submitButton {
     text-align: center;
     line-height: 84rpx;
-    width: 686rpx;
+    //width: 686rpx;
+    width: 150rpx;
     height: 84rpx;
-    background: #FFE05C;
-    border-radius: 54rpx;
-    margin-top: 24rpx;
+    background: #FFF6CE;
+    border-bottom-right-radius: 54rpx;
+    border-top-right-radius: 54rpx;
+
+    //border-radius: 54rpx;
+    //margin-top: 24rpx;
 }
 .text_9{
   margin-left: 24rpx;

+ 21 - 8
orderPages/serviceItems/index.vue

@@ -90,15 +90,21 @@
 <!--                    </view>-->
 <!--                </view>-->
 
-                <view class="selectType flex-row justify-between" @click="popupClick">
-                    <text>请选择优惠方式</text>
-                    <text class="text-group_5" v-if="ticketBtnIndex === 1" v-for="(iter,i) in equitys" :key="i">{{iter.title}}</text>
-                    <text class="text-group_5" v-if="ticketBtnIndex === 2" v-for="(iter,i) in coupons" :key="i">{{iter.name}}:-¥{{iter.discountsPrice}}</text>
-                    <u-icon name="arrow-right" color="#666" size="18"></u-icon>
-                </view>
+<!--                <view class="selectType flex-row justify-between" @click="popupClick">-->
+<!--                    <text>请选择优惠方式</text>-->
+<!--                    <text class="text-group_5" v-if="ticketBtnIndex === 1" v-for="(iter,i) in equitys" :key="i">{{iter.title}}</text>-->
+<!--                    <text class="text-group_5" v-if="ticketBtnIndex === 2" v-for="(iter,i) in coupons" :key="i">{{iter.name}}:-¥{{iter.discountsPrice}}</text>-->
+<!--                    <u-icon name="arrow-right" color="#666" size="18"></u-icon>-->
+<!--                </view>-->
 
                 <view class="flex-row justify-center">
-                    <view class="submitButton" @click="addChildProject">确定</view>
+                    <view class=" submitButtonLeft" @click="popupClick">
+                        <text v-if="(ticketBtnIndex === 1 && equitys.length===0) || (ticketBtnIndex === 2 && coupons.length === 0)">使用权益卡或优惠券</text>
+                        <text class="text-group_5" v-else-if="ticketBtnIndex === 1" v-for="(iter,i) in equitys" :key="i">{{iter.title}}</text>
+                        <text class="text-group_5" v-else-if="ticketBtnIndex === 2" v-for="(iter,i) in coupons" :key="i">{{iter.name}}:-¥{{iter.discountsPrice}}</text>
+                    </view>
+                    <view class="submitButton " @click="addChildProject">确定</view>
+
                 </view>
             </view>
             <uni-popup ref="popup" type="bottom" >
@@ -150,7 +156,7 @@ export default {
     onLoad(e) {
         // 判断Openid是否为空
         let sysInfo=uni.getSystemInfoSync();
-        this.height= sysInfo.windowHeight -120  +'px';
+        this.height= sysInfo.windowHeight -80  +'px';
         this.orderId=e.orderId
         this.serviceStationId=e.serviceStationId
         this.serviceObjectId=e.serviceObjectId
@@ -238,6 +244,10 @@ export default {
                 uni.$u.toast("请选择服务项目")
                 return
             }
+            if(this.requestStatus){
+                return;
+            }
+            this.requestStatus=true
             let userEquityCardId
             if (this.equitys.length>0){
                  userEquityCardId = this.equitys[0].id
@@ -250,9 +260,12 @@ export default {
                 couponIds:this.couponIds,
                 userEquityCardId:userEquityCardId
             }).then(res=>{
+                this.requestStatus=false
                 uni.navigateBack({
                   delta:1
                 })
+            }).catch(()=>{
+                this.requestStatus=false
             })
 
 

+ 29 - 3
pages/order/index.vue

@@ -184,7 +184,8 @@
 				tradeNo:'',
 				password:'',
 				openType:0,//开启的支付类型:1一键支付子订单费用,2:支付预约费用
-				appointmentOrder:{}
+				appointmentOrder:{},
+				requestStatus : false
 
 			}
 		},
@@ -244,6 +245,8 @@
 						signType: "RSA",
 						paySign: param.sign,
 						success: res => {
+							this.requestStatus=false
+							uni.hideLoading();
 							that.$refs.popup.close()
 							uni.showToast({
 								title: '支付成功!'
@@ -252,6 +255,8 @@
 							that.getUserInfo()
 						},
 						fail: res => {
+							this.requestStatus=false
+							uni.hideLoading();
 							that.$refs.popup.close()
 							console.log(res)
 							uni.showToast({
@@ -287,6 +292,8 @@
 						orderNo: this.appointmentOrder.subOrderNo,
 						password: ''
 					}).then((res)=>{
+						this.requestStatus=false
+						uni.hideLoading();
 						that.$refs.popup.close()
 						uni.showToast({
 							title: '支付成功'
@@ -295,6 +302,8 @@
 						that.getUserInfo()
 						that.password = ''
 					}).catch((err) =>{
+						this.requestStatus=false
+						uni.hideLoading();
 						that.$refs.popup.close()
 						uni.showToast({
 							title: err.msg,
@@ -309,6 +318,8 @@
 						tradeNo: this.tradeNo,
 						password: ''
 					}).then((res)=>{
+						this.requestStatus=false
+						uni.hideLoading();
 						that.$refs.popup.close()
 						uni.showToast({
 							title: '支付成功'
@@ -316,7 +327,16 @@
 						that.$refs.MescrollItem[that.tabIndex].downCallback()
 						that.getUserInfo()
 						that.password = ''
-					})
+					}).catch((err) =>{
+						this.requestStatus=false
+						uni.hideLoading();
+						that.$refs.popup.close()
+						uni.showToast({
+							title: err.msg,
+							icon:'error'
+						})
+						that.password = ''
+					});
 				}
 
 
@@ -353,8 +373,12 @@
 			},
 
 			commonGeneralOrder(){
+				if(this.requestStatus){
+					return;
+				}
+				this.requestStatus=true
         uni.showLoading({
-          title: '加载中'
+          title: '支付中'
         });
 				let that =this
 				if (this.curServiceTab===1){
@@ -379,6 +403,7 @@
 								signType: "RSA",
 								paySign: param.sign,
 								success: res => {
+									this.requestStatus=false
                   uni.hideLoading();
 									uni.showToast({
 										title: '支付成功!'
@@ -389,6 +414,7 @@
 								},
 								fail: res => {
 									console.log(res)
+									this.requestStatus=false
                   uni.hideLoading();
 									uni.showToast({
 										title: '支付失败',