Commit 7850cc26687581cc69e1def4f4c36a43f982be9c
1 parent
bb951693
赤峰微信公众号 -- 临停支付
Showing
6 changed files
with
144 additions
and
191 deletions
dist 2.zip deleted
No preview for this file type
dist.zip
No preview for this file type
src/router/index.js
| 1 | 1 | import Vue from 'vue' |
| 2 | 2 | import Router from 'vue-router' |
| 3 | 3 | import plateNumber from '@/views/parkPay/plateNumber' |
| 4 | -import parkRecord from '@/views/parkPay/parkRecord' | |
| 4 | +// import parkRecord from '@/views/parkPay/parkRecord' | |
| 5 | 5 | // import selfNav from '@/views/mySelf/selfNav' |
| 6 | 6 | |
| 7 | 7 | Vue.use(Router) |
| ... | ... | @@ -23,7 +23,7 @@ export default new Router({ |
| 23 | 23 | { |
| 24 | 24 | path: '/parkRecord', |
| 25 | 25 | name: 'parkRecord', |
| 26 | - component: parkRecord | |
| 26 | + component: () => import("@/views/parkPay/parkRecord.vue") | |
| 27 | 27 | }, |
| 28 | 28 | { |
| 29 | 29 | path: '/plateNumber', | ... | ... |
src/views/parkPay/orderPay.vue
| ... | ... | @@ -117,123 +117,38 @@ export default { |
| 117 | 117 | this.orderId = _order |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if (this.clientBrowser == '支付宝') { // 支付宝支付 | |
| 121 | - var aliParams = {}; | |
| 122 | - aliParams.orderId = this.orderId; | |
| 123 | - aliParams.carNumber = this.carNumber; | |
| 124 | - aliParams.payType = 1;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | |
| 125 | - aliParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | |
| 126 | - aliParams.paySrcType = this.paySrcType;//101停车支付 | |
| 127 | - aliParams.orgId = this.$utils.myOrgId, | |
| 128 | - aliParams.backType = 2, | |
| 129 | - aliParams.recordArreaInfos = JSON.stringify(this.orderId); | |
| 130 | - console.log(aliParams) | |
| 131 | - aliPay(aliParams).then(response => { | |
| 132 | - console.log(response) | |
| 133 | - if (response.code == 0) {//进场 | |
| 134 | - document.write(response.data);//打开支付表单 | |
| 135 | - } else {//其他情况如【该卡号场内已存在】 | |
| 136 | - console.log(response.message); | |
| 137 | - } | |
| 138 | - | |
| 139 | - }) | |
| 140 | - } | |
| 141 | 120 | |
| 142 | - console.log(this.clientBrowser) | |
| 143 | - if (this.clientBrowser == '立即') { // 农行支付 | |
| 144 | - var bankabcParams = {}; | |
| 145 | - bankabcParams.orderId = this.orderId; | |
| 146 | - bankabcParams.carNumber = this.carNumber; | |
| 147 | - bankabcParams.payType = 34;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 34 农行 | |
| 148 | - bankabcParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | |
| 149 | - bankabcParams.paySrcType = this.paySrcType;//101停车支付 | |
| 150 | - bankabcParams.orgId = this.$utils.myOrgId, | |
| 151 | - bankabcParams.backType = 2, | |
| 152 | - bankabcParams.PaymentLinkType = 1 | |
| 153 | - bankabcParams.recordArreaInfos = JSON.stringify(this.orderId); | |
| 154 | - console.log(bankabcParams) | |
| 155 | - bankH5Pay(bankabcParams).then(response => { | |
| 156 | - console.log(response) | |
| 157 | - if(response.code=='0'){ | |
| 158 | - let res = response.data.PaymentURL | |
| 159 | - let _token = res.split('TOKEN=')[1] | |
| 160 | - let OrderNo = response.data.OrderNo | |
| 161 | - localStorage.setItem('OrderNum',OrderNo) | |
| 162 | - | |
| 163 | - | |
| 164 | - if(window.navigator.userAgent.indexOf('Bankabc/Portal') > -1) { | |
| 165 | - // alert('当前页面在新容器'); | |
| 166 | - AlipayJSBridge.call('startApp',{ | |
| 167 | - appId:'30603024', // 固定值 | |
| 168 | - param:{ | |
| 169 | - type:"3", // 3: 掌银内H5页面, | |
| 170 | - tokenId:_token, //商户传过来的tokenId | |
| 171 | - paySystem:"", //商户传过来的paySystem, 没有则传空字符串 | |
| 172 | - payType:"1111", //商户传过来的payType,没有则传'1111' | |
| 173 | - webviewURL:"https://wxgzh.renniting.cn/wechatwuxi/Chifeng/TEST/sweeping_payment/codepay/index.html#/payResult", //商户传过来的回跳地址 | |
| 174 | - remark:"其他参数", //扩展备用 | |
| 175 | - showProgress:'NO', | |
| 176 | - backBehavior:'back' | |
| 177 | - }, | |
| 178 | - },function(result){ | |
| 179 | - | |
| 180 | - }); | |
| 121 | + if (this.clientBrowser == '微信') { // 微信支付 | |
| 122 | + let _openId = sessionStorage.getItem('openIdData') | |
| 123 | + if(_openId){ | |
| 124 | + me.vxPay(_openId, this.orderId) | |
| 125 | + }else{ | |
| 126 | + //第一步获取openid | |
| 127 | + var codeParams = { | |
| 128 | + code: this.webAppCode, | |
| 129 | + appId: this.$utils.myVxAppId | |
| 130 | + }; | |
| 131 | + getOpenId(codeParams).then(res => { | |
| 132 | + if (res.code == 0) { | |
| 133 | + me.vxPay(res.data, this.orderId) | |
| 134 | + sessionStorage.setItem('openIdData',res.data) | |
| 135 | + } else if (res.code == 40163) { //code been used, hints[重复code问题] | |
| 136 | + alert('请重新扫码重复code问题') | |
| 137 | + console.log(res.message); | |
| 181 | 138 | } else { |
| 182 | - // alert('当前页面在旧容器'); | |
| 183 | - // 旧支付方式 | |
| 184 | - window.location.href = 'https://www.abchina.com/luascript/mobilePayLua/'+ encodeURI('{"return":{"tokenID":"'+_token+'","backURL":"https://wxgzh.renniting.cn/wechatwuxi/Chifeng/TEST/sweeping_payment/codepay/index.html#/payResult","payType":""}}'); | |
| 185 | - | |
| 139 | + alert('请重新扫码') | |
| 186 | 140 | } |
| 187 | - }else{ | |
| 188 | - alert('支付失败') | |
| 189 | - } | |
| 190 | - | |
| 191 | - | |
| 192 | - // console.log(_token) | |
| 193 | - // let _data = 'method=invokePayFromBrowser&tokenID='+_token | |
| 194 | - // let cryData = CryptoJS.encrypt(_data, 'G9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvM3', 'EkpTEA3FbZFGGq8Y') | |
| 195 | - // | |
| 196 | - // let baseCRY = Base64.encode(cryData) | |
| 197 | - // console.log(baseCRY) | |
| 198 | - // window.location.href='bankabc:' + encodeURIComponent('{"method":"invokePayFromBrowser","param":'+baseCRY+'}') | |
| 199 | - // // 即为加密后的数据。其中paramsEncode是需要加密的数据、 | |
| 200 | - // // keyStr是加密时使用的key,与服务端一致、hash是偏移量,是一个随机生成的16位字符串。 | |
| 201 | - }) | |
| 202 | - } | |
| 203 | - | |
| 204 | - | |
| 205 | - | |
| 206 | - | |
| 207 | - | |
| 208 | - | |
| 209 | - | |
| 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 | - | |
| 141 | + }) | |
| 142 | + } | |
| 227 | 143 | } |
| 228 | - | |
| 229 | 144 | }, |
| 230 | 145 | vxPay(openIdData, orderIdData) { |
| 231 | 146 | let vm = this |
| 232 | 147 | var wxParams = {}; |
| 233 | 148 | wxParams.orderId = orderIdData; |
| 234 | 149 | wxParams.backType = 2, |
| 235 | - wxParams.orgId = this.$utils.myOrgId, | |
| 236 | - wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | |
| 150 | + wxParams.orgId = this.$utils.myOrgId, | |
| 151 | + wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | |
| 237 | 152 | wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 |
| 238 | 153 | wxParams.carNumber = this.carNumber; |
| 239 | 154 | wxParams.paySrcType = this.paySrcType;//101停车支付 |
| ... | ... | @@ -301,6 +216,8 @@ export default { |
| 301 | 216 | console.log(response) |
| 302 | 217 | me.parkList = response.data.dataList |
| 303 | 218 | |
| 219 | + // alert(JSON.stringify(me.parkList)) | |
| 220 | + // alert(me.parkList.length) | |
| 304 | 221 | if(me.parkList.length == 0){ |
| 305 | 222 | me.$router.push({ |
| 306 | 223 | path:'parkRecord', |
| ... | ... | @@ -310,25 +227,43 @@ export default { |
| 310 | 227 | parkFlag: 0 // 0表示在停 1表示历史 |
| 311 | 228 | } |
| 312 | 229 | }) |
| 313 | - } | |
| 314 | 230 | |
| 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('确定'); | |
| 231 | + }else{ | |
| 232 | + me.parkingData = me.parkList.filter(item => { | |
| 233 | + return item.parkState == '10' | |
| 234 | + }) | |
| 235 | + console.log(me.parkingData) | |
| 236 | + me.historyList = me.parkList.filter(item => { | |
| 237 | + return item.parkState == '20' | |
| 238 | + }) | |
| 239 | + console.log(me.historyList) | |
| 240 | + | |
| 241 | + if(me.historyList.length>0){ | |
| 242 | + MessageBox.confirm('', { | |
| 243 | + message: '您当前有历史欠费 是否立即补缴?', | |
| 244 | + title: '温馨提示', | |
| 245 | + confirmButtonText: '去补缴', | |
| 246 | + cancelButtonText: '取消' | |
| 247 | + }).then(action => { | |
| 248 | + if (action == 'confirm') { //确认的回调 | |
| 249 | + console.log('确定'); | |
| 250 | + me.$router.push({ | |
| 251 | + path:'parkRecord', | |
| 252 | + query:{ | |
| 253 | + carNumber: me.carNumber, | |
| 254 | + carNumberColor: me.carWrapBG, | |
| 255 | + parkFlag: 1 // 0表示在停 1表示历史 | |
| 256 | + } | |
| 257 | + }) | |
| 258 | + } | |
| 259 | + }).catch(err => { | |
| 260 | + if (err == 'cancel') { //取消的回调 | |
| 261 | + console.log('取消'); | |
| 262 | + } | |
| 263 | + }); | |
| 264 | + }else{ | |
| 265 | + | |
| 266 | + if(me.paySrcType==101){ //缴费了本次 | |
| 332 | 267 | me.$router.push({ |
| 333 | 268 | path:'parkRecord', |
| 334 | 269 | query:{ |
| ... | ... | @@ -337,42 +272,37 @@ export default { |
| 337 | 272 | parkFlag: 0 // 0表示在停 1表示历史 |
| 338 | 273 | } |
| 339 | 274 | }) |
| 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表示历史 | |
| 275 | + }else{ | |
| 276 | + MessageBox.confirm('', { | |
| 277 | + message: '您当前有在停订单 是否立即支付?', | |
| 278 | + title: '温馨提示', | |
| 279 | + confirmButtonText: '去支付', | |
| 280 | + cancelButtonText: '取消' | |
| 281 | + }).then(action => { | |
| 282 | + if (action == 'confirm') { //确认的回调 | |
| 283 | + console.log('确定'); | |
| 284 | + me.$router.push({ | |
| 285 | + path:'parkRecord', | |
| 286 | + query:{ | |
| 287 | + carNumber: me.carNumber, | |
| 288 | + carNumberColor: me.carWrapBG, | |
| 289 | + parkFlag: 0 // 0表示在停 1表示历史 | |
| 290 | + } | |
| 291 | + }) | |
| 363 | 292 | } |
| 364 | - }) | |
| 365 | - } | |
| 366 | - }).catch(err => { | |
| 367 | - if (err == 'cancel') { //取消的回调 | |
| 368 | - console.log('取消'); | |
| 293 | + }).catch(err => { | |
| 294 | + if (err == 'cancel') { //取消的回调 | |
| 295 | + console.log('取消'); | |
| 296 | + } | |
| 297 | + }); | |
| 369 | 298 | } |
| 370 | - }); | |
| 299 | + | |
| 300 | + } | |
| 371 | 301 | } |
| 372 | 302 | |
| 373 | - }) | |
| 374 | 303 | |
| 375 | 304 | |
| 305 | + }) | |
| 376 | 306 | |
| 377 | 307 | |
| 378 | 308 | ... | ... |
src/views/parkPay/parkRecord.vue
| ... | ... | @@ -33,7 +33,7 @@ |
| 33 | 33 | <p>停车时长:{{ $utils.dateFormat(i.parkDuration)}}</p> |
| 34 | 34 | <div class="out-wrap"> |
| 35 | 35 | <p class="mon-wrap">¥{{(i.unPayFee/100).toFixed(2)}}</p> |
| 36 | - <p class="out-btn" @click="toPayCurrent(i,parkingData[0].parkDuration)" v-if="parkingData[0].parkDuration<=60">申请离场</p> | |
| 36 | + <p class="out-btn" @click="toPayCurrent(i,parkingData[0].parkDuration)" v-if="parkingData[0].parkDuration<=900">申请离场</p> | |
| 37 | 37 | <p class="out-btn" @click="toPayCurrent(i,parkingData[0].parkDuration)" v-else>出场缴费</p> |
| 38 | 38 | </div> |
| 39 | 39 | </div> |
| ... | ... | @@ -145,6 +145,8 @@ export default { |
| 145 | 145 | } |
| 146 | 146 | }, |
| 147 | 147 | mounted(){ |
| 148 | + | |
| 149 | + | |
| 148 | 150 | }, |
| 149 | 151 | created() { |
| 150 | 152 | this.carNumber = this.$route.query.carNumber // 获取车牌号 |
| ... | ... | @@ -153,6 +155,9 @@ export default { |
| 153 | 155 | console.log(this.carNumber) |
| 154 | 156 | this.parkRecordList(this.carNumber) |
| 155 | 157 | |
| 158 | + | |
| 159 | + // | |
| 160 | + | |
| 156 | 161 | }, |
| 157 | 162 | methods: { |
| 158 | 163 | parkRecordList(){ // 获取停车记录数据 |
| ... | ... | @@ -189,13 +194,19 @@ export default { |
| 189 | 194 | this.historyList = this.parkList.filter(item => { |
| 190 | 195 | return item.parkState == '20' |
| 191 | 196 | }) |
| 192 | - if(this.parkingData.length==0&&this.historyList.length>0){ | |
| 193 | - this.currentTabActive = 1 | |
| 194 | - } | |
| 197 | + | |
| 195 | 198 | this.historyList.forEach( i => { |
| 196 | 199 | this.allMoney += Number(i.unPayFee) |
| 197 | 200 | }) |
| 198 | 201 | |
| 202 | + if(this.parkingData.length==0 && this.historyList.length>0){ | |
| 203 | + this.currentTabActive = 1 | |
| 204 | + } | |
| 205 | + | |
| 206 | + if(this.$route.query.parkFlag == 1){ | |
| 207 | + this.currentTabActive = 1 | |
| 208 | + this.checkedAll() | |
| 209 | + } | |
| 199 | 210 | console.log(this.historyList) |
| 200 | 211 | }) |
| 201 | 212 | }, | ... | ... |
src/views/parkPay/plateNumber.vue
| ... | ... | @@ -198,40 +198,40 @@ |
| 198 | 198 | <div class="word"> |
| 199 | 199 | <span>新</span> |
| 200 | 200 | </div> |
| 201 | - <div class="word"> | |
| 202 | - <span>学</span> | |
| 203 | - </div> | |
| 204 | - <!--<div class="word bordernone">--> | |
| 205 | - <!--<!– <img src="../assets/images/icon-switch.png" alt=""> –>--> | |
| 201 | + <!--<div class="word">--> | |
| 202 | + <!--<span>学</span>--> | |
| 206 | 203 | <!--</div>--> |
| 204 | + <div class="word bordernone"> | |
| 205 | + <!-- <img src="../assets/images/icon-switch.png" alt=""> --> | |
| 206 | + </div> | |
| 207 | 207 | </div> |
| 208 | 208 | |
| 209 | - <div class="first-word" | |
| 210 | - @click="selectFirstWord($event)"> | |
| 211 | - <div class="word"> | |
| 212 | - <span>港</span> | |
| 213 | - </div> | |
| 214 | - <div class="word"> | |
| 215 | - <span>澳</span> | |
| 216 | - </div> | |
| 217 | - <div class="word"> | |
| 218 | - <span>领</span> | |
| 219 | - </div> | |
| 209 | + <!--<div class="first-word"--> | |
| 210 | + <!--@click="selectFirstWord($event)">--> | |
| 211 | + <!--<div class="word">--> | |
| 212 | + <!--<span>港</span>--> | |
| 213 | + <!--</div>--> | |
| 214 | + <!--<div class="word">--> | |
| 215 | + <!--<span>澳</span>--> | |
| 216 | + <!--</div>--> | |
| 217 | + <!--<div class="word">--> | |
| 218 | + <!--<span>领</span>--> | |
| 219 | + <!--</div>--> | |
| 220 | 220 | |
| 221 | - <div class="word"> | |
| 222 | - <span>警</span> | |
| 223 | - </div> | |
| 221 | + <!--<div class="word">--> | |
| 222 | + <!--<span>警</span>--> | |
| 223 | + <!--</div>--> | |
| 224 | 224 | |
| 225 | 225 | |
| 226 | - <div class="word bordernone"> | |
| 227 | - </div> | |
| 228 | - <div class="word bordernone"> | |
| 229 | - </div> | |
| 230 | - <div class="word bordernone"> | |
| 231 | - </div> | |
| 232 | - <div class="word bordernone"> | |
| 233 | - </div> | |
| 234 | - </div> | |
| 226 | + <!--<div class="word bordernone">--> | |
| 227 | + <!--</div>--> | |
| 228 | + <!--<div class="word bordernone">--> | |
| 229 | + <!--</div>--> | |
| 230 | + <!--<div class="word bordernone">--> | |
| 231 | + <!--</div>--> | |
| 232 | + <!--<div class="word bordernone">--> | |
| 233 | + <!--</div>--> | |
| 234 | + <!--</div>--> | |
| 235 | 235 | </div> |
| 236 | 236 | <div class="keyboard-wrap" v-if="keyBoardStatus === true"> |
| 237 | 237 | <!-- <div class="number-wrap"></div> |
| ... | ... | @@ -367,6 +367,18 @@ export default { |
| 367 | 367 | this.initSWiper() |
| 368 | 368 | }, |
| 369 | 369 | mounted () { |
| 370 | + // | |
| 371 | + // if (this.$utils.clientBrowser() == "微信") { | |
| 372 | + // var appID = this.$utils.myVxAppId; | |
| 373 | + // var code = this.getUrlParam('code'); | |
| 374 | + // var local = window.location.href; | |
| 375 | + // if (code == null || code === '') { | |
| 376 | + // 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,0#wechat_redirect' | |
| 377 | + // } else { | |
| 378 | + // return code; | |
| 379 | + // } | |
| 380 | + // } | |
| 381 | + | |
| 370 | 382 | this.boundList = localStorage.getItem('parkRecordList') ? localStorage.getItem('parkRecordList') : [] |
| 371 | 383 | console.log(this.boundList) |
| 372 | 384 | }, |
| ... | ... | @@ -481,7 +493,7 @@ export default { |
| 481 | 493 | plateLicense = this.plate_license_1 |
| 482 | 494 | plateLicense = this.palindrome(plateLicense) |
| 483 | 495 | if (plateLicense.length < 7) { |
| 484 | - this.$refs.alert.open() | |
| 496 | + this.$msgbox('提示', '请输入正确的车牌号') | |
| 485 | 497 | return |
| 486 | 498 | } |
| 487 | 499 | } |
| ... | ... | @@ -489,7 +501,7 @@ export default { |
| 489 | 501 | plateLicense = this.plate_license_2 |
| 490 | 502 | plateLicense = this.palindrome(plateLicense) |
| 491 | 503 | if (plateLicense.length < 8) { |
| 492 | - this.$refs.alert.open() | |
| 504 | + this.$msgbox('提示', '请输入正确的车牌号') | |
| 493 | 505 | return |
| 494 | 506 | } |
| 495 | 507 | } | ... | ... |