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,7 +8,7 @@ module.exports = { | ||
| 8 | dev: { | 8 | dev: { | 
| 9 | 9 | ||
| 10 | // Paths | 10 | // Paths | 
| 11 | - assetsSubDirectory: 'static', | 11 | + assetsSubDirectory: 'yueka', | 
| 12 | assetsPublicPath: '/', | 12 | assetsPublicPath: '/', | 
| 13 | // proxyTable: { | 13 | // proxyTable: { | 
| 14 | // '/api':{ | 14 | // '/api':{ | 
| @@ -47,11 +47,11 @@ module.exports = { | @@ -47,11 +47,11 @@ module.exports = { | ||
| 47 | 47 | ||
| 48 | build: { | 48 | build: { | 
| 49 | // Template for index.html | 49 | // Template for index.html | 
| 50 | - index: path.resolve(__dirname, '../dist/index.html'), | 50 | + index: path.resolve(__dirname, '../yueka/yueka.html'), | 
| 51 | 51 | ||
| 52 | // Paths | 52 | // Paths | 
| 53 | - assetsRoot: path.resolve(__dirname, '../dist'), | ||
| 54 | - assetsSubDirectory: 'static', | 53 | + assetsRoot: path.resolve(__dirname, '../yueka'), | 
| 54 | + assetsSubDirectory: 'yueka', | ||
| 55 | assetsPublicPath: './', | 55 | assetsPublicPath: './', | 
| 56 | 56 | ||
| 57 | /** | 57 | /** | 
index.html
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> | 8 | <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> | 
| 9 | <meta http-equiv="Pragma" content="no-cache" /> | 9 | <meta http-equiv="Pragma" content="no-cache" /> | 
| 10 | <meta http-equiv="Expires" content="0" /> | 10 | <meta http-equiv="Expires" content="0" /> | 
| 11 | - <title>微信公众号</title> | 11 | + <title>购买会员卡</title> | 
| 12 | </head> | 12 | </head> | 
| 13 | <body> | 13 | <body> | 
| 14 | <div id="app"></div> | 14 | <div id="app"></div> | 
src/api/cards/cards.js
| @@ -115,6 +115,29 @@ export function createVipCardOrderForH5(params) { | @@ -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,15 +154,15 @@ export default { | ||
| 154 | // 14318527b13840c2a4af63fef52c2d6e 老的签名 | 154 | // 14318527b13840c2a4af63fef52c2d6e 老的签名 | 
| 155 | // ud8yq5tv0inxupc05xfeau39jywlqoj2 新的id | 155 | // ud8yq5tv0inxupc05xfeau39jywlqoj2 新的id | 
| 156 | // ny1u72b6k374sg379z0kqjgfxe2ycnpw 新的签名 | 156 | // ny1u72b6k374sg379z0kqjgfxe2ycnpw 新的签名 | 
| 157 | - myVarAppid: "65grtq5tv0wewec05xfeau39jyghhjm",// 公共请求Appid | 157 | + myVarAppid: "ud8yq5tv0inxupc05xfeau39jywlqoj2",// 公共请求Appid | 
| 158 | myDeviceInfo: "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E", // 公共请求设备信息 80ac1a4218beb19a BC0703A4-AFB0-4B51-9089-9B7487C0CC6E | 158 | myDeviceInfo: "BC0703A4-AFB0-4B51-9089-9B7487C0CC6E", // 公共请求设备信息 80ac1a4218beb19a BC0703A4-AFB0-4B51-9089-9B7487C0CC6E | 
| 159 | - myVxAppId: "wx1e9001e5940605b1", | 159 | + myVxAppId: "wx78702b90dadb9586", | 
| 160 | // 测试环境 微信赤峰 appid wxff4cebaedbf4f886 | 160 | // 测试环境 微信赤峰 appid wxff4cebaedbf4f886 | 
| 161 | // 微信赤峰 appid wx2af2bab90d433c86 | 161 | // 微信赤峰 appid wx2af2bab90d433c86 | 
| 162 | // 黄石 appid wxa1a66cc7d263afe6 | 162 | // 黄石 appid wxa1a66cc7d263afe6 | 
| 163 | // 阳明 wxdfb0276f85514ea3 | 163 | // 阳明 wxdfb0276f85514ea3 | 
| 164 | // 无锡 wx1e9001e5940605b1 | 164 | // 无锡 wx1e9001e5940605b1 | 
| 165 | - myOrgId: "10003", // 归属地 赤峰id 10003 黄石 10079 无锡10005 扬明10193 西城10007 | 165 | + myOrgId: "10007", // 归属地 赤峰id 10003 黄石 10079 无锡10005 扬明10193 西城10007 | 
| 166 | myGetSign: function(objb) { // 获取签名 | 166 | myGetSign: function(objb) { // 获取签名 | 
| 167 | var compare = function(obj1, obj2) { | 167 | var compare = function(obj1, obj2) { | 
| 168 | var val1 = obj1.keyname; | 168 | var val1 = obj1.keyname; | 
| @@ -176,13 +176,13 @@ export default { | @@ -176,13 +176,13 @@ export default { | ||
| 176 | } | 176 | } | 
| 177 | }; | 177 | }; | 
| 178 | objb.sort(compare); | 178 | objb.sort(compare); | 
| 179 | - var strmd5 = "dfdf2b6k37r5y79z0kqjgfxe2wet3434"; | 179 | + var strmd5 = "ny1u72b6k374sg379z0kqjgfxe2ycnpw"; | 
| 180 | for (var i = 0; i < objb.length; i++) { | 180 | for (var i = 0; i < objb.length; i++) { | 
| 181 | if (objb[i].value != null && objb[i].value != "") { | 181 | if (objb[i].value != null && objb[i].value != "") { | 
| 182 | strmd5 += objb[i].keyname + objb[i].value; | 182 | strmd5 += objb[i].keyname + objb[i].value; | 
| 183 | } | 183 | } | 
| 184 | } | 184 | } | 
| 185 | - strmd5 += "dfdf2b6k37r5y79z0kqjgfxe2wet3434"; | 185 | + strmd5 += "ny1u72b6k374sg379z0kqjgfxe2ycnpw"; | 
| 186 | // console.log('strmd5-------->'+strmd5); | 186 | // console.log('strmd5-------->'+strmd5); | 
| 187 | strmd5 = md5(strmd5); | 187 | strmd5 = md5(strmd5); | 
| 188 | strmd5 = strmd5.toUpperCase(); | 188 | strmd5 = strmd5.toUpperCase(); | 
src/views/cards/Cards.vue
| @@ -56,7 +56,8 @@ export default { | @@ -56,7 +56,8 @@ export default { | ||
| 56 | name: "Cards", | 56 | name: "Cards", | 
| 57 | data() { | 57 | data() { | 
| 58 | return { | 58 | return { | 
| 59 | - cardList: [] | 59 | + cardList: [], | 
| 60 | + custId:'' | ||
| 60 | }; | 61 | }; | 
| 61 | }, | 62 | }, | 
| 62 | mounted() { | 63 | mounted() { | 
| @@ -73,7 +74,10 @@ export default { | @@ -73,7 +74,10 @@ export default { | ||
| 73 | queryVipCardsByCarNumberForH5(jsondata).then(data => { | 74 | queryVipCardsByCarNumberForH5(jsondata).then(data => { | 
| 74 | console.log(data); | 75 | console.log(data); | 
| 75 | if (data.code == 0) { | 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 | } else { | 81 | } else { | 
| 78 | this.$vux.toast.text(data.message, "top"); | 82 | this.$vux.toast.text(data.message, "top"); | 
| 79 | } | 83 | } | 
| @@ -105,7 +109,8 @@ export default { | @@ -105,7 +109,8 @@ export default { | ||
| 105 | path:'buyCard', | 109 | path:'buyCard', | 
| 106 | query:{ | 110 | query:{ | 
| 107 | carNumber:this.$route.query.carNumber, | 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,13 +89,13 @@ | ||
| 89 | 89 | ||
| 90 | <!--<p>停车场停车场停车停车场</p>--> | 90 | <!--<p>停车场停车场停车停车场</p>--> | 
| 91 | <!--</div>--> | 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 | <div style="margin-top: 34px" class="leftRightPadding"> | 101 | <div style="margin-top: 34px" class="leftRightPadding"> | 
| @@ -181,7 +181,9 @@ import { | @@ -181,7 +181,9 @@ import { | ||
| 181 | weixinpay, | 181 | weixinpay, | 
| 182 | createVipCardOrder, | 182 | createVipCardOrder, | 
| 183 | queryVipCardInfoByPlNoForH5, | 183 | queryVipCardInfoByPlNoForH5, | 
| 184 | - createVipCardOrderForH5 | 184 | + createVipCardOrderForH5, | 
| 185 | + publicUnifiedOrderForH5, | ||
| 186 | + getOpenIdByCode | ||
| 185 | } from "@/api/cards/cards"; | 187 | } from "@/api/cards/cards"; | 
| 186 | import { timestampToTime } from "../../utils/utils.js"; | 188 | import { timestampToTime } from "../../utils/utils.js"; | 
| 187 | export default { | 189 | export default { | 
| @@ -217,12 +219,21 @@ export default { | @@ -217,12 +219,21 @@ export default { | ||
| 217 | typeNum: 4, // 卡类型判断 | 219 | typeNum: 4, // 卡类型判断 | 
| 218 | showHideOnBlur: false, // 购买协议 | 220 | showHideOnBlur: false, // 购买协议 | 
| 219 | createVipCardOrder: {}, // 创建订单对象 | 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 | mounted() { | 233 | mounted() { | 
| 224 | this.queryParkListForVipCard(); // 获取停车场 | 234 | this.queryParkListForVipCard(); // 获取停车场 | 
| 225 | // this.queryUserCars(); // 获取用户车牌 | 235 | // this.queryUserCars(); // 获取用户车牌 | 
| 236 | + this.custId = this.$route.query.custId | ||
| 226 | }, | 237 | }, | 
| 227 | computed: { | 238 | computed: { | 
| 228 | // 卡类型 1-年卡;2-半年卡;3-季卡;4-月卡;5-日卡; | 239 | // 卡类型 1-年卡;2-半年卡;3-季卡;4-月卡;5-日卡; | 
| @@ -261,6 +272,23 @@ export default { | @@ -261,6 +272,23 @@ export default { | ||
| 261 | } | 272 | } | 
| 262 | }, | 273 | }, | 
| 263 | methods: { | 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 | queryUserCars() { | 293 | queryUserCars() { | 
| 266 | let jsondata = this.$utils.commonParams(); | 294 | let jsondata = this.$utils.commonParams(); | 
| @@ -336,15 +364,16 @@ export default { | @@ -336,15 +364,16 @@ export default { | ||
| 336 | jsondata.plNo = this.parkNo; | 364 | jsondata.plNo = this.parkNo; | 
| 337 | jsondata.cardType = "4"; | 365 | jsondata.cardType = "4"; | 
| 338 | // jsondata.parkName = this.parkName; | 366 | // jsondata.parkName = this.parkName; | 
| 339 | - | ||
| 340 | jsondata.sign = this.$utils.signObject(jsondata); | 367 | jsondata.sign = this.$utils.signObject(jsondata); | 
| 341 | queryVipCardInfoByPlNoForH5(jsondata).then(data => { | 368 | queryVipCardInfoByPlNoForH5(jsondata).then(data => { | 
| 342 | console.log(data); | 369 | console.log(data); | 
| 343 | if (data.code == 0) { | 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 | // me.cardTypeList = []; | 377 | // me.cardTypeList = []; | 
| 349 | // me.carType = "请点击选择"; | 378 | // me.carType = "请点击选择"; | 
| 350 | // // res.vipCardList = | 379 | // // res.vipCardList = | 
| @@ -367,8 +396,6 @@ export default { | @@ -367,8 +396,6 @@ export default { | ||
| 367 | // me.typeNum = vipCardList[0].cardType; | 396 | // me.typeNum = vipCardList[0].cardType; | 
| 368 | // me.createVipCardOrder = e; | 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,22 +458,59 @@ export default { | ||
| 431 | // this.$vux.toast.text("请选择车牌", "top"); | 458 | // this.$vux.toast.text("请选择车牌", "top"); | 
| 432 | // return; | 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 | // this.createOrder(); | 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 | let jsondata = this.$utils.commonParams(); | 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 | jsondata.sign = this.$utils.signObject(jsondata); | 505 | jsondata.sign = this.$utils.signObject(jsondata); | 
| 446 | createVipCardOrderForH5(jsondata).then(data => { | 506 | createVipCardOrderForH5(jsondata).then(data => { | 
| 447 | console.log(data); | 507 | console.log(data); | 
| 448 | if (data.code == 0) { | 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 | } else { | 514 | } else { | 
| 451 | this.$vux.toast.text(data.message, "top"); | 515 | this.$vux.toast.text(data.message, "top"); | 
| 452 | } | 516 | } | 
| @@ -469,31 +533,35 @@ export default { | @@ -469,31 +533,35 @@ export default { | ||
| 469 | jsondata.carNumber = this.carNumber; // 卡适用车牌 | 533 | jsondata.carNumber = this.carNumber; // 卡适用车牌 | 
| 470 | jsondata.optType = "1"; // 操作类型 1 购买 2 续费 | 534 | jsondata.optType = "1"; // 操作类型 1 购买 2 续费 | 
| 471 | jsondata.forceBuy = "1"; | 535 | jsondata.forceBuy = "1"; | 
| 536 | + | ||
| 472 | jsondata.sign = this.$utils.signObject(jsondata); | 537 | jsondata.sign = this.$utils.signObject(jsondata); | 
| 473 | createVipCardOrder(jsondata).then(data => { | 538 | createVipCardOrder(jsondata).then(data => { | 
| 474 | console.log(data); | 539 | console.log(data); | 
| 475 | // orderId | 540 | // orderId | 
| 476 | if (data.code == 0) { | 541 | if (data.code == 0) { | 
| 477 | this.orderId = data.data.orderId; | 542 | this.orderId = data.data.orderId; | 
| 478 | - this.vxPay(); | 543 | + this.vxPay(orderId); | 
| 479 | } else { | 544 | } else { | 
| 480 | this.$vux.toast.text(data.message, "top"); | 545 | this.$vux.toast.text(data.message, "top"); | 
| 481 | } | 546 | } | 
| 482 | }); | 547 | }); | 
| 483 | }, | 548 | }, | 
| 484 | - vxPay() { | 549 | + publicUnifiedOrderForH5(orderId) { | 
| 485 | let vm = this; | 550 | let vm = this; | 
| 486 | let jsondata = this.$utils.commonParams(); | 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 | jsondata.appId = this.$utils.myVxAppId; // 微信标识符 | 556 | jsondata.appId = this.$utils.myVxAppId; // 微信标识符 | 
| 491 | jsondata.terminalSource = "3"; // 请求端来源 1: 任你停 2:pda 3:微信公共号 | 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 | jsondata.couponPersonId = ""; | 561 | jsondata.couponPersonId = ""; | 
| 494 | - jsondata.openId = sessionStorage.getItem("wx_openId"); | 562 | + // jsondata.openId = sessionStorage.getItem("wx_openId"); | 
| 495 | jsondata.sign = this.$utils.signObject(jsondata); | 563 | jsondata.sign = this.$utils.signObject(jsondata); | 
| 496 | - weixinpay(jsondata).then(res => { | 564 | + publicUnifiedOrderForH5(jsondata).then(res => { | 
| 497 | console.log(data); | 565 | console.log(data); | 
| 498 | if (res.code == 0) { // | 566 | if (res.code == 0) { // | 
| 499 | if (res.data) { | 567 | if (res.data) { | 
| @@ -537,11 +605,11 @@ export default { | @@ -537,11 +605,11 @@ export default { | ||
| 537 | if (res.err_msg === "get_brand_wcpay_request:ok") { | 605 | if (res.err_msg === "get_brand_wcpay_request:ok") { | 
| 538 | console.log("成功"); | 606 | console.log("成功"); | 
| 539 | this.$vux.toast.text("支付成功", "top"); | 607 | this.$vux.toast.text("支付成功", "top"); | 
| 540 | - me.$router.go(-2); | 608 | + me.$router.go(-3); | 
| 541 | } else { | 609 | } else { | 
| 542 | console.log("失败"); | 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,7 +4,7 @@ | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | <li> | 6 | <li> | 
| 7 | - <div style="color: #666">选择停车场</div> | 7 | + <div style="color: #666">停车场</div> | 
| 8 | <div >{{renewData.parkName}}</div> | 8 | <div >{{renewData.parkName}}</div> | 
| 9 | <!--<div class="arrow">></div>--> | 9 | <!--<div class="arrow">></div>--> | 
| 10 | <!--<div class="arrow">></div>--> | 10 | <!--<div class="arrow">></div>--> | 
| @@ -17,15 +17,16 @@ | @@ -17,15 +17,16 @@ | ||
| 17 | <!--</li>--> | 17 | <!--</li>--> | 
| 18 | 18 | ||
| 19 | <li> | 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 | <!--<div class="arrow">></div>--> | 24 | <!--<div class="arrow">></div>--> | 
| 24 | </li> | 25 | </li> | 
| 25 | 26 | ||
| 26 | 27 | ||
| 27 | <li> | 28 | <li> | 
| 28 | - <div style="color: #666">绑定车牌</div> | 29 | + <div style="color: #666">车牌</div> | 
| 29 | <div>{{renewData.carNumber}}</div> | 30 | <div>{{renewData.carNumber}}</div> | 
| 30 | <!--<div class="arrow">></div>--> | 31 | <!--<div class="arrow">></div>--> | 
| 31 | </li> | 32 | </li> | 
| @@ -69,13 +70,13 @@ | @@ -69,13 +70,13 @@ | ||
| 69 | 70 | ||
| 70 | </ul> | 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 | <div style="margin-top: 34px" class="leftRightPadding"> | 82 | <div style="margin-top: 34px" class="leftRightPadding"> | 
| @@ -120,7 +121,10 @@ import { | @@ -120,7 +121,10 @@ import { | ||
| 120 | queryVipCardInfoByPlNo, | 121 | queryVipCardInfoByPlNo, | 
| 121 | queryUserCars, | 122 | queryUserCars, | 
| 122 | weixinpay, | 123 | weixinpay, | 
| 123 | - createVipCardOrder | 124 | + createVipCardOrder, | 
| 125 | + createVipCardOrderForH5, | ||
| 126 | + publicUnifiedOrderForH5, | ||
| 127 | + getOpenIdByCode | ||
| 124 | } from "@/api/cards/cards"; | 128 | } from "@/api/cards/cards"; | 
| 125 | import { timestampToTime } from "../../utils/utils.js"; | 129 | import { timestampToTime } from "../../utils/utils.js"; | 
| 126 | export default { | 130 | export default { | 
| @@ -148,6 +152,11 @@ export default { | @@ -148,6 +152,11 @@ export default { | ||
| 148 | renewData: {} // 续费数据 | 152 | renewData: {} // 续费数据 | 
| 149 | }; | 153 | }; | 
| 150 | }, | 154 | }, | 
| 155 | + created() { | ||
| 156 | + if (this.$utils.clientBrowser() == "微信") { | ||
| 157 | + this.webAppCode = this.getCode(); | ||
| 158 | + } | ||
| 159 | + }, | ||
| 151 | mounted() { | 160 | mounted() { | 
| 152 | this.renewData = JSON.parse(sessionStorage.getItem("renewData")); | 161 | this.renewData = JSON.parse(sessionStorage.getItem("renewData")); | 
| 153 | console.log(this.renewData); | 162 | console.log(this.renewData); | 
| @@ -198,7 +207,23 @@ export default { | @@ -198,7 +207,23 @@ export default { | ||
| 198 | }, | 207 | }, | 
| 199 | methods: { | 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 | clickActionCarNum(e) { | 229 | clickActionCarNum(e) { | 
| @@ -221,11 +246,105 @@ export default { | @@ -221,11 +246,105 @@ export default { | ||
| 221 | // 购买 | 246 | // 购买 | 
| 222 | toPay() { | 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 | createOrder() { | 349 | createOrder() { | 
| 231 | console.log(this.createVipCardOrder); | 350 | console.log(this.createVipCardOrder); | 
src/views/parkPay/plateNumber.vue
| 1 | <template> | 1 | <template> | 
| 2 | <div id="page"> | 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 | <div class="wrap"> | 18 | <div class="wrap"> | 
| 19 | <!--<p style="margin-bottom: 18px;margin-top: 18px;">请选择车牌颜色</p>--> | 19 | <!--<p style="margin-bottom: 18px;margin-top: 18px;">请选择车牌颜色</p>--> | 
| @@ -360,7 +360,7 @@ export default { | @@ -360,7 +360,7 @@ export default { | ||
| 360 | } | 360 | } | 
| 361 | }, | 361 | }, | 
| 362 | created(){ | 362 | created(){ | 
| 363 | - this.initSWiper() | 363 | + // this.initSWiper() | 
| 364 | }, | 364 | }, | 
| 365 | mounted () { | 365 | mounted () { | 
| 366 | // | 366 | // | 
| @@ -647,7 +647,7 @@ export default { | @@ -647,7 +647,7 @@ export default { | ||
| 647 | align-items: center; | 647 | align-items: center; | 
| 648 | } | 648 | } | 
| 649 | .wrap { | 649 | .wrap { | 
| 650 | - padding:0 18px; | 650 | + padding:40px 18px 0; | 
| 651 | .radio-box { | 651 | .radio-box { | 
| 652 | display: flex; | 652 | display: flex; | 
| 653 | align-items: center; | 653 | align-items: center; |