| | |
| | | data() { |
| | | return { |
| | | tips: '该商户暂未开通支付功能', |
| | | payLoading: false, |
| | | loading: false, |
| | | remark: '', |
| | | buyerNote: '', |
| | |
| | | couponInfo: { |
| | | id: '', |
| | | discount: 0, |
| | | thresholdValue: 0 |
| | | thresholdValue: 0, |
| | | discountMax: 0, |
| | | }, // 优惠券内容 |
| | | checkCoupon: { |
| | | id: null, |
| | | discount: 0, |
| | | thresholdValue: 0 |
| | | thresholdValue: 0, |
| | | discountMax: 0, |
| | | }, |
| | | }; |
| | | }, |
| | |
| | | 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() { |
| | |
| | | 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() { |
| | |
| | | } |
| | | }, |
| | | 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') |
| | | |
| | |
| | | thresholdValue: res.thresholdValue, |
| | | discount: res.discount, |
| | | discountType: res.discountType, |
| | | discountMax: res.discountMax |
| | | } |
| | | } |
| | | } |
| | |
| | | return |
| | | } |
| | | this.bordShow = false |
| | | if (this.payLoading) return |
| | | this.payLoading = true |
| | | // 金额 this.money |
| | | uni.showLoading({ |
| | | title: '下单中', |
| | |
| | | params.cid = this.cid |
| | | } |
| | | if (this.onlineId) { |
| | | params = {payWay: this.payWay,onlineId: this.onlineId} |
| | | params.onlineId = this.onlineId |
| | | } |
| | | //生成订单 |
| | | saveOrder(params).then(res => { |
| | |
| | | this.aliPay(res.paymentUrl) |
| | | } |
| | | } catch (e) { |
| | | this.payLoading = false |
| | | //TODO handle the exception |
| | | console.error(e); |
| | | } |
| | | }).catch(() => { |
| | | this.payLoading = false |
| | | uni.hideLoading() |
| | | }) |
| | | }, |
| | |
| | | "paySign": res.paySign //微信签名 |
| | | }, |
| | | (res) => { |
| | | this.payLoading = false |
| | | if (res.err_msg == "get_brand_wcpay_request:ok") { |
| | | // 使用以上方式判断前端返回,微信团队郑重提示: |
| | | //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 |
| | |
| | | ap.tradePay({ |
| | | tradeNO: res.tradeNO |
| | | }, (res) => { |
| | | this.payLoading = false |
| | | if (res.resultCode == 9000) { |
| | | uni.navigateTo({ |
| | | url: `/pay/paySuccess?orderId=${this.orderId}&youHuiInfo=${JSON |