coupon.vue
7.19 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<template>
<div v-show="loadFlag">
<img :src="imgurl" alt="" style="margin: 10px auto;width: 64px;height: 64px;">
<div style="padding: 10px 30px 50px">
<p>尊敬的车主您好:{{ tipText }}</p>
</div>
<div style="padding: 0 20px">
<mt-button size="large" type="primary" @click="toPay" style="margin-bottom: 20px;" v-show="payFlag"
:disabled="disabledFlag">
{{btnText}}
</mt-button>
<!--<mt-button size="large" type="danger" @click="toBackPage">返回</mt-button>-->
</div>
</div>
</template>
<script>
import {
scanCouponQR,
queryParkingRecordPageByCarNumbers,
appApplyParkOut,
parkingQuery
} from "@/api/couponPay/couponPay.js";
export default {
name: "coupon",
data() {
return {
imgurl: require("../../assets/images/successIcon.png"),
successiconUrl: require("../../assets/images/successIcon.png"),
loseiconUrl: require("../../assets/images/loseIcon.png"),
carNum: "",
carNumberColor: "",
parkingData: [],
carType: "",
codeType: "",
tipText: "",
payFlag: true,
couponsType: 1,// 1:按次优惠,2:按时优惠,3:折扣优惠(打折),4:满减优惠'
cardRuleName: "",
loadFlag: false, //
disabledFlag: false,
btnText: "去查询停车费用"
};
},
created() {
this.carNum = this.$route.query.carNumber;
this.carType = this.$route.query.carType;
this.codeType = this.$route.query.codeType;
this.cardRelParkNo = this.$route.query.cardRelParkNo;
// this.carNum = this.$route.query.carNumber // 获取车牌号
// this.carNumberColor = this.$route.query.carNumberColor // 获取颜色 0:蓝牌;1:黄牌;2:白牌;3:黑牌;4:绿色
// this.currentTabActive = this.$route.query.parkFlag ? this.$route.query.parkFlag : 0
// console.log(this.currentTabActive)
// console.log(this.carNumber)
this.scanCouponQR()
},
methods: {
scanCouponQR() {
let url = process.env.VUE_APP_API;
console.log(url);
var salt = this.$utils.myCommonSalt(32);
var jsondata = {
app_id: this.$utils.myVarAppid,
deviceInfo: this.$utils.myDeviceInfo,
salt: salt,
sign_type: "md5",
carType: "2",
codeType: this.codeType,
cardRelParkNo: this.cardRelParkNo,
key: this.$route.query.key,
encryptTime: this.$route.query.encryptTime,
carNum: this.carNum,
// carNumberColor: this.carNumberColor,
orgId: this.$utils.myOrgId,
terminalSource: "7"
// token:'e2c1e43722dd43a5b7e268001b39e6f0'
};
jsondata.sign = this.$utils.signObject(jsondata);
console.log(jsondata);
scanCouponQR(url, jsondata).then(response => {
console.log(response);
if (response.code == 0) {
this.payFlag = true;
this.imgurl = this.successiconUrl;
this.tipText = "领取优惠券成功";
this.cardRuleName = response.data.cardRuleName;
this.couponsType = response.data.cardType;
console.log(this.couponsType);
} else {
this.payFlag = false;
this.imgurl = this.loseiconUrl;
this.tipText = response.message;
}
setTimeout(() => {
this.loadFlag = true;
}, 300);
// this.tipText =
});
},
toPay() {
let url = `https://park.jycrtc.com/wxgzh/xp/index.html#/parkRecord?carNumber=${this.carNum}&carNumberColor=${this.$route.query.carNumberColor}`
window.location.href = url
// window.location = ''
// this.parkRecordList();
// this.$router.push({
// path: 'couponPay'
// })
},
toBackPage() {
this.$router.back();
},
parkRecordList() { // 获取停车记录数据
this.disabledFlag = true
this.btnText = "查询中,请等待"
let url = process.env.VUE_APP_PAYAPI;
var salt = this.$utils.myCommonSalt(32);
var jsondata = {
app_id: this.$utils.myVarAppid,
deviceInfo: this.$utils.myDeviceInfo,
salt: salt,
sign_type: "md5",
pageNum: "1",
pageSize: "1000",
parkState: "10",
terminalSource: "7",
// parkState:'10',
carNumber: this.carNum,
// carNumberColor: '1',
orgId: this.$utils.myOrgId
};
jsondata.sign = this.$utils.signObject(jsondata);
// jsondata.sign = md5sign
console.log("停车记录传参 " + JSON.stringify(jsondata));
queryParkingRecordPageByCarNumbers(url, jsondata).then(response => {
console.log(response);
this.disabledFlag = false
this.btnText = "去查询停车费用"
// this.parkList = response.data.dataList
this.parkingData = response.data.dataList.filter(item => {
return item.parkState == "10";
});
console.log(this.parkingData);
this.toPayCurrent(this.parkingData);
});
},
toPayCurrent(i) { // 缴纳本次在停费用
let url = process.env.VUE_APP_PAYAPI;
var salt = this.$utils.myCommonSalt(32);
var params = {
app_id: this.$utils.myVarAppid,
deviceInfo: this.$utils.myDeviceInfo,
salt: salt,
sign_type: "md5",
orderId: i[0].orderId,
payOrderType: "101",
terminalSource: "7"
};
params.sign = this.$utils.signObject(params);
appApplyParkOut(url, params).then(response => {
console.log(response);
if (response.code == "5005") {
var salt = this.$utils.myCommonSalt(32);
var jsondata = {
app_id: this.$utils.myVarAppid,
deviceInfo: this.$utils.myDeviceInfo,
salt: salt,
sign_type: "md5",
payType: this.$utils.clientBrowsePayType(),
appId: this.$utils.myVxAppId,
orderId: i[0].orderId,
terminalSource: "7",
parkCode: i[0].parkCode,
carNumber: this.carNum
};
jsondata.sign = this.$utils.signObject(jsondata);
parkingQuery(url, jsondata).then(result => {
console.log(result);
let res = result.data;
let _dis = res.discountFee;
let discountFee = _dis.slice(1, _dis.length - 1);
sessionStorage.setItem("couponPark", JSON.stringify(result.data));
this.$router.push(
{
path: "couponPay",
query: {
carColor: this.carColor,// 车牌颜色
arrearageTotalFee: res.orderTotalFee,// 应收
arrearageDiscFee: discountFee * 100,// 优惠
arrearageActFee: res.orderFee,// 实收
carNumber: this.carNumber, // 车牌
paySrcType: 101, //支付的类型 101 是本次 103是历史欠费
ordeID: i.orderId, //支付的订单号
appOrderTimeout: res.appOrderTimeout, // 超时描述
couponsType: this.couponsType
}
}
);
});
} else {
//$('.dialog-out').show()
this.$msgbox("提示", "成功领取" + this.cardRuleName + ",离场时自动抵扣");
}
});
}
}
};
</script>
<style scoped>
</style>