pay.vue
7.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<template>
<div class="zj-main">
<mt-header title="订单结算">
<span @click="gotoback" slot="left">
<mt-button icon="back"></mt-button>
</span>
</mt-header>
<div class="zj-pay-mid">
<div class="pay-top">
<div class="left cell">
<img src="../../static/images/defaultface.png" v-if="pushOrder.buyerAvatar==''"/>
<img :src="pushOrder.buyerAvatar" v-else/>
</div>
<div class="right cell">
<p>{{pushOrder.buyerNickName}}</p>
<p class="samllerfont">会员ID:{{pushOrder.custId}}</p>
<p>{{pushOrder.siteUnitName}}:{{pushOrder.custPoints}}</p>
</div>
</div>
<div class="pay-mid">
<div class="typer">
<p class="order-cell-p">需支付:<span class="purple">{{pushOrder.orderPoints}}{{pushOrder.siteUnitName}} <em
v-if="pushOrder.orderMoney!=''&&pushOrder.orderMoney!=0">+
¥{{pushOrder.orderMoney}}</em></span></p>
</div>
</div>
<!--有人民币支付时显示-->
<div class="pay-bot" v-if="pushOrder.orderMoney!=''&&pushOrder.orderMoney!=0">
<div class="typer" style="border-bottom:1px solid #eee">人民币支付方式</div>
<div class="typer">
<template v-for="(item,index) in pushOrder.payWay">
<!--微信支付--->
<label class="order-cell-p mint-radiolist-label" @click.self="selectedlabel(index,item)"
v-if="item=='wx'">
<img src="../../static/images/weixing.svg" style="width:0.5rem;margin-right:5px;"/>微信支付<em
style="color:#ff0000">(系统推荐)</em>
<span class="mint-radio">
<input class="mint-radio-input" type="radio" :value="item.buyerAddressId"
checked="checked">
<span class="mint-radio-core"></span>
</span>
</label>
<!--支付宝支付--->
<label class="order-cell-p mint-radiolist-label" @click.self="selectedlabel(index,item)"
v-if="item=='zfb'&&browsertyper!='weixing'">
<img src="../../static/images/zfb.svg" style="width:0.5rem;margin-right:5px;"/>支付宝支付
<span class="mint-radio">
<input class="mint-radio-input" type="radio" :value="item.buyerAddressId">
<span class="mint-radio-core"></span>
</span>
</label>
</template>
</div>
</div>
<div class="returnGood-ps" style="padding:0 0.2rem">温馨提示:未支付的订单将于{{downTime}}分钟后自动取消</div>
<div class="pay-button">
<mt-button size="large" class="system-btn" @click.native="pay"
v-if="pushOrder.custPoints>pushOrder.orderPoints" v-show="downTime>0">确认付款
</mt-button>
<mt-button size="large" class="disabled-btn" @click.native="pay" disabled
v-if="pushOrder.custPoints>pushOrder.orderPoints" v-show="downTime<=0">确认付款
</mt-button>
<mt-button size="large" v-else disabled class="disabled-btn">{{pushOrder.siteUnitName}}不足</mt-button>
</div>
</div>
</div>
</template>
<script type="text/ecmascript-6">
import orderAddressItem from '../address/orderAddressItem.vue';
import orderGoodsItem from '../order/orderGoodsItem.vue';
import {MessageBox, Actionsheet} from 'mint-ui';
import {countDown} from '../../utils/commonUtil';
import {getpushOrder, postpayOrder} from '../../vuex/actions';
export default{
data(){
return {
paymentType: 'wx',//支付方式
browsertyper: '',//浏览器类型
downTime: ''//倒计时
}
},
components: {
orderAddressItem,
orderGoodsItem
},
computed: {},
methods: {
gotoback(){
var self = this;
MessageBox.confirm('未支付订单' + self.downTime + '分钟后将被取消,确认离开?').then(action => {
this.$router.go(-1)
});
},
orderValidTime(){
var self = this;
this.downTime = (this.pushOrder.orderValidTime / 60);
function timeCount() {
self.downTime = self.downTime - 1;
if (self.downTime == 0) {
window.clearInterval(interavl);
}
}
var interavl = setInterval(timeCount, 60000);
},
selectedlabel(index, type){
var self = this;
$(".mint-radio-input").removeAttr("checked");
$(".mint-radio-label").removeClass("colorpurple");
$(".mint-radio-input").eq(index).attr("checked", "checked");
$(".mint-radio-label").eq(index).addClass("colorpurple");
this.paymentType = type;
},
pay(){
var self = this;
var payType;
if (this.paymentType == 'wx') {
if (this.browsertyper != 'pc') {
payType = 'weixin';
} else {
payType = 'weixin_code';
}
} else {
if (this.browsertyper != 'pc') {
payType = 'wapalipay';
} else {
payType = 'alipay';
}
}
var data = {
order_code: this.$route.params.orderId,
payment_type: payType,
show_url: '/orderDetail/orderId/' + this.$route.params.orderId,
order_create_time: this.pushOrder.orderTime,
order_money: this.pushOrder.orderMoney
};
this.postpayOrder(data)
}
},
vuex: {
getters: {
pushOrder: ({orderData}) => {
return orderData.pushOrder;
},
},
actions: {
getpushOrder,
postpayOrder
}
},
beforeRouteEnter (to, from, next){
next(vm => {
vm.browsertyper = window.BROWSERTYPER
vm.getpushOrder(vm.$route.params.orderId).then(function () {
vm.orderValidTime();
});
});
},
beforeRouteLeave (to, from, next){
next()
}
}
</script>