|
|
@@ -1,74 +1,45 @@
|
|
|
<template>
|
|
|
- <!-- 各种回调页面 -->
|
|
|
- <div class="app-content awaitPayYe awaitPayYe">
|
|
|
+ <div class="app-content awaitPayYe awaitPayYe">
|
|
|
<div class="callback-wrap">
|
|
|
<div class="bg_01"></div>
|
|
|
<div class="callback-blo">
|
|
|
- <!-- 使用icon -->
|
|
|
- <!-- 待支付 -->
|
|
|
<block>
|
|
|
<div class="icon">
|
|
|
<i class="iconfont icondaizhifu"></i>
|
|
|
</div>
|
|
|
</block>
|
|
|
<view class="wait">待付款</view>
|
|
|
- <!-- 待支付 -->
|
|
|
<block>
|
|
|
<div class="price">
|
|
|
<span>¥</span>
|
|
|
<span class="app-size-36 app-bold">{{ realPrice || '0.00'}}</span>
|
|
|
</div>
|
|
|
<div class="order-num app-color-3">订单号: {{ orderSn || ''}}</div>
|
|
|
- <div v-if="count >0" class="order-num app-color-3" style="margin-top:18rpx;font-size:26rpx;"><span style="font-weight:bold;padding-right:8rpx;">{{count}}</span>秒后订单失效</div>
|
|
|
+ <div v-if="count > miniCount" class="order-num app-color-3" style="margin-top:18rpx;font-size:26rpx;"><span style="font-weight:bold;padding-right:8rpx;">{{count}}</span>秒后失效</div>
|
|
|
<div v-else class="order-num app-color-3" style="margin-top:12rpx;font-size:26rpx;">订单已失效</div>
|
|
|
</block>
|
|
|
<block>
|
|
|
- <div v-if="count >0" class="call-one-btn">
|
|
|
- <button
|
|
|
- class="button-com green pay-wx"
|
|
|
- @click="postponePay"
|
|
|
- v-if="hasDebtPay === '1'"
|
|
|
- >延期支付</button>
|
|
|
- <button
|
|
|
- class="button-com green pay-wx"
|
|
|
- @click="_wxPay"
|
|
|
- v-if="type ==='1' || type === '2'"
|
|
|
- >微信支付</button>
|
|
|
- <button
|
|
|
- class="button-com green pay-wx"
|
|
|
- @click="_balancePay"
|
|
|
- v-if="type === '2'"
|
|
|
- >余额支付</button>
|
|
|
- </div>
|
|
|
- <div v-else class="call-one-btn">
|
|
|
- <button
|
|
|
- class="button-com default pay-wx"
|
|
|
- disabled="true"
|
|
|
- v-if="hasDebtPay === '1'"
|
|
|
- >延期支付</button>
|
|
|
- <button
|
|
|
- class="button-com default pay-wx"
|
|
|
- disabled="true"
|
|
|
- v-if="type ==='1' || type === '2'"
|
|
|
- >微信支付</button>
|
|
|
- <button
|
|
|
- class="button-com default pay-wx"
|
|
|
- disabled="true"
|
|
|
- v-if="type === '2'"
|
|
|
- >余额支付</button>
|
|
|
+ <view class="balance">余额:¥{{balance}}</view>
|
|
|
+ <div class="call-one-btn">
|
|
|
+
|
|
|
+ <view v-if="Number(balance) >= Number(realPrice)">
|
|
|
+ <button class="button-com pay-wx" :class="[count >miniCount ? 'green':'default']" :disabled="count >miniCount ? false : true" v-if="Number(balance) >0" @click="balancePay">余额支付</button>
|
|
|
+ <button class="button-com pay-wx" :class="[count >miniCount ? 'green':'default']" :disabled="count >miniCount ? false : true" @click="_wxPay">微信支付</button>
|
|
|
+ </view>
|
|
|
+ <view v-else>
|
|
|
+ <button class="button-com pay-wx" :class="[count >miniCount ? 'green':'default']" :disabled="count >miniCount ? false : true" @click="_wxPay">微信支付</button>
|
|
|
+ <button class="button-com pay-wx" :class="[count >miniCount ? 'green':'default']" :disabled="count >miniCount ? false : true" v-if="Number(balance) >0" @click="balancePay">余额支付</button>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <button class="button-com pay-wx" :class="[count >miniCount ? 'green':'default']" :disabled="count >miniCount ? false : true" @click="debtPay" v-if="hasDebtPay === '1'">延期支付</button>
|
|
|
+
|
|
|
</div>
|
|
|
+
|
|
|
</block>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 键盘 -->
|
|
|
- <keyboard-module
|
|
|
- :show="keyShow"
|
|
|
- @comfirm="hideKeyFn"
|
|
|
- @clickKey="clickKeyFn"
|
|
|
- :psdShow="true"
|
|
|
- :type="_type"
|
|
|
- @closeKey="closeKeyFn"
|
|
|
- />
|
|
|
+ <keyboard-module :show="keyShow" @comfirm="hideKeyFn" @clickKey="clickKeyFn" :psdShow="true" :type="_type" @closeKey="closeKeyFn" />
|
|
|
<alert-module>
|
|
|
<div class="go-login-module">
|
|
|
<div>请先设置支付密码!</div>
|
|
|
@@ -78,7 +49,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { purchaseClearCreateOrder, purchaseClearWxPay, purchaseBalancePay, purchaseDebtPay, purchaseWxPay } from "@/api/purchase/index";
|
|
|
+import { purchaseBalancePay, purchaseDebtPay, purchaseWxPay } from "@/api/purchase/index";
|
|
|
+import { getCgPayWay } from "@/api/shop/index";
|
|
|
import keyboardModule from './components/keyboard'
|
|
|
import { mapGetters } from "vuex";
|
|
|
import wexinPay from "@/utils/pay/wxPay";
|
|
|
@@ -100,67 +72,81 @@ export default {
|
|
|
realPrice: '',
|
|
|
_type: '1',
|
|
|
pageId: '',
|
|
|
- count:10,
|
|
|
- hasDebtPay:0
|
|
|
+ count:150,
|
|
|
+ hasDebtPay:0,
|
|
|
+ balance:0,
|
|
|
+ miniCount:120
|
|
|
};
|
|
|
},
|
|
|
onLoad (options) {
|
|
|
+ this.id = options.id
|
|
|
this.orderSn = options.orderSn;
|
|
|
this.realPrice = options.realPrice;
|
|
|
- this.type = options.type
|
|
|
- this.hasDebtPay = options.hasDebtPay
|
|
|
- let that = this
|
|
|
- this.count = options.count
|
|
|
- let t =setInterval(function(){
|
|
|
- if(that.count > 0){
|
|
|
- that.count--
|
|
|
- }else{
|
|
|
- clearInterval(t);
|
|
|
- }
|
|
|
- },1000);
|
|
|
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters(["getLoginInfo", 'getDictionariesInfo']),
|
|
|
},
|
|
|
mounted () {
|
|
|
- // this.getWeChat()
|
|
|
},
|
|
|
methods: {
|
|
|
- // 延期支付
|
|
|
- postponePay () {
|
|
|
+ init(){
|
|
|
+ let that = this
|
|
|
+ getCgPayWay({id:this.option.id}).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ that.hasDebtPay = res.data.hasDebtPay
|
|
|
+ that.balance = res.data.balance
|
|
|
+ that.count = res.data.count
|
|
|
+
|
|
|
+ let t =setInterval(function(){
|
|
|
+ if(that.count > 0){
|
|
|
+ that.count--
|
|
|
+ }else{
|
|
|
+ clearInterval(t);
|
|
|
+ }
|
|
|
+ },1000);
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ debtPay () {
|
|
|
let that = this
|
|
|
uni.showModal({
|
|
|
title: '提示',
|
|
|
- content: '确认延期支付?',
|
|
|
+ content: '确认延期?',
|
|
|
success: function (res) {
|
|
|
if (res.confirm) {
|
|
|
- console.log(that.orderSn)
|
|
|
+
|
|
|
+ uni.showLoading({title: '加载中',mask:true})
|
|
|
+
|
|
|
purchaseDebtPay({ orderSn: that.orderSn }).then(res => {
|
|
|
- console.log(res)
|
|
|
- that.pageTo({
|
|
|
- url: '/pagesPurchase/particulars?id=' + res.data.id,
|
|
|
- type: 2
|
|
|
- })
|
|
|
- }).catch(err => { console.log(err) })
|
|
|
+
|
|
|
+ //关闭加载中
|
|
|
+ uni.hideLoading()
|
|
|
+ if(res.code == 1){
|
|
|
+ that.pageTo({
|
|
|
+ url: '/pagesPurchase/particulars?id=' + res.data.id,
|
|
|
+ type: 2
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }).catch(err => { })
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
},
|
|
|
- // getWeChat () {
|
|
|
- // purchaseClearCreateOrder({ id: this.options.id }).then(res => {
|
|
|
- // this.options = res.data
|
|
|
- // this.orderSn = res.data.orderSn
|
|
|
- // }).catch(err => { console.log(err) })
|
|
|
- // },
|
|
|
_wxPay () {
|
|
|
- let Fn = this.type === '1' ? purchaseClearWxPay({ orderSn: this.orderSn }) : this.type === '2' ? purchaseWxPay({ orderSn: this.orderSn }) : null
|
|
|
- Fn.then(res => {
|
|
|
- console.log(res, 128)
|
|
|
- this.pageId = res.data.id
|
|
|
- wexinPay(res.data, this.getSuccess, this.getError)
|
|
|
- }).catch(err => { console.log(err) })
|
|
|
+ uni.showLoading({title: '加载中',mask:true})
|
|
|
+ purchaseWxPay({ orderSn: this.orderSn }).then(res => {
|
|
|
+ uni.hideLoading()
|
|
|
+ if(res.code == 1){
|
|
|
+ this.pageId = res.data.id
|
|
|
+ wexinPay(res.data, this.getSuccess, this.getError)
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+
|
|
|
+ })
|
|
|
},
|
|
|
getSuccess () {
|
|
|
this.pageTo({
|
|
|
@@ -174,8 +160,12 @@ export default {
|
|
|
},
|
|
|
getError () {
|
|
|
},
|
|
|
- _balancePay () {
|
|
|
+ balancePay () {
|
|
|
let self = this
|
|
|
+ if(Number(this.balance) < Number(this.realPrice)){
|
|
|
+ this.$msg('余额不足')
|
|
|
+ return false;
|
|
|
+ }
|
|
|
if (this.getLoginInfo.payPassword) {
|
|
|
self.keyShow = true
|
|
|
} else {
|
|
|
@@ -199,17 +189,22 @@ export default {
|
|
|
},
|
|
|
// 点击了完成
|
|
|
hideKeyFn () {
|
|
|
+ uni.showLoading({title: '加载中',mask:true})
|
|
|
if (this.psdKey.length === 6) {
|
|
|
let data = {
|
|
|
orderSn: this.orderSn,
|
|
|
password: this.psdKey
|
|
|
}
|
|
|
purchaseBalancePay(data).then(res => {
|
|
|
- this.pageTo({
|
|
|
- url: '/pagesPurchase/particulars?id=' + res.data.id,
|
|
|
- type: 2
|
|
|
- })
|
|
|
- }).catch(err => { console.log(err) })
|
|
|
+ //关闭加载中
|
|
|
+ uni.hideLoading()
|
|
|
+ if(res.code == 1){
|
|
|
+ this.pageTo({
|
|
|
+ url: '/pagesPurchase/particulars?id=' + res.data.id,
|
|
|
+ type: 2
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch(err => {})
|
|
|
} else {
|
|
|
this.$msg('请输入六位数支付密码')
|
|
|
}
|
|
|
@@ -222,7 +217,6 @@ export default {
|
|
|
.app-content {
|
|
|
.callback-wrap {
|
|
|
padding-top: 50px;
|
|
|
- // background-image: url("../../src/static/images/callback/bg.png");
|
|
|
background-repeat: no-repeat;
|
|
|
background-size: 100% auto;
|
|
|
position: relative;
|
|
|
@@ -292,4 +286,7 @@ export default {
|
|
|
font-weight: 700;
|
|
|
margin: 20upx 0;
|
|
|
}
|
|
|
-</style>
|
|
|
+.balance{
|
|
|
+ margin-top:20rpx;
|
|
|
+}
|
|
|
+</style>
|