Commit 42d99196469776abbf8bd43490a12ccaf46019c4
1 parent
12f4a15c
赤峰小票码 -- 微信支付完成后的跳转
Showing
3 changed files
with
203 additions
and
177 deletions
src/components/orderPay.vue
| @@ -208,22 +208,27 @@ export default { | @@ -208,22 +208,27 @@ export default { | ||
| 208 | 208 | ||
| 209 | 209 | ||
| 210 | if (this.clientBrowser == '微信') { // 微信支付 | 210 | if (this.clientBrowser == '微信') { // 微信支付 |
| 211 | - //第一步获取openid | ||
| 212 | - var codeParams = { | ||
| 213 | - code: this.webAppCode, | ||
| 214 | - appId: this.$utils.myVxAppId | ||
| 215 | - }; | ||
| 216 | - getOpenId(codeParams).then(res => { | ||
| 217 | - if (res.code == 0) { | ||
| 218 | - me.vxPay(res.data, this.orderId) | ||
| 219 | - } else if (res.code == 40163) { //code been used, hints[重复code问题] | ||
| 220 | - alert('请重新扫码') | ||
| 221 | - console.log(res.message); | ||
| 222 | - } else { | ||
| 223 | - alert('请重新扫码') | ||
| 224 | - } | ||
| 225 | - }) | ||
| 226 | - | 211 | + let _openId = sessionStorage.getItem('openIdData') |
| 212 | + if(_openId){ | ||
| 213 | + me.vxPay(_openId, this.orderId) | ||
| 214 | + }else { | ||
| 215 | + //第一步获取openid | ||
| 216 | + var codeParams = { | ||
| 217 | + code: this.webAppCode, | ||
| 218 | + appId: this.$utils.myVxAppId | ||
| 219 | + }; | ||
| 220 | + getOpenId(codeParams).then(res => { | ||
| 221 | + if (res.code == 0) { | ||
| 222 | + me.vxPay(res.data, this.orderId) | ||
| 223 | + sessionStorage.setItem('openIdData', res.data) | ||
| 224 | + } else if (res.code == 40163) { //code been used, hints[重复code问题] | ||
| 225 | + alert('请重新扫码重复code问题') | ||
| 226 | + console.log(res.message); | ||
| 227 | + } else { | ||
| 228 | + alert('请重新扫码') | ||
| 229 | + } | ||
| 230 | + }) | ||
| 231 | + } | ||
| 227 | } | 232 | } |
| 228 | 233 | ||
| 229 | }, | 234 | }, |
| @@ -265,125 +270,140 @@ export default { | @@ -265,125 +270,140 @@ export default { | ||
| 265 | } | 270 | } |
| 266 | }) | 271 | }) |
| 267 | }, | 272 | }, |
| 268 | - onBridgeReady(params) { | ||
| 269 | - let me = this | ||
| 270 | - console.log('调用微信支付WeixinJSBridge') | ||
| 271 | - WeixinJSBridge.invoke( | ||
| 272 | - 'getBrandWCPayRequest', params, | ||
| 273 | - // | ||
| 274 | - // 'getBrandWCPayRequest', { // 下面参数内容都是后台返回的 | ||
| 275 | - // 'appId': data.appId, // 公众号名称,由商户传入 | ||
| 276 | - // 'timeStamp': data.timeStamp, // 时间戳 | ||
| 277 | - // 'nonceStr': data.nonceStr, // 随机串 | ||
| 278 | - // 'package': data.package, // 预支付id | ||
| 279 | - // 'signType': data.signType, // 微信签名方式 | ||
| 280 | - // 'paySign': data.paySign // 微信签名 | ||
| 281 | - // }, | ||
| 282 | - function (res) { | ||
| 283 | - // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 | ||
| 284 | - if (res.err_msg === 'get_brand_wcpay_request:ok') { | ||
| 285 | - console.log('成功') | ||
| 286 | - var salt = me.$utils.myCommonSalt(32); | ||
| 287 | - let wxparams = { | ||
| 288 | - pageNum: 1, | ||
| 289 | - pageSize: 10000, | ||
| 290 | - parkState: 10, | ||
| 291 | - terminalSource: 7, | ||
| 292 | - carNumber: me.carNumber, | ||
| 293 | - app_id: me.$utils.myVarAppid, | ||
| 294 | - deviceInfo: me.$utils.myDeviceInfo, | ||
| 295 | - salt: salt, | ||
| 296 | - sign_type: "md5", | ||
| 297 | - token:'', | ||
| 298 | - } | ||
| 299 | - wxparams.sign = me.$utils.signObject(wxparams) | ||
| 300 | - queryParkingRecordPageByCarNumbers(wxparams).then(response => { | ||
| 301 | - console.log(response) | ||
| 302 | - me.parkList = response.data.dataList | ||
| 303 | - | ||
| 304 | - if(me.parkList.length == 0){ | ||
| 305 | - me.$router.push({ | ||
| 306 | - path:'parkRecord', | ||
| 307 | - query:{ | ||
| 308 | - carNumber: me.carNumber, | ||
| 309 | - carNumberColor: me.carWrapBG, | ||
| 310 | - parkFlag: 0 // 0表示在停 1表示历史 | ||
| 311 | - } | ||
| 312 | - }) | 273 | + onBridgeReady(params) { |
| 274 | + let me = this | ||
| 275 | + console.log('调用微信支付WeixinJSBridge') | ||
| 276 | + WeixinJSBridge.invoke( | ||
| 277 | + 'getBrandWCPayRequest', params, | ||
| 278 | + // | ||
| 279 | + // 'getBrandWCPayRequest', { // 下面参数内容都是后台返回的 | ||
| 280 | + // 'appId': data.appId, // 公众号名称,由商户传入 | ||
| 281 | + // 'timeStamp': data.timeStamp, // 时间戳 | ||
| 282 | + // 'nonceStr': data.nonceStr, // 随机串 | ||
| 283 | + // 'package': data.package, // 预支付id | ||
| 284 | + // 'signType': data.signType, // 微信签名方式 | ||
| 285 | + // 'paySign': data.paySign // 微信签名 | ||
| 286 | + // }, | ||
| 287 | + function (res) { | ||
| 288 | + // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 | ||
| 289 | + if (res.err_msg === 'get_brand_wcpay_request:ok') { | ||
| 290 | + console.log('成功') | ||
| 291 | + var salt = me.$utils.myCommonSalt(32); | ||
| 292 | + let wxparams = { | ||
| 293 | + pageNum: 1, | ||
| 294 | + pageSize: 10000, | ||
| 295 | + parkState: 10, | ||
| 296 | + terminalSource: 7, | ||
| 297 | + carNumber: me.carNumber, | ||
| 298 | + app_id: me.$utils.myVarAppid, | ||
| 299 | + deviceInfo: me.$utils.myDeviceInfo, | ||
| 300 | + salt: salt, | ||
| 301 | + sign_type: "md5", | ||
| 302 | + token:'', | ||
| 313 | } | 303 | } |
| 314 | - | ||
| 315 | - me.parkingData = me.parkList.filter(item => { | ||
| 316 | - return item.parkState == '10' | ||
| 317 | - }) | ||
| 318 | - console.log(me.parkingData) | ||
| 319 | - me.historyList = me.parkList.filter(item => { | ||
| 320 | - return item.parkState == '20' | ||
| 321 | - }) | ||
| 322 | - console.log(me.historyList) | ||
| 323 | - if(me.parkingData.length>0){ | ||
| 324 | - MessageBox.confirm('', { | ||
| 325 | - message: '您当前有在停订单 是否立即支付?', | ||
| 326 | - title: '温馨提示', | ||
| 327 | - confirmButtonText: '去支付', | ||
| 328 | - cancelButtonText: '取消' | ||
| 329 | - }).then(action => { | ||
| 330 | - if (action == 'confirm') { //确认的回调 | ||
| 331 | - console.log('确定'); | ||
| 332 | - me.$router.push({ | ||
| 333 | - path:'parkRecord', | ||
| 334 | - query:{ | ||
| 335 | - carNumber: me.carNumber, | ||
| 336 | - carNumberColor: me.carWrapBG, | ||
| 337 | - parkFlag: 0 // 0表示在停 1表示历史 | 304 | + wxparams.sign = me.$utils.signObject(wxparams) |
| 305 | + queryParkingRecordPageByCarNumbers(wxparams).then(response => { | ||
| 306 | + console.log(response) | ||
| 307 | + me.parkList = response.data.dataList | ||
| 308 | + | ||
| 309 | + // alert(JSON.stringify(me.parkList)) | ||
| 310 | + // alert(me.parkList.length) | ||
| 311 | + if(me.parkList.length == 0){ | ||
| 312 | + me.$router.push({ | ||
| 313 | + path:'parkRecord', | ||
| 314 | + query:{ | ||
| 315 | + carNumber: me.carNumber, | ||
| 316 | + carNumberColor: me.carWrapBG, | ||
| 317 | + parkFlag: 0 // 0表示在停 1表示历史 | ||
| 318 | + } | ||
| 319 | + }) | ||
| 320 | + | ||
| 321 | + }else{ | ||
| 322 | + me.parkingData = me.parkList.filter(item => { | ||
| 323 | + return item.parkState == '10' | ||
| 324 | + }) | ||
| 325 | + console.log(me.parkingData) | ||
| 326 | + me.historyList = me.parkList.filter(item => { | ||
| 327 | + return item.parkState == '20' | ||
| 328 | + }) | ||
| 329 | + console.log(me.historyList) | ||
| 330 | + | ||
| 331 | + if(me.historyList.length>0){ | ||
| 332 | + MessageBox.confirm('', { | ||
| 333 | + message: '您当前有历史欠费 是否立即补缴?', | ||
| 334 | + title: '温馨提示', | ||
| 335 | + confirmButtonText: '去补缴', | ||
| 336 | + cancelButtonText: '取消' | ||
| 337 | + }).then(action => { | ||
| 338 | + if (action == 'confirm') { //确认的回调 | ||
| 339 | + console.log('确定'); | ||
| 340 | + me.$router.push({ | ||
| 341 | + path:'parkRecord', | ||
| 342 | + query:{ | ||
| 343 | + carNumber: me.carNumber, | ||
| 344 | + carNumberColor: me.carWrapBG, | ||
| 345 | + parkFlag: 1 // 0表示在停 1表示历史 | ||
| 346 | + } | ||
| 347 | + }) | ||
| 338 | } | 348 | } |
| 339 | - }) | ||
| 340 | - } | ||
| 341 | - }).catch(err => { | ||
| 342 | - if (err == 'cancel') { //取消的回调 | ||
| 343 | - console.log('取消'); | ||
| 344 | - } | ||
| 345 | - }); | ||
| 346 | - } | ||
| 347 | - | ||
| 348 | - if(me.parkingData.length==0&&me.historyList.length>0){ | ||
| 349 | - MessageBox.confirm('', { | ||
| 350 | - message: '您当前有历史欠费 是否立即补缴?', | ||
| 351 | - title: '温馨提示', | ||
| 352 | - confirmButtonText: '去补缴', | ||
| 353 | - cancelButtonText: '取消' | ||
| 354 | - }).then(action => { | ||
| 355 | - if (action == 'confirm') { //确认的回调 | ||
| 356 | - console.log('确定'); | ||
| 357 | - me.$router.push({ | ||
| 358 | - path:'parkRecord', | ||
| 359 | - query:{ | ||
| 360 | - carNumber: me.carNumber, | ||
| 361 | - carNumberColor: me.carWrapBG, | ||
| 362 | - parkFlag: 1 // 0表示在停 1表示历史 | 349 | + }).catch(err => { |
| 350 | + if (err == 'cancel') { //取消的回调 | ||
| 351 | + console.log('取消'); | ||
| 363 | } | 352 | } |
| 364 | - }) | ||
| 365 | - } | ||
| 366 | - }).catch(err => { | ||
| 367 | - if (err == 'cancel') { //取消的回调 | ||
| 368 | - console.log('取消'); | 353 | + }); |
| 354 | + }else{ | ||
| 355 | + | ||
| 356 | + if(me.paySrcType==101){ //缴费了本次 | ||
| 357 | + me.$router.push({ | ||
| 358 | + path:'parkRecord', | ||
| 359 | + query:{ | ||
| 360 | + carNumber: me.carNumber, | ||
| 361 | + carNumberColor: me.carWrapBG, | ||
| 362 | + parkFlag: 0 // 0表示在停 1表示历史 | ||
| 363 | + } | ||
| 364 | + }) | ||
| 365 | + }else{ | ||
| 366 | + MessageBox.confirm('', { | ||
| 367 | + message: '您当前有在停订单 是否立即支付?', | ||
| 368 | + title: '温馨提示', | ||
| 369 | + confirmButtonText: '去支付', | ||
| 370 | + cancelButtonText: '取消' | ||
| 371 | + }).then(action => { | ||
| 372 | + if (action == 'confirm') { //确认的回调 | ||
| 373 | + console.log('确定'); | ||
| 374 | + me.$router.push({ | ||
| 375 | + path:'parkRecord', | ||
| 376 | + query:{ | ||
| 377 | + carNumber: me.carNumber, | ||
| 378 | + carNumberColor: me.carWrapBG, | ||
| 379 | + parkFlag: 0 // 0表示在停 1表示历史 | ||
| 380 | + } | ||
| 381 | + }) | ||
| 382 | + } | ||
| 383 | + }).catch(err => { | ||
| 384 | + if (err == 'cancel') { //取消的回调 | ||
| 385 | + console.log('取消'); | ||
| 386 | + } | ||
| 387 | + }); | ||
| 388 | + } | ||
| 389 | + | ||
| 369 | } | 390 | } |
| 370 | - }); | ||
| 371 | - } | 391 | + } |
| 372 | 392 | ||
| 373 | - }) | ||
| 374 | 393 | ||
| 375 | 394 | ||
| 395 | + }) | ||
| 376 | 396 | ||
| 377 | 397 | ||
| 378 | 398 | ||
| 379 | - } else { | ||
| 380 | - console.log('失败') | ||
| 381 | - alert('支付失败') | ||
| 382 | - me.$router.go(-2); | 399 | + } else { |
| 400 | + console.log('失败') | ||
| 401 | + alert('支付失败') | ||
| 402 | + me.$router.go(-2); | ||
| 403 | + } | ||
| 383 | } | 404 | } |
| 384 | - } | ||
| 385 | - ) | ||
| 386 | - }, | 405 | + ) |
| 406 | + }, | ||
| 387 | }, | 407 | }, |
| 388 | filters: { | 408 | filters: { |
| 389 | } | 409 | } |
src/components/parkRecord.vue
| @@ -113,24 +113,24 @@ | @@ -113,24 +113,24 @@ | ||
| 113 | 暂无记录 | 113 | 暂无记录 |
| 114 | </div> | 114 | </div> |
| 115 | 115 | ||
| 116 | - <modal-alert ref="alert"> | ||
| 117 | - <div class="trave-tip-content txt-l" slot="content"> | ||
| 118 | - <div class="confirm-text"> | ||
| 119 | - <p>请至少选择一笔记录</p> | ||
| 120 | - </div> | ||
| 121 | - </div> | ||
| 122 | - <span slot="button">知道了</span> | ||
| 123 | - </modal-alert> | ||
| 124 | - | ||
| 125 | - | ||
| 126 | - <modal-alert ref="zeroAlert"> | ||
| 127 | - <div class="trave-tip-content txt-l" slot="content"> | ||
| 128 | - <div class="confirm-text"> | ||
| 129 | - <p>停车15分钟内无需缴费,申请成功。</p> | ||
| 130 | - </div> | ||
| 131 | - </div> | ||
| 132 | - <span slot="button">知道了</span> | ||
| 133 | - </modal-alert> | 116 | + <!--<modal-alert ref="alert">--> |
| 117 | + <!--<div class="trave-tip-content txt-l" slot="content">--> | ||
| 118 | + <!--<div class="confirm-text">--> | ||
| 119 | + <!--<p>请至少选择一笔记录</p>--> | ||
| 120 | + <!--</div>--> | ||
| 121 | + <!--</div>--> | ||
| 122 | + <!--<span slot="button">知道了</span>--> | ||
| 123 | + <!--</modal-alert>--> | ||
| 124 | + | ||
| 125 | + | ||
| 126 | + <!--<modal-alert ref="zeroAlert">--> | ||
| 127 | + <!--<div class="trave-tip-content txt-l" slot="content">--> | ||
| 128 | + <!--<div class="confirm-text">--> | ||
| 129 | + <!--<p>停车15分钟内无需缴费,申请成功。</p>--> | ||
| 130 | + <!--</div>--> | ||
| 131 | + <!--</div>--> | ||
| 132 | + <!--<span slot="button">知道了</span>--> | ||
| 133 | + <!--</modal-alert>--> | ||
| 134 | 134 | ||
| 135 | 135 | ||
| 136 | </div> | 136 | </div> |
| @@ -207,13 +207,18 @@ export default { | @@ -207,13 +207,18 @@ export default { | ||
| 207 | this.historyList = this.parkList.filter(item => { | 207 | this.historyList = this.parkList.filter(item => { |
| 208 | return item.parkState == '20' | 208 | return item.parkState == '20' |
| 209 | }) | 209 | }) |
| 210 | - if(this.parkingData.length==0&&this.historyList.length>0){ | ||
| 211 | - this.currentTabActive = 1 | ||
| 212 | - } | ||
| 213 | - this.historyList.forEach(i => { | 210 | + this.historyList.forEach( i => { |
| 214 | this.allMoney += Number(i.unPayFee) | 211 | this.allMoney += Number(i.unPayFee) |
| 215 | }) | 212 | }) |
| 216 | 213 | ||
| 214 | + if(this.parkingData.length==0 && this.historyList.length>0){ | ||
| 215 | + this.currentTabActive = 1 | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + if(this.$route.query.parkFlag == 1){ | ||
| 219 | + this.currentTabActive = 1 | ||
| 220 | + this.checkedAll() | ||
| 221 | + } | ||
| 217 | console.log(this.historyList) | 222 | console.log(this.historyList) |
| 218 | }) | 223 | }) |
| 219 | }, | 224 | }, |
| @@ -317,7 +322,7 @@ export default { | @@ -317,7 +322,7 @@ export default { | ||
| 317 | 322 | ||
| 318 | } else { | 323 | } else { |
| 319 | //$('.dialog-out').show() | 324 | //$('.dialog-out').show() |
| 320 | - this.$refs.zeroAlert.open() | 325 | + this.$msgbox('提示', '停车15分钟内无需缴费,申请成功。') |
| 321 | } | 326 | } |
| 322 | 327 | ||
| 323 | }) | 328 | }) |
| @@ -325,7 +330,8 @@ export default { | @@ -325,7 +330,8 @@ export default { | ||
| 325 | }, | 330 | }, |
| 326 | toPayHisroryPage() { // 缴纳历史费用 | 331 | toPayHisroryPage() { // 缴纳历史费用 |
| 327 | if (this.historyCheckedLen == 0) { | 332 | if (this.historyCheckedLen == 0) { |
| 328 | - this.$refs.alert.open() | 333 | + this.$msgbox('提示', '请至少选择一条记录') |
| 334 | + | ||
| 329 | return | 335 | return |
| 330 | } | 336 | } |
| 331 | var salt = this.$utils.myCommonSalt(32); | 337 | var salt = this.$utils.myCommonSalt(32); |
src/components/plateNumber.vue
| @@ -165,41 +165,41 @@ | @@ -165,41 +165,41 @@ | ||
| 165 | <span>新</span> | 165 | <span>新</span> |
| 166 | </div> | 166 | </div> |
| 167 | 167 | ||
| 168 | - <div class="word"> | ||
| 169 | - <span>学</span> | ||
| 170 | - </div> | ||
| 171 | - <!--<div class="word bordernone">--> | ||
| 172 | - <!--<!– <img src="../assets/images/icon-switch.png" alt=""> –>--> | 168 | + <!--<div class="word">--> |
| 169 | + <!--<span>学</span>--> | ||
| 173 | <!--</div>--> | 170 | <!--</div>--> |
| 171 | + <div class="word bordernone"> | ||
| 172 | + <!-- <img src="../assets/images/icon-switch.png" alt=""> --> | ||
| 173 | + </div> | ||
| 174 | </div> | 174 | </div> |
| 175 | 175 | ||
| 176 | 176 | ||
| 177 | - <div class="first-word" | ||
| 178 | - @click="selectFirstWord($event)"> | ||
| 179 | - <div class="word"> | ||
| 180 | - <span>港</span> | ||
| 181 | - </div> | ||
| 182 | - <div class="word"> | ||
| 183 | - <span>澳</span> | ||
| 184 | - </div> | ||
| 185 | - <div class="word"> | ||
| 186 | - <span>领</span> | ||
| 187 | - </div> | 177 | + <!--<div class="first-word"--> |
| 178 | + <!--@click="selectFirstWord($event)">--> | ||
| 179 | + <!--<div class="word">--> | ||
| 180 | + <!--<span>港</span>--> | ||
| 181 | + <!--</div>--> | ||
| 182 | + <!--<div class="word">--> | ||
| 183 | + <!--<span>澳</span>--> | ||
| 184 | + <!--</div>--> | ||
| 185 | + <!--<div class="word">--> | ||
| 186 | + <!--<span>领</span>--> | ||
| 187 | + <!--</div>--> | ||
| 188 | 188 | ||
| 189 | - <div class="word"> | ||
| 190 | - <span>警</span> | ||
| 191 | - </div> | 189 | + <!--<div class="word">--> |
| 190 | + <!--<span>警</span>--> | ||
| 191 | + <!--</div>--> | ||
| 192 | 192 | ||
| 193 | 193 | ||
| 194 | - <div class="word bordernone"> | ||
| 195 | - </div> | ||
| 196 | - <div class="word bordernone"> | ||
| 197 | - </div> | ||
| 198 | - <div class="word bordernone"> | ||
| 199 | - </div> | ||
| 200 | - <div class="word bordernone"> | ||
| 201 | - </div> | ||
| 202 | - </div> | 194 | + <!--<div class="word bordernone">--> |
| 195 | + <!--</div>--> | ||
| 196 | + <!--<div class="word bordernone">--> | ||
| 197 | + <!--</div>--> | ||
| 198 | + <!--<div class="word bordernone">--> | ||
| 199 | + <!--</div>--> | ||
| 200 | + <!--<div class="word bordernone">--> | ||
| 201 | + <!--</div>--> | ||
| 202 | + <!--</div>--> | ||
| 203 | 203 | ||
| 204 | </div> | 204 | </div> |
| 205 | <div class="keyboard-wrap" v-if="keyBoardStatus === true"> | 205 | <div class="keyboard-wrap" v-if="keyBoardStatus === true"> |
| @@ -315,7 +315,7 @@ export default { | @@ -315,7 +315,7 @@ export default { | ||
| 315 | _4: ['H', 'J', 'K', 'L', 'M', 'N', 'O'], | 315 | _4: ['H', 'J', 'K', 'L', 'M', 'N', 'O'], |
| 316 | _5: ['P', 'Q', 'R', 'S', 'T', 'U', 'V'], | 316 | _5: ['P', 'Q', 'R', 'S', 'T', 'U', 'V'], |
| 317 | _6: ['W', 'X', 'Y', 'Z'], | 317 | _6: ['W', 'X', 'Y', 'Z'], |
| 318 | - // _7: ['港', '澳', '学', '领', '警'] | 318 | + _7: ['港', '澳', '学', '领', '警'] |
| 319 | }, | 319 | }, |
| 320 | activeKeyWordIndex: 1, // 当前车牌号 | 320 | activeKeyWordIndex: 1, // 当前车牌号 |
| 321 | keyBoardStatus: false, | 321 | keyBoardStatus: false, |