|
@@ -22,10 +22,12 @@
|
|
|
<!-- #ifdef MP-WEIXIN -->
|
|
<!-- #ifdef MP-WEIXIN -->
|
|
|
<div class="call-one-btn">
|
|
<div class="call-one-btn">
|
|
|
<view v-if="Number(balance) >= Number(realPrice)">
|
|
<view v-if="Number(balance) >= Number(realPrice)">
|
|
|
- <button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="wxPayFn">微信支付</button>
|
|
|
|
|
|
|
+ <button v-if="getPayType == 1" class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="wxPayFn">微信支付</button>
|
|
|
|
|
+ <button v-else class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="wxPayFnOld">微信支付</button>
|
|
|
</view>
|
|
</view>
|
|
|
<view v-else>
|
|
<view v-else>
|
|
|
- <button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="wxPayFn">微信支付</button>
|
|
|
|
|
|
|
+ <button v-if="getPayType == 1" class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="wxPayFn">微信支付</button>
|
|
|
|
|
+ <button v-else class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="wxPayFnOld">微信支付</button>
|
|
|
</view>
|
|
</view>
|
|
|
<button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="debtPay" v-if="hasDebtPay === '1'">赊账</button>
|
|
<button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="debtPay" v-if="hasDebtPay === '1'">赊账</button>
|
|
|
</div>
|
|
</div>
|
|
@@ -75,7 +77,8 @@ export default {
|
|
|
pageId: '',
|
|
pageId: '',
|
|
|
remainPayTime:120,
|
|
remainPayTime:120,
|
|
|
hasDebtPay:0,
|
|
hasDebtPay:0,
|
|
|
- balance:0
|
|
|
|
|
|
|
+ balance:0,
|
|
|
|
|
+ getPayType:1
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
onLoad (options) {
|
|
onLoad (options) {
|
|
@@ -94,7 +97,7 @@ export default {
|
|
|
if(res.code == 1){
|
|
if(res.code == 1){
|
|
|
this.realPrice = res.data.realPrice ? parseFloat(res.data.realPrice) : ''
|
|
this.realPrice = res.data.realPrice ? parseFloat(res.data.realPrice) : ''
|
|
|
this.orderSn = res.data.orderSn
|
|
this.orderSn = res.data.orderSn
|
|
|
-
|
|
|
|
|
|
|
+ this.getPayType = res.data.getPayType
|
|
|
that.hasDebtPay = res.data.hasDebtPay
|
|
that.hasDebtPay = res.data.hasDebtPay
|
|
|
that.balance = res.data.balance
|
|
that.balance = res.data.balance
|
|
|
|
|
|
|
@@ -152,6 +155,39 @@ export default {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
+ wxPayFnOld () {
|
|
|
|
|
+ let that = this
|
|
|
|
|
+ uni.showLoading({title: '加载中',mask:true})
|
|
|
|
|
+ purchaseWxPay({ orderSn: this.orderSn }).then(res => {
|
|
|
|
|
+ uni.hideLoading()
|
|
|
|
|
+ if(res.code == 1){
|
|
|
|
|
+ if(res.data.hasNoMiniOpenId && res.data.hasNoMiniOpenId == 1){
|
|
|
|
|
+ //没有miniOpenId,补miniOpenId
|
|
|
|
|
+ uni.login({
|
|
|
|
|
+ provider: 'weixin',
|
|
|
|
|
+ success: res => {
|
|
|
|
|
+ uni.setStorageSync('code', res.code)
|
|
|
|
|
+ postWxCode({ code: res.code }).then(subRes => {
|
|
|
|
|
+ if(subRes.data.currentMiniOpenId){
|
|
|
|
|
+ let currentMiniOpenId = subRes.data.currentMiniOpenId
|
|
|
|
|
+ updateMiniOpenId({miniOpenId:currentMiniOpenId}).then(subRes=>{
|
|
|
|
|
+ if(subRes.code == 1){
|
|
|
|
|
+ that.$util.confirmModal({content:'网络开小差了,请继续',okText:'确认',singer:true},() => {
|
|
|
|
|
+ that.wxPayFn()
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.pageId = res.data.id
|
|
|
|
|
+ wexinPay(res.data, this.getSuccess, this.getError)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
getSuccess () {
|
|
getSuccess () {
|
|
|
let that = this
|
|
let that = this
|
|
|
that.pageTo({ url: '/pagesPurchase/particulars?id=' + that.pageId, type: 2 })
|
|
that.pageTo({ url: '/pagesPurchase/particulars?id=' + that.pageId, type: 2 })
|