|
|
@@ -1,6 +1,13 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <el-dialog center title="支付订单" :visible.sync="show" width="680px" :before-close="handleClose">
|
|
|
+ <el-dialog
|
|
|
+ center
|
|
|
+ title="支付订单"
|
|
|
+ append-to-body
|
|
|
+ :visible.sync="show"
|
|
|
+ width="680px"
|
|
|
+ :before-close="handleClose"
|
|
|
+ >
|
|
|
<div class="border"></div>
|
|
|
<div class="page" v-loading="loading">
|
|
|
<div v-if="list[0]">
|
|
|
@@ -47,11 +54,11 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="border"></div>
|
|
|
- <div class="payMethods">
|
|
|
+ <div class="payType">
|
|
|
<div class="title">选择支付方式</div>
|
|
|
<div class="pay-list">
|
|
|
<div class="pay-info">
|
|
|
- <el-radio-group v-model="payMethods">
|
|
|
+ <el-radio-group v-model="payType">
|
|
|
<el-radio
|
|
|
:disabled="flag"
|
|
|
v-for="item in payList"
|
|
|
@@ -69,13 +76,13 @@
|
|
|
<div v-if="status === 'NOT_PAID'">
|
|
|
<div class="qrcode">
|
|
|
<vue-qrcode
|
|
|
- v-if="payMethods === 'WEIXIN'"
|
|
|
+ v-if="payType === 'WEIXIN'"
|
|
|
:value="payUrl"
|
|
|
:options="{ width: 140, margin: 1 }"
|
|
|
class="code"
|
|
|
></vue-qrcode>
|
|
|
<vue-qrcode
|
|
|
- v-if="payMethods === 'ALIPAY'"
|
|
|
+ v-if="payType === 'ALIPAY'"
|
|
|
:value="payUrl2"
|
|
|
:options="{ width: 140, margin: 1 }"
|
|
|
class="code"
|
|
|
@@ -105,7 +112,7 @@
|
|
|
<el-button type="primary" class="pay" @click="submit">确认</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
- <el-dialog center title="兑换券" :visible.sync="show2" width="680px">
|
|
|
+ <el-dialog center title="兑换券" append-to-body :visible.sync="show2" width="680px">
|
|
|
<div class="border"></div>
|
|
|
<div style="padding: 30px 0 20px 0" class="page">
|
|
|
<div v-for="(item, index) in listAll" :key="index" @click="IdFn(item)">
|
|
|
@@ -156,7 +163,7 @@ export default {
|
|
|
chooseId: '',
|
|
|
org: '',
|
|
|
empty: false,
|
|
|
- payMethods: 'WEIXIN',
|
|
|
+ payType: 'WEIXIN',
|
|
|
flag: false,
|
|
|
minters: 0,
|
|
|
seconds: 0,
|
|
|
@@ -164,16 +171,17 @@ export default {
|
|
|
closeTime: '',
|
|
|
list: [],
|
|
|
listAll: [],
|
|
|
+ payChannel: null,
|
|
|
payList: [
|
|
|
- {
|
|
|
- icon: require('../assets/weixin.png'),
|
|
|
- name: '微信',
|
|
|
- type: 'WEIXIN'
|
|
|
- },
|
|
|
{
|
|
|
icon: require('../assets/alipay.png'),
|
|
|
name: '支付宝',
|
|
|
type: 'ALIPAY'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ icon: require('../assets/weixin.png'),
|
|
|
+ name: '微信',
|
|
|
+ type: 'WEIXIN'
|
|
|
}
|
|
|
|
|
|
// {
|
|
|
@@ -188,7 +196,10 @@ export default {
|
|
|
id: 0,
|
|
|
status: '',
|
|
|
payUrl: '',
|
|
|
- payUrl2: ''
|
|
|
+ payUrl2: '',
|
|
|
+ enable_wx_lite: false,
|
|
|
+ enable_wx_pub: false,
|
|
|
+ orderInfo: {}
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -275,7 +286,9 @@ export default {
|
|
|
'/userCoupon/all',
|
|
|
{
|
|
|
query: {
|
|
|
- userId: this.userInfo.id
|
|
|
+ userId: this.userInfo.id,
|
|
|
+ used: false,
|
|
|
+ projectId: this.$store.state.projectId
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
@@ -283,13 +296,14 @@ export default {
|
|
|
}
|
|
|
)
|
|
|
.then(res => {
|
|
|
- this.list = res.content.filter(item => {
|
|
|
- return !item.used && this.checkTime(item) && this.checkUse(item, this.$route.query.id);
|
|
|
- });
|
|
|
- this.listAll = res.content.filter(item => {
|
|
|
- return !item.used && this.checkTime(item) && this.checkUse(item, this.$route.query.id);
|
|
|
- });
|
|
|
- // console.log(this.listAll);
|
|
|
+ if (!res.empty) {
|
|
|
+ this.list = res.content.filter(item => {
|
|
|
+ return !item.used && this.checkTime(item) && this.checkUse(item, this.$route.query.id);
|
|
|
+ });
|
|
|
+ this.listAll = res.content.filter(item => {
|
|
|
+ return !item.used && this.checkTime(item) && this.checkUse(item, this.$route.query.id);
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
IdFn(e) {
|
|
|
@@ -316,13 +330,26 @@ export default {
|
|
|
this.payTimeout = setInterval(() => {
|
|
|
this.$http.get('/order/get/' + this.id).then(res => {
|
|
|
// console.log(res);
|
|
|
- if (res.status === 'FINISH') {
|
|
|
+ if (res.status === 'PROCESSING' || res.status === 'FINISH' || res.status === 'CANCELLED') {
|
|
|
clearInterval(this.payTimeout);
|
|
|
this.show = false;
|
|
|
this.flag = false;
|
|
|
- setTimeout(() => {
|
|
|
- this.init2();
|
|
|
- }, 1000);
|
|
|
+ this.$confirm(
|
|
|
+ res.status === 'CANCELLED' ? '订单支付失败,点击重新下单' : '订单已支付,点击查看订单详情',
|
|
|
+ '提示',
|
|
|
+ {
|
|
|
+ confirmButtonText: res.status === 'CANCELLED' ? '重新下单' : '查看订单',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ customClass: 'myClass',
|
|
|
+ center: true
|
|
|
+ }
|
|
|
+ ).then(() => {
|
|
|
+ if (res.status === 'CANCELLED') {
|
|
|
+ this.$router.back();
|
|
|
+ } else {
|
|
|
+ this.$router.replace('/collectionorder?orderId=' + res.id);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
}, 1000);
|
|
|
@@ -337,7 +364,7 @@ export default {
|
|
|
},
|
|
|
submit() {
|
|
|
// console.log(this.$baseUrl);
|
|
|
- // if (this.payMethods === 'DCEP') {
|
|
|
+ // if (this.payType === 'DCEP') {
|
|
|
// this.wait();
|
|
|
// }
|
|
|
this.flag = true;
|
|
|
@@ -348,37 +375,44 @@ export default {
|
|
|
this.$http
|
|
|
.post(url)
|
|
|
.then(res => {
|
|
|
+ this.orderInfo = res;
|
|
|
+ if (this.money) {
|
|
|
+ if (this.payType === 'WEIXIN') {
|
|
|
+ return this.$http
|
|
|
+ .get('/payOrder/weixin', {
|
|
|
+ id: res.id
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.payUrl = res.wx_h5_pay_url;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this.payType === 'ALIPAY') {
|
|
|
+ return this.$http
|
|
|
+ .get('/payOrder/alipay_qr', {
|
|
|
+ id: res.id
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ this.payUrl2 = res;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return Promise.resolve();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
if (this.money) {
|
|
|
// 没有兑换券
|
|
|
- this.initTime(res.id, res.createdAt);
|
|
|
- this.status = res.status;
|
|
|
- this.id = res.id;
|
|
|
+ this.initTime(this.orderInfo.id, this.orderInfo.createdAt);
|
|
|
+ this.status = this.orderInfo.status;
|
|
|
+ this.id = this.orderInfo.id;
|
|
|
this.payWatch();
|
|
|
} else {
|
|
|
// 兑换券
|
|
|
this.$message.success('支付成功');
|
|
|
setTimeout(() => {
|
|
|
- this.$router.replace('/collectionorder');
|
|
|
+ this.$router.replace('/collectionorder?orderId=' + this.orderInfo.id);
|
|
|
}, 1000);
|
|
|
}
|
|
|
- if (this.payMethods === 'WEIXIN') {
|
|
|
- this.$http
|
|
|
- .get('/payOrder/weixin', {
|
|
|
- id: res.id
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- this.payUrl = res.wx_h5_pay_url;
|
|
|
- });
|
|
|
- }
|
|
|
- if (this.payMethods === 'ALIPAY') {
|
|
|
- this.$http
|
|
|
- .get('/payOrder/alipay_qr', {
|
|
|
- id: res.id
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- this.payUrl2 = res;
|
|
|
- });
|
|
|
- }
|
|
|
})
|
|
|
.catch(e => {
|
|
|
if (e) {
|
|
|
@@ -397,6 +431,20 @@ export default {
|
|
|
})
|
|
|
.then(res => {
|
|
|
this.gas = res.value;
|
|
|
+ return this.$http.get('/sysConfig/get/enable_wx_lite').then(res => {
|
|
|
+ this.enable_wx_lite = res.value === '1';
|
|
|
+ return Promise.resolve();
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ if (!(this.enable_wx_lite || this.enable_wx_pub)) {
|
|
|
+ this.payList.splice(1, 1);
|
|
|
+ this.payType = 'ALIPAY';
|
|
|
+ } else if (this.enable_wx_pub) {
|
|
|
+ this.payChannel = 'wx_pub';
|
|
|
+ } else {
|
|
|
+ this.payChannel = 'wx_lite';
|
|
|
+ }
|
|
|
this.loading = false;
|
|
|
})
|
|
|
.catch(e => {
|
|
|
@@ -426,7 +474,7 @@ export default {
|
|
|
padding: 4px 20px 0;
|
|
|
}
|
|
|
/deep/ .el-radio__inner {
|
|
|
- background-color: #fff !important;
|
|
|
+ background-color: #fff;
|
|
|
}
|
|
|
.border {
|
|
|
height: 1px;
|
|
|
@@ -536,15 +584,13 @@ export default {
|
|
|
.text1 {
|
|
|
text-align: center;
|
|
|
font-size: 24px;
|
|
|
- font-family: PingFangSC-Medium, PingFang SC;
|
|
|
font-weight: bold;
|
|
|
- color: #1a1a1a;
|
|
|
+ color: #fff;
|
|
|
line-height: 36px;
|
|
|
}
|
|
|
.text2 {
|
|
|
font-size: 12px;
|
|
|
- font-weight: 400;
|
|
|
- color: #1a1a1a;
|
|
|
+ color: #fff;
|
|
|
line-height: 22px;
|
|
|
text-align: center;
|
|
|
}
|
|
|
@@ -628,8 +674,8 @@ export default {
|
|
|
}
|
|
|
|
|
|
&.is-checked {
|
|
|
- .el-radio__inner {
|
|
|
- background-image: linear-gradient(135deg, @prim 20%, @warn 100%);
|
|
|
+ .el-radio.is-checked .el-radio__inner {
|
|
|
+ background-color: @prim!important;
|
|
|
border-width: 0;
|
|
|
}
|
|
|
}
|
|
|
@@ -637,7 +683,7 @@ export default {
|
|
|
&.is-checked {
|
|
|
background: rgba(253, 251, 96, 0.12);
|
|
|
border-radius: 4px;
|
|
|
- border: 1px solid #ff4f50;
|
|
|
+ border: 1px solid @prim;
|
|
|
// .line(@bg:#E0FFF8,@radius:4px);
|
|
|
// border-width: 0;
|
|
|
.el-radio__label {
|
|
|
@@ -651,7 +697,7 @@ export default {
|
|
|
line-height: 24px;
|
|
|
padding-bottom: 20px;
|
|
|
}
|
|
|
-.payMethods {
|
|
|
+.payType {
|
|
|
padding: 30px 0;
|
|
|
}
|
|
|
/deep/.el-radio.is-bordered + .el-radio.is-bordered {
|
|
|
@@ -673,13 +719,9 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
.pay {
|
|
|
- background-image: linear-gradient(135deg, @prim, @warn);
|
|
|
- border-width: 0;
|
|
|
+ // background-image: linear-gradient(135deg, @prim, @warn);
|
|
|
+ // border-width: 0;
|
|
|
width: 200px;
|
|
|
- color: #000;
|
|
|
- &:hover {
|
|
|
- background-image: linear-gradient(135deg, darken(@prim, 20), darken(@warn, 20));
|
|
|
- }
|
|
|
}
|
|
|
.qrcode {
|
|
|
width: 160px;
|