Просмотр исходного кода

地址显示问题 支付按钮问题

MS-IOHQJGHXZHQD\Administrator 5 месяцев назад
Родитель
Сommit
e47f1033b6

+ 5 - 9
src/pages/address/index.vue

@@ -82,14 +82,11 @@ export default {
 	methods: {
 		//选择地址
 		selectedAddressFun(item) {
-			//只有商品详情页传过来id,才能点击选择
-			if (this.selectedAddressId) {
-				this.selectedAddressId = item.id
-				let pages = getCurrentPages();
-				let prevPage = pages[pages.length - 2];
-				// 传参
-				prevPage.$vm.selectedAddressId = this.selectedAddressId;
-			}
+			this.selectedAddressId = item.id
+			let pages = getCurrentPages();
+			let prevPage = pages[pages.length - 2];
+			// 传参
+			prevPage.$vm.selectedAddressId = this.selectedAddressId;
 
 		},
 		// 获取数据
@@ -167,7 +164,6 @@ export default {
 		},
 		// 点选
 		onClick(item) {
-			console.log(item)
 			if (this.query.name === '支付订单' && this.query.orderNo) {
 				let params = {
 					cId: this.query.orderNo,

+ 44 - 29
src/points/productDetails/components/selectProduct.vue

@@ -8,12 +8,12 @@
             <text class="name" v-if="defaultAddress">{{ defaultAddress.userName }}</text>
 
             <text class="address" v-if="defaultAddress">{{ defaultAddress.address + defaultAddress.atlasAdd
-                }}</text>
+            }}</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>
+                <text class="addAddress" style="color: #999;" v-if='!defaultAddress'>添加收货地址</text>
 
-                <image style="width: 35rpx;height: 35rpx;position: absolute;right: 0;top: 0;" @click="addressSelectFun"
+                <image style="width: 35rpx;height: 35rpx;position: absolute;right: 0;top: 2rpx;" @click="addressSelectFun"
                     src="@/static/points/Keyboard_arrow_rifht.png" mode=""></image>
             </view>
 
@@ -68,7 +68,7 @@
         <!--运费 -->
         <view class="yunFeiClass">
             <view class="text">运费</view>
-            <view class="price">¥{{ params.freight }}</view>
+            <view class="price" v-if="params">¥{{ params.freight }}</view>
 
         </view>
         <!--订单备注 -->
@@ -79,29 +79,33 @@
 
         </view>
         <!--支付方式 -->
-        <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 v-if="params">
+            <u-radio-group v-if="selectPayMeth && (params.paymentType == 2 || params.paymentType == 3)"
+                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 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>
-            </view>
-        </u-radio-group>
+            </u-radio-group>
+        </view>
+
 
         <view class="footer-bar">
 
@@ -109,10 +113,11 @@
                 color: '#fff',
                 background: '#03C1B8'
             }">请选择</u-button>
-            <u-button :disabled="redeemNowBtnDisable" v-else-if="selectedObj && selectedObj.stock" :customStyle="{
+            <u-button :disabled="redeemNowBtnDisable" v-else-if="selectedObj && selectedObj.stock && params" :customStyle="{
                 color: '#fff',
                 background: '#03C1B8'
-            }" @click="redeemNowFun">实付价 {{ params.paymentType == 1 ? selectedObj.pricePoint + '积分' :
+            }" @click="redeemNowFun">{{ params.paymentType == 1 ? '立即兑换' : '实付价' }} {{ params.paymentType == 1 ?
+                selectedObj.pricePoint + '积分' :
                 params.paymentType == 2 ? '¥' + selectedObj.priceMoney + '元' :
                     params.paymentType == 3 ? '¥' + selectedObj.priceMoney + '元' + '+' +
                         selectedObj.pricePoint + '积分' : null }}</u-button>
@@ -236,7 +241,7 @@ export default {
         //去我的地址页面
         addressSelectFun() {
             uni.navigateTo({
-                url: `/pages/address/index?selectedAddressId=${this.defaultAddress?this.defaultAddress.id:null}`
+                url: `/pages/address/index?selectedAddressId=${this.defaultAddress ? this.defaultAddress.id : null}`
             });
         }
 
@@ -253,6 +258,7 @@ export default {
     border-radius: 20rpx 20rpx 0 0;
     overflow-y: auto;
     position: relative;
+
     .addressBox {
         position: relative;
         margin-top: 70rpx;
@@ -271,6 +277,15 @@ export default {
             text-transform: none;
         }
 
+        .addAddress {
+            font-weight: 500;
+            font-size: 28rpx;
+            color: #333333;
+            text-align: left;
+            font-style: normal;
+            text-transform: none;
+        }
+
         .address {
             font-weight: 500;
             font-size: 28rpx;
@@ -278,7 +293,7 @@ export default {
             text-align: left;
             font-style: normal;
             text-transform: none;
-            width: 460rpx;
+            width: 520rpx;
             white-space: nowrap;
             overflow: hidden;
             text-overflow: ellipsis;
@@ -414,7 +429,7 @@ export default {
             text-align: right;
             font-style: normal;
             text-transform: none;
-            width: 450rpx;
+            width: 490rpx;
         }
     }
 }

+ 142 - 142
src/points/productDetails/index.vue

@@ -187,7 +187,7 @@ export default {
       addressList: [],
       dBalance: 0.00,
       wxconfig: {},
-      orderNo:null,
+      orderNo: null,
 
 
     }
@@ -202,21 +202,17 @@ export default {
 
   },
   onShow() {
-    console.log(this.selectedAddressId, '666661111111')
-    if (!this.selectedAddressId) {
-      this.defaultAddress = null
-    } else if (!this.defaultAddress) {
-      this.getAddrListFun(this.selectedAddressId)
-    }
+    this.getAddrListFun()
+
     //选择地址后传回的地址id
-    if (this.selectedAddressId && this.defaultAddress) {
-      if (this.selectedAddressId !== this.defaultAddress.id) {
-        this.defaultAddress = this.addressList.find(item => {
-          if (item.id == this.selectedAddressId)
-            return item
-        });
-      }
-    }
+    // if (this.selectedAddressId && this.defaultAddress) {
+    //   if (this.selectedAddressId !== this.defaultAddress.id) {
+    //     this.defaultAddress = this.addressList.find(item => {
+    //       if (item.id == this.selectedAddressId)
+    //         return item
+    //     });
+    //   }
+    // }
   },
   onPageScroll(e) {
     //console.log("滚动距离为:" + e.scrollTop);
@@ -237,7 +233,7 @@ export default {
       })
     },
     //查询默认地址
-    getAddrListFun(selectedAddressId) {
+    getAddrListFun() {
       let params = {
         current: 1,
         size: 100,
@@ -245,21 +241,40 @@ export default {
       }
       getAddrList(params).then(res => {
         if (res.data.code === 200) {
-          this.addressList = res.data.data
-          if (selectedAddressId) {
-            this.defaultAddress = res.data.data.find(item => {
-              if (item.id == selectedAddressId)
-                return item
-            });
+          if (!res.data.data.length) {
+            this.defaultAddress = null
             return
           }
-          if (!this.defaultAddress) {
-            this.defaultAddress = res.data.data.find(item => {
-              if (item.type == 1)
-                return item
+
+          if (this.selectedAddressId) {
+            let flag = res.data.data.some(item => {
+              return item.id == this.selectedAddressId
             });
+            if (flag) {
+              let defaultAddress = res.data.data.find(item => {
+                if (item.id == this.selectedAddressId)
+                  return item
+              });
+              this.$set(this, 'defaultAddress', defaultAddress);
+            } else {
+              this.defaultAddress = res.data.data[0]
+            }
+            console.log(this.selectedAddressId, 'this.selectedAddressId99999999999')
+            console.log(this.defaultAddress, 'this.defaultAddress9999999999')
+            return
+          } else if (!this.selectedAddressId || !this.defaultAddress) {
+            let flag = res.data.data.some(item => {
+              return item.type == 1
+            });
+            if (flag) {
+              this.defaultAddress = res.data.data.find(item => {
+                if (item.type == 1)
+                  return item
+              });
+            } else {
+              this.defaultAddress = res.data.data[0]
+            }
           }
-
         }
       });
     },
@@ -304,7 +319,7 @@ export default {
       }
 
       if (this.selectedObj) {
-        if (this.selectPayMeth == null) {
+        if (this.selectPayMeth == null && (params.paymentType == 2 || params.paymentType == 3)) {
           uni.showToast({
             title: '请选择支付方式',
             icon: 'none'
@@ -324,15 +339,16 @@ export default {
         params.skuId = this.selectedObj.skuId; //选中的SKU ID
         params.specNameValueLis = this.selectedObj.specNameValueList; // SKU列表(规格组合明细)
         params.quantity = 1; //购买数量
-        params.payType = Number(this.selectPayMeth);//支付方式:1微信支付 2账户余额
+        params.payType = this.params.paymentType == 1 ? null : Number(this.selectPayMeth);//支付方式:1微信支付 2账户余额
         params.freightAmount = this.params.freight; //运费
         params.totalAmount = (this.selectedObj.priceMoney + (this.params.freight > 0 ? this.params.freight : 0));// 支付金额+运费=总金额
         params.payAmount = this.selectedObj.priceMoney;// 支付金额
         params.pointsUsed = this.selectedObj.pricePoint;// 使用的积分
         params.buyerRemark = this.orderRemarks;//买家备注信息
-        console.log(params, 'params')
-        console.log(this.params, 'this.params')
-
+        if (params.paymentType == 1) {//只有积分兑换
+          this.productOrderCreateFun(params)
+          return
+        }
         if (this.selectPayMeth == 1) {
           //微信支付 
           this.weixinPay(params)
@@ -341,6 +357,7 @@ export default {
           this.nowYuyue(params)
         }
 
+
       } else {
         this.selectProductShowPopup = true
         this.$nextTick(() => {
@@ -350,93 +367,74 @@ 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:余额支付
-            totalPrice: params.totalAmount //订单总金额,单位:元
-          }).then(res => {
-            if (res.data.code == 200) {
-              let payConfig = JSON.parse(res.data.data)
-              console.log(payConfig, 'this.payConfig9999999')
-              getSignature(h5Url).then(res => {
-                this.wxconfig = res.data
-                console.log(this.wxconfig, 'this.wxconfig66666')
-                wx.config({
-                  beta: true,
-                  debug: false,
-                  appId: this.wxconfig.appId, // 公众号ID 
-                  // appId: uni.getAppBaseInfo().host.appId, // 公众号ID 
-                  timestamp: this.wxconfig.timestamp, // 时间戳,自1970年以来的秒数
-                  nonceStr: this.wxconfig.nonceStr, // 随机串
-                  signature: this.wxconfig.signature, // 微信签名方式
-                  jsApiList: ['getBrandWCPayRequest']
-                });
-                var vm = this
-                wx.invoke('getBrandWCPayRequest',
-                  // 下面参数内容都是后台返回的
-                  {
-                    'appId': payConfig.appId, // 公众号名称,由商户传入
-                    'timeStamp': payConfig.timeStamp, // 时间戳
-                    'nonceStr': payConfig.nonceStr, // 随机串
-                    'package': payConfig.package, // 预支付id
-                    'signType': payConfig.signType, // 微信签名方式
-                    'paySign': payConfig.paySign, // 微信签名
-                  },
-                  function (res) {
-                    console.log(res, '---------------付款')
-                    // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
-                    
-                    // 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'
-                      })
-                      uni.navigateTo({
-                        url: '/points/productDetails/pendingPayment?orderNo=' + this.orderNo
-                      });
-
-
-                    } else {
-                      this.redeemNowBtnDisable = false
-                      alert('付款失败');
-                    }
-                  }
-                )
-
-              }).catch(err => {
-                uni.showToast({
-                  title: err,
-                  icon: 'none'
-                })
-                this.redeemNowBtnDisable = false
+    async weixinPay(params) {
+      let data = await this.productOrderCreateFun(params)
+      if (!data) return
+      let payConfig = JSON.parse(data.data)
+      getSignature(h5Url).then(res => {
+        this.wxconfig = res.data
+        console.log(this.wxconfig, 'this.wxconfig66666')
+        wx.config({
+          beta: true,
+          debug: false,
+          appId: this.wxconfig.appId, // 公众号ID 
+          // appId: uni.getAppBaseInfo().host.appId, // 公众号ID 
+          timestamp: this.wxconfig.timestamp, // 时间戳,自1970年以来的秒数
+          nonceStr: this.wxconfig.nonceStr, // 随机串
+          signature: this.wxconfig.signature, // 微信签名方式
+          jsApiList: ['getBrandWCPayRequest']
+        });
+        var vm = this
+        wx.invoke('getBrandWCPayRequest',
+          // 下面参数内容都是后台返回的
+          {
+            'appId': payConfig.appId, // 公众号名称,由商户传入
+            'timeStamp': payConfig.timeStamp, // 时间戳
+            'nonceStr': payConfig.nonceStr, // 随机串
+            'package': payConfig.package, // 预支付id
+            'signType': payConfig.signType, // 微信签名方式
+            'paySign': payConfig.paySign, // 微信签名
+          },
+          function (res) {
+            console.log(res, '---------------付款')
+            vm.redeemNowBtnDisable = false
+            // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
+
+            // JSON.stringify(res);
+            if (res.err_msg == "get_brand_wcpay_request:ok") {
+              uni.navigateTo({
+                url: '/points/productDetails/paymentSuccessful?orderNo=' + vm.orderNo
+              });
+            } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
+              uni.showToast({
+                title: '已取消支付',
+                icon: 'none'
               })
+              uni.navigateTo({
+                url: '/points/productDetails/pendingPayment?orderNo=' + vm.orderNo
+              });
+
+
+            } else {
+              vm.redeemNowBtnDisable = false
+              alert('付款失败');
             }
+          }
+        )
 
+      }).catch(err => {
+        this.redeemNowBtnDisable = false
+        uni.showToast({
+          title: err,
+          icon: 'none'
+        })
 
-          }).catch(err => {
-            uni.showToast({
-              title: err,
-              icon: 'none'
-            })
-            this.redeemNowBtnDisable = false
-          })
-        }
       })
     },
     //账号余额支付
-    nowYuyue(params) {
+    async nowYuyue(params) {
       if (parseInt(this.dBalance) < parseInt(this.selectedObj.priceMoney)) {
+        this.redeemNowBtnDisable = false
         uni.showModal({
           title: '账户余额不足',
           content: '请充值',
@@ -449,45 +447,47 @@ export default {
           }
         });
       } else {
-        productOrderCreate(params).then(res => {
-          if (res.data.code == 200) {
-            productOrderPay({
-              orderNo: res.data.data, //订单编号
-              payType: params.payType, //支付方式:1微信支付 2:余额支付
-              totalPrice: params.totalAmount //订单总金额,单位:元
-            }).then(res => {
-              if (res.data.code == 200) {
-                this.redeemNowBtnDisable = false
-                uni.navigateTo({
-                  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'
-              })
-            })
-          }
+        let data = await this.productOrderCreateFun(params)
+        if (!data) return
+        this.redeemNowBtnDisable = false
+        uni.navigateTo({
+          url: '/points/productDetails/paymentSuccessful'
+        });
 
-        }).catch(err => {
+      }
+    },
+    //支付api
+    async productOrderCreateFun(params) {
+      let res = await productOrderCreate(params)
+      if (res.data.code == 200) {
+        this.orderNo = res.data.data
+        let res1 = await productOrderPay({
+          orderNo: res.data.data, //订单编号
+          payType: params.payType, //支付方式:1微信支付 2:余额支付
+          totalPrice: params.totalAmount //订单总金额,单位:元
+        })
+        if (res1.data.code == 200) {
+          return res1.data
+        } else {
           this.redeemNowBtnDisable = false
           uni.showToast({
-            title: err,
+            title: res.data.msg,
             icon: 'none'
           })
-        })
+        }
 
+      } else {
+        this.redeemNowBtnDisable = false
+        uni.showToast({
+          title: res.data.msg,
+          icon: 'none'
+        })
       }
+
+
+
     },
+
     //打开选择商品页
     selectProductShowFun() {
       this.selectProductShowPopup = true

+ 78 - 88
src/points/productDetails/pendingPayment.vue

@@ -47,9 +47,9 @@
                         </view>
                         <view class="productPrice1">
                             <view class="text">商品金额</view>
-                            <view class="price">{{ orderInfo.paymentType == 1 ? orderInfo.pointsUsed + '积分' :
-                                orderInfo.paymentType == 2 ? '¥' + orderInfo.payAmount + '元' :
-                                    orderInfo.paymentType == 3 ? '¥' + orderInfo.payAmount + '元' + '+' +
+                            <view class="price">{{ productInfo.paymentType == 1 ? orderInfo.pointsUsed + '积分' :
+                                productInfo.paymentType == 2 ? '¥' + orderInfo.payAmount + '元' :
+                                    productInfo.paymentType == 3 ? '¥' + orderInfo.payAmount + '元' + '+' +
                                         orderInfo.pointsUsed + '积分' : null }}</view>
                         </view>
                         <view class="shippingFee">
@@ -277,6 +277,10 @@ export default {
         //去付款
         goPay() {
             this.goPayBtnDisable = true
+            if (this.productInfo.paymentType == 1) {//只有积分兑换
+                this.productOrderCreateFun()
+                return
+            }
             if (this.orderInfo.payType == 1) {
                 //微信支付 
                 this.weixinPay()
@@ -286,79 +290,83 @@ export default {
             }
 
         },
-        //微信支付
-        weixinPay() {
-            let url = 'https://city.baoxianzhanggui.com/fragrance/'
-            productOrderPay({
+        //支付api
+        async productOrderPayFun() {
+            let res1 = await productOrderPay({
                 orderNo: this.orderInfo.orderNo, //订单编号
-                payType: this.orderInfo.payType, //支付方式:1微信支付 2:余额支付
+                payType: this.productInfo.paymentType == 1 ? null : this.orderInfo.payType, //支付方式:1微信支付 2:余额支付
                 totalPrice: this.orderInfo.totalAmount //订单总金额,单位:元
-            }).then(res => {
-                let payConfig = JSON.parse(res.data.data)
-                getSignature(url).then(res => {
-                    this.wxconfig = res.data
-                    wx.config({
-                        beta: true,
-                        debug: false,
-                        appId: this.wxconfig.appId, // 公众号ID 
-                        // appId: uni.getAppBaseInfo().host.appId, // 公众号ID 
-                        timestamp: this.wxconfig.timestamp, // 时间戳,自1970年以来的秒数
-                        nonceStr: this.wxconfig.nonceStr, // 随机串
-                        signature: this.wxconfig.signature, // 微信签名方式
-                        jsApiList: ['getBrandWCPayRequest']
-                    });
-                    var vm = this
-                    wx.invoke('getBrandWCPayRequest',
-                        // 下面参数内容都是后台返回的
-                        {
-                            'appId': payConfig.appId, // 公众号名称,由商户传入
-                            'timeStamp': payConfig.timeStamp, // 时间戳
-                            'nonceStr': payConfig.nonceStr, // 随机串
-                            'package': payConfig.package, // 预支付id
-                            'signType': payConfig.signType, // 微信签名方式
-                            'paySign': payConfig.paySign, // 微信签名
-                        },
-                        function (res) {
-                            // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
-                            
-                            // 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('付款失败');
-                            }
+            })
+            if (res1.data.code == 200) {
+                return res1.data
+            } else {
+                this.goPayBtnDisable = false
+                uni.showToast({
+                    title: res.data.msg,
+                    icon: 'none'
+                })
+            }
+
+        },
+        //微信支付
+        async weixinPay() {
+            let data = await this.productOrderPayFun()
+            if (!data) return
+            let payConfig = JSON.parse(data.data)
+            getSignature(h5Url).then(res => {
+                this.wxconfig = res.data
+                wx.config({
+                    beta: true,
+                    debug: false,
+                    appId: this.wxconfig.appId, // 公众号ID 
+                    // appId: uni.getAppBaseInfo().host.appId, // 公众号ID 
+                    timestamp: this.wxconfig.timestamp, // 时间戳,自1970年以来的秒数
+                    nonceStr: this.wxconfig.nonceStr, // 随机串
+                    signature: this.wxconfig.signature, // 微信签名方式
+                    jsApiList: ['getBrandWCPayRequest']
+                });
+                var vm = this
+                wx.invoke('getBrandWCPayRequest',
+                    // 下面参数内容都是后台返回的
+                    {
+                        'appId': payConfig.appId, // 公众号名称,由商户传入
+                        'timeStamp': payConfig.timeStamp, // 时间戳
+                        'nonceStr': payConfig.nonceStr, // 随机串
+                        'package': payConfig.package, // 预支付id
+                        'signType': payConfig.signType, // 微信签名方式
+                        'paySign': payConfig.paySign, // 微信签名
+                    },
+                    function (res) {
+                        // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
+                        vm.goPayBtnDisable = false
+                        // JSON.stringify(res);
+                        if (res.err_msg == "get_brand_wcpay_request:ok") {
+
+                            uni.navigateTo({
+                                url: '/points/productDetails/paymentSuccessful?orderNo=' + vm.orderNo
+                            });
+                        } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
+                            uni.showToast({
+                                title: '已取消支付',
+                                icon: 'none'
+                            })
+
+                        } else {
+                            alert('付款失败');
                         }
-                    )
+                    }
+                )
 
-                }).catch(err => {
-                    this.redeemNowBtnDisable = false
-                    uni.showToast({
-                        title: err,
-                        icon: 'none'
-                    })
-                })
             }).catch(err => {
-                this.redeemNowBtnDisable = false
+                this.goPayBtnDisable = false
                 uni.showToast({
                     title: err,
                     icon: 'none'
                 })
-                
             })
         },
         //账号余额支付
-        nowYuyue(params) {
+        async nowYuyue(params) {
             if (parseInt(this.dBalance) < parseInt(10)) {
                 uni.showModal({
                     title: '账户余额不足',
@@ -372,31 +380,13 @@ export default {
                     }
                 });
             } else {
-                productOrderPay({
-                    orderNo: this.orderInfo.orderNo, //订单编号
-                    payType: this.orderInfo.payType, //支付方式:1微信支付 2:余额支付
-                    totalPrice: this.orderInfo.totalAmount //订单总金额,单位:元
-                }).then(res => {
-                    if (res.data.code == 200) {
-                        this.goPayBtnDisable = false
-                        uni.navigateTo({
-                            url: '/points/productDetails/paymentSuccessful'
-                        });
-                    } else {
-                        uni.showToast({
-                            icon: 'error',
-                            title: res.data.msg,
-                        })
-                        this.goPayBtnDisable = false
-                    }
+                let data = await this.productOrderPayFun()
+                if (!data) return
+                this.goPayBtnDisable = false
+                uni.navigateTo({
+                    url: '/points/productDetails/paymentSuccessful'
+                });
 
-                }).catch(err => {
-                    uni.showToast({
-                        title: err,
-                        icon: 'none'
-                    })
-                    this.redeemNowBtnDisable = false
-                })
             }
         },
         //查询账户余额