Commit 89d61651f58747add150858c63e006730763c6ca
1 parent
cc310148
西城购买月卡
Showing
8 changed files
with
295 additions
and
80 deletions
config/index.js
... | ... | @@ -8,7 +8,7 @@ module.exports = { |
8 | 8 | dev: { |
9 | 9 | |
10 | 10 | // Paths |
11 | - assetsSubDirectory: 'static', | |
11 | + assetsSubDirectory: 'yueka', | |
12 | 12 | assetsPublicPath: '/', |
13 | 13 | // proxyTable: { |
14 | 14 | // '/api':{ |
... | ... | @@ -47,11 +47,11 @@ module.exports = { |
47 | 47 | |
48 | 48 | build: { |
49 | 49 | // Template for index.html |
50 | - index: path.resolve(__dirname, '../dist/index.html'), | |
50 | + index: path.resolve(__dirname, '../yueka/yueka.html'), | |
51 | 51 | |
52 | 52 | // Paths |
53 | - assetsRoot: path.resolve(__dirname, '../dist'), | |
54 | - assetsSubDirectory: 'static', | |
53 | + assetsRoot: path.resolve(__dirname, '../yueka'), | |
54 | + assetsSubDirectory: 'yueka', | |
55 | 55 | assetsPublicPath: './', |
56 | 56 | |
57 | 57 | /** | ... | ... |
index.html
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> |
9 | 9 | <meta http-equiv="Pragma" content="no-cache" /> |
10 | 10 | <meta http-equiv="Expires" content="0" /> |
11 | - <title>微信公众号</title> | |
11 | + <title>购买会员卡</title> | |
12 | 12 | </head> |
13 | 13 | <body> |
14 | 14 | <div id="app"></div> | ... | ... |
src/api/cards/cards.js
... | ... | @@ -115,6 +115,29 @@ export function createVipCardOrderForH5(params) { |
115 | 115 | |
116 | 116 | |
117 | 117 | |
118 | +// 创建订单 购买月卡 | |
119 | +export function publicUnifiedOrderForH5(params) { | |
120 | + return request({ | |
121 | + url: '/weixinpay/publicUnifiedOrderForH5', | |
122 | + method: 'post', | |
123 | + data: params | |
124 | + }) | |
125 | +} | |
126 | + | |
127 | + | |
128 | + | |
129 | + | |
130 | +// 获取OpenId | |
131 | +export function getOpenIdByCode(params) { | |
132 | + return request({ | |
133 | + url: 'weixinPublicPay/getOpenIdByCode', | |
134 | + method: 'post', | |
135 | + data: params | |
136 | + }) | |
137 | +} | |
138 | + | |
139 | + | |
140 | + | |
118 | 141 | |
119 | 142 | |
120 | 143 | ... | ... |
src/utils/utils.js
... | ... | @@ -154,15 +154,15 @@ export default { |
154 | 154 | // 14318527b13840c2a4af63fef52c2d6e 老的签名 |
155 | 155 | // ud8yq5tv0inxupc05xfeau39jywlqoj2 新的id |
156 | 156 | // ny1u72b6k374sg379z0kqjgfxe2ycnpw 新的签名 |
157 | - myVarAppid: "65grtq5tv0wewec05xfeau39jyghhjm",// 公共请求Appid | |
157 | + myVarAppid: "ud8yq5tv0inxupc05xfeau39jywlqoj2",// 公共请求Appid | |
158 | 158 | myDeviceInfo: "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E", // 公共请求设备信息 80ac1a4218beb19a BC0703A4-AFB0-4B51-9089-9B7487C0CC6E |
159 | - myVxAppId: "wx1e9001e5940605b1", | |
159 | + myVxAppId: "wx78702b90dadb9586", | |
160 | 160 | // 测试环境 微信赤峰 appid wxff4cebaedbf4f886 |
161 | 161 | // 微信赤峰 appid wx2af2bab90d433c86 |
162 | 162 | // 黄石 appid wxa1a66cc7d263afe6 |
163 | 163 | // 阳明 wxdfb0276f85514ea3 |
164 | 164 | // 无锡 wx1e9001e5940605b1 |
165 | - myOrgId: "10003", // 归属地 赤峰id 10003 黄石 10079 无锡10005 扬明10193 西城10007 | |
165 | + myOrgId: "10007", // 归属地 赤峰id 10003 黄石 10079 无锡10005 扬明10193 西城10007 | |
166 | 166 | myGetSign: function(objb) { // 获取签名 |
167 | 167 | var compare = function(obj1, obj2) { |
168 | 168 | var val1 = obj1.keyname; |
... | ... | @@ -176,13 +176,13 @@ export default { |
176 | 176 | } |
177 | 177 | }; |
178 | 178 | objb.sort(compare); |
179 | - var strmd5 = "dfdf2b6k37r5y79z0kqjgfxe2wet3434"; | |
179 | + var strmd5 = "ny1u72b6k374sg379z0kqjgfxe2ycnpw"; | |
180 | 180 | for (var i = 0; i < objb.length; i++) { |
181 | 181 | if (objb[i].value != null && objb[i].value != "") { |
182 | 182 | strmd5 += objb[i].keyname + objb[i].value; |
183 | 183 | } |
184 | 184 | } |
185 | - strmd5 += "dfdf2b6k37r5y79z0kqjgfxe2wet3434"; | |
185 | + strmd5 += "ny1u72b6k374sg379z0kqjgfxe2ycnpw"; | |
186 | 186 | // console.log('strmd5-------->'+strmd5); |
187 | 187 | strmd5 = md5(strmd5); |
188 | 188 | strmd5 = strmd5.toUpperCase(); | ... | ... |
src/views/cards/Cards.vue
... | ... | @@ -56,7 +56,8 @@ export default { |
56 | 56 | name: "Cards", |
57 | 57 | data() { |
58 | 58 | return { |
59 | - cardList: [] | |
59 | + cardList: [], | |
60 | + custId:'' | |
60 | 61 | }; |
61 | 62 | }, |
62 | 63 | mounted() { |
... | ... | @@ -73,7 +74,10 @@ export default { |
73 | 74 | queryVipCardsByCarNumberForH5(jsondata).then(data => { |
74 | 75 | console.log(data); |
75 | 76 | if (data.code == 0) { |
76 | - | |
77 | + this.cardList = data.data | |
78 | + if(this.cardList.length>0){ | |
79 | + this.custId = this.cardList[0].custId | |
80 | + } | |
77 | 81 | } else { |
78 | 82 | this.$vux.toast.text(data.message, "top"); |
79 | 83 | } |
... | ... | @@ -105,7 +109,8 @@ export default { |
105 | 109 | path:'buyCard', |
106 | 110 | query:{ |
107 | 111 | carNumber:this.$route.query.carNumber, |
108 | - carNumberColor: this.$route.query.carNumberColor | |
112 | + carNumberColor: this.$route.query.carNumberColor, | |
113 | + custId:this.custId | |
109 | 114 | } |
110 | 115 | }) |
111 | 116 | } | ... | ... |
src/views/cards/buyCard.vue
... | ... | @@ -89,13 +89,13 @@ |
89 | 89 | |
90 | 90 | <!--<p>停车场停车场停车停车场</p>--> |
91 | 91 | <!--</div>--> |
92 | - <div style="padding:15px;text-align: center"> | |
93 | - <check-icon :value.sync="agreement"> | |
94 | - </check-icon> | |
95 | - <p style="display: inline-block;height: 23px;line-height: 23px;">我已阅读并同意 <span style="color: blue" | |
96 | - @click="showHideOnBlur=true">《购买须知》</span> | |
97 | - </p> | |
98 | - </div> | |
92 | + <!--<div style="padding:15px;text-align: center">--> | |
93 | + <!--<check-icon :value.sync="agreement">--> | |
94 | + <!--</check-icon>--> | |
95 | + <!--<p style="display: inline-block;height: 23px;line-height: 23px;">我已阅读并同意 <span style="color: blue"--> | |
96 | + <!--@click="showHideOnBlur=true">《购买须知》</span>--> | |
97 | + <!--</p>--> | |
98 | + <!--</div>--> | |
99 | 99 | |
100 | 100 | |
101 | 101 | <div style="margin-top: 34px" class="leftRightPadding"> |
... | ... | @@ -181,7 +181,9 @@ import { |
181 | 181 | weixinpay, |
182 | 182 | createVipCardOrder, |
183 | 183 | queryVipCardInfoByPlNoForH5, |
184 | - createVipCardOrderForH5 | |
184 | + createVipCardOrderForH5, | |
185 | + publicUnifiedOrderForH5, | |
186 | + getOpenIdByCode | |
185 | 187 | } from "@/api/cards/cards"; |
186 | 188 | import { timestampToTime } from "../../utils/utils.js"; |
187 | 189 | export default { |
... | ... | @@ -217,12 +219,21 @@ export default { |
217 | 219 | typeNum: 4, // 卡类型判断 |
218 | 220 | showHideOnBlur: false, // 购买协议 |
219 | 221 | createVipCardOrder: {}, // 创建订单对象 |
220 | - orderId: "" // 订单号 | |
222 | + orderId: "", // 订单号 | |
223 | + vipCardList: {}, | |
224 | + openid: "", | |
225 | + custId: "" | |
221 | 226 | }; |
222 | 227 | }, |
228 | + created() { | |
229 | + if (this.$utils.clientBrowser() == "微信") { | |
230 | + this.webAppCode = this.getCode(); | |
231 | + } | |
232 | + }, | |
223 | 233 | mounted() { |
224 | 234 | this.queryParkListForVipCard(); // 获取停车场 |
225 | 235 | // this.queryUserCars(); // 获取用户车牌 |
236 | + this.custId = this.$route.query.custId | |
226 | 237 | }, |
227 | 238 | computed: { |
228 | 239 | // 卡类型 1-年卡;2-半年卡;3-季卡;4-月卡;5-日卡; |
... | ... | @@ -261,6 +272,23 @@ export default { |
261 | 272 | } |
262 | 273 | }, |
263 | 274 | methods: { |
275 | + // 获取code | |
276 | + getCode() { | |
277 | + var appID = this.$utils.myVxAppId; | |
278 | + var code = this.getUrlParam("code"); | |
279 | + var local = window.location.href; | |
280 | + if (code == null || code === "") { | |
281 | + window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appID + "&redirect_uri=" + encodeURIComponent(local) + "&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect"; | |
282 | + } else { | |
283 | + return code; | |
284 | + } | |
285 | + }, | |
286 | + getUrlParam(name) { | |
287 | + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); | |
288 | + var r = window.location.search.substr(1).match(reg); | |
289 | + if (r != null) return unescape(r[2]); | |
290 | + return null; | |
291 | + }, | |
264 | 292 | // 获取用户绑定车牌 |
265 | 293 | queryUserCars() { |
266 | 294 | let jsondata = this.$utils.commonParams(); |
... | ... | @@ -336,15 +364,16 @@ export default { |
336 | 364 | jsondata.plNo = this.parkNo; |
337 | 365 | jsondata.cardType = "4"; |
338 | 366 | // jsondata.parkName = this.parkName; |
339 | - | |
340 | 367 | jsondata.sign = this.$utils.signObject(jsondata); |
341 | 368 | queryVipCardInfoByPlNoForH5(jsondata).then(data => { |
342 | 369 | console.log(data); |
343 | 370 | if (data.code == 0) { |
344 | - | |
345 | - me.unitPrice = data.data.vipCardList[0].price | |
346 | - | |
347 | - | |
371 | + this.vipCardList = data.data.vipCardList[0]; | |
372 | + me.unitPrice = data.data.vipCardList[0].price; | |
373 | + console.log(data.data.vipCardList[0].discValue / 10); | |
374 | + console.log(me.unitPrice * data.data.vipCardList[0].discValue); | |
375 | + me.disPrice = me.unitPrice - me.unitPrice * (data.data.vipCardList[0].discValue / 10); | |
376 | + me.needPay = me.unitPrice * (data.data.vipCardList[0].discValue / 10); | |
348 | 377 | // me.cardTypeList = []; |
349 | 378 | // me.carType = "请点击选择"; |
350 | 379 | // // res.vipCardList = |
... | ... | @@ -367,8 +396,6 @@ export default { |
367 | 396 | // me.typeNum = vipCardList[0].cardType; |
368 | 397 | // me.createVipCardOrder = e; |
369 | 398 | // } |
370 | - } else { | |
371 | - this.$vux.toast.text(data.message, "top"); | |
372 | 399 | } |
373 | 400 | }); |
374 | 401 | }, |
... | ... | @@ -431,22 +458,59 @@ export default { |
431 | 458 | // this.$vux.toast.text("请选择车牌", "top"); |
432 | 459 | // return; |
433 | 460 | // } |
434 | - if (!this.agreement) { | |
435 | - this.$vux.toast.text("请同意购买须知", "top"); | |
436 | - return; | |
437 | - } | |
461 | + // if (!this.agreement) { | |
462 | + // this.$vux.toast.text("请同意购买须知", "top"); | |
463 | + // return; | |
464 | + // } | |
438 | 465 | // this.createOrder(); |
439 | - this.createVipCardOrderForH5() | |
466 | + this.getopenid(); | |
467 | + | |
468 | + }, | |
469 | + // 获取openid | |
470 | + getopenid() { | |
471 | + let jsondata = { | |
472 | + appId: this.$utils.myVxAppId, | |
473 | + code: this.webAppCode | |
474 | + }; | |
475 | + getOpenIdByCode(jsondata).then(data => { | |
476 | + console.log(data); | |
477 | + if (data.code == "0") { | |
478 | + this.openid = data.data; | |
479 | + this.createVipCardOrderForH5(); | |
480 | + } else { | |
481 | + this.$vux.toast.text(data.message, "top"); | |
482 | + } | |
483 | + }); | |
440 | 484 | }, |
441 | - createVipCardOrderForH5(){ | |
485 | + createVipCardOrderForH5() { | |
442 | 486 | let jsondata = this.$utils.commonParams(); |
443 | - jsondata.carNumber = this.$route.query.carNumber | |
444 | - jsondata.custId = '' | |
487 | + jsondata.carNumber = this.$route.query.carNumber; | |
488 | + jsondata.custId = this.custId; | |
489 | + jsondata.optType = "1"; | |
490 | + jsondata.cardCouponsId = ""; | |
491 | + jsondata.terminalSource = "3"; | |
492 | + jsondata.plNo = this.parkNo; // 停车场id | |
493 | + jsondata.discountAmount = this.disPrice; | |
494 | + jsondata.cardNo = this.vipCardList.cardNo; // 卡券编码 | |
495 | + jsondata.cardType = (this.vipCardList.cardType).toString(); // 卡类型 | |
496 | + jsondata.carType = (this.vipCardList.carType).toString(); // 1-大型车;2-小型车 | |
497 | + // jsondata.plNo = this.createVipCardOrder.id; // 1-大型车;2-小型车 | |
498 | + jsondata.price = (this.vipCardList.price).toString(); // 卡单价 | |
499 | + jsondata.totalAmount = (this.needPay).toString(); // 购买的总金额 | |
500 | + jsondata.num = this.cardNum; // 购买数量 | |
501 | + jsondata.effDate = this.$utils.timestampToTime(this.startData); // 生效时间 | |
502 | + jsondata.expDate = this.$utils.timestampToTime(this.endDate); // 失效时间 | |
503 | + // jsondata.carNumber = this.carNumber; // 卡适用车牌 | |
504 | + jsondata.optType = "1"; // 操作类型 1 购买 2 续费 | |
445 | 505 | jsondata.sign = this.$utils.signObject(jsondata); |
446 | 506 | createVipCardOrderForH5(jsondata).then(data => { |
447 | 507 | console.log(data); |
448 | 508 | if (data.code == 0) { |
449 | 509 | |
510 | + // orderId | |
511 | + let orderId = data.data.orderId; | |
512 | + this.custId = data.data.custId; | |
513 | + this.publicUnifiedOrderForH5(orderId); | |
450 | 514 | } else { |
451 | 515 | this.$vux.toast.text(data.message, "top"); |
452 | 516 | } |
... | ... | @@ -469,31 +533,35 @@ export default { |
469 | 533 | jsondata.carNumber = this.carNumber; // 卡适用车牌 |
470 | 534 | jsondata.optType = "1"; // 操作类型 1 购买 2 续费 |
471 | 535 | jsondata.forceBuy = "1"; |
536 | + | |
472 | 537 | jsondata.sign = this.$utils.signObject(jsondata); |
473 | 538 | createVipCardOrder(jsondata).then(data => { |
474 | 539 | console.log(data); |
475 | 540 | // orderId |
476 | 541 | if (data.code == 0) { |
477 | 542 | this.orderId = data.data.orderId; |
478 | - this.vxPay(); | |
543 | + this.vxPay(orderId); | |
479 | 544 | } else { |
480 | 545 | this.$vux.toast.text(data.message, "top"); |
481 | 546 | } |
482 | 547 | }); |
483 | 548 | }, |
484 | - vxPay() { | |
549 | + publicUnifiedOrderForH5(orderId) { | |
485 | 550 | let vm = this; |
486 | 551 | let jsondata = this.$utils.commonParams(); |
487 | - jsondata.orderId = this.orderId; // 订单号 | |
488 | - jsondata.payType = "4"; // 支付方式-- 1:支付宝 2:微信 3:银联. | |
489 | - jsondata.paySrcType = "301"; // 支付单来源 101:停车付款单 102:停车预付单 103:停车补缴单 104 共享车位 201 余额充值单 202 押金充值单 301 会员卡购买单 302 会员卡续费 | |
552 | + jsondata.orderId = orderId; // 订单号 | |
553 | + jsondata.payType = "4"; // /** 支付方式-- 1:支付宝 2:微信 3:银联 4:微信公众号 5 个人账户. */ | |
554 | + jsondata.openId = this.openid | |
555 | + jsondata.paySrcType = "301"; // //支付单来源 101:停车付款单 102:停车预付单 103:停车补缴单 104 共享车位 201 余额充值单 202 押金充值单 301 会员卡购买单 302 会员卡续费 | |
490 | 556 | jsondata.appId = this.$utils.myVxAppId; // 微信标识符 |
491 | 557 | jsondata.terminalSource = "3"; // 请求端来源 1: 任你停 2:pda 3:微信公共号 |
492 | - jsondata.paySource = "3"; | |
558 | + jsondata.custId = this.custId; | |
559 | + jsondata.payFee = this.needPay; | |
560 | + // jsondata.paySource = "3"; | |
493 | 561 | jsondata.couponPersonId = ""; |
494 | - jsondata.openId = sessionStorage.getItem("wx_openId"); | |
562 | + // jsondata.openId = sessionStorage.getItem("wx_openId"); | |
495 | 563 | jsondata.sign = this.$utils.signObject(jsondata); |
496 | - weixinpay(jsondata).then(res => { | |
564 | + publicUnifiedOrderForH5(jsondata).then(res => { | |
497 | 565 | console.log(data); |
498 | 566 | if (res.code == 0) { // |
499 | 567 | if (res.data) { |
... | ... | @@ -537,11 +605,11 @@ export default { |
537 | 605 | if (res.err_msg === "get_brand_wcpay_request:ok") { |
538 | 606 | console.log("成功"); |
539 | 607 | this.$vux.toast.text("支付成功", "top"); |
540 | - me.$router.go(-2); | |
608 | + me.$router.go(-3); | |
541 | 609 | } else { |
542 | 610 | console.log("失败"); |
543 | - alert("支付失败"); | |
544 | - me.$router.go(-2); | |
611 | + this.$vux.toast.text("支付失败", "top"); | |
612 | + me.$router.go(-3); | |
545 | 613 | } |
546 | 614 | } |
547 | 615 | ); | ... | ... |
src/views/cards/renew.vue
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | |
5 | 5 | |
6 | 6 | <li> |
7 | - <div style="color: #666">选择停车场</div> | |
7 | + <div style="color: #666">停车场</div> | |
8 | 8 | <div >{{renewData.parkName}}</div> |
9 | 9 | <!--<div class="arrow">></div>--> |
10 | 10 | <!--<div class="arrow">></div>--> |
... | ... | @@ -17,15 +17,16 @@ |
17 | 17 | <!--</li>--> |
18 | 18 | |
19 | 19 | <li> |
20 | - <div style="color: #666">选择卡类型</div> | |
21 | - <div >{{renewData.cardName}}</div> | |
20 | + <div style="color: #666">卡类型</div> | |
21 | + <!--<div >{{renewData.cardName}}</div>--> | |
22 | + <div >月卡</div> | |
22 | 23 | |
23 | 24 | <!--<div class="arrow">></div>--> |
24 | 25 | </li> |
25 | 26 | |
26 | 27 | |
27 | 28 | <li> |
28 | - <div style="color: #666">绑定车牌</div> | |
29 | + <div style="color: #666">车牌</div> | |
29 | 30 | <div>{{renewData.carNumber}}</div> |
30 | 31 | <!--<div class="arrow">></div>--> |
31 | 32 | </li> |
... | ... | @@ -69,13 +70,13 @@ |
69 | 70 | |
70 | 71 | </ul> |
71 | 72 | |
72 | - <div style="padding:15px;text-align: center"> | |
73 | - <check-icon :value.sync="agreement"> | |
74 | - </check-icon> | |
75 | - <p style="display: inline-block;height: 23px;line-height: 23px;">我已阅读并同意 <span style="color: blue" | |
76 | - @click="showHideOnBlur=true">《购买须知》</span> | |
77 | - </p> | |
78 | - </div> | |
73 | + <!--<div style="padding:15px;text-align: center">--> | |
74 | + <!--<check-icon :value.sync="agreement">--> | |
75 | + <!--</check-icon>--> | |
76 | + <!--<p style="display: inline-block;height: 23px;line-height: 23px;">我已阅读并同意 <span style="color: blue"--> | |
77 | + <!--@click="showHideOnBlur=true">《购买须知》</span>--> | |
78 | + <!--</p>--> | |
79 | + <!--</div>--> | |
79 | 80 | |
80 | 81 | |
81 | 82 | <div style="margin-top: 34px" class="leftRightPadding"> |
... | ... | @@ -120,7 +121,10 @@ import { |
120 | 121 | queryVipCardInfoByPlNo, |
121 | 122 | queryUserCars, |
122 | 123 | weixinpay, |
123 | - createVipCardOrder | |
124 | + createVipCardOrder, | |
125 | + createVipCardOrderForH5, | |
126 | + publicUnifiedOrderForH5, | |
127 | + getOpenIdByCode | |
124 | 128 | } from "@/api/cards/cards"; |
125 | 129 | import { timestampToTime } from "../../utils/utils.js"; |
126 | 130 | export default { |
... | ... | @@ -148,6 +152,11 @@ export default { |
148 | 152 | renewData: {} // 续费数据 |
149 | 153 | }; |
150 | 154 | }, |
155 | + created() { | |
156 | + if (this.$utils.clientBrowser() == "微信") { | |
157 | + this.webAppCode = this.getCode(); | |
158 | + } | |
159 | + }, | |
151 | 160 | mounted() { |
152 | 161 | this.renewData = JSON.parse(sessionStorage.getItem("renewData")); |
153 | 162 | console.log(this.renewData); |
... | ... | @@ -198,7 +207,23 @@ export default { |
198 | 207 | }, |
199 | 208 | methods: { |
200 | 209 | |
201 | - | |
210 | + // 获取code | |
211 | + getCode() { | |
212 | + var appID = this.$utils.myVxAppId; | |
213 | + var code = this.getUrlParam("code"); | |
214 | + var local = window.location.href; | |
215 | + if (code == null || code === "") { | |
216 | + window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appID + "&redirect_uri=" + encodeURIComponent(local) + "&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect"; | |
217 | + } else { | |
218 | + return code; | |
219 | + } | |
220 | + }, | |
221 | + getUrlParam(name) { | |
222 | + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); | |
223 | + var r = window.location.search.substr(1).match(reg); | |
224 | + if (r != null) return unescape(r[2]); | |
225 | + return null; | |
226 | + }, | |
202 | 227 | |
203 | 228 | |
204 | 229 | clickActionCarNum(e) { |
... | ... | @@ -221,11 +246,105 @@ export default { |
221 | 246 | // 购买 |
222 | 247 | toPay() { |
223 | 248 | |
224 | - if (!this.agreement) { | |
225 | - this.$vux.toast.text("请同意购买须知", "top"); | |
226 | - return; | |
227 | - } | |
228 | - this.createOrder(); | |
249 | + // if (!this.agreement) { | |
250 | + // this.$vux.toast.text("请同意购买须知", "top"); | |
251 | + // return; | |
252 | + // } | |
253 | + this.getopenid(); | |
254 | + | |
255 | + // this.createOrder(); | |
256 | + }, | |
257 | + // 获取openid | |
258 | + getopenid() { | |
259 | + let jsondata = { | |
260 | + appId: this.$utils.myVxAppId, | |
261 | + code: this.webAppCode | |
262 | + }; | |
263 | + getOpenIdByCode(jsondata).then(data => { | |
264 | + console.log(data); | |
265 | + if (data.code == "0") { | |
266 | + this.openid = data.data; | |
267 | + this.createVipCardOrderForH5(); | |
268 | + } else { | |
269 | + this.$vux.toast.text(data.message, "top"); | |
270 | + } | |
271 | + }); | |
272 | + }, | |
273 | + createVipCardOrderForH5() { | |
274 | + let jsondata = this.$utils.commonParams(); | |
275 | + jsondata.carNumber = this.renewData.carNumber; | |
276 | + jsondata.custId = this.renewData.custId; | |
277 | + jsondata.optType = "1"; | |
278 | + // jsondata.cardCouponsId = ""; | |
279 | + jsondata.terminalSource = "3"; | |
280 | + jsondata.plNo = this.renewData.parkNo; // 停车场id | |
281 | + jsondata.discountAmount = this.disPrice; | |
282 | + jsondata.cardCouponsId = this.renewData.custCardNo; // 卡券编码 | |
283 | + jsondata.cardNo = this.renewData.cardNo; // 卡券编码 | |
284 | + jsondata.cardType = (this.renewData.cardType).toString(); // 卡类型 | |
285 | + // jsondata.carType = (this.vipCardList.carType).toString(); // 1-大型车;2-小型车 | |
286 | + // jsondata.plNo = this.createVipCardOrder.id; // 1-大型车;2-小型车 | |
287 | + jsondata.price = this.unitPrice.toString(); // 卡单价 | |
288 | + jsondata.totalAmount = (this.needPay).toString(); // 购买的总金额 | |
289 | + jsondata.num = this.cardNum; // 购买数量 | |
290 | + jsondata.effDate = this.$utils.timestampToTime(this.renewData.expDate); // 生效时间 | |
291 | + jsondata.expDate = this.$utils.timestampToTime(this.endTimeFunc); // 失效时间 | |
292 | + // jsondata.carNumber = this.carNumber; // 卡适用车牌 | |
293 | + jsondata.optType = "2"; // 操作类型 1 购买 2 续费 | |
294 | + jsondata.sign = this.$utils.signObject(jsondata); | |
295 | + createVipCardOrderForH5(jsondata).then(data => { | |
296 | + console.log(data); | |
297 | + if (data.code == 0) { | |
298 | + | |
299 | + // orderId | |
300 | + let orderId = data.data.orderId; | |
301 | + // this.custId = data.data.custId; | |
302 | + this.publicUnifiedOrderForH5(orderId); | |
303 | + } else { | |
304 | + this.$vux.toast.text(data.message, "top"); | |
305 | + } | |
306 | + }); | |
307 | + }, | |
308 | + publicUnifiedOrderForH5(orderId) { | |
309 | + let vm = this; | |
310 | + let jsondata = this.$utils.commonParams(); | |
311 | + jsondata.orderId = orderId; // 订单号 | |
312 | + jsondata.payType = "4"; // /** 支付方式-- 1:支付宝 2:微信 3:银联 4:微信公众号 5 个人账户. */ | |
313 | + jsondata.openId = this.openid | |
314 | + jsondata.paySrcType = "302"; // //支付单来源 101:停车付款单 102:停车预付单 103:停车补缴单 104 共享车位 201 余额充值单 202 押金充值单 301 会员卡购买单 302 会员卡续费 | |
315 | + jsondata.appId = this.$utils.myVxAppId; // 微信标识符 | |
316 | + jsondata.terminalSource = "3"; // 请求端来源 1: 任你停 2:pda 3:微信公共号 | |
317 | + jsondata.custId = this.renewData.custId; | |
318 | + jsondata.payFee = this.needPay; | |
319 | + // jsondata.paySource = "3"; | |
320 | + jsondata.cardNo = this.renewData.cardNo; // 卡券编码 | |
321 | + jsondata.couponPersonId = this.renewData.custCardNo; | |
322 | + // jsondata.openId = sessionStorage.getItem("wx_openId"); | |
323 | + jsondata.sign = this.$utils.signObject(jsondata); | |
324 | + publicUnifiedOrderForH5(jsondata).then(res => { | |
325 | + console.log(data); | |
326 | + if (res.code == 0) { // | |
327 | + if (res.data) { | |
328 | + var data = res.data; | |
329 | + console.log(JSON.stringify(data)); | |
330 | + if (typeof WeixinJSBridge === "undefined") { // 微信浏览器内置对象。参考微信官方文档 | |
331 | + if (document.addEventListener) { | |
332 | + document.addEventListener("WeixinJSBridgeReady", vm.onBridgeReady(data), false); | |
333 | + } else if (document.attachEvent) { | |
334 | + document.attachEvent("WeixinJSBridgeReady", vm.onBridgeReady(data)); | |
335 | + document.attachEvent("onWeixinJSBridgeReady", vm.onBridgeReady(data)); | |
336 | + } | |
337 | + } else { | |
338 | + console.log("准备调用微信支付"); | |
339 | + vm.onBridgeReady(data); | |
340 | + } | |
341 | + } else { | |
342 | + alert("没有找到返回值"); | |
343 | + } | |
344 | + } else { | |
345 | + alert(res.message); | |
346 | + } | |
347 | + }); | |
229 | 348 | }, |
230 | 349 | createOrder() { |
231 | 350 | console.log(this.createVipCardOrder); | ... | ... |
src/views/parkPay/plateNumber.vue
1 | 1 | <template> |
2 | 2 | <div id="page"> |
3 | 3 | |
4 | - <div class="swiper-container" style="height: 260px"> | |
5 | - <div class="swiper-wrapper"> | |
6 | - <div class="swiper-slide" v-for="item in swiperData" :key="item.id" | |
7 | - :style="{backgroundImage:'url(' + item.url + ')'}" | |
8 | - @click="openImgUrl(item)" | |
9 | - ></div> | |
10 | - </div> | |
11 | - <!-- 如果需要分页器 --> | |
12 | - <div class="swiper-pagination"></div> | |
4 | + <!--<div class="swiper-container" style="height: 260px">--> | |
5 | + <!--<div class="swiper-wrapper">--> | |
6 | + <!--<div class="swiper-slide" v-for="item in swiperData" :key="item.id"--> | |
7 | + <!--:style="{backgroundImage:'url(' + item.url + ')'}"--> | |
8 | + <!--@click="openImgUrl(item)"--> | |
9 | + <!--></div>--> | |
10 | + <!--</div>--> | |
11 | + <!--<!– 如果需要分页器 –>--> | |
12 | + <!--<div class="swiper-pagination"></div>--> | |
13 | 13 | |
14 | - <!-- 如果需要滚动条 --> | |
15 | - <!-- <div class="swiper-scrollbar"></div>--> | |
16 | - </div> | |
14 | + <!--<!– 如果需要滚动条 –>--> | |
15 | + <!--<!– <div class="swiper-scrollbar"></div>–>--> | |
16 | + <!--</div>--> | |
17 | 17 | |
18 | 18 | <div class="wrap"> |
19 | 19 | <!--<p style="margin-bottom: 18px;margin-top: 18px;">请选择车牌颜色</p>--> |
... | ... | @@ -360,7 +360,7 @@ export default { |
360 | 360 | } |
361 | 361 | }, |
362 | 362 | created(){ |
363 | - this.initSWiper() | |
363 | + // this.initSWiper() | |
364 | 364 | }, |
365 | 365 | mounted () { |
366 | 366 | // |
... | ... | @@ -647,7 +647,7 @@ export default { |
647 | 647 | align-items: center; |
648 | 648 | } |
649 | 649 | .wrap { |
650 | - padding:0 18px; | |
650 | + padding:40px 18px 0; | |
651 | 651 | .radio-box { |
652 | 652 | display: flex; |
653 | 653 | align-items: center; | ... | ... |