Commit 331018f3090949ea904c674b64160fb06303a028
1 parent
92e91fa6
江阴领取优惠券调接口
Showing
7 changed files
with
107 additions
and
69 deletions
config/dev.env.js
config/prod.env.js
1 | 1 | 'use strict' |
2 | 2 | module.exports = { |
3 | + APP_BASE_APP_API:'"https://bus.jycrtc.com"', //项目api地址1 注意里面的双引号 | |
4 | + APP_BASE_WWW_API:'"https://pay.jycrtc.com"', //项目api地址2 | |
5 | + VUE_APP_API:'"https://bus.jycrtc.com"', | |
6 | + VUE_APP_PAYAPI:'"https://pay.jycrtc.com"', | |
7 | + | |
3 | 8 | NODE_ENV: '"production"' |
4 | 9 | } | ... | ... |
src/api/couponPay/couponPay.js
1 | 1 | import request from '@/utils/request' |
2 | 2 | |
3 | -export function scanCouponQR(params) { | |
3 | +export function scanCouponQR(base,params) { | |
4 | + console.log('1111ase') | |
5 | + console.log(base) | |
4 | 6 | return request({ |
5 | - requestBase:'VUE_APP_URL', | |
6 | - url: '/api/business/h5/qr/scanCouponQR', | |
7 | + // requestBase:'VUE_APP_URL', | |
8 | + url: base+'/business/h5/qr/scanCouponQR', | |
7 | 9 | method: 'post', |
8 | 10 | data: params |
9 | 11 | }) |
10 | 12 | } |
11 | 13 | |
12 | 14 | |
13 | -export function queryParkingRecordPageByCarNumbers(params) { | |
15 | +export function queryParkingRecordPageByCarNumbers(base,params) { | |
14 | 16 | return request({ |
15 | - requestBase:'VUE_APP_URL_TWO', | |
16 | - url: '/payapi/queryParkOrder/queryParkingRecordPageByCarNumbers', | |
17 | + // requestBase:'VUE_APP_URL_TWO', | |
18 | + url: base+'/queryParkOrder/queryParkingRecordPageByCarNumbers', | |
17 | 19 | method: 'post', |
18 | 20 | data: params |
19 | 21 | }) |
20 | 22 | } |
21 | 23 | |
22 | 24 | |
23 | -export function appApplyParkOut(params) { // 0元出场 | |
25 | +export function appApplyParkOut(base,params) { // 0元出场 | |
24 | 26 | return request({ |
25 | - url: '/payapi/appAccountPay/appApplyParkOut', | |
27 | + url: base+'/appAccountPay/appApplyParkOut', | |
26 | 28 | method: 'post', |
27 | 29 | data: params |
28 | 30 | }) |
29 | 31 | } |
30 | 32 | |
31 | 33 | |
32 | -export function parkingQuery(params) { | |
34 | +export function parkingQuery(base,params) { | |
33 | 35 | return request({ |
34 | - url: '/payapi/queryParkOrder/billQuery', | |
36 | + url: base+'/queryParkOrder/billQuery', | |
35 | 37 | method: 'post', |
36 | 38 | data: params |
37 | 39 | }) |
38 | 40 | } |
39 | 41 | |
40 | -export function aliPay(params) { // 支付宝 | |
42 | +export function aliPay(base,params) { // 支付宝 | |
41 | 43 | return request({ |
42 | - url: '/payapi/alipay/aliH5Pay', | |
44 | + url: base+'/alipay/aliH5Pay', | |
43 | 45 | method: 'post', |
44 | 46 | data: params |
45 | 47 | }) |
46 | 48 | } |
47 | 49 | |
48 | 50 | |
49 | -export function getOpenId(params) { // 获取OpenId | |
51 | +export function getOpenId(base,params) { // 获取OpenId | |
50 | 52 | return request({ |
51 | - url: '/payapi/weixinPublicPay/getOpenIdByCode', | |
53 | + url: base+'/weixinPublicPay/getOpenIdByCode', | |
52 | 54 | method: 'post', |
53 | 55 | data: params |
54 | 56 | }) |
55 | 57 | } |
56 | 58 | |
57 | -export function vxPayQuery(params) { // 微信 | |
59 | +export function vxPayQuery(base,params) { // 微信 | |
58 | 60 | return request({ |
59 | - url: '/payapi/weixinpay/publicUnifiedOrder', | |
61 | + url: base+'/weixinpay/publicUnifiedOrder', | |
60 | 62 | method: 'post', |
61 | 63 | data: params |
62 | 64 | }) | ... | ... |
src/utils/request.js
... | ... | @@ -6,9 +6,17 @@ import axios from 'axios' |
6 | 6 | const service = axios.create({ |
7 | 7 | // baseURL:'https://bus.jycrtc.com/', |
8 | 8 | // baseURL:process.env.VUE_APP_URL, |
9 | + // baseURL:'', | |
9 | 10 | // withCredentials: true, // send cookies when cross-domain requests |
10 | 11 | timeout: 6000, // request timeout |
11 | - withCredentials: false, | |
12 | + // withCredentials: false, | |
13 | + // crossDomain: true, | |
14 | + | |
15 | + xhrFields: { | |
16 | + | |
17 | + withCredentials: false | |
18 | + | |
19 | + }, | |
12 | 20 | headers:{ |
13 | 21 | 'Access-Control-Allow-Origin':'*' |
14 | 22 | //'Content-Type':'application/x-www-form-urlencoded' |
... | ... | @@ -18,13 +26,16 @@ const service = axios.create({ |
18 | 26 | service.interceptors.request.use( |
19 | 27 | |
20 | 28 | config => { |
21 | - // if(config.requestBase=='VUE_APP_URL'){ | |
22 | - // config.baseURL='https://bus.jycrtc.com/'; | |
29 | + // if (process.env.NODE_ENV === 'production'){ | |
30 | + // if(config.requestBase=='VUE_APP_URL'){ | |
31 | + // config.baseURL='https://bus.jycrtc.com/'; | |
23 | 32 | // |
24 | - // }else if(config.requestBase=='VUE_APP_URL_TWO'){ | |
25 | - // config.baseURL='https://pay.jycrtc.com/'; | |
33 | + // }else if(config.requestBase=='VUE_APP_URL_TWO'){ | |
34 | + // config.baseURL='https://pay.jycrtc.com/'; | |
35 | + // } | |
26 | 36 | // } |
27 | 37 | |
38 | + | |
28 | 39 | return config |
29 | 40 | }, |
30 | 41 | error => { | ... | ... |
src/views/parkPay/coupon.vue
... | ... | @@ -2,10 +2,11 @@ |
2 | 2 | <div> |
3 | 3 | <img :src="imgurl" alt="" style="margin: 10px auto;width: 64px;height: 64px;"> |
4 | 4 | <div style="padding: 10px 30px 50px"> |
5 | - <p>尊敬的车主您好:{{tipText}}</p> | |
5 | + <p>尊敬的车主您好:{{ tipText }}</p> | |
6 | 6 | </div> |
7 | 7 | <div style="padding: 0 20px"> |
8 | - <mt-button size="large" type="primary" @click="toPay" style="margin-bottom: 20px;" v-show="payFlag">去支付</mt-button> | |
8 | + <mt-button size="large" type="primary" @click="toPay" style="margin-bottom: 20px;" v-show="payFlag">去支付 | |
9 | + </mt-button> | |
9 | 10 | <mt-button size="large" type="danger" @click="toBackPage">返回</mt-button> |
10 | 11 | </div> |
11 | 12 | |
... | ... | @@ -15,29 +16,34 @@ |
15 | 16 | <script> |
16 | 17 | |
17 | 18 | |
18 | -import { scanCouponQR, queryParkingRecordPageByCarNumbers, appApplyParkOut, parkingQuery } from '@/api/couponPay/couponPay.js' | |
19 | +import { | |
20 | + scanCouponQR, | |
21 | + queryParkingRecordPageByCarNumbers, | |
22 | + appApplyParkOut, | |
23 | + parkingQuery | |
24 | +} from '@/api/couponPay/couponPay.js' | |
19 | 25 | |
20 | 26 | export default { |
21 | 27 | name: "coupon", |
22 | 28 | data() { |
23 | 29 | return { |
24 | - imgurl:'', | |
30 | + imgurl: '', | |
25 | 31 | successiconUrl: require('../../assets/images/successIcon.png'), |
26 | 32 | loseiconUrl: require('../../assets/images/loseIcon.png'), |
27 | 33 | carNum: '', |
28 | 34 | carNumberColor: '', |
29 | - parkingData:[], | |
30 | - carType:'', | |
31 | - codeType:'', | |
32 | - tipText:'', | |
33 | - payFlag:false, | |
35 | + parkingData: [], | |
36 | + carType: '', | |
37 | + codeType: '', | |
38 | + tipText: '', | |
39 | + payFlag: false, | |
34 | 40 | } |
35 | 41 | }, |
36 | 42 | created() { |
37 | 43 | this.carNum = this.$route.query.carNumber |
38 | 44 | this.carType = this.$route.query.carType |
39 | 45 | this.codeType = this.$route.query.codeType |
40 | - | |
46 | + this.cardRelParkNo = this.$route.query.cardRelParkNo | |
41 | 47 | // this.carNum = this.$route.query.carNumber // 获取车牌号 |
42 | 48 | // this.carNumberColor = this.$route.query.carNumberColor // 获取颜色 0:蓝牌;1:黄牌;2:白牌;3:黑牌;4:绿色 |
43 | 49 | // this.currentTabActive = this.$route.query.parkFlag ? this.$route.query.parkFlag : 0 |
... | ... | @@ -46,34 +52,40 @@ export default { |
46 | 52 | this.scanCouponQR() |
47 | 53 | }, |
48 | 54 | methods: { |
49 | - scanCouponQR(){ | |
55 | + scanCouponQR() { | |
56 | + | |
57 | + let url = process.env.VUE_APP_API; | |
58 | + console.log(url) | |
50 | 59 | var salt = this.$utils.myCommonSalt(32); |
51 | 60 | var jsondata = { |
52 | 61 | app_id: this.$utils.myVarAppid, |
53 | 62 | deviceInfo: this.$utils.myDeviceInfo, |
54 | 63 | salt: salt, |
55 | 64 | sign_type: "md5", |
56 | - carType:this.carType, | |
57 | - codeType:this.codeType, | |
58 | - cardRelParkNo:'123qwe', | |
59 | - key:'1', | |
65 | + carType: '2', | |
66 | + codeType: this.codeType, | |
67 | + cardRelParkNo: this.cardRelParkNo, | |
68 | + key: this.$route.query.key, | |
60 | 69 | carNum: this.carNum, |
61 | 70 | // carNumberColor: this.carNumberColor, |
62 | 71 | orgId: this.$utils.myOrgId, |
63 | - terminalSource:'7', | |
72 | + terminalSource: '7', | |
64 | 73 | // token:'e2c1e43722dd43a5b7e268001b39e6f0' |
65 | 74 | } |
66 | 75 | jsondata.sign = this.$utils.signObject(jsondata) |
67 | - scanCouponQR(jsondata).then(response => { | |
76 | + scanCouponQR(url,jsondata).then(response => { | |
68 | 77 | console.log(response) |
69 | - this.tipText = response.data.message | |
70 | - if(response.data.code==0){ | |
78 | + | |
79 | + if (response.code == 0) { | |
71 | 80 | this.payFlag = true |
72 | 81 | this.imgurl = this.successiconUrl |
73 | - }else{ | |
82 | + this.tipText = '领取优惠券成功' | |
83 | + } else { | |
74 | 84 | this.payFlag = false |
75 | 85 | this.imgurl = this.loseiconUrl |
86 | + this.tipText = response.message | |
76 | 87 | } |
88 | + // this.tipText = | |
77 | 89 | }) |
78 | 90 | }, |
79 | 91 | toPay() { |
... | ... | @@ -86,6 +98,7 @@ export default { |
86 | 98 | this.$router.back() |
87 | 99 | }, |
88 | 100 | parkRecordList() { // 获取停车记录数据 |
101 | + let url = process.env.VUE_APP_PAYAPI; | |
89 | 102 | var salt = this.$utils.myCommonSalt(32); |
90 | 103 | var jsondata = { |
91 | 104 | app_id: this.$utils.myVarAppid, |
... | ... | @@ -106,7 +119,7 @@ export default { |
106 | 119 | |
107 | 120 | // jsondata.sign = md5sign |
108 | 121 | console.log('停车记录传参 ' + JSON.stringify(jsondata)); |
109 | - queryParkingRecordPageByCarNumbers(jsondata).then(response => { | |
122 | + queryParkingRecordPageByCarNumbers(url,jsondata).then(response => { | |
110 | 123 | console.log(response) |
111 | 124 | // this.parkList = response.data.dataList |
112 | 125 | |
... | ... | @@ -119,6 +132,7 @@ export default { |
119 | 132 | }) |
120 | 133 | }, |
121 | 134 | toPayCurrent(i) { // 缴纳本次在停费用 |
135 | + let url = process.env.VUE_APP_PAYAPI; | |
122 | 136 | var salt = this.$utils.myCommonSalt(32); |
123 | 137 | var params = { |
124 | 138 | app_id: this.$utils.myVarAppid, |
... | ... | @@ -130,7 +144,7 @@ export default { |
130 | 144 | terminalSource: '3', |
131 | 145 | } |
132 | 146 | params.sign = this.$utils.signObject(params) |
133 | - appApplyParkOut(params).then(response => { | |
147 | + appApplyParkOut(url,params).then(response => { | |
134 | 148 | console.log(response) |
135 | 149 | |
136 | 150 | if (response.code == '5005') { |
... | ... | @@ -148,33 +162,33 @@ export default { |
148 | 162 | carNumber: this.carNum, |
149 | 163 | } |
150 | 164 | jsondata.sign = this.$utils.signObject(jsondata) |
151 | - parkingQuery(jsondata).then(result => { | |
165 | + parkingQuery(url,jsondata).then(result => { | |
152 | 166 | console.log(result) |
153 | 167 | let res = result.data |
154 | 168 | let _dis = res.discountFee |
155 | 169 | let discountFee = _dis.slice(1, _dis.length - 1) |
156 | - sessionStorage.setItem('couponPark',JSON.stringify(result.data)) | |
157 | - this.$router.push( | |
158 | - { | |
159 | - path: 'couponPay', | |
160 | - query: { | |
161 | - carColor: this.carColor,// 车牌颜色 | |
162 | - arrearageTotalFee: res.orderTotalFee,// 应收 | |
163 | - arrearageDiscFee: discountFee * 100,// 优惠 | |
164 | - arrearageActFee: res.orderFee,// 实收 | |
165 | - carNumber: this.carNumber, // 车牌 | |
166 | - paySrcType: 101, //支付的类型 101 是本次 103是历史欠费 | |
167 | - ordeID: i.orderId, //支付的订单号 | |
168 | - appOrderTimeout: res.appOrderTimeout, // 超时描述 | |
169 | - } | |
170 | + sessionStorage.setItem('couponPark', JSON.stringify(result.data)) | |
171 | + this.$router.push( | |
172 | + { | |
173 | + path: 'couponPay', | |
174 | + query: { | |
175 | + carColor: this.carColor,// 车牌颜色 | |
176 | + arrearageTotalFee: res.orderTotalFee,// 应收 | |
177 | + arrearageDiscFee: discountFee * 100,// 优惠 | |
178 | + arrearageActFee: res.orderFee,// 实收 | |
179 | + carNumber: this.carNumber, // 车牌 | |
180 | + paySrcType: 101, //支付的类型 101 是本次 103是历史欠费 | |
181 | + ordeID: i.orderId, //支付的订单号 | |
182 | + appOrderTimeout: res.appOrderTimeout, // 超时描述 | |
170 | 183 | } |
171 | - ) | |
184 | + } | |
185 | + ) | |
172 | 186 | }) |
173 | 187 | |
174 | - } else { | |
175 | - //$('.dialog-out').show() | |
176 | - this.$msgbox('提示', '停车15分钟内无需缴费,申请成功。') | |
177 | - } | |
188 | + } else { | |
189 | + //$('.dialog-out').show() | |
190 | + this.$msgbox('提示', '停车15分钟内无需缴费,申请成功。') | |
191 | + } | |
178 | 192 | |
179 | 193 | }) |
180 | 194 | ... | ... |
src/views/parkPay/couponPay.vue
... | ... | @@ -214,7 +214,8 @@ export default { |
214 | 214 | code: this.webAppCode, |
215 | 215 | appId: this.$utils.myVxAppId |
216 | 216 | }; |
217 | - getOpenId(codeParams).then(res => { | |
217 | + let url = process.env.VUE_APP_PAYAPI; | |
218 | + getOpenId(url,codeParams).then(res => { | |
218 | 219 | if (res.code == 0) { |
219 | 220 | me.vxPay(res.data, this.orderId) |
220 | 221 | sessionStorage.setItem('openIdData', res.data) |
... | ... | @@ -229,6 +230,7 @@ export default { |
229 | 230 | } |
230 | 231 | }, |
231 | 232 | vxPay(openIdData, orderIdData) { |
233 | + let url = process.env.VUE_APP_PAYAPI; | |
232 | 234 | let vm = this |
233 | 235 | var wxParams = {}; |
234 | 236 | wxParams.orderId = orderIdData; |
... | ... | @@ -241,7 +243,7 @@ export default { |
241 | 243 | wxParams.recordArreaInfos = JSON.stringify(orderIdData); |
242 | 244 | wxParams.openId = openIdData; |
243 | 245 | wxParams.appId = this.$utils.myVxAppId; |
244 | - vxPayQuery(wxParams).then(res => { | |
246 | + vxPayQuery(url,wxParams).then(res => { | |
245 | 247 | if (res.code == 0) { // |
246 | 248 | if (res.data) { |
247 | 249 | var data = res.data; | ... | ... |
src/views/parkPay/plateNumber.vue
... | ... | @@ -334,6 +334,7 @@ export default { |
334 | 334 | created() { |
335 | 335 | this.carType = this.$route.query.carType |
336 | 336 | this.codeType = this.$route.query.codeType |
337 | + console.log(this.codeType) | |
337 | 338 | }, |
338 | 339 | mounted() { |
339 | 340 | // |
... | ... | @@ -453,9 +454,10 @@ export default { |
453 | 454 | query: { |
454 | 455 | carNumber: plateLicense, |
455 | 456 | carNumberColor: this.currentColor, |
456 | - carType: this.carType, | |
457 | - codeType: this.codeType | |
458 | - | |
457 | + carType: 2, | |
458 | + codeType: this.codeType, | |
459 | + cardRelParkNo: this.$route.query.cardRelParkNo, | |
460 | + key: this.$route.query.key | |
459 | 461 | } |
460 | 462 | }) |
461 | 463 | }, | ... | ... |