Răsfoiți Sursa

Merge remote-tracking branch 'origin/v2' into v2

xyh 5 luni în urmă
părinte
comite
aa75c4a1bc

+ 11 - 0
src/pages/address/index.vue

@@ -102,6 +102,17 @@ export default {
 			getAddrList(params).then(res => {
 				if (res.data.code === 200) {
 					this.selected = res.data.data.find(item => item.type == 1)?.id;
+					if (this.selectedAddressId) {
+						let flag = res.data.data.some(element => {
+							return this.selectedAddressId == element.id
+						});
+						if (!flag) {
+							let pages = getCurrentPages();
+							let prevPage = pages[pages.length - 2];
+							// 传参
+							prevPage.$vm.selectedAddressId = null;
+						}
+					}
 					this.$refs.paging.complete(res.data.data);
 				} else {
 					this.$refs.paging.complete(false);

+ 2 - 2
src/points/productDetails/applyExchange.vue

@@ -34,7 +34,7 @@
                             <view class="tip">
                                 <view :style="{ color: selectReasonValue ? '#333' : '#999' }">{{
                                     selectReasonValue !== null ? selectReasonValue : '请选择申请原因' }}</view>
-                                <image style="width: 28rpx;height: 28rpx;margin-left: 8rpx;"
+                                <image style="width: 35rpx;height: 35rpx;margin-left: 8rpx;"
                                     @click="selectApplyReasonFun('1')" src="@/static/points/Keyboard_arrow_rifht.png"
                                     mode=""></image>
                             </view>
@@ -45,7 +45,7 @@
                                 <view :style="{ color: questionOrDiscribeValue ? '#333' : '#999' }"
                                     class="questionOrDiscribeValue">
                                     {{ questionOrDiscribeValue ? questionOrDiscribeValue : '请您务必上传描述和凭证' }}</view>
-                                <image style="width: 28rpx;height: 28rpx;margin-left: 8rpx;"
+                                <image style="width: 35rpx;height: 35rpx;margin-left: 8rpx;"
                                     @click="selectApplyReasonFun('2')" src="@/static/points/Keyboard_arrow_rifht.png"
                                     mode=""></image>
                             </view>

+ 23 - 11
src/points/productDetails/components/selectProduct.vue

@@ -6,9 +6,18 @@
             <image style="width: 40rpx;height: 40rpx;" src="@/static/points/addressIcon.png" mode=""></image>
 
             <text class="name" v-if="defaultAddress">{{ defaultAddress.userName }}</text>
-            <text class="address" v-if="defaultAddress">{{ defaultAddress.address + defaultAddress.atlasAdd }}</text>
-            <image style="width: 28rpx;height: 28rpx;position: absolute;right: 0;" @click="addressSelectFun"
-                src="@/static/points/Keyboard_arrow_rifht.png" mode=""></image>
+
+            <text class="address" v-if="defaultAddress">{{ defaultAddress.address + defaultAddress.atlasAdd
+                }}</text>
+            <view style="position: absolute;right: 0;display: flex;width: 195rpx;align-items: center;height: 33rpx;
+            ">
+                <text class="address" style="color: #999;" v-if='!defaultAddress'>添加收货地址</text>
+
+                <image style="width: 35rpx;height: 35rpx;position: absolute;right: 0;top: 0;" @click="addressSelectFun"
+                    src="@/static/points/Keyboard_arrow_rifht.png" mode=""></image>
+            </view>
+
+
 
         </view>
         <view class="productPrice">
@@ -127,13 +136,13 @@ export default {
         },
         defaultAddress: {
             type: Object,
-            default: {}
+            default: null
         },
         redeemNowBtnDisable: {
-            type: Boolean ,
+            type: Boolean,
             default: false
         },
-        
+
     },
     data() {
         return {
@@ -153,6 +162,7 @@ export default {
     },
     onShow() {
         console.log('555')
+        this.$emit('getAddrListFun')
 
     },
     onPageScroll() {
@@ -190,7 +200,7 @@ export default {
         },
         //立即兑换
         redeemNowFun() {
-            this.$emit('redeemNowFun', this.selectedObj ? JSON.parse(JSON.stringify(this.selectedObj)) : null, this.selectPayMeth, this.orderRemarks,true)
+            this.$emit('redeemNowFun', this.selectedObj ? JSON.parse(JSON.stringify(this.selectedObj)) : null, this.selectPayMeth, this.orderRemarks, true)
         },
         //点击选规则
         selectedSpecFun(specValue, specName) {
@@ -226,7 +236,7 @@ export default {
         //去我的地址页面
         addressSelectFun() {
             uni.navigateTo({
-                url:`/pages/address/index?selectedAddressId=${this.defaultAddress.id}`
+                url: `/pages/address/index?selectedAddressId=${this.defaultAddress?this.defaultAddress.id:null}`
             });
         }
 
@@ -237,11 +247,12 @@ export default {
 <style lang="scss" scoped>
 .content {
     background-color: #F5F8F8;
-    padding: 24rpx 32rpx 0 32rpx;
+    padding: 24rpx 32rpx 32rpx 32rpx;
     font-family: PingFang SC, PingFang SC;
-    height: 1250rpx;
+    height: 1000rpx;
     border-radius: 20rpx 20rpx 0 0;
-
+    overflow-y: auto;
+    position: relative;
     .addressBox {
         position: relative;
         margin-top: 70rpx;
@@ -379,6 +390,7 @@ export default {
         display: flex;
         align-items: center;
         justify-content: space-between;
+        margin-bottom: 30rpx;
 
         .u-radio__icon-wrap {
             margin: 0;

+ 72 - 27
src/points/productDetails/index.vue

@@ -52,8 +52,8 @@
                 <text v-if="selectedObj" style="color: #666666;margin-right: 30rpx;">已选:{{
                   selectedObj.specValueText }}</text>
                 <text v-else style="color: #999;margin-right: 30rpx;">选择商品</text>
-                <span style="position: absolute;right: 0;top: 1rpx;">
-                  <image style="width: 28rpx;height: 28rpx;" @click="selectProductShowFun"
+                <span style="position: absolute;right: 0;top: -3rpx;">
+                  <image style="width: 35rpx;height: 35rpx;" @click="selectProductShowFun"
                     src="@/static/points/Keyboard_arrow_rifht.png" mode=""></image>
                 </span>
               </view>
@@ -66,8 +66,8 @@
               style="width: 520rpx;white-space:nowrap;overflow: hidden;text-overflow: ellipsis;">
               {{ defaultAddress.address }}</text>
             <text v-else style="color: #999;position: absolute;right: 30rpx;">添加收货地址</text>
-            <span style="position: absolute;right: 0;top: 1rpx;">
-              <image style="width: 28rpx;height: 28rpx;" @click="addressSelectFun"
+            <span style="position: absolute;right: 0;top: -3rpx;">
+              <image style="width: 35rpx;height: 35rpx;" @click="addressSelectFun"
                 src="@/static/points/Keyboard_arrow_rifht.png" mode=""></image>
             </span>
           </view>
@@ -136,7 +136,8 @@
       </u-popup>
       <u-popup :z-index="999" :show="selectProductShowPopup" mode="bottom" round="10">
         <SelectProduct :redeemNowBtnDisable="redeemNowBtnDisable" :params="params" ref="selectProductRef"
-          :defaultAddress="defaultAddress" @redeemNowFun="redeemNowFun" @closeSelectProduct="closeSelectProduct">
+          :defaultAddress="defaultAddress" @redeemNowFun="redeemNowFun" @getAddrListFun="getAddrListFun"
+          @closeSelectProduct="closeSelectProduct">
         </SelectProduct>
       </u-popup>
 
@@ -186,6 +187,7 @@ export default {
       addressList: [],
       dBalance: 0.00,
       wxconfig: {},
+      orderNo:null,
 
 
     }
@@ -200,8 +202,14 @@ export default {
 
   },
   onShow() {
+    console.log(this.selectedAddressId, '666661111111')
+    if (!this.selectedAddressId) {
+      this.defaultAddress = null
+    } else if (!this.defaultAddress) {
+      this.getAddrListFun(this.selectedAddressId)
+    }
     //选择地址后传回的地址id
-    if (this.selectedAddressId) {
+    if (this.selectedAddressId && this.defaultAddress) {
       if (this.selectedAddressId !== this.defaultAddress.id) {
         this.defaultAddress = this.addressList.find(item => {
           if (item.id == this.selectedAddressId)
@@ -229,7 +237,7 @@ export default {
       })
     },
     //查询默认地址
-    getAddrListFun() {
+    getAddrListFun(selectedAddressId) {
       let params = {
         current: 1,
         size: 100,
@@ -238,10 +246,20 @@ export default {
       getAddrList(params).then(res => {
         if (res.data.code === 200) {
           this.addressList = res.data.data
-          this.defaultAddress = res.data.data.find(item => {
-            if (item.type == 1)
-              return item
-          });
+          if (selectedAddressId) {
+            this.defaultAddress = res.data.data.find(item => {
+              if (item.id == selectedAddressId)
+                return item
+            });
+            return
+          }
+          if (!this.defaultAddress) {
+            this.defaultAddress = res.data.data.find(item => {
+              if (item.type == 1)
+                return item
+            });
+          }
+
         }
       });
     },
@@ -276,16 +294,14 @@ export default {
       if (selectPayMeth) this.selectPayMeth = selectPayMeth
       if (orderRemarks) this.orderRemarks = orderRemarks
 
-      // if (this.remainingTime == 0) {
-      // 	uni.showToast({
-      // 		title: '订单已过期',
-      // 		icon: 'none'
-      // 	})
-      // 	return;
-      // 
-      // uni.navigateTo({
-      //   url: '/points/productDetails/pendingPayment'
-      // });
+      console.log(this.selectedObj, 'this.selectedObj')
+      if (!this.defaultAddress) {
+        uni.showToast({
+          title: '请选择添加地址',
+          icon: 'none'
+        })
+        return
+      }
 
       if (this.selectedObj) {
         if (this.selectPayMeth == null) {
@@ -337,6 +353,7 @@ export default {
     weixinPay(params) {
       productOrderCreate(params).then(res => {
         if (res.data.code == 200) {
+          this.orderNo = res.data.data
           productOrderPay({
             orderNo: res.data.data, //订单编号
             payType: params.payType, //支付方式:1微信支付 2:余额支付
@@ -344,10 +361,10 @@ export default {
           }).then(res => {
             if (res.data.code == 200) {
               let payConfig = JSON.parse(res.data.data)
-              console.log(payConfig,'this.payConfig9999999')
+              console.log(payConfig, 'this.payConfig9999999')
               getSignature(h5Url).then(res => {
                 this.wxconfig = res.data
-                console.log(this.wxconfig,'this.wxconfig66666')
+                console.log(this.wxconfig, 'this.wxconfig66666')
                 wx.config({
                   beta: true,
                   debug: false,
@@ -370,16 +387,17 @@ export default {
                     'paySign': payConfig.paySign, // 微信签名
                   },
                   function (res) {
-                    console.log(res,'---------------付款')
+                    console.log(res, '---------------付款')
                     // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
-                    this.redeemNowBtnDisable = false
+                    
                     // JSON.stringify(res);
                     if (res.err_msg == "get_brand_wcpay_request:ok") {
-
+                      this.redeemNowBtnDisable = false
                       uni.navigateTo({
                         url: '/points/productDetails/paymentSuccessful?orderNo=' + this.orderNo
                       });
                     } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
+                      this.redeemNowBtnDisable = false
                       uni.showToast({
                         title: '已取消支付',
                         icon: 'none'
@@ -390,15 +408,28 @@ export default {
 
 
                     } else {
+                      this.redeemNowBtnDisable = false
                       alert('付款失败');
                     }
                   }
                 )
 
+              }).catch(err => {
+                uni.showToast({
+                  title: err,
+                  icon: 'none'
+                })
+                this.redeemNowBtnDisable = false
               })
             }
 
 
+          }).catch(err => {
+            uni.showToast({
+              title: err,
+              icon: 'none'
+            })
+            this.redeemNowBtnDisable = false
           })
         }
       })
@@ -431,15 +462,28 @@ export default {
                   url: '/points/productDetails/paymentSuccessful'
                 });
               } else {
+                this.redeemNowBtnDisable = false
                 uni.showToast({
                   icon: 'error',
                   title: res.data.msg,
                 })
               }
 
+            }).catch(err => {
+              this.redeemNowBtnDisable = false
+              uni.showToast({
+                title: err,
+                icon: 'none'
+              })
             })
           }
 
+        }).catch(err => {
+          this.redeemNowBtnDisable = false
+          uni.showToast({
+            title: err,
+            icon: 'none'
+          })
         })
 
       }
@@ -461,7 +505,7 @@ export default {
     //去我的地址页面 /points/productDetails/addressManagement
     addressSelectFun() {
       uni.navigateTo({
-        url: `/pages/address/index?selectedAddressId=${this.defaultAddress.id}`
+        url: `/pages/address/index?selectedAddressId=${this.defaultAddress ? this.defaultAddress.id : null}`
       });
     },
 
@@ -610,6 +654,7 @@ export default {
       margin-top: 32rpx;
       position: relative;
       display: flex;
+      align-items: center;
     }
 
     .addressTextClass {

+ 25 - 2
src/points/productDetails/pendingPayment.vue

@@ -320,25 +320,41 @@ export default {
                         },
                         function (res) {
                             // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
-                            this.goPayBtnDisable = false
+                            
                             // JSON.stringify(res);
                             if (res.err_msg == "get_brand_wcpay_request:ok") {
+                                this.goPayBtnDisable = false
                                 uni.navigateTo({
                                     url: '/points/productDetails/paymentSuccessful?orderNo=' + this.orderNo
                                 });
                             } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
+                                this.goPayBtnDisable = false
                                 uni.showToast({
                                     title: '已取消支付',
                                     icon: 'none'
                                 })
 
                             } else {
+                                this.redeemNowBtnDisable = false
                                 alert('付款失败');
                             }
                         }
                     )
 
+                }).catch(err => {
+                    this.redeemNowBtnDisable = false
+                    uni.showToast({
+                        title: err,
+                        icon: 'none'
+                    })
                 })
+            }).catch(err => {
+                this.redeemNowBtnDisable = false
+                uni.showToast({
+                    title: err,
+                    icon: 'none'
+                })
+                
             })
         },
         //账号余额支付
@@ -371,8 +387,15 @@ export default {
                             icon: 'error',
                             title: res.data.msg,
                         })
+                        this.goPayBtnDisable = false
                     }
 
+                }).catch(err => {
+                    uni.showToast({
+                        title: err,
+                        icon: 'none'
+                    })
+                    this.redeemNowBtnDisable = false
                 })
             }
         },
@@ -460,7 +483,7 @@ export default {
         display: flex;
         align-items: center;
         height: 56rpx;
-        line-height: 40rpx;
+        line-height: 56rpx;
         border-radius: 98rpx 98rpx 98rpx 98rpx;
 
         font-size: 26rpx;