Explorar el Código

地址 支付 修改

MS-IOHQJGHXZHQD\Administrator hace 5 meses
padre
commit
5b013e2827

+ 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>

+ 117 - 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: 115rpx;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: 1rpx;" @click="addressSelectFun"
+                    src="@/static/points/Keyboard_arrow_rifht.png" mode=""></image>
+            </view>
+
+
 
         </view>
         <view class="productPrice">
@@ -94,6 +103,100 @@
             </view>
         </u-radio-group>
 
+
+        <!-- ========== -->
+        <u-radio-group v-if="selectPayMeth" class="nodeClass" v-model="selectPayMeth">
+            <view style="width: 100%;">
+                <view style="display: flex;justify-content: space-between;width: 100%;">
+                    <view style="display: flex;">
+                        <image style="width: 40rpx;height: 40rpx;" src="@/static/points/weiXin.png" mode="">
+                        </image>
+                        <view class="text" style="color: #333;margin-left: 16rpx;">微信支付</view>
+                    </view>
+                    <view>
+                        <u-radio activeColor="#03C1B8 " name='1' style="margin: 0;"></u-radio>
+                    </view>
+
+                </view>
+                <view style="display: flex;justify-content: space-between;width: 100%;margin-top: 24rpx;">
+                    <view style="display: flex;">
+                        <image style="width: 40rpx;height: 40rpx;" src="@/static/points/yue.png" mode="">
+                        </image>
+                        <view class="text" style="color: #333;margin-left: 16rpx;">余额支付</view>
+                    </view>
+                    <u-radio activeColor="#03C1B8 " name='2'></u-radio>
+                </view>
+            </view>
+        </u-radio-group><u-radio-group v-if="selectPayMeth" class="nodeClass" v-model="selectPayMeth">
+            <view style="width: 100%;">
+                <view style="display: flex;justify-content: space-between;width: 100%;">
+                    <view style="display: flex;">
+                        <image style="width: 40rpx;height: 40rpx;" src="@/static/points/weiXin.png" mode="">
+                        </image>
+                        <view class="text" style="color: #333;margin-left: 16rpx;">微信支付</view>
+                    </view>
+                    <view>
+                        <u-radio activeColor="#03C1B8 " name='1' style="margin: 0;"></u-radio>
+                    </view>
+
+                </view>
+                <view style="display: flex;justify-content: space-between;width: 100%;margin-top: 24rpx;">
+                    <view style="display: flex;">
+                        <image style="width: 40rpx;height: 40rpx;" src="@/static/points/yue.png" mode="">
+                        </image>
+                        <view class="text" style="color: #333;margin-left: 16rpx;">余额支付</view>
+                    </view>
+                    <u-radio activeColor="#03C1B8 " name='2'></u-radio>
+                </view>
+            </view>
+        </u-radio-group><u-radio-group v-if="selectPayMeth" class="nodeClass" v-model="selectPayMeth">
+            <view style="width: 100%;">
+                <view style="display: flex;justify-content: space-between;width: 100%;">
+                    <view style="display: flex;">
+                        <image style="width: 40rpx;height: 40rpx;" src="@/static/points/weiXin.png" mode="">
+                        </image>
+                        <view class="text" style="color: #333;margin-left: 16rpx;">微信支付</view>
+                    </view>
+                    <view>
+                        <u-radio activeColor="#03C1B8 " name='1' style="margin: 0;"></u-radio>
+                    </view>
+
+                </view>
+                <view style="display: flex;justify-content: space-between;width: 100%;margin-top: 24rpx;">
+                    <view style="display: flex;">
+                        <image style="width: 40rpx;height: 40rpx;" src="@/static/points/yue.png" mode="">
+                        </image>
+                        <view class="text" style="color: #333;margin-left: 16rpx;">余额支付</view>
+                    </view>
+                    <u-radio activeColor="#03C1B8 " name='2'></u-radio>
+                </view>
+            </view>
+        </u-radio-group><u-radio-group v-if="selectPayMeth" class="nodeClass" v-model="selectPayMeth">
+            <view style="width: 100%;">
+                <view style="display: flex;justify-content: space-between;width: 100%;">
+                    <view style="display: flex;">
+                        <image style="width: 40rpx;height: 40rpx;" src="@/static/points/weiXin.png" mode="">
+                        </image>
+                        <view class="text" style="color: #333;margin-left: 16rpx;">微信支付</view>
+                    </view>
+                    <view>
+                        <u-radio activeColor="#03C1B8 " name='1' style="margin: 0;"></u-radio>
+                    </view>
+
+                </view>
+                <view style="display: flex;justify-content: space-between;width: 100%;margin-top: 24rpx;">
+                    <view style="display: flex;">
+                        <image style="width: 40rpx;height: 40rpx;" src="@/static/points/yue.png" mode="">
+                        </image>
+                        <view class="text" style="color: #333;margin-left: 16rpx;">余额支付</view>
+                    </view>
+                    <u-radio activeColor="#03C1B8 " name='2'></u-radio>
+                </view>
+            </view>
+        </u-radio-group>
+
+        <!-- ------------- -->
+
         <view class="footer-bar">
 
             <u-button v-if="!selectedObj" :customStyle="{
@@ -127,13 +230,13 @@ export default {
         },
         defaultAddress: {
             type: Object,
-            default: {}
+            default: null
         },
         redeemNowBtnDisable: {
-            type: Boolean ,
+            type: Boolean,
             default: false
         },
-        
+
     },
     data() {
         return {
@@ -153,6 +256,7 @@ export default {
     },
     onShow() {
         console.log('555')
+        this.$emit('getAddrListFun')
 
     },
     onPageScroll() {
@@ -190,7 +294,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 +330,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 +341,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 +484,7 @@ export default {
         display: flex;
         align-items: center;
         justify-content: space-between;
+        margin-bottom: 30rpx;
 
         .u-radio__icon-wrap {
             margin: 0;

+ 66 - 25
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: 0;">
+                  <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: 0;">
+              <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>
 
@@ -200,8 +201,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 +236,7 @@ export default {
       })
     },
     //查询默认地址
-    getAddrListFun() {
+    getAddrListFun(selectedAddressId) {
       let params = {
         current: 1,
         size: 100,
@@ -238,10 +245,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 +293,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) {
@@ -344,10 +359,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,7 +385,7 @@ export default {
                     'paySign': payConfig.paySign, // 微信签名
                   },
                   function (res) {
-                    console.log(res,'---------------付款')
+                    console.log(res, '---------------付款')
                     // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
                     this.redeemNowBtnDisable = false
                     // JSON.stringify(res);
@@ -390,15 +405,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
           })
         }
       })
@@ -437,9 +465,21 @@ export default {
                 })
               }
 
+            }).catch(err => {
+              uni.showToast({
+                title: err,
+                icon: 'none'
+              })
+              this.redeemNowBtnDisable = false
             })
           }
 
+        }).catch(err => {
+          uni.showToast({
+            title: err,
+            icon: 'none'
+          })
+          this.redeemNowBtnDisable = false
         })
 
       }
@@ -461,7 +501,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 +650,7 @@ export default {
       margin-top: 32rpx;
       position: relative;
       display: flex;
+      align-items: center;
     }
 
     .addressTextClass {

+ 20 - 0
src/points/productDetails/pendingPayment.vue

@@ -334,11 +334,24 @@ export default {
 
                             } else {
                                 alert('付款失败');
+                                this.goPayBtnDisable = false
                             }
                         }
                     )
 
+                }).catch(err => {
+                    uni.showToast({
+                        title: err,
+                        icon: 'none'
+                    })
+                    this.redeemNowBtnDisable = false
+                })
+            }).catch(err => {
+                uni.showToast({
+                    title: err,
+                    icon: 'none'
                 })
+                this.redeemNowBtnDisable = false
             })
         },
         //账号余额支付
@@ -371,8 +384,15 @@ export default {
                             icon: 'error',
                             title: res.data.msg,
                         })
+                        this.goPayBtnDisable = false
                     }
 
+                }).catch(err => {
+                    uni.showToast({
+                        title: err,
+                        icon: 'none'
+                    })
+                    this.redeemNowBtnDisable = false
                 })
             }
         },