DESKTOP-SVI9JE1\muzen 1 rok temu
rodzic
commit
c00a2a8d02
1 zmienionych plików z 6 dodań i 5 usunięć
  1. 6 5
      src/pages/pay/index.vue

+ 6 - 5
src/pages/pay/index.vue

@@ -51,7 +51,6 @@ import { openId, wechatPay, detail, options } from "@/api/pay"
 export default {
   data() {
     return {
-      openId: '',
       // 流量信息
       info: {},
       rateplan: {},
@@ -79,7 +78,7 @@ export default {
     getOpenId(e) {
       openId(e.code).then(res => {
         if (res.code === 0) {
-          this.openId = res.data.openid
+          uni.setStorageSync('openId', res.data.openid)
         }
       })
     },
@@ -113,7 +112,7 @@ export default {
     // 下单
     getWechatPay() {
       wechatPay({
-        openId: this.openId,
+        openId: uni.getStorageSync('openId'),
         goodType: 18,
         goodsId: this.goodsId,
         ptype: 1,
@@ -141,7 +140,7 @@ export default {
       WeixinJSBridge.invoke('getBrandWCPayRequest', this.form, function (res) {
         if (res.err_msg == "get_brand_wcpay_request:ok") {
           // 支付成功刷新页面
-          this.getDetail()
+          location.reload();
         }
       })
     },
@@ -299,7 +298,9 @@ export default {
   button {
     width: calc(100% - 64rpx);
     height: 92rpx;
-    line-height: 92rpx;
+    display: flex;
+    justify-content: center;
+    align-items: center;
     background: linear-gradient(90deg, #F3CF97 0%, #F6E5C4 100%);
     border-radius: 23px;
     color: #7C541A;