|
|
@@ -1,6 +1,24 @@
|
|
|
<template>
|
|
|
<el-dialog center title="支付订单" :visible.sync="show" width="680px">
|
|
|
<div class="page" v-loading="loading">
|
|
|
+ <div class="coupon" @click="choose(list2)">
|
|
|
+ <div class="coupon-top">
|
|
|
+ <div class="text1">{{ list2.name }}</div>
|
|
|
+ <div class="text2">
|
|
|
+ <span>兑换券编码</span>
|
|
|
+ <span>{{ list2.id }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="coupon-bottom">
|
|
|
+ <span>有效期至:{{ list2.expiration }}</span>
|
|
|
+ <span v-if="!list2.limited">规定商品可用</span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <img v-if="chooseId === list2.id" class="icon" src="../assets/icon_gouxuan_pre.png" alt="" />
|
|
|
+ <img v-else class="icon" src="../assets/icon_gouxuan_huise.png" alt="" />
|
|
|
+ <el-empty v-if="empty" description="暂无兑换券哦~" />
|
|
|
+ </div>
|
|
|
+ <div @click="$router.push('/my')">查看更多</div>
|
|
|
<div class="info">
|
|
|
<div class="price">
|
|
|
<span class="text1">应付金额</span>
|
|
|
@@ -57,12 +75,17 @@
|
|
|
<script>
|
|
|
import vueQrcode from '@chenfengyuan/vue-qrcode';
|
|
|
import resolveUrl from 'resolve-url';
|
|
|
+import pageableTable from '../mixins/pageableTable';
|
|
|
+import { mapState } from 'vuex';
|
|
|
import { add } from 'mathjs';
|
|
|
export default {
|
|
|
+ mixins: [pageableTable],
|
|
|
data() {
|
|
|
return {
|
|
|
show: false,
|
|
|
+ url: '/userCoupon/all',
|
|
|
payMethods: 'WEIXIN',
|
|
|
+ list2: [],
|
|
|
payList: [
|
|
|
{
|
|
|
icon: require('../assets/weixin.png'),
|
|
|
@@ -89,45 +112,53 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- // payUrl() {
|
|
|
- // return resolveUrl('https://nfttest.9space.vip/wx/payOrder/weixin_pc?id=' + this.info.id);
|
|
|
- // },
|
|
|
payUrl() {
|
|
|
- return resolveUrl(this.$baseUrl, 'https://nfttest.9space.vip/payOrder/weixin_pc?id=' + this.id);
|
|
|
+ return resolveUrl(
|
|
|
+ this.$baseUrl,
|
|
|
+ 'https://nfttest.9space.vip/wx/redirect?redirectUrl=https://nfttest.9space.vip/payOrder/weixin_pc?id=' +
|
|
|
+ this.id
|
|
|
+ );
|
|
|
},
|
|
|
- // https://nfttest.9space.vip/wx/redirect?redirectUrl=https://nfttest.9space.vip/payOrder/weixin_pc?id=2006
|
|
|
money() {
|
|
|
- if (this.info.price) {
|
|
|
- return add(this.info.price, this.gas);
|
|
|
- } else {
|
|
|
- return 0;
|
|
|
+ let money = 0;
|
|
|
+ if (this.info.price && !this.couponInfo) {
|
|
|
+ money = this.accAdd(this.info.price, money);
|
|
|
}
|
|
|
- // add(this.info.price, this.gas)
|
|
|
- // if (this.info.price) {
|
|
|
- // return this.info.price.reduce((prev, cur) => {
|
|
|
- // var r1, r2, m;
|
|
|
- // try {
|
|
|
- // r1 = prev.toString().split('.')[1].length;
|
|
|
- // } catch (e) {
|
|
|
- // r1 = 0;
|
|
|
- // }
|
|
|
- // try {
|
|
|
- // r2 = cur.money.toString().split('.')[1].length;
|
|
|
- // } catch (e) {
|
|
|
- // r2 = 0;
|
|
|
- // }
|
|
|
- // m = Math.pow(10, Math.max(r1, r2));
|
|
|
- // return (prev * m + cur.money * m) / m;
|
|
|
- // }, 0);
|
|
|
- // } else {
|
|
|
- // return 0;
|
|
|
- // }
|
|
|
+ if (this.gas && (!this.couponInfo || this.couponInfo.needGas)) {
|
|
|
+ money = this.accAdd(money, this.gas);
|
|
|
+ }
|
|
|
+
|
|
|
+ return money;
|
|
|
+ },
|
|
|
+ ...mapState(['couponInfo'])
|
|
|
+ },
|
|
|
+ beforeRouteLeave(to, from, next) {
|
|
|
+ console.log(to);
|
|
|
+ if (to.path !== '/couponList') {
|
|
|
+ this.$store.commit('setCouponInfo', null);
|
|
|
}
|
|
|
+ next();
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.getData();
|
|
|
},
|
|
|
methods: {
|
|
|
+ beforeData() {
|
|
|
+ return {
|
|
|
+ query: {
|
|
|
+ userId: this.userInfo.id
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ setList(list) {
|
|
|
+ this.list2 = list[0];
|
|
|
+ console.log(this.list2);
|
|
|
+ },
|
|
|
+ choose(info) {
|
|
|
+ this.chooseId = info.id;
|
|
|
+ this.$store.commit('setCouponInfo', info);
|
|
|
+ },
|
|
|
submit() {
|
|
|
- // console.log(this.payUrl);
|
|
|
- // console.log(this.info.id);
|
|
|
// console.log(this.$baseUrl);
|
|
|
// if (this.payMethods === 'DCEP') {
|
|
|
// this.wait();
|
|
|
@@ -135,9 +166,11 @@ export default {
|
|
|
this.$http
|
|
|
.post('/order/create?collectionId=' + this.$route.query.id + '&qty=1')
|
|
|
.then(res => {
|
|
|
- // console.log(res);
|
|
|
- this.id = res.id;
|
|
|
+ console.log(res);
|
|
|
this.status = res.status;
|
|
|
+ this.id = res.id;
|
|
|
+ console.log(this.id);
|
|
|
+ console.log(this.payUrl);
|
|
|
})
|
|
|
.catch(e => {
|
|
|
if (e) {
|
|
|
@@ -237,7 +270,99 @@ export default {
|
|
|
/deep/.el-loading-mask {
|
|
|
background-color: #ffffffee;
|
|
|
}
|
|
|
+.list {
|
|
|
+ padding: 24px 0 50px;
|
|
|
+}
|
|
|
+.coupon {
|
|
|
+ border-radius: 8px;
|
|
|
+ background: linear-gradient(135deg, rgba(253, 251, 96, 1), rgba(255, 143, 62, 1));
|
|
|
+ position: relative;
|
|
|
+ padding: 0 10px;
|
|
|
+ margin: 0 16px 16px;
|
|
|
+ &::after {
|
|
|
+ content: '';
|
|
|
+ position: absolute;
|
|
|
+ top: 1px;
|
|
|
+ right: 1px;
|
|
|
+ left: 1px;
|
|
|
+ bottom: 1px;
|
|
|
+ border-radius: 8px;
|
|
|
+ background-color: #181818;
|
|
|
+ z-index: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ div {
|
|
|
+ position: relative;
|
|
|
+ z-index: 1;
|
|
|
+ }
|
|
|
|
|
|
+ .coupon-top {
|
|
|
+ padding: 16px 0;
|
|
|
+
|
|
|
+ .text1 {
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #939599;
|
|
|
+ line-height: 24px;
|
|
|
+ background: linear-gradient(0deg, #fdfb60 0%, #ff8f3e 100%);
|
|
|
+ -webkit-background-clip: text;
|
|
|
+ -webkit-text-fill-color: transparent;
|
|
|
+ }
|
|
|
+
|
|
|
+ .text2 {
|
|
|
+ padding-top: 6px;
|
|
|
+ font-size: 12px;
|
|
|
+ line-height: 17px;
|
|
|
+ color: #939599;
|
|
|
+ span {
|
|
|
+ &:last-child {
|
|
|
+ color: #fff;
|
|
|
+ margin-left: 6px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .coupon-bottom {
|
|
|
+ border-top: 1px dashed #ebebeb;
|
|
|
+ color: #939599;
|
|
|
+ font-size: 11px;
|
|
|
+ line-height: 17px;
|
|
|
+ padding: 9px 0;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ position: relative;
|
|
|
+ &::before {
|
|
|
+ // content: '' !important;
|
|
|
+ // position: absolute;
|
|
|
+ // background-color: #181818;
|
|
|
+ // width: 16px;
|
|
|
+ // height: 16px;
|
|
|
+ // left: -18px;
|
|
|
+ // top: -8px;
|
|
|
+ // border-radius: 16px;
|
|
|
+ }
|
|
|
+ &::after {
|
|
|
+ // content: '';
|
|
|
+ // position: absolute;
|
|
|
+ // background-color: #181818;
|
|
|
+ // width: 16px;
|
|
|
+ // height: 16px;
|
|
|
+ // right: -18px;
|
|
|
+ // top: -8px;
|
|
|
+ // border-radius: 16px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .icon {
|
|
|
+ position: absolute;
|
|
|
+ width: 24px;
|
|
|
+ height: 24px;
|
|
|
+ right: 10px;
|
|
|
+ top: 30px;
|
|
|
+ z-index: 3;
|
|
|
+ }
|
|
|
+}
|
|
|
/deep/.el-radio {
|
|
|
.flex();
|
|
|
display: inline-flex;
|