|
|
@@ -25,7 +25,7 @@
|
|
|
<amountInput ref="amountInput" confirmText="付款" btnColor="#ff9900" placeholder="请输入交易金额" @change="change"
|
|
|
@confirm="debouncePay"></amountInput>
|
|
|
|
|
|
- <u-modal v-model="payModalShow" :showCancelButton="true" confirm-color="#FF9447">
|
|
|
+ <u-modal v-model="payModalShow" confirmText="确认支付" cancelText="暂不支付" @confirm="toWXPay(pointPayType)" @cancel="$back()" :showCancelButton="true" confirm-color="#FF9447">
|
|
|
<view class="center flex-direction text-df" style="padding: 30rpx 40rpx;">
|
|
|
<view>您的积分可足额抵扣支付</view>
|
|
|
<view class="padding-top-10">本次支付不会扣除您的现金</view>
|
|
|
@@ -51,7 +51,8 @@
|
|
|
payModalShow: false,
|
|
|
modalShow: false,
|
|
|
shopId: '',
|
|
|
- shopDetail: {}
|
|
|
+ shopDetail: {},
|
|
|
+ pointPayType:''
|
|
|
}
|
|
|
},
|
|
|
async onLoad(options) {
|
|
|
@@ -102,7 +103,7 @@
|
|
|
this.$u.debounce(this.pay, 500)
|
|
|
}
|
|
|
},
|
|
|
- //获取商户i信息
|
|
|
+ //获取商户信息
|
|
|
fetchShopDetail() {
|
|
|
this.$api.shop.detail({
|
|
|
id: this.shopId
|
|
|
@@ -185,15 +186,6 @@
|
|
|
this.$u.toast('支付失败')
|
|
|
}
|
|
|
},
|
|
|
- isMoney(s) {
|
|
|
- var str = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
|
|
|
- var reg = new RegExp(str)
|
|
|
- if (reg.test(s)) {
|
|
|
- return true;
|
|
|
- }else {
|
|
|
- return false;
|
|
|
- }
|
|
|
- },
|
|
|
async pay() {
|
|
|
if (!this.orderAmount.length || this.orderAmount == 0) {
|
|
|
this.$u.toast('请输入交易金额')
|
|
|
@@ -204,16 +196,28 @@
|
|
|
// #endif
|
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
- let flag = false
|
|
|
- if (flag) {
|
|
|
+ let res= await this.getPointPayType()
|
|
|
+ this.pointPayType=res.data
|
|
|
+ if (this.pointPayType==this.$global.pointPayType.CHANNEL_ENOUGN
|
|
|
+ || this.pointPayType==this.$global.pointPayType.CHANNEL_ZERO_RARE_ENOUGH
|
|
|
+ || this.pointPayType==this.$global.pointPayType.CHANNEL_NOENOUGH_RARE_ENOUGH) {
|
|
|
//可以足额支付
|
|
|
this.payModalShow = true
|
|
|
- } else {
|
|
|
- //积分不足额支付,调易宝支付
|
|
|
+ }else{
|
|
|
this.toWXPay()
|
|
|
}
|
|
|
// #endif
|
|
|
},
|
|
|
+ //获取积分策略
|
|
|
+ async getPointPayType(){
|
|
|
+ let params={
|
|
|
+ shopId: this.shopId,
|
|
|
+ loginUserId: this.vuex_userId,
|
|
|
+ money: this.orderAmount
|
|
|
+ }
|
|
|
+ let res=await this.$api.pay.getPointPayType(params)
|
|
|
+ return res
|
|
|
+ },
|
|
|
async toWXPay() {
|
|
|
let expireTime = this.$dateTime.getExpireTime(5)
|
|
|
let params = {
|
|
|
@@ -224,7 +228,8 @@
|
|
|
expireTime,
|
|
|
appId: this.$global.wxParams.APPID,
|
|
|
openId: this.$cache.get('userInfo').openId,
|
|
|
- type: 1 //type: 1-用户扫商户收款码支付 2-商户扫用户付款码支付
|
|
|
+ type: 1 ,//type: 1-用户扫商户收款码支付 2-商户扫用户付款码支付
|
|
|
+ pointPayType:this.pointPayType
|
|
|
}
|
|
|
let resp = await this.$api.loginUser.payBefore(params)
|
|
|
if (!resp.success) {
|