Commit 49f85de6e92de9f94796f0fda899368974f68f8e
1 parent
4087b794
黄石微信公众号 -- 临停支付
Showing
10 changed files
with
527 additions
and
283 deletions
dist.zip
No preview for this file type
src/api/binDing/binDing.js
0 → 100644
1 | +import request from '@/utils/request' | ||
2 | + | ||
3 | +export function sendverificode(params) { // 获取验证码 | ||
4 | + return request({ | ||
5 | + url: 'user/sendverificode', | ||
6 | + method: 'post', | ||
7 | + data: params | ||
8 | + }) | ||
9 | +} | ||
10 | + | ||
11 | + | ||
12 | +export function bindCustByOpenId(params) { // 绑定用户 | ||
13 | + return request({ | ||
14 | + url: 'wxPublicUser/bindCustByOpenId', | ||
15 | + method: 'post', | ||
16 | + data: params | ||
17 | + }) | ||
18 | +} | ||
19 | + | ||
20 | + | ||
21 | +export function queryUserInfo(params) { // 获取用户信息 | ||
22 | + return request({ | ||
23 | + url: 'user/queryUserInfo', | ||
24 | + method: 'post', | ||
25 | + data: params | ||
26 | + }) | ||
27 | +} | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + |
src/api/orderPay/orderPay.js
@@ -17,6 +17,7 @@ export function getOpenId(params) { // 获取OpenId | @@ -17,6 +17,7 @@ export function getOpenId(params) { // 获取OpenId | ||
17 | }) | 17 | }) |
18 | } | 18 | } |
19 | 19 | ||
20 | + | ||
20 | export function vxPayQuery(params) { // 微信 | 21 | export function vxPayQuery(params) { // 微信 |
21 | return request({ | 22 | return request({ |
22 | url: 'weixinpay/publicUnifiedOrder', | 23 | url: 'weixinpay/publicUnifiedOrder', |
@@ -25,18 +26,22 @@ export function vxPayQuery(params) { // 微信 | @@ -25,18 +26,22 @@ export function vxPayQuery(params) { // 微信 | ||
25 | }) | 26 | }) |
26 | } | 27 | } |
27 | 28 | ||
29 | +// 新接口银联 | ||
28 | 30 | ||
29 | -export function bankH5Pay(params) { // 农行 | 31 | +export function doPay(params) { // 微信 |
30 | return request({ | 32 | return request({ |
31 | - url: 'abcBankPay/bankPayForH5', | 33 | + url: 'unionpay/doPay', |
32 | method: 'post', | 34 | method: 'post', |
33 | data: params | 35 | data: params |
34 | }) | 36 | }) |
35 | } | 37 | } |
36 | 38 | ||
37 | -export function queryParkingRecordPageByCarNumbers(params) { // 支付完成后查询记录 | 39 | + |
40 | +// 创建订单 | ||
41 | + | ||
42 | +export function doOrderCreate(params) { // 创建订单 | ||
38 | return request({ | 43 | return request({ |
39 | - url: 'queryParkOrder/queryParkingRecordPageByCarNumbers', | 44 | + url: 'unionpay/doOrderCreate', |
40 | method: 'post', | 45 | method: 'post', |
41 | data: params | 46 | data: params |
42 | }) | 47 | }) |
@@ -45,8 +50,3 @@ export function queryParkingRecordPageByCarNumbers(params) { // 支付完成后 | @@ -45,8 +50,3 @@ export function queryParkingRecordPageByCarNumbers(params) { // 支付完成后 | ||
45 | 50 | ||
46 | 51 | ||
47 | 52 | ||
48 | - | ||
49 | - | ||
50 | - | ||
51 | - | ||
52 | - |
src/api/selfNav/selfNav.js
0 → 100644
1 | +import request from '@/utils/request' | ||
2 | + | ||
3 | +export function getOpenIdByCode(params) { // 获取opendid | ||
4 | + return request({ | ||
5 | + url: 'weixinPublicPay/getOpenIdByCode', | ||
6 | + method: 'post', | ||
7 | + data: params | ||
8 | + }) | ||
9 | +} | ||
10 | + | ||
11 | + | ||
12 | +export function getTokenByOpenId(params) { // 获取token和手机号 | ||
13 | + return request({ | ||
14 | + url: 'wxPublicUser/getTokenByOpenId', | ||
15 | + method: 'post', | ||
16 | + data: params | ||
17 | + }) | ||
18 | +} | ||
19 | + | ||
20 | + | ||
21 | +export function queryUserInfo(params) { // 获取用户信息 | ||
22 | + return request({ | ||
23 | + url: 'user/queryUserInfo', | ||
24 | + method: 'post', | ||
25 | + data: params | ||
26 | + }) | ||
27 | +} | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | + |
src/main.js
@@ -6,19 +6,21 @@ import router from './router' | @@ -6,19 +6,21 @@ import router from './router' | ||
6 | 6 | ||
7 | import './assets/css/reset.css' // 引入公共样式 | 7 | import './assets/css/reset.css' // 引入公共样式 |
8 | 8 | ||
9 | -import h5Popup from 'vue-h5-popup' // 引入弹窗 | ||
10 | -Vue.use(h5Popup) | 9 | +// import h5Popup from 'vue-h5-popup' // 引入弹窗 |
10 | +// Vue.use(h5Popup) | ||
11 | 11 | ||
12 | 12 | ||
13 | -// import MintUI from 'mint-ui' | ||
14 | -// import 'mint-ui/lib/style.css' | ||
15 | -// Vue.use(MintUI) // 引入MintUI | ||
16 | 13 | ||
17 | 14 | ||
15 | +import Mint from 'mint-ui'; | ||
18 | import 'mint-ui/lib/style.css' | 16 | import 'mint-ui/lib/style.css' |
17 | +Vue.use(Mint); | ||
18 | + | ||
19 | import { MessageBox } from 'mint-ui' | 19 | import { MessageBox } from 'mint-ui' |
20 | -// Vue.use(MessageBox) | 20 | +import { Toast } from 'mint-ui'; |
21 | + | ||
21 | Vue.prototype.$msgbox = MessageBox | 22 | Vue.prototype.$msgbox = MessageBox |
23 | +Vue.prototype.$toast = Toast | ||
22 | 24 | ||
23 | //全局设置的基本样式 | 25 | //全局设置的基本样式 |
24 | import './assets/css/base.scss' | 26 | import './assets/css/base.scss' |
@@ -33,13 +35,11 @@ Vue.prototype.$moment = moment | @@ -33,13 +35,11 @@ Vue.prototype.$moment = moment | ||
33 | import utils from './utils/utils' // 工具类 | 35 | import utils from './utils/utils' // 工具类 |
34 | Vue.prototype.$utils = utils | 36 | Vue.prototype.$utils = utils |
35 | 37 | ||
36 | -import Mint from 'mint-ui'; | ||
37 | -import 'mint-ui/lib/style.css' | ||
38 | -Vue.use(Mint); | ||
39 | 38 | ||
40 | 39 | ||
41 | -import 'swiper/dist/css/swiper.min.css' // 轮播 | ||
42 | -import 'swiper/dist/js/swiper.min' | 40 | + |
41 | +// import 'swiper/dist/css/swiper.min.css' // 轮播 | ||
42 | +// import 'swiper/dist/js/swiper.min' | ||
43 | 43 | ||
44 | import vueFilter from './utils/filters' // 公共filter | 44 | import vueFilter from './utils/filters' // 公共filter |
45 | for (let key in vueFilter){ | 45 | for (let key in vueFilter){ |
src/router/index.js
@@ -2,7 +2,7 @@ import Vue from 'vue' | @@ -2,7 +2,7 @@ import Vue from 'vue' | ||
2 | import Router from 'vue-router' | 2 | import Router from 'vue-router' |
3 | import plateNumber from '@/views/parkPay/plateNumber' | 3 | import plateNumber from '@/views/parkPay/plateNumber' |
4 | // import parkRecord from '@/views/parkPay/parkRecord' | 4 | // import parkRecord from '@/views/parkPay/parkRecord' |
5 | -// import selfNav from '@/views/mySelf/selfNav' | 5 | +import selfNav from '@/views/mySelf/selfNav' |
6 | 6 | ||
7 | Vue.use(Router) | 7 | Vue.use(Router) |
8 | 8 | ||
@@ -37,12 +37,12 @@ export default new Router({ | @@ -37,12 +37,12 @@ export default new Router({ | ||
37 | component: () => import("@/views/parkPay/orderPay.vue") | 37 | component: () => import("@/views/parkPay/orderPay.vue") |
38 | }, | 38 | }, |
39 | 39 | ||
40 | - // //---------------- 个人页面导航 | ||
41 | - // { | ||
42 | - // path: '/selfNav', | ||
43 | - // name: 'selfNav', | ||
44 | - // component: () => import("@/views/mySelf/selfNav.vue") | ||
45 | - // }, | 40 | + //---------------- 个人页面导航 |
41 | + { | ||
42 | + path: '/selfNav', | ||
43 | + name: 'selfNav', | ||
44 | + component: () => import("@/views/mySelf/selfNav.vue") | ||
45 | + }, | ||
46 | // | 46 | // |
47 | // // ------------------------建议反馈 | 47 | // // ------------------------建议反馈 |
48 | // { | 48 | // { |
@@ -60,11 +60,11 @@ export default new Router({ | @@ -60,11 +60,11 @@ export default new Router({ | ||
60 | // | 60 | // |
61 | // | 61 | // |
62 | // // ------------------------停车记录 | 62 | // // ------------------------停车记录 |
63 | - // { | ||
64 | - // path: '/binDing', | ||
65 | - // name: 'binDing', | ||
66 | - // component: () => import("@/views/binding/binDing.vue") | ||
67 | - // }, | 63 | + { |
64 | + path: '/binDing', | ||
65 | + name: 'binDing', | ||
66 | + component: () => import("@/views/binding/binDing.vue") | ||
67 | + }, | ||
68 | // | 68 | // |
69 | // | 69 | // |
70 | // // ------------------------购买会员卡提示 | 70 | // // ------------------------购买会员卡提示 |
src/utils/utils.js
1 | import md5 from './md5.min.js'; | 1 | import md5 from './md5.min.js'; |
2 | + | ||
2 | export default { | 3 | export default { |
3 | myCommonSalt: function (val) { // 获取盐值 | 4 | myCommonSalt: function (val) { // 获取盐值 |
4 | let len = parseInt(val); | 5 | let len = parseInt(val); |
@@ -12,36 +13,45 @@ export default { | @@ -12,36 +13,45 @@ export default { | ||
12 | return pwd; | 13 | return pwd; |
13 | }, | 14 | }, |
14 | 15 | ||
15 | - formatDate: function(secs, type=0){ //type是可选参数,因为json中时间的格式是year-month-date,不能识别XX年XX月XX日 | 16 | + formatDate: function (secs, type = 0) { //type是可选参数,因为json中时间的格式是year-month-date,不能识别XX年XX月XX日 |
16 | var t = new Date(secs) | 17 | var t = new Date(secs) |
17 | var year = t.getFullYear() | 18 | var year = t.getFullYear() |
18 | var month = t.getMonth() + 1 | 19 | var month = t.getMonth() + 1 |
19 | - if(month < 10){ month = '0' + month } | 20 | + if (month < 10) { |
21 | + month = '0' + month | ||
22 | + } | ||
20 | var date = t.getDate() | 23 | var date = t.getDate() |
21 | - if(date < 10){ date = '0' + date } | 24 | + if (date < 10) { |
25 | + date = '0' + date | ||
26 | + } | ||
22 | var hour = t.getHours() | 27 | var hour = t.getHours() |
23 | - if(hour < 10){ hour = '0' + hour } | 28 | + if (hour < 10) { |
29 | + hour = '0' + hour | ||
30 | + } | ||
24 | var minute = t.getMinutes() | 31 | var minute = t.getMinutes() |
25 | - if(minute < 10){ minute = '0' + minute } | 32 | + if (minute < 10) { |
33 | + minute = '0' + minute | ||
34 | + } | ||
26 | var second = t.getSeconds() | 35 | var second = t.getSeconds() |
27 | - if(second < 10){ second = '0' + second } | ||
28 | - if(type==0){ | 36 | + if (second < 10) { |
37 | + second = '0' + second | ||
38 | + } | ||
39 | + if (type == 0) { | ||
29 | return year + '年' + month + '月' + date + '日' | 40 | return year + '年' + month + '月' + date + '日' |
30 | - }else{ | ||
31 | - return year + '-'+month+'-'+date | ||
32 | - }}, | 41 | + } else { |
42 | + return year + '-' + month + '-' + date | ||
43 | + } | ||
44 | + }, | ||
33 | 45 | ||
34 | timestampToTime: function (timestamp) { | 46 | timestampToTime: function (timestamp) { |
35 | var d = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000 | 47 | var d = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000 |
36 | - var youWant=d.getFullYear() + '-' + this.completedString(d.getMonth() + 1) + '-' + this.completedString(d.getDate()) ; | ||
37 | - return youWant | 48 | + var youWant = d.getFullYear() + '-' + this.completedString(d.getMonth() + 1) + '-' + this.completedString(d.getDate()); |
49 | + return youWant | ||
38 | }, | 50 | }, |
39 | - completedString:function(s) { | 51 | + completedString: function (s) { |
40 | return s < 10 ? '0' + s : s | 52 | return s < 10 ? '0' + s : s |
41 | }, | 53 | }, |
42 | 54 | ||
43 | - | ||
44 | - | ||
45 | dateFormat: function (msd) { // 时间转换 | 55 | dateFormat: function (msd) { // 时间转换 |
46 | var time = msd | 56 | var time = msd |
47 | 57 | ||
@@ -78,21 +88,43 @@ export default { | @@ -78,21 +88,43 @@ export default { | ||
78 | parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒"; | 88 | parseInt((parseFloat(time / 3600.0) - parseInt(time / 3600.0)) * 60)) * 60) + "秒"; |
79 | 89 | ||
80 | } | 90 | } |
81 | - | ||
82 | else { | 91 | else { |
83 | - | ||
84 | time = parseInt(time) + "秒"; | 92 | time = parseInt(time) + "秒"; |
85 | - | ||
86 | } | 93 | } |
87 | - | ||
88 | } | 94 | } |
89 | 95 | ||
90 | return time; | 96 | return time; |
91 | }, | 97 | }, |
92 | 98 | ||
93 | - signObject: function (jsonObj){ //签名字段 | 99 | + GetOpenid: function () { // 获取openid |
100 | + let openid = sessionStorage.getItem('wx_openId'); | ||
101 | + if (!openid || openid == '') { | ||
102 | + openid = null; | ||
103 | + } | ||
104 | + return openid; | ||
105 | + }, | ||
106 | + | ||
107 | + SetOpenid: function (openid) { // 存储openid | ||
108 | + sessionStorage.setItem('wx_openId', openid); | ||
109 | + }, | ||
110 | + | ||
111 | + SetToken: function (token) { // 存储 token | ||
112 | + sessionStorage.setItem('wx_Token', token); | ||
113 | + }, | ||
114 | + GetToken: function () { | ||
115 | + let token = sessionStorage.getItem('wx_Token'); | ||
116 | + //测试环境 | ||
117 | + if (!token || token == '') { | ||
118 | + token = null; | ||
119 | + } | ||
120 | + return token; | ||
121 | + }, | ||
122 | + SetPhone: function (phone) { // 存储 手机号 | ||
123 | + sessionStorage.setItem('WXPhone', phone); | ||
124 | + }, | ||
125 | + signObject: function (jsonObj) { //签名字段 | ||
94 | let sort = [] | 126 | let sort = [] |
95 | - for(let k in jsonObj){ | 127 | + for (let k in jsonObj) { |
96 | sort.push({ | 128 | sort.push({ |
97 | keyname: k, | 129 | keyname: k, |
98 | value: jsonObj[k] | 130 | value: jsonObj[k] |
@@ -111,10 +143,10 @@ export default { | @@ -111,10 +143,10 @@ export default { | ||
111 | } else if (/BankabciPhone/.test(window.navigator.userAgent)) { | 143 | } else if (/BankabciPhone/.test(window.navigator.userAgent)) { |
112 | console.log("农行客户端"); | 144 | console.log("农行客户端"); |
113 | return '立即' | 145 | return '立即' |
114 | - }else if (/BankabcAndroid/.test(window.navigator.userAgent)) { | 146 | + } else if (/BankabcAndroid/.test(window.navigator.userAgent)) { |
115 | console.log("农行客户端"); | 147 | console.log("农行客户端"); |
116 | return '立即' | 148 | return '立即' |
117 | - }else { | 149 | + } else { |
118 | console.log("其他浏览器"); | 150 | console.log("其他浏览器"); |
119 | return '支付宝' | 151 | return '支付宝' |
120 | } | 152 | } |
@@ -131,10 +163,10 @@ export default { | @@ -131,10 +163,10 @@ export default { | ||
131 | } else if (/BankabciPhone/.test(window.navigator.userAgent)) { | 163 | } else if (/BankabciPhone/.test(window.navigator.userAgent)) { |
132 | console.log("农行客户端"); | 164 | console.log("农行客户端"); |
133 | return '34' | 165 | return '34' |
134 | - }else if (/BankabcAndroid/.test(window.navigator.userAgent)) { | 166 | + } else if (/BankabcAndroid/.test(window.navigator.userAgent)) { |
135 | console.log("农行客户端"); | 167 | console.log("农行客户端"); |
136 | return '34' | 168 | return '34' |
137 | - }else { | 169 | + } else { |
138 | console.log("其他浏览器"); | 170 | console.log("其他浏览器"); |
139 | return '1' | 171 | return '1' |
140 | } | 172 | } |
@@ -145,7 +177,7 @@ export default { | @@ -145,7 +177,7 @@ export default { | ||
145 | // ud8yq5tv0inxupc05xfeau39jywlqoj2 新的id | 177 | // ud8yq5tv0inxupc05xfeau39jywlqoj2 新的id |
146 | // ny1u72b6k374sg379z0kqjgfxe2ycnpw 新的签名 | 178 | // ny1u72b6k374sg379z0kqjgfxe2ycnpw 新的签名 |
147 | 179 | ||
148 | - myVarAppid:'0eca8f5373ca4866aec2f8e9d9367104',// 公共请求Appid | 180 | + myVarAppid: '0eca8f5373ca4866aec2f8e9d9367104',// 公共请求Appid |
149 | 181 | ||
150 | myDeviceInfo: 'BC0703A4-AFB0-4B51-9089-9B7487C0CC6E', // 公共请求设备信息 | 182 | myDeviceInfo: 'BC0703A4-AFB0-4B51-9089-9B7487C0CC6E', // 公共请求设备信息 |
151 | 183 | ||
@@ -170,15 +202,15 @@ export default { | @@ -170,15 +202,15 @@ export default { | ||
170 | } | 202 | } |
171 | objb.sort(compare); | 203 | objb.sort(compare); |
172 | var strmd5 = '14318527b13840c2a4af63fef52c2d6e'; | 204 | var strmd5 = '14318527b13840c2a4af63fef52c2d6e'; |
173 | - for(var i=0;i<objb.length;i++){ | ||
174 | - if(objb[i].value != null&&objb[i].value != ''){ | ||
175 | - strmd5 += objb[i].keyname+objb[i].value; | 205 | + for (var i = 0; i < objb.length; i++) { |
206 | + if (objb[i].value != null && objb[i].value != '') { | ||
207 | + strmd5 += objb[i].keyname + objb[i].value; | ||
176 | } | 208 | } |
177 | } | 209 | } |
178 | strmd5 += '14318527b13840c2a4af63fef52c2d6e'; | 210 | strmd5 += '14318527b13840c2a4af63fef52c2d6e'; |
179 | // console.log('strmd5-------->'+strmd5); | 211 | // console.log('strmd5-------->'+strmd5); |
180 | strmd5 = md5(strmd5); | 212 | strmd5 = md5(strmd5); |
181 | - strmd5=strmd5.toUpperCase(); | 213 | + strmd5 = strmd5.toUpperCase(); |
182 | return strmd5; | 214 | return strmd5; |
183 | }, | 215 | }, |
184 | 216 |
src/views/binding/binDing.vue
1 | <template> | 1 | <template> |
2 | <div> | 2 | <div> |
3 | 3 | ||
4 | - <mt-field label="手机号" placeholder="请输入正确的手机号" type="tel" v-model="phone" :attr="{ maxlength: 13 }"></mt-field> | 4 | + <mt-field label="手机号" placeholder="请输入正确的手机号" type="tel" v-model.trim="phone" :attr="{ maxlength: 11 }"></mt-field> |
5 | 5 | ||
6 | - <mt-field label="验证码" v-model="codeText"> | ||
7 | - <div class="getCode" @click="getCode">{{timeNum}}</div> | 6 | + <mt-field label="验证码" v-model.trim="codeText" :attr="{ maxlength: 6 }"> |
7 | + <div class="getCode" @click="getCodeHandle">{{timeNum}}</div> | ||
8 | </mt-field> | 8 | </mt-field> |
9 | 9 | ||
10 | <div style="margin-top: 34px" class="leftRightPadding"> | 10 | <div style="margin-top: 34px" class="leftRightPadding"> |
11 | - <mt-button type="danger" size="large">绑定</mt-button> | 11 | + <mt-button type="danger" size="large" @click="bingUser">绑定</mt-button> |
12 | </div> | 12 | </div> |
13 | </div> | 13 | </div> |
14 | </template> | 14 | </template> |
15 | 15 | ||
16 | <script> | 16 | <script> |
17 | +import { sendverificode, bindCustByOpenId } from '@/api/binDing/binDing' | ||
18 | + | ||
17 | export default { | 19 | export default { |
18 | name: 'binDing', | 20 | name: 'binDing', |
19 | data() { | 21 | data() { |
@@ -22,23 +24,119 @@ export default { | @@ -22,23 +24,119 @@ export default { | ||
22 | phone: '', | 24 | phone: '', |
23 | timeText: '获取验证码', | 25 | timeText: '获取验证码', |
24 | timeNum: 60, | 26 | timeNum: 60, |
27 | + clickFlag: true, // 获取验证码按钮是否可以点击 | ||
25 | } | 28 | } |
26 | }, | 29 | }, |
27 | - created(){ | 30 | + created() { |
28 | this.timeNum = this.timeText | 31 | this.timeNum = this.timeText |
29 | }, | 32 | }, |
30 | methods: { | 33 | methods: { |
31 | - getCode: function () { | ||
32 | - var _this = this | ||
33 | - // this.timeText = this.timeNum+'S' | ||
34 | - let Num = 5 | ||
35 | - var timer = setInterval(function () { | ||
36 | - _this.timeNum = Num-- +'s' | ||
37 | - if(Num== -1){ | ||
38 | - _this.timeNum = '获取验证码' | ||
39 | - clearInterval(timer) | 34 | + getCodeHandle: function () { // 获取验证码事件 |
35 | + if (!(/^1[3456789]\d{9}$/.test(this.phone))) { // 先判断手机号是否输入正确 | ||
36 | + this.$msgbox('提示', '请输入正确手机号') | ||
37 | + } else { | ||
38 | + if (this.clickFlag) { | ||
39 | + let _this = this | ||
40 | + this.clickFlag = false | ||
41 | + | ||
42 | + _this.getCode() | ||
43 | + // this.timeText = this.timeNum+'S' | ||
44 | + let Num = 5 | ||
45 | + var timer = setInterval(function () { | ||
46 | + _this.timeNum = Num-- + 's' | ||
47 | + if (Num == -1) { | ||
48 | + _this.clickFlag = true | ||
49 | + _this.timeNum = _this.timeText | ||
50 | + Num = 5 | ||
51 | + clearInterval(timer) | ||
52 | + } | ||
53 | + }, 1000) | ||
40 | } | 54 | } |
41 | - }, 1000) | 55 | + } |
56 | + }, | ||
57 | + getCode: function () { // 获取验证码接口 | ||
58 | + let salt = this.$utils.myCommonSalt(32); | ||
59 | + let jsondata = { | ||
60 | + app_id: this.$utils.myVarAppid, | ||
61 | + deviceInfo: this.$utils.myDeviceInfo, | ||
62 | + salt: salt, | ||
63 | + sign_type: "md5", | ||
64 | + phone: this.phone | ||
65 | + } | ||
66 | + jsondata.sign = this.$utils.signObject(jsondata) | ||
67 | + sendverificode(jsondata).then(response => { | ||
68 | + this.$toast({ | ||
69 | + message: '获取验证码成功', | ||
70 | + iconClass: 'icon icon-success', | ||
71 | + duration: 1500 | ||
72 | + }) | ||
73 | + }) | ||
74 | + }, | ||
75 | + | ||
76 | + bingUser: function () { // 用户绑定 | ||
77 | + let openid = this.$utils.GetOpenid(); | ||
78 | + | ||
79 | + if (!(/^1[3456789]\d{9}$/.test(this.phone))) { // 先判断手机号是否输入正确 | ||
80 | + this.$toast({ | ||
81 | + message: '请输入正常手机号', | ||
82 | + duration: 1500 | ||
83 | + }); | ||
84 | + return | ||
85 | + } | ||
86 | + if (this.codeText.length < 6) { | ||
87 | + this.$toast({ | ||
88 | + message: '请输入正常验证码', | ||
89 | + duration: 1500 | ||
90 | + }); | ||
91 | + return | ||
92 | + } | ||
93 | + | ||
94 | + let jsondata = { | ||
95 | + phoneNum: this.phone, | ||
96 | + verifyCode: this.codeText, | ||
97 | + openid: openid | ||
98 | + } | ||
99 | + | ||
100 | + bindCustByOpenId(jsondata).then(data => { | ||
101 | + if (data.code == 0 || data.code == '0') { | ||
102 | + // $.alert('亲,您已绑定成功!', '成功', function () { | ||
103 | + // var datas = data.data; | ||
104 | + // var urll = document.referrer; | ||
105 | + // jsajax.gett(openid, function (n) { | ||
106 | + // window.location.href = document.referrer; | ||
107 | + // }); | ||
108 | + // }); | ||
109 | + | ||
110 | + this.$messagebox.alert('亲,您已绑定成功!').then(action => { | ||
111 | + this.$router.push({ | ||
112 | + path:'selfNav' | ||
113 | + }) | ||
114 | + }); | ||
115 | + | ||
116 | + } else { | ||
117 | + if (data.code == 1017 || data.code == '1017') { | ||
118 | + // $.alert('已经绑定过', function () { | ||
119 | + // var urll = document.referrer; | ||
120 | + // jsajax.gett(openid, function (n) { | ||
121 | + // window.location.href = document.referrer; | ||
122 | + // }); | ||
123 | + // }); | ||
124 | + | ||
125 | + | ||
126 | + this.$messagebox.alert('亲,您已经绑定过!').then(action => { | ||
127 | + | ||
128 | + }); | ||
129 | + | ||
130 | + } else { | ||
131 | + // $.alert('亲,请重新绑定!', '失败', function () { | ||
132 | + // return false; | ||
133 | + // }); | ||
134 | + this.$toast('亲,绑定失败,请重新绑定!') | ||
135 | + } | ||
136 | + | ||
137 | + } | ||
138 | + }) | ||
139 | + | ||
42 | } | 140 | } |
43 | } | 141 | } |
44 | } | 142 | } |
src/views/mySelf/selfNav.vue
@@ -4,31 +4,141 @@ | @@ -4,31 +4,141 @@ | ||
4 | <div class="person-ifo"> | 4 | <div class="person-ifo"> |
5 | <div class="person-pic"></div> | 5 | <div class="person-pic"></div> |
6 | <ul class="person-con"> | 6 | <ul class="person-con"> |
7 | - <li>15911111111</li> | ||
8 | - <li>账户余额: <span>¥100.00</span></li> | ||
9 | - <li>我的卡券:<span>20张</span></li> | 7 | + <li>{{ phoneNum }}</li> |
8 | + <li>账户余额: <span>¥ {{ acctBalance }}</span></li> | ||
9 | + <li>我的卡券:<span>{{couponNum}} 张</span></li> | ||
10 | </ul> | 10 | </ul> |
11 | </div> | 11 | </div> |
12 | </div> | 12 | </div> |
13 | 13 | ||
14 | - <mt-cell title="会员卡" is-link :to="{ name: 'Toast' }"></mt-cell> | 14 | + <mt-cell title="会员卡" is-link :to="{ name: 'Toast' }"></mt-cell> |
15 | 15 | ||
16 | - <mt-cell title="车辆管理" is-link :to="{ name: 'Toast' }"></mt-cell> | 16 | + <mt-cell title="车辆管理" is-link :to="{ name: 'Toast' }"></mt-cell> |
17 | 17 | ||
18 | - <mt-cell title="停车记录" is-link :to="{ name: 'parkNotes' }"></mt-cell> | 18 | + <mt-cell title="停车记录" is-link :to="{ name: 'parkNotes' }"></mt-cell> |
19 | 19 | ||
20 | - <mt-cell title="建议反馈" is-link :to="{ name: 'suggestionBack' }"></mt-cell> | 20 | + <mt-cell title="建议反馈" is-link :to="{ name: 'suggestionBack' }"></mt-cell> |
21 | 21 | ||
22 | <div class="leftRightPadding" style="margin-top: 34px"> | 22 | <div class="leftRightPadding" style="margin-top: 34px"> |
23 | - <mt-button type="danger" size="large">退出账户</mt-button> | 23 | + <mt-button type="danger" size="large" @click="toBinDing">退出账户</mt-button> |
24 | </div> | 24 | </div> |
25 | 25 | ||
26 | </div> | 26 | </div> |
27 | </template> | 27 | </template> |
28 | 28 | ||
29 | <script> | 29 | <script> |
30 | +import { getOpenIdByCode, getTokenByOpenId, queryUserInfo } from '@/api/selfNav/selfNav' | ||
31 | + | ||
30 | export default { | 32 | export default { |
31 | - name: 'selfNav' | 33 | + name: 'selfNav', |
34 | + data(){ | ||
35 | + return { | ||
36 | + couponNum:'3', // 卡券数量 | ||
37 | + acctBalance: '420.00', // 账户余额 | ||
38 | + phoneNum:'',// 用户手机号 | ||
39 | + } | ||
40 | + }, | ||
41 | + created() { | ||
42 | + if (this.$utils.clientBrowser() == "微信") { | ||
43 | + var appID = this.$utils.myVxAppId; | ||
44 | + var code = this.getUrlParam('code'); | ||
45 | + var local = window.location.href; | ||
46 | + if (code == null || code === '') { | ||
47 | + 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' | ||
48 | + } else { | ||
49 | + return code; | ||
50 | + } | ||
51 | + } | ||
52 | + }, | ||
53 | + mounted() { | ||
54 | + if(this.$utils.GetOpenid()){ | ||
55 | + this.getTokenByOpenId(this.$utils.GetOpenid()) | ||
56 | + }else{ | ||
57 | + this.getOpenId() | ||
58 | + } | ||
59 | + | ||
60 | + }, | ||
61 | + methods: { | ||
62 | + getUrlParam(name) { | ||
63 | + var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); | ||
64 | + var r = window.location.search.substr(1).match(reg) | ||
65 | + if (r != null) return unescape(r[2]) | ||
66 | + return null | ||
67 | + }, | ||
68 | + getOpenId: function () { // 第一步获取openid | ||
69 | + let getCode = location.href | ||
70 | + console.log(getCode) | ||
71 | + let dataCode = getCode.split('?')[1] | ||
72 | + let wxCode = dataCode.split('&')[0].split('=')[1] | ||
73 | + let jsondata = { | ||
74 | + appId: this.$utils.myVxAppId, | ||
75 | + code: wxCode | ||
76 | + }; | ||
77 | + getOpenIdByCode(jsondata).then(data => { | ||
78 | + console.log(data) | ||
79 | + // SetOpenid | ||
80 | + if(data.code=='0'){ | ||
81 | + let openid = data.data; | ||
82 | + this.$utils.SetOpenid(openid); | ||
83 | + // mUrl.setApporWX('wx'); | ||
84 | + console.log("用户 openid "+openid); | ||
85 | + this.getTokenByOpenId(openid) | ||
86 | + } | ||
87 | + }) | ||
88 | + }, | ||
89 | + getTokenByOpenId: function (openid) { // 获取token和手机号 | ||
90 | + let jsondata = { | ||
91 | + openid: openid, | ||
92 | + deviceInfo: this.$utils.myDeviceInfo | ||
93 | + } | ||
94 | + getTokenByOpenId(jsondata).then(data => { | ||
95 | + console.log('执行获取token的接口 '+JSON.stringify(data)); | ||
96 | + if(data.code==0){ | ||
97 | + console.log("用户 token "+data.data.token); | ||
98 | + this.$utils.SetToken(data.data.token) | ||
99 | + this.$utils.SetPhone(data.data.phoneNum) | ||
100 | + this.phoneNum = data.data.phoneNum | ||
101 | + // 用户已经绑定手机号,获取用户信息 | ||
102 | + this.getInfoSelf() | ||
103 | + }else{ | ||
104 | + // 用户未绑定手机号 | ||
105 | + this.$router.push({ | ||
106 | + path: 'binDing' | ||
107 | + }) | ||
108 | + } | ||
109 | + }) | ||
110 | + }, | ||
111 | + | ||
112 | + getInfoSelf: function () { // 获取用户信息 | ||
113 | + let salt = this.$utils.myCommonSalt(32); | ||
114 | + var jsondata = { | ||
115 | + app_id: this.$utils.myVarAppid, | ||
116 | + deviceInfo: this.$utils.myDeviceInfo, | ||
117 | + salt: salt, | ||
118 | + sign_type: "md5", | ||
119 | + token: this.$utils.GetToken(), | ||
120 | + } | ||
121 | + jsondata.sign = this.$utils.signObject(jsondata) | ||
122 | + | ||
123 | + queryUserInfo(jsondata).then(data => { | ||
124 | + console.log(data) | ||
125 | + if(data.code == '0'){ | ||
126 | + let datas = data.data | ||
127 | + this.couponNum = datas.couponNum;//卡券数量 | ||
128 | + this.acctBalance = (datas.acctBalance/100).toFixed(2);//账户余额 单位:分 | ||
129 | + | ||
130 | + } | ||
131 | + }) | ||
132 | + | ||
133 | + }, | ||
134 | + | ||
135 | + toBinDing: function () { // 退出账户 去绑定页面 | ||
136 | + this.$router.push({ | ||
137 | + path:'binDing' | ||
138 | + }) | ||
139 | + } | ||
140 | + | ||
141 | + } | ||
32 | } | 142 | } |
33 | </script> | 143 | </script> |
34 | 144 | ||
@@ -44,21 +154,22 @@ export default { | @@ -44,21 +154,22 @@ export default { | ||
44 | padding-top: 45px; | 154 | padding-top: 45px; |
45 | display: flex; | 155 | display: flex; |
46 | color: #ffbfbf; | 156 | color: #ffbfbf; |
47 | - .person-pic{ | 157 | + .person-pic { |
48 | width: 64px; | 158 | width: 64px; |
49 | height: 64px; | 159 | height: 64px; |
50 | margin-right: 15px; | 160 | margin-right: 15px; |
51 | background: url("../../assets/images/mySelf/photoBG.png") no-repeat; | 161 | background: url("../../assets/images/mySelf/photoBG.png") no-repeat; |
52 | } | 162 | } |
53 | } | 163 | } |
54 | - .person-con{ | ||
55 | - span{ | 164 | + |
165 | + .person-con { | ||
166 | + span { | ||
56 | font-size: 16px; | 167 | font-size: 16px; |
57 | font-weight: bold; | 168 | font-weight: bold; |
58 | } | 169 | } |
59 | } | 170 | } |
60 | 171 | ||
61 | - .mint-cell{ | 172 | + .mint-cell { |
62 | border-bottom: 1px solid #EFEDED; | 173 | border-bottom: 1px solid #EFEDED; |
63 | } | 174 | } |
64 | </style> | 175 | </style> |
src/views/parkPay/orderPay.vue
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | <div class="toPay" @click="toPay">{{clientBrowser}}支付</div> | 25 | <div class="toPay" @click="toPay">{{clientBrowser}}支付</div> |
26 | </div> | 26 | </div> |
27 | 27 | ||
28 | - <div v-if="appOrderTimeout.length>0"> | 28 | + <div v-if="appOrderTimeout"> |
29 | <p class="tip"> | 29 | <p class="tip"> |
30 | 温馨提示: | 30 | 温馨提示: |
31 | </p> | 31 | </p> |
@@ -40,31 +40,26 @@ | @@ -40,31 +40,26 @@ | ||
40 | </template> | 40 | </template> |
41 | 41 | ||
42 | <script> | 42 | <script> |
43 | -// import CryptoJS from '../utils/AES.js' | ||
44 | -// let Base64 = require('js-base64').Base64 | ||
45 | - | ||
46 | -import {aliPay, getOpenId, vxPayQuery, bankH5Pay, queryParkingRecordPageByCarNumbers} from '@/api/orderPay/orderPay' | 43 | +import {aliPay, getOpenId, vxPayQuery, doPay, doOrderCreate} from '@/api/orderPay/orderPay' |
47 | 44 | ||
48 | export default { | 45 | export default { |
49 | name: 'orderPay', | 46 | name: 'orderPay', |
50 | data() { | 47 | data() { |
51 | return { | 48 | return { |
52 | carWrapBG: 0, | 49 | carWrapBG: 0, |
53 | - carNumber: '', | 50 | + carNumber: '京A12312', |
54 | arrearageActFee: 0, | 51 | arrearageActFee: 0, |
55 | arrearageDiscFee: 0, | 52 | arrearageDiscFee: 0, |
56 | arrearageActFee: 0, | 53 | arrearageActFee: 0, |
57 | - parkingData: [], // 在停数据 | ||
58 | - historyList: [], // 历史欠费数据 | ||
59 | clientBrowser: '', // 客户端 | 54 | clientBrowser: '', // 客户端 |
60 | paySrcType: '', //支付的类型 101 是本次 103是历史欠费 | 55 | paySrcType: '', //支付的类型 101 是本次 103是历史欠费 |
61 | orderId: '', //支付的订单 | 56 | orderId: '', //支付的订单 |
62 | webAppCode: '', // 微信code | 57 | webAppCode: '', // 微信code |
63 | appOrderTimeout: '', // 超时描述 | 58 | appOrderTimeout: '', // 超时描述 |
59 | + isAndroid: '', // 终端类型 | ||
64 | } | 60 | } |
65 | }, | 61 | }, |
66 | created() { | 62 | created() { |
67 | - | ||
68 | this.carWrapBG = this.$route.query.carColor //车牌颜色 | 63 | this.carWrapBG = this.$route.query.carColor //车牌颜色 |
69 | this.carNumber = this.$route.query.carNumber | 64 | this.carNumber = this.$route.query.carNumber |
70 | this.arrearageTotalFee = this.$route.query.arrearageTotalFee // 应收 | 65 | this.arrearageTotalFee = this.$route.query.arrearageTotalFee // 应收 |
@@ -72,16 +67,16 @@ export default { | @@ -72,16 +67,16 @@ export default { | ||
72 | this.arrearageActFee = this.$route.query.arrearageActFee // 实收 | 67 | this.arrearageActFee = this.$route.query.arrearageActFee // 实收 |
73 | this.clientBrowser = this.$utils.clientBrowser() //支付方式 | 68 | this.clientBrowser = this.$utils.clientBrowser() //支付方式 |
74 | this.paySrcType = this.$route.query.paySrcType // 实收 | 69 | this.paySrcType = this.$route.query.paySrcType // 实收 |
75 | - this.orderId = this.$route.query.ordeID | 70 | + this.orderId = this.$route.query.ordeID // 订单号 |
76 | console.log(this.orderId) | 71 | console.log(this.orderId) |
77 | - this.appOrderTimeout = this.$route.query.appOrderTimeout | 72 | + this.appOrderTimeout = this.$route.query.appOrderTimeout //提示 |
73 | + | ||
74 | + let userAgent = navigator.userAgent; | ||
75 | + this.isAndroid = userAgent.indexOf('Android') > -1 || userAgent.indexOf('Adr') > -1; //android终端 | ||
76 | + | ||
78 | if (this.clientBrowser == "微信") { | 77 | if (this.clientBrowser == "微信") { |
79 | this.webAppCode = this.getCode(); | 78 | this.webAppCode = this.getCode(); |
80 | } | 79 | } |
81 | - | ||
82 | - }, | ||
83 | - mounted() { | ||
84 | - | ||
85 | }, | 80 | }, |
86 | methods: { | 81 | methods: { |
87 | getCode() { | 82 | getCode() { |
@@ -94,95 +89,130 @@ export default { | @@ -94,95 +89,130 @@ export default { | ||
94 | return code; | 89 | return code; |
95 | } | 90 | } |
96 | }, | 91 | }, |
92 | + doOrderCreate(orderID) { // 欠费创建订单号 | ||
93 | + var jsondata = { | ||
94 | + orderBigType: 100, | ||
95 | + payOrderType: this.paySrcType, | ||
96 | + parkOrderIds: orderID, | ||
97 | + terminalSource: 7, | ||
98 | + operName: '', | ||
99 | + operCode: '', | ||
100 | + }; | ||
101 | + // jsondata = JSON.stringify(jsondata); | ||
102 | + doOrderCreate(jsondata).then(res => { | ||
103 | + console.log(res) | ||
104 | + this.orderId = res.data.rltOrderId | ||
105 | + console.log(this.orderId) | ||
106 | + this.dopay(this.orderId) | ||
107 | + }) | ||
108 | + | ||
109 | + }, | ||
97 | getUrlParam(name) { | 110 | getUrlParam(name) { |
98 | var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); | 111 | var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); |
99 | var r = window.location.search.substr(1).match(reg) | 112 | var r = window.location.search.substr(1).match(reg) |
100 | if (r != null) return unescape(r[2]) | 113 | if (r != null) return unescape(r[2]) |
101 | return null | 114 | return null |
102 | }, | 115 | }, |
116 | + dopay(orderID) { | ||
117 | + let me = this | ||
118 | + | ||
119 | + if (this.clientBrowser == '微信') { // 微信支付 | ||
120 | + var vm = this | ||
121 | + //第一步获取openid | ||
122 | + var codeParams = { | ||
123 | + code: this.webAppCode, | ||
124 | + appId: this.$utils.myVxAppId | ||
125 | + }; | ||
126 | + getOpenId(codeParams).then(resu => { | ||
127 | + if (resu.code == 0) { | ||
128 | + // me.vxPay(res.data, this.orderId) | ||
129 | + | ||
130 | + var jsondata = { | ||
131 | + orderBigType: 100, | ||
132 | + payOrderType: this.paySrcType, | ||
133 | + rltOrderId: orderID, | ||
134 | + payType: 2, // 1 是支付宝 2是微信 | ||
135 | + terminalSource: 7, | ||
136 | + orderActFee: this.arrearageActFee, | ||
137 | + orderTotalFee: this.arrearageTotalFee, | ||
138 | + orderDicountFee: this.arrearageDiscFee, | ||
139 | + payUserId: resu.data, | ||
140 | + terminalOS: this.isAndroid ? 'AND' : 'IOS', | ||
141 | + couponType: 1, //优惠类型 | ||
142 | + couponCode: this.arrearageDiscFee, | ||
143 | + }; | ||
144 | + | ||
145 | + doPay(jsondata).then(res => { | ||
146 | + console.log(res) | ||
147 | + if (res.code == 0) { // | ||
148 | + //alertMsg("出场成功"); | ||
149 | + if (res.data) { | ||
150 | + var data = JSON.parse(res.data.jsPayRequest); | ||
151 | + console.log(JSON.stringify(data)); | ||
152 | + if (typeof WeixinJSBridge === 'undefined') { // 微信浏览器内置对象。参考微信官方文档 | ||
153 | + if (document.addEventListener) { | ||
154 | + document.addEventListener('WeixinJSBridgeReady', vm.onBridgeReady(data), false) | ||
155 | + } else if (document.attachEvent) { | ||
156 | + document.attachEvent('WeixinJSBridgeReady', vm.onBridgeReady(data)) | ||
157 | + document.attachEvent('onWeixinJSBridgeReady', vm.onBridgeReady(data)) | ||
158 | + } | ||
159 | + } else { | ||
160 | + console.log('准备调用微信支付') | ||
161 | + vm.onBridgeReady(data) | ||
162 | + } | ||
163 | + } else { | ||
164 | + alert("没有找到返回值"); | ||
165 | + } | ||
166 | + } else { | ||
167 | + alert('支付错误') | ||
168 | + console.log(res.message); | ||
169 | + alert(res.message); | ||
170 | + } | ||
171 | + | ||
172 | + }) | ||
173 | + | ||
174 | + } else if (res.code == 40163) { //code been used, hints[重复code问题] | ||
175 | + alert('获取opendid错误--------') | ||
176 | + alert(res.message) | ||
177 | + console.log(res.message); | ||
178 | + } else { | ||
179 | + alert('获取opendid错误') | ||
180 | + alert(res.message) | ||
181 | + } | ||
182 | + }) | ||
183 | + | ||
184 | + } | ||
185 | + }, | ||
103 | toPay() { | 186 | toPay() { |
104 | let me = this | 187 | let me = this |
105 | let _order = [] | 188 | let _order = [] |
106 | - | 189 | + // this.orderId = JSON.parse(this.orderId) |
107 | console.log(this.orderId) | 190 | console.log(this.orderId) |
108 | if (this.paySrcType == 103) { | 191 | if (this.paySrcType == 103) { |
109 | this.orderId = JSON.parse(this.orderId) | 192 | this.orderId = JSON.parse(this.orderId) |
110 | - this.orderId.forEach(item => { | ||
111 | - _order.push({ | ||
112 | - orderId: item | ||
113 | - }) | ||
114 | - }) | ||
115 | - this.orderId = [] | ||
116 | - this.orderId = _order | ||
117 | - } | 193 | + this.doOrderCreate(this.orderId) |
194 | + } else { | ||
195 | + console.log(this.orderId) | ||
196 | + console.log(typeof this.orderId) | ||
118 | 197 | ||
119 | - if (this.clientBrowser == '微信') { // 微信支付 | ||
120 | - let _openId = sessionStorage.getItem('openIdData') | ||
121 | - if (_openId) { | ||
122 | - me.vxPay(_openId, this.orderId) | ||
123 | - } else { | ||
124 | - //第一步获取openid | ||
125 | - var codeParams = { | ||
126 | - code: this.webAppCode, | ||
127 | - appId: this.$utils.myVxAppId | ||
128 | - }; | ||
129 | - getOpenId(codeParams).then(res => { | ||
130 | - if (res.code == 0) { | ||
131 | - me.vxPay(res.data, this.orderId) | ||
132 | - sessionStorage.setItem('openIdData', res.data) | ||
133 | - } else if (res.code == 40163) { //code been used, hints[重复code问题] | ||
134 | - this.$msgbox('提示', '请重新扫码重复code问题') | ||
135 | - console.log(res.message); | ||
136 | - } else { | ||
137 | - this.$msgbox('提示', '请重新扫码') | ||
138 | - } | ||
139 | - }) | ||
140 | - } | 198 | + this.dopay(this.orderId) |
141 | } | 199 | } |
200 | + | ||
142 | }, | 201 | }, |
143 | - vxPay(openIdData, orderIdData) { | ||
144 | - let vm = this | ||
145 | - var wxParams = {}; | ||
146 | - wxParams.orderId = orderIdData; | ||
147 | - wxParams.backType = 2, | ||
148 | - wxParams.orgId = this.$utils.myOrgId, | ||
149 | - wxParams.payType = 4;// 1:支付宝 2:微信 3:银联 10:H5 4微信公众号 | ||
150 | - wxParams.terminalSource = 7;//请求端来源 1: 任你停 2:pda 3:微信公共号 7:H5扫码 10页面支付 | ||
151 | - wxParams.carNumber = this.carNumber; | ||
152 | - wxParams.paySrcType = this.paySrcType;//101停车支付 | ||
153 | - wxParams.recordArreaInfos = JSON.stringify(orderIdData); | ||
154 | - wxParams.openId = openIdData; | ||
155 | - wxParams.appId = this.$utils.myVxAppId; | ||
156 | - vxPayQuery(wxParams).then(res => { | ||
157 | - if (res.code == 0) { // | ||
158 | - if (res.data) { | ||
159 | - var data = res.data; | ||
160 | - console.log(JSON.stringify(data)); | ||
161 | - if (typeof WeixinJSBridge === 'undefined') { // 微信浏览器内置对象。参考微信官方文档 | ||
162 | - if (document.addEventListener) { | ||
163 | - document.addEventListener('WeixinJSBridgeReady', vm.onBridgeReady(data), false) | ||
164 | - } else if (document.attachEvent) { | ||
165 | - document.attachEvent('WeixinJSBridgeReady', vm.onBridgeReady(data)) | ||
166 | - document.attachEvent('onWeixinJSBridgeReady', vm.onBridgeReady(data)) | ||
167 | - } | ||
168 | - } else { | ||
169 | - console.log('准备调用微信支付') | ||
170 | - vm.onBridgeReady(data) | ||
171 | - } | ||
172 | - } else { | ||
173 | - this.$msgbox('提示', '没有找到返回值') | ||
174 | - } | ||
175 | - } else { | ||
176 | - console.log(res.message); | ||
177 | - this.$msgbox('提示', res.message) | ||
178 | - } | ||
179 | - }) | ||
180 | - }, | 202 | + |
181 | onBridgeReady(params) { | 203 | onBridgeReady(params) { |
182 | - let me = this | ||
183 | console.log('调用微信支付WeixinJSBridge') | 204 | console.log('调用微信支付WeixinJSBridge') |
184 | WeixinJSBridge.invoke( | 205 | WeixinJSBridge.invoke( |
185 | - 'getBrandWCPayRequest', params, | 206 | + 'getBrandWCPayRequest', { |
207 | + "appId": params.appId, //公众号名称,由商户传入 | ||
208 | + "timeStamp": params.timeStamp, //时间戳,自1970年以来的秒数 | ||
209 | + "nonceStr": params.nonceStr, //随机串 | ||
210 | + "package": params.package, | ||
211 | + "signType": params.signType, //微信签名方式: | ||
212 | + "paySign": params.paySign //微信签名 | ||
213 | + }, | ||
214 | + | ||
215 | + // 'getBrandWCPayRequest', params, | ||
186 | // | 216 | // |
187 | // 'getBrandWCPayRequest', { // 下面参数内容都是后台返回的 | 217 | // 'getBrandWCPayRequest', { // 下面参数内容都是后台返回的 |
188 | // 'appId': data.appId, // 公众号名称,由商户传入 | 218 | // 'appId': data.appId, // 公众号名称,由商户传入 |
@@ -196,120 +226,15 @@ export default { | @@ -196,120 +226,15 @@ export default { | ||
196 | // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 | 226 | // 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 |
197 | if (res.err_msg === 'get_brand_wcpay_request:ok') { | 227 | if (res.err_msg === 'get_brand_wcpay_request:ok') { |
198 | console.log('成功') | 228 | console.log('成功') |
199 | - var salt = me.$utils.myCommonSalt(32); | ||
200 | - let wxparams = { | ||
201 | - pageNum: 1, | ||
202 | - pageSize: 10000, | ||
203 | - parkState: 10, | ||
204 | - terminalSource: 7, | ||
205 | - carNumber: me.carNumber, | ||
206 | - app_id: me.$utils.myVarAppid, | ||
207 | - deviceInfo: me.$utils.myDeviceInfo, | ||
208 | - salt: salt, | ||
209 | - sign_type: "md5", | ||
210 | - token: '', | ||
211 | - } | ||
212 | - wxparams.sign = me.$utils.signObject(wxparams) | ||
213 | - queryParkingRecordPageByCarNumbers(wxparams).then(response => { | ||
214 | - console.log(response) | ||
215 | - me.parkList = response.data.dataList | ||
216 | - | ||
217 | - // alert(JSON.stringify(me.parkList)) | ||
218 | - // alert(me.parkList.length) | ||
219 | - if (me.parkList.length == 0) { | ||
220 | - me.$router.push({ | ||
221 | - path: 'parkRecord', | ||
222 | - query: { | ||
223 | - carNumber: me.carNumber, | ||
224 | - carNumberColor: me.carWrapBG, | ||
225 | - parkFlag: 0 // 0表示在停 1表示历史 | ||
226 | - } | ||
227 | - }) | ||
228 | - | ||
229 | - } else { | ||
230 | - me.parkingData = me.parkList.filter(item => { | ||
231 | - return item.parkState == '10' | ||
232 | - }) | ||
233 | - console.log(me.parkingData) | ||
234 | - me.historyList = me.parkList.filter(item => { | ||
235 | - return item.parkState == '20' | ||
236 | - }) | ||
237 | - console.log(me.historyList) | ||
238 | - | ||
239 | - if (me.historyList.length > 0) { | ||
240 | - MessageBox.confirm('', { | ||
241 | - message: '您当前有历史欠费 是否立即补缴?', | ||
242 | - title: '温馨提示', | ||
243 | - confirmButtonText: '去补缴', | ||
244 | - cancelButtonText: '取消' | ||
245 | - }).then(action => { | ||
246 | - if (action == 'confirm') { //确认的回调 | ||
247 | - console.log('确定'); | ||
248 | - me.$router.push({ | ||
249 | - path: 'parkRecord', | ||
250 | - query: { | ||
251 | - carNumber: me.carNumber, | ||
252 | - carNumberColor: me.carWrapBG, | ||
253 | - parkFlag: 1 // 0表示在停 1表示历史 | ||
254 | - } | ||
255 | - }) | ||
256 | - } | ||
257 | - }).catch(err => { | ||
258 | - if (err == 'cancel') { //取消的回调 | ||
259 | - console.log('取消'); | ||
260 | - } | ||
261 | - }); | ||
262 | - } else { | ||
263 | - | ||
264 | - if (me.paySrcType == 101) { //缴费了本次 | ||
265 | - me.$router.push({ | ||
266 | - path: 'parkRecord', | ||
267 | - query: { | ||
268 | - carNumber: me.carNumber, | ||
269 | - carNumberColor: me.carWrapBG, | ||
270 | - parkFlag: 0 // 0表示在停 1表示历史 | ||
271 | - } | ||
272 | - }) | ||
273 | - } else { | ||
274 | - MessageBox.confirm('', { | ||
275 | - message: '您当前有在停订单 是否立即支付?', | ||
276 | - title: '温馨提示', | ||
277 | - confirmButtonText: '去支付', | ||
278 | - cancelButtonText: '取消' | ||
279 | - }).then(action => { | ||
280 | - if (action == 'confirm') { //确认的回调 | ||
281 | - console.log('确定'); | ||
282 | - me.$router.push({ | ||
283 | - path: 'parkRecord', | ||
284 | - query: { | ||
285 | - carNumber: me.carNumber, | ||
286 | - carNumberColor: me.carWrapBG, | ||
287 | - parkFlag: 0 // 0表示在停 1表示历史 | ||
288 | - } | ||
289 | - }) | ||
290 | - } | ||
291 | - }).catch(err => { | ||
292 | - if (err == 'cancel') { //取消的回调 | ||
293 | - console.log('取消'); | ||
294 | - } | ||
295 | - }); | ||
296 | - } | ||
297 | - | ||
298 | - } | ||
299 | - } | ||
300 | - | ||
301 | - }) | ||
302 | - | ||
303 | } else { | 229 | } else { |
304 | console.log('失败') | 230 | console.log('失败') |
305 | - this.$msgbox('提示', '支付失败') | ||
306 | - me.$router.go(-2); | 231 | + alert('支付失败') |
307 | } | 232 | } |
308 | } | 233 | } |
309 | ) | 234 | ) |
310 | }, | 235 | }, |
311 | }, | 236 | }, |
312 | - filters: {} | 237 | + |
313 | } | 238 | } |
314 | </script> | 239 | </script> |
315 | 240 |