石广澎
2025-03-07 fb809790d865c5ec0a107c752f1a8c0be151cb9b
pay/scanpay.vue
@@ -166,6 +166,7 @@
  data() {
    return {
      tips: '该商户暂未开通支付功能',
      payLoading: false,
      loading: false,
      remark: '',
      buyerNote: '',
@@ -198,12 +199,14 @@
      couponInfo: {
        id: '',
        discount: 0,
        thresholdValue: 0
        thresholdValue: 0,
        discountMax: 0,
      }, // 优惠券内容
      checkCoupon: {
        id: null,
        discount: 0,
        thresholdValue: 0
        thresholdValue: 0,
        discountMax: 0,
      },
    };
  },
@@ -223,7 +226,10 @@
        return parseFloat(num);
      }
      const dis = 1 - parseFloat(this.checkCoupon.discount)
      const dic = Math.floor(this.$utils.accMul(this.money,100) * dis)
      let dic = Math.floor(this.$utils.accMul(this.money,100) * dis)
      if(dic>this.checkCoupon.discountMax){
        dic = this.checkCoupon.discountMax
      }
      return this.$utils.fenToYuan(dic).toFixed(2);
    },
    discount() {
@@ -235,7 +241,10 @@
        return parseFloat(num);
      }
      const dis = 1 - parseFloat(this.couponInfo.discount)
      const dic = Math.floor(this.$utils.accMul(this.money,100) * dis)
      let dic = Math.floor(this.$utils.accMul(this.money,100) * dis)
      if(dic>this.couponInfo.discountMax){
        dic = this.couponInfo.discountMax
      }
      return this.$utils.fenToYuan(dic).toFixed(2);
    },
    payMoney() {
@@ -247,9 +256,6 @@
    }
  },
  onLoad(opt) {
    uni.setStorageSync('CID', opt.cid)
    uni.setStorageSync('SHOPID', opt.shopId)
    uni.setStorageSync('AQCI', opt.activityQrcodeId)
    this.UNIONID = uni.getStorageSync('UNIONID') || null
    this.isNew = uni.getStorageSync('IS_NEW')
@@ -430,6 +436,7 @@
              thresholdValue: res.thresholdValue,
              discount: res.discount,
              discountType: res.discountType,
              discountMax: res.discountMax
            }
          }
        }
@@ -596,6 +603,8 @@
        return
      }
      this.bordShow = false
      if (this.payLoading) return
      this.payLoading = true
      // 金额 this.money
      uni.showLoading({
        title: '下单中',
@@ -618,7 +627,7 @@
        params.cid = this.cid
      }
      if (this.onlineId) {
        params = {payWay: this.payWay,onlineId: this.onlineId}
        params.onlineId = this.onlineId
      }
      //生成订单
      saveOrder(params).then(res => {
@@ -637,10 +646,12 @@
            this.aliPay(res.paymentUrl)
          }
        } catch (e) {
          this.payLoading = false
          //TODO handle the exception
          console.error(e);
        }
      }).catch(() => {
        this.payLoading = false
        uni.hideLoading()
      })
    },
@@ -657,6 +668,7 @@
              "paySign": res.paySign //微信签名
            },
            (res) => {
              this.payLoading = false
              if (res.err_msg == "get_brand_wcpay_request:ok") {
                // 使用以上方式判断前端返回,微信团队郑重提示:
                //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
@@ -674,6 +686,7 @@
      ap.tradePay({
        tradeNO: res.tradeNO
      }, (res) => {
        this.payLoading = false
        if (res.resultCode == 9000) {
          uni.navigateTo({
            url: `/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON