|
@@ -26,16 +26,22 @@
|
|
|
<div class="order-num app-color-3" style="margin-top:12upx;">订单号 {{ orderSn || ''}}</div>
|
|
<div class="order-num app-color-3" style="margin-top:12upx;">订单号 {{ orderSn || ''}}</div>
|
|
|
<div v-if="remainPayTime > 0" class="order-num app-color-3" style="margin-top:18upx;font-size:26upx;"><span style="font-weight:bold;padding-right:8upx;">{{remainPayTime}}</span>秒后失效</div>
|
|
<div v-if="remainPayTime > 0" class="order-num app-color-3" style="margin-top:18upx;font-size:26upx;"><span style="font-weight:bold;padding-right:8upx;">{{remainPayTime}}</span>秒后失效</div>
|
|
|
<div v-else class="order-num app-color-3" style="margin-top:12upx;font-size:26upx;">订单已失效</div>
|
|
<div v-else class="order-num app-color-3" style="margin-top:12upx;font-size:26upx;">订单已失效</div>
|
|
|
|
|
+ <view class="balance" v-if="Number(customNetBalance) > 0">
|
|
|
|
|
+ <text>余额</text>
|
|
|
|
|
+ <text class="app-size-30" style="color:#3385ff;font-weight:bold;margin-left:10upx;">¥{{ parseFloat(customNetBalance) }}</text>
|
|
|
|
|
+ </view>
|
|
|
</block>
|
|
</block>
|
|
|
<block>
|
|
<block>
|
|
|
<!-- #ifdef MP-WEIXIN -->
|
|
<!-- #ifdef MP-WEIXIN -->
|
|
|
<div class="call-one-btn">
|
|
<div class="call-one-btn">
|
|
|
- <view v-if="Number(balance) >= Number(realPrice)">
|
|
|
|
|
- <button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" style="height:100upx;line-height:50upx;" :disabled="remainPayTime >0 ? false : true" @click="wxPayFn">微信支付</button>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view v-else>
|
|
|
|
|
- <button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" style="height:100upx;line-height:50upx;" :disabled="remainPayTime >0 ? false : true" @click="wxPayFn">微信支付</button>
|
|
|
|
|
- </view>
|
|
|
|
|
|
|
+ <button
|
|
|
|
|
+ v-if="showBalancePay == 1"
|
|
|
|
|
+ class="button-com pay-balance"
|
|
|
|
|
+ :class="[remainPayTime > 0 ? 'blue' : 'default']"
|
|
|
|
|
+ :disabled="remainPayTime > 0 ? false : true"
|
|
|
|
|
+ @click="balancePay"
|
|
|
|
|
+ >余额支付</button>
|
|
|
|
|
+ <button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" style="height:100upx;line-height:50upx;margin-top:50upx;" :disabled="remainPayTime >0 ? false : true" @click="wxPayFn">微信支付</button>
|
|
|
<button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" style="height:100upx;line-height:100upx;margin-top:50upx;padding:0;display:flex;align-items:center;justify-content:center;width:70%;margin-left:auto;margin-right:auto;" :disabled="remainPayTime >0 ? false : true" @click="debtPay" v-if="hasDebtPay === '1'">挂账</button>
|
|
<button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" style="height:100upx;line-height:100upx;margin-top:50upx;padding:0;display:flex;align-items:center;justify-content:center;width:70%;margin-left:auto;margin-right:auto;" :disabled="remainPayTime >0 ? false : true" @click="debtPay" v-if="hasDebtPay === '1'">挂账</button>
|
|
|
|
|
|
|
|
<button class="button-com" @click="useAliPay()" :class="[remainPayTime >0 ? 'ali-btn green':'default']" style="height:100upx;line-height:100upx;margin-top:50upx;margin-bottom:40upx;padding:0;display:flex;align-items:center;justify-content:center;width:70%;margin-left:auto;margin-right:auto;" :disabled="remainPayTime > 0 ? false : true">支付宝付款</button>
|
|
<button class="button-com" @click="useAliPay()" :class="[remainPayTime >0 ? 'ali-btn green':'default']" style="height:100upx;line-height:100upx;margin-top:50upx;margin-bottom:40upx;padding:0;display:flex;align-items:center;justify-content:center;width:70%;margin-left:auto;margin-right:auto;" :disabled="remainPayTime > 0 ? false : true">支付宝付款</button>
|
|
@@ -48,8 +54,19 @@
|
|
|
<!-- #endif -->
|
|
<!-- #endif -->
|
|
|
<!-- #ifdef APP-PLUS -->
|
|
<!-- #ifdef APP-PLUS -->
|
|
|
<div class="call-one-btn">
|
|
<div class="call-one-btn">
|
|
|
|
|
+ <view class="balance" v-if="Number(customNetBalance) > 0" style="margin-bottom:30upx;">
|
|
|
|
|
+ <text>余额</text>
|
|
|
|
|
+ <text class="app-size-30" style="color:#3385ff;font-weight:bold;margin-left:10upx;">¥{{ parseFloat(customNetBalance) }}</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <button
|
|
|
|
|
+ v-if="showBalancePay == 1"
|
|
|
|
|
+ class="button-com pay-balance"
|
|
|
|
|
+ :class="[remainPayTime > 0 ? 'blue' : 'default']"
|
|
|
|
|
+ :disabled="remainPayTime > 0 ? false : true"
|
|
|
|
|
+ @click="balancePay"
|
|
|
|
|
+ >余额支付</button>
|
|
|
<view>
|
|
<view>
|
|
|
- <button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="appAliPayFn(0)">微信支付</button>
|
|
|
|
|
|
|
+ <button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="appAliPayFn(0)" style="margin-top:50upx;">微信支付</button>
|
|
|
</view>
|
|
</view>
|
|
|
<button class="button-com pay-wx" :class="[remainPayTime >0 ? 'ali-btn':'default']" :disabled="remainPayTime >0 ? false : true" @click="appAliPayFn(1)" style="margin-top:50upx;">支付宝支付</button>
|
|
<button class="button-com pay-wx" :class="[remainPayTime >0 ? 'ali-btn':'default']" :disabled="remainPayTime >0 ? false : true" @click="appAliPayFn(1)" style="margin-top:50upx;">支付宝支付</button>
|
|
|
<button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="debtPay" v-if="hasDebtPay === '1'" style="margin-top:50upx;">挂账</button>
|
|
<button class="button-com pay-wx" :class="[remainPayTime >0 ? 'green':'default']" :disabled="remainPayTime >0 ? false : true" @click="debtPay" v-if="hasDebtPay === '1'" style="margin-top:50upx;">挂账</button>
|
|
@@ -63,7 +80,6 @@
|
|
|
</block>
|
|
</block>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <keyboard-module :show="keyShow" @comfirm="hideKeyFn" @clickKey="clickKeyFn" :psdShow="true" :type="typeNum" @closeKey="closeKeyFn" />
|
|
|
|
|
<alert-module>
|
|
<alert-module>
|
|
|
<div class="go-login-module">
|
|
<div class="go-login-module">
|
|
|
<div>请先设置支付密码!</div>
|
|
<div>请先设置支付密码!</div>
|
|
@@ -73,8 +89,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import { purchaseBalancePay, purchaseDebtPay, purchaseWxPay,purchaseAliPay,getDetail } from "@/api/purchase";
|
|
|
|
|
-import keyboardModule from './components/keyboard'
|
|
|
|
|
|
|
+import { purchaseCustomBalancePay, purchaseDebtPay, purchaseWxPay,purchaseAliPay,getDetail } from "@/api/purchase";
|
|
|
import { mapGetters } from "vuex";
|
|
import { mapGetters } from "vuex";
|
|
|
import wexinPay from "@/utils/pay/wxPay";
|
|
import wexinPay from "@/utils/pay/wxPay";
|
|
|
import { postWxCode } from '@/api/mini'
|
|
import { postWxCode } from '@/api/mini'
|
|
@@ -82,24 +97,19 @@ import { updateMiniOpenId } from '@/api/admin'
|
|
|
export default {
|
|
export default {
|
|
|
name: "wechatPay",
|
|
name: "wechatPay",
|
|
|
components: {
|
|
components: {
|
|
|
- keyboardModule
|
|
|
|
|
},
|
|
},
|
|
|
data () {
|
|
data () {
|
|
|
return {
|
|
return {
|
|
|
options: {},
|
|
options: {},
|
|
|
- type: '',
|
|
|
|
|
- keyShow: false,
|
|
|
|
|
- modalForm: {
|
|
|
|
|
- payPassword: ''
|
|
|
|
|
- },
|
|
|
|
|
- psdKey: '',
|
|
|
|
|
orderSn: '',
|
|
orderSn: '',
|
|
|
realPrice: '',
|
|
realPrice: '',
|
|
|
- typeNum: '1',
|
|
|
|
|
pageId: '',
|
|
pageId: '',
|
|
|
remainPayTime:120,
|
|
remainPayTime:120,
|
|
|
hasDebtPay:0,
|
|
hasDebtPay:0,
|
|
|
balance:0,
|
|
balance:0,
|
|
|
|
|
+ customNetBalance:0,
|
|
|
|
|
+ showBalancePay:0,
|
|
|
|
|
+ ghsSalt:'',
|
|
|
info:[],
|
|
info:[],
|
|
|
hasRequestApi:false,
|
|
hasRequestApi:false,
|
|
|
needCheck:0,
|
|
needCheck:0,
|
|
@@ -116,6 +126,10 @@ export default {
|
|
|
},
|
|
},
|
|
|
onShow(){
|
|
onShow(){
|
|
|
let that = this
|
|
let that = this
|
|
|
|
|
+ if (uni.getStorageSync('wechatPayNeedRefresh') == '1') {
|
|
|
|
|
+ uni.removeStorageSync('wechatPayNeedRefresh')
|
|
|
|
|
+ that.init()
|
|
|
|
|
+ }
|
|
|
if(that.needCheck == 1){
|
|
if(that.needCheck == 1){
|
|
|
that.needCheck = 0
|
|
that.needCheck = 0
|
|
|
that.$util.confirmModal({content:'已付款成功?',okText:'是的',cancelText:'没有'},() => {
|
|
that.$util.confirmModal({content:'已付款成功?',okText:'是的',cancelText:'没有'},() => {
|
|
@@ -156,7 +170,10 @@ export default {
|
|
|
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
|
|
|
that.hasDebtPay = res.data.hasDebtPay
|
|
that.hasDebtPay = res.data.hasDebtPay
|
|
|
- that.balance = res.data.balance
|
|
|
|
|
|
|
+ that.balance = res.data.balance || 0
|
|
|
|
|
+ that.customNetBalance = res.data.customNetBalance != null ? res.data.customNetBalance : (res.data.balance || 0)
|
|
|
|
|
+ that.showBalancePay = res.data.showBalancePay == 1 ? 1 : 0
|
|
|
|
|
+ that.ghsSalt = res.data.ghsSalt || ''
|
|
|
this.info = res.data
|
|
this.info = res.data
|
|
|
that.remainPayTime = res.data.remainPayTime
|
|
that.remainPayTime = res.data.remainPayTime
|
|
|
if(that.remainPayTime > 0){
|
|
if(that.remainPayTime > 0){
|
|
@@ -368,61 +385,55 @@ export default {
|
|
|
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 })
|
|
|
},
|
|
},
|
|
|
- // 关闭键盘
|
|
|
|
|
- closeKeyFn () {
|
|
|
|
|
- this.keyShow = false
|
|
|
|
|
- },
|
|
|
|
|
getError () {
|
|
getError () {
|
|
|
},
|
|
},
|
|
|
balancePay () {
|
|
balancePay () {
|
|
|
- let self = this
|
|
|
|
|
- if(Number(this.balance) < Number(this.realPrice)){
|
|
|
|
|
- this.$msg('余额不足')
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ let that = this
|
|
|
|
|
+ if (this.remainPayTime <= 0) {
|
|
|
|
|
+ this.$msg('订单已失效')
|
|
|
|
|
+ return false
|
|
|
}
|
|
}
|
|
|
- if (this.getLoginInfo.payPassword) {
|
|
|
|
|
- self.keyShow = true
|
|
|
|
|
- } else {
|
|
|
|
|
- uni.showModal({
|
|
|
|
|
- title: '',
|
|
|
|
|
- content: '请先设置支付密码',
|
|
|
|
|
- success: function (res) {
|
|
|
|
|
- if (res.confirm) {
|
|
|
|
|
- self.pageTo({
|
|
|
|
|
- url: '/pagesPurchase/setPsd'
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ if (this.hasRequestApi) {
|
|
|
|
|
+ this.$msg('正在请求,请稍后再试')
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ const available = Number(this.customNetBalance)
|
|
|
|
|
+ const needPay = Number(this.realPrice)
|
|
|
|
|
+ if (available < needPay) {
|
|
|
|
|
+ const shortfall = parseFloat((needPay - available).toFixed(2))
|
|
|
|
|
+ const ghsId = this.info.ghsId || 0
|
|
|
|
|
+ const salt = this.ghsSalt || ''
|
|
|
|
|
+ const purchaseId = this.option.id || this.id || ''
|
|
|
|
|
+ this.$util.confirmModal({ content: '余额不足,请先充值' }, () => {
|
|
|
|
|
+ that.pageTo({
|
|
|
|
|
+ url: '/admin/ghs/pay',
|
|
|
|
|
+ query: {
|
|
|
|
|
+ id: ghsId,
|
|
|
|
|
+ salt: salt,
|
|
|
|
|
+ amount: shortfall,
|
|
|
|
|
+ from: 'wechatPay',
|
|
|
|
|
+ purchaseId: purchaseId
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ return false
|
|
|
}
|
|
}
|
|
|
- },
|
|
|
|
|
- // 点击数字键盘
|
|
|
|
|
- clickKeyFn (val) {
|
|
|
|
|
- this.psdKey = val
|
|
|
|
|
- console.log(this.psdKey)
|
|
|
|
|
- },
|
|
|
|
|
- // 点击了完成
|
|
|
|
|
- hideKeyFn () {
|
|
|
|
|
- uni.showLoading({title: '加载中',mask:true})
|
|
|
|
|
- if (this.psdKey.length === 6) {
|
|
|
|
|
- let data = {
|
|
|
|
|
- orderSn: this.orderSn,
|
|
|
|
|
- password: this.psdKey
|
|
|
|
|
- }
|
|
|
|
|
- purchaseBalancePay(data).then(res => {
|
|
|
|
|
- //关闭加载中
|
|
|
|
|
|
|
+ this.$util.confirmModal({ content: '确认余额支付?' }, () => {
|
|
|
|
|
+ that.hasRequestApi = true
|
|
|
|
|
+ uni.showLoading({ title: '支付中', mask: true })
|
|
|
|
|
+ purchaseCustomBalancePay({ orderSn: that.orderSn }).then(res => {
|
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
|
- if(res.code == 1){
|
|
|
|
|
- this.pageTo({
|
|
|
|
|
- url: '/pagesPurchase/particulars?id=' + res.data.id,
|
|
|
|
|
- type: 2
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ that.hasRequestApi = false
|
|
|
|
|
+ if (res.code == 1) {
|
|
|
|
|
+ const id = res.data.id || that.option.id
|
|
|
|
|
+ that.pageTo({ url: '/pagesPurchase/particulars?id=' + id, type: 2 })
|
|
|
}
|
|
}
|
|
|
- }).catch(err => {})
|
|
|
|
|
- } else {
|
|
|
|
|
- this.$msg('请输入六位数支付密码')
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ uni.hideLoading()
|
|
|
|
|
+ that.hasRequestApi = false
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
</script>
|
|
</script>
|
|
@@ -433,6 +444,24 @@ export default {
|
|
|
border:1upx solid #3385ff;
|
|
border:1upx solid #3385ff;
|
|
|
color:white;
|
|
color:white;
|
|
|
}
|
|
}
|
|
|
|
|
+ .pay-balance {
|
|
|
|
|
+ height: 100upx;
|
|
|
|
|
+ line-height: normal;
|
|
|
|
|
+ padding: 0;
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: center;
|
|
|
|
|
+ width: 70%;
|
|
|
|
|
+ margin-left: auto;
|
|
|
|
|
+ margin-right: auto;
|
|
|
|
|
+ margin-top: 20upx;
|
|
|
|
|
+ }
|
|
|
|
|
+ .pay-balance.blue {
|
|
|
|
|
+ background-color: #3385ff;
|
|
|
|
|
+ border: 1upx solid #3385ff;
|
|
|
|
|
+ color: #fff;
|
|
|
|
|
+ }
|
|
|
.callback-wrap {
|
|
.callback-wrap {
|
|
|
padding-top:40upx;
|
|
padding-top:40upx;
|
|
|
background-repeat: no-repeat;
|
|
background-repeat: no-repeat;
|
|
@@ -473,6 +502,10 @@ export default {
|
|
|
font-size: 32upx;
|
|
font-size: 32upx;
|
|
|
margin-top:20upx;
|
|
margin-top:20upx;
|
|
|
}
|
|
}
|
|
|
|
|
+ .button-com.pay-balance {
|
|
|
|
|
+ padding-top: 0;
|
|
|
|
|
+ padding-bottom: 0;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|