Commit 331018f3090949ea904c674b64160fb06303a028
1 parent
92e91fa6
江阴领取优惠券调接口
Showing
7 changed files
with
107 additions
and
69 deletions
config/dev.env.js
@@ -3,5 +3,7 @@ const merge = require('webpack-merge') | @@ -3,5 +3,7 @@ const merge = require('webpack-merge') | ||
3 | const prodEnv = require('./prod.env') | 3 | const prodEnv = require('./prod.env') |
4 | 4 | ||
5 | module.exports = merge(prodEnv, { | 5 | module.exports = merge(prodEnv, { |
6 | - NODE_ENV: '"development"' | 6 | + NODE_ENV: '"development"', |
7 | + VUE_APP_API:'"/api"', | ||
8 | + VUE_APP_PAYAPI:'"/payapi"' //本地域名 | ||
7 | }) | 9 | }) |
config/prod.env.js
1 | 'use strict' | 1 | 'use strict' |
2 | module.exports = { | 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 | NODE_ENV: '"production"' | 8 | NODE_ENV: '"production"' |
4 | } | 9 | } |
src/api/couponPay/couponPay.js
1 | import request from '@/utils/request' | 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 | return request({ | 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 | method: 'post', | 9 | method: 'post', |
8 | data: params | 10 | data: params |
9 | }) | 11 | }) |
10 | } | 12 | } |
11 | 13 | ||
12 | 14 | ||
13 | -export function queryParkingRecordPageByCarNumbers(params) { | 15 | +export function queryParkingRecordPageByCarNumbers(base,params) { |
14 | return request({ | 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 | method: 'post', | 19 | method: 'post', |
18 | data: params | 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 | return request({ | 26 | return request({ |
25 | - url: '/payapi/appAccountPay/appApplyParkOut', | 27 | + url: base+'/appAccountPay/appApplyParkOut', |
26 | method: 'post', | 28 | method: 'post', |
27 | data: params | 29 | data: params |
28 | }) | 30 | }) |
29 | } | 31 | } |
30 | 32 | ||
31 | 33 | ||
32 | -export function parkingQuery(params) { | 34 | +export function parkingQuery(base,params) { |
33 | return request({ | 35 | return request({ |
34 | - url: '/payapi/queryParkOrder/billQuery', | 36 | + url: base+'/queryParkOrder/billQuery', |
35 | method: 'post', | 37 | method: 'post', |
36 | data: params | 38 | data: params |
37 | }) | 39 | }) |
38 | } | 40 | } |
39 | 41 | ||
40 | -export function aliPay(params) { // 支付宝 | 42 | +export function aliPay(base,params) { // 支付宝 |
41 | return request({ | 43 | return request({ |
42 | - url: '/payapi/alipay/aliH5Pay', | 44 | + url: base+'/alipay/aliH5Pay', |
43 | method: 'post', | 45 | method: 'post', |
44 | data: params | 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 | return request({ | 52 | return request({ |
51 | - url: '/payapi/weixinPublicPay/getOpenIdByCode', | 53 | + url: base+'/weixinPublicPay/getOpenIdByCode', |
52 | method: 'post', | 54 | method: 'post', |
53 | data: params | 55 | data: params |
54 | }) | 56 | }) |
55 | } | 57 | } |
56 | 58 | ||
57 | -export function vxPayQuery(params) { // 微信 | 59 | +export function vxPayQuery(base,params) { // 微信 |
58 | return request({ | 60 | return request({ |
59 | - url: '/payapi/weixinpay/publicUnifiedOrder', | 61 | + url: base+'/weixinpay/publicUnifiedOrder', |
60 | method: 'post', | 62 | method: 'post', |
61 | data: params | 63 | data: params |
62 | }) | 64 | }) |
src/utils/request.js
@@ -6,9 +6,17 @@ import axios from 'axios' | @@ -6,9 +6,17 @@ import axios from 'axios' | ||
6 | const service = axios.create({ | 6 | const service = axios.create({ |
7 | // baseURL:'https://bus.jycrtc.com/', | 7 | // baseURL:'https://bus.jycrtc.com/', |
8 | // baseURL:process.env.VUE_APP_URL, | 8 | // baseURL:process.env.VUE_APP_URL, |
9 | + // baseURL:'', | ||
9 | // withCredentials: true, // send cookies when cross-domain requests | 10 | // withCredentials: true, // send cookies when cross-domain requests |
10 | timeout: 6000, // request timeout | 11 | timeout: 6000, // request timeout |
11 | - withCredentials: false, | 12 | + // withCredentials: false, |
13 | + // crossDomain: true, | ||
14 | + | ||
15 | + xhrFields: { | ||
16 | + | ||
17 | + withCredentials: false | ||
18 | + | ||
19 | + }, | ||
12 | headers:{ | 20 | headers:{ |
13 | 'Access-Control-Allow-Origin':'*' | 21 | 'Access-Control-Allow-Origin':'*' |
14 | //'Content-Type':'application/x-www-form-urlencoded' | 22 | //'Content-Type':'application/x-www-form-urlencoded' |
@@ -18,13 +26,16 @@ const service = axios.create({ | @@ -18,13 +26,16 @@ const service = axios.create({ | ||
18 | service.interceptors.request.use( | 26 | service.interceptors.request.use( |
19 | 27 | ||
20 | config => { | 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 | return config | 39 | return config |
29 | }, | 40 | }, |
30 | error => { | 41 | error => { |
src/views/parkPay/coupon.vue
@@ -2,10 +2,11 @@ | @@ -2,10 +2,11 @@ | ||
2 | <div> | 2 | <div> |
3 | <img :src="imgurl" alt="" style="margin: 10px auto;width: 64px;height: 64px;"> | 3 | <img :src="imgurl" alt="" style="margin: 10px auto;width: 64px;height: 64px;"> |
4 | <div style="padding: 10px 30px 50px"> | 4 | <div style="padding: 10px 30px 50px"> |
5 | - <p>尊敬的车主您好:{{tipText}}</p> | 5 | + <p>尊敬的车主您好:{{ tipText }}</p> |
6 | </div> | 6 | </div> |
7 | <div style="padding: 0 20px"> | 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 | <mt-button size="large" type="danger" @click="toBackPage">返回</mt-button> | 10 | <mt-button size="large" type="danger" @click="toBackPage">返回</mt-button> |
10 | </div> | 11 | </div> |
11 | 12 | ||
@@ -15,29 +16,34 @@ | @@ -15,29 +16,34 @@ | ||
15 | <script> | 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 | export default { | 26 | export default { |
21 | name: "coupon", | 27 | name: "coupon", |
22 | data() { | 28 | data() { |
23 | return { | 29 | return { |
24 | - imgurl:'', | 30 | + imgurl: '', |
25 | successiconUrl: require('../../assets/images/successIcon.png'), | 31 | successiconUrl: require('../../assets/images/successIcon.png'), |
26 | loseiconUrl: require('../../assets/images/loseIcon.png'), | 32 | loseiconUrl: require('../../assets/images/loseIcon.png'), |
27 | carNum: '', | 33 | carNum: '', |
28 | carNumberColor: '', | 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 | created() { | 42 | created() { |
37 | this.carNum = this.$route.query.carNumber | 43 | this.carNum = this.$route.query.carNumber |
38 | this.carType = this.$route.query.carType | 44 | this.carType = this.$route.query.carType |
39 | this.codeType = this.$route.query.codeType | 45 | this.codeType = this.$route.query.codeType |
40 | - | 46 | + this.cardRelParkNo = this.$route.query.cardRelParkNo |
41 | // this.carNum = this.$route.query.carNumber // 获取车牌号 | 47 | // this.carNum = this.$route.query.carNumber // 获取车牌号 |
42 | // this.carNumberColor = this.$route.query.carNumberColor // 获取颜色 0:蓝牌;1:黄牌;2:白牌;3:黑牌;4:绿色 | 48 | // this.carNumberColor = this.$route.query.carNumberColor // 获取颜色 0:蓝牌;1:黄牌;2:白牌;3:黑牌;4:绿色 |
43 | // this.currentTabActive = this.$route.query.parkFlag ? this.$route.query.parkFlag : 0 | 49 | // this.currentTabActive = this.$route.query.parkFlag ? this.$route.query.parkFlag : 0 |
@@ -46,34 +52,40 @@ export default { | @@ -46,34 +52,40 @@ export default { | ||
46 | this.scanCouponQR() | 52 | this.scanCouponQR() |
47 | }, | 53 | }, |
48 | methods: { | 54 | methods: { |
49 | - scanCouponQR(){ | 55 | + scanCouponQR() { |
56 | + | ||
57 | + let url = process.env.VUE_APP_API; | ||
58 | + console.log(url) | ||
50 | var salt = this.$utils.myCommonSalt(32); | 59 | var salt = this.$utils.myCommonSalt(32); |
51 | var jsondata = { | 60 | var jsondata = { |
52 | app_id: this.$utils.myVarAppid, | 61 | app_id: this.$utils.myVarAppid, |
53 | deviceInfo: this.$utils.myDeviceInfo, | 62 | deviceInfo: this.$utils.myDeviceInfo, |
54 | salt: salt, | 63 | salt: salt, |
55 | sign_type: "md5", | 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 | carNum: this.carNum, | 69 | carNum: this.carNum, |
61 | // carNumberColor: this.carNumberColor, | 70 | // carNumberColor: this.carNumberColor, |
62 | orgId: this.$utils.myOrgId, | 71 | orgId: this.$utils.myOrgId, |
63 | - terminalSource:'7', | 72 | + terminalSource: '7', |
64 | // token:'e2c1e43722dd43a5b7e268001b39e6f0' | 73 | // token:'e2c1e43722dd43a5b7e268001b39e6f0' |
65 | } | 74 | } |
66 | jsondata.sign = this.$utils.signObject(jsondata) | 75 | jsondata.sign = this.$utils.signObject(jsondata) |
67 | - scanCouponQR(jsondata).then(response => { | 76 | + scanCouponQR(url,jsondata).then(response => { |
68 | console.log(response) | 77 | console.log(response) |
69 | - this.tipText = response.data.message | ||
70 | - if(response.data.code==0){ | 78 | + |
79 | + if (response.code == 0) { | ||
71 | this.payFlag = true | 80 | this.payFlag = true |
72 | this.imgurl = this.successiconUrl | 81 | this.imgurl = this.successiconUrl |
73 | - }else{ | 82 | + this.tipText = '领取优惠券成功' |
83 | + } else { | ||
74 | this.payFlag = false | 84 | this.payFlag = false |
75 | this.imgurl = this.loseiconUrl | 85 | this.imgurl = this.loseiconUrl |
86 | + this.tipText = response.message | ||
76 | } | 87 | } |
88 | + // this.tipText = | ||
77 | }) | 89 | }) |
78 | }, | 90 | }, |
79 | toPay() { | 91 | toPay() { |
@@ -86,6 +98,7 @@ export default { | @@ -86,6 +98,7 @@ export default { | ||
86 | this.$router.back() | 98 | this.$router.back() |
87 | }, | 99 | }, |
88 | parkRecordList() { // 获取停车记录数据 | 100 | parkRecordList() { // 获取停车记录数据 |
101 | + let url = process.env.VUE_APP_PAYAPI; | ||
89 | var salt = this.$utils.myCommonSalt(32); | 102 | var salt = this.$utils.myCommonSalt(32); |
90 | var jsondata = { | 103 | var jsondata = { |
91 | app_id: this.$utils.myVarAppid, | 104 | app_id: this.$utils.myVarAppid, |
@@ -106,7 +119,7 @@ export default { | @@ -106,7 +119,7 @@ export default { | ||
106 | 119 | ||
107 | // jsondata.sign = md5sign | 120 | // jsondata.sign = md5sign |
108 | console.log('停车记录传参 ' + JSON.stringify(jsondata)); | 121 | console.log('停车记录传参 ' + JSON.stringify(jsondata)); |
109 | - queryParkingRecordPageByCarNumbers(jsondata).then(response => { | 122 | + queryParkingRecordPageByCarNumbers(url,jsondata).then(response => { |
110 | console.log(response) | 123 | console.log(response) |
111 | // this.parkList = response.data.dataList | 124 | // this.parkList = response.data.dataList |
112 | 125 | ||
@@ -119,6 +132,7 @@ export default { | @@ -119,6 +132,7 @@ export default { | ||
119 | }) | 132 | }) |
120 | }, | 133 | }, |
121 | toPayCurrent(i) { // 缴纳本次在停费用 | 134 | toPayCurrent(i) { // 缴纳本次在停费用 |
135 | + let url = process.env.VUE_APP_PAYAPI; | ||
122 | var salt = this.$utils.myCommonSalt(32); | 136 | var salt = this.$utils.myCommonSalt(32); |
123 | var params = { | 137 | var params = { |
124 | app_id: this.$utils.myVarAppid, | 138 | app_id: this.$utils.myVarAppid, |
@@ -130,7 +144,7 @@ export default { | @@ -130,7 +144,7 @@ export default { | ||
130 | terminalSource: '3', | 144 | terminalSource: '3', |
131 | } | 145 | } |
132 | params.sign = this.$utils.signObject(params) | 146 | params.sign = this.$utils.signObject(params) |
133 | - appApplyParkOut(params).then(response => { | 147 | + appApplyParkOut(url,params).then(response => { |
134 | console.log(response) | 148 | console.log(response) |
135 | 149 | ||
136 | if (response.code == '5005') { | 150 | if (response.code == '5005') { |
@@ -148,33 +162,33 @@ export default { | @@ -148,33 +162,33 @@ export default { | ||
148 | carNumber: this.carNum, | 162 | carNumber: this.carNum, |
149 | } | 163 | } |
150 | jsondata.sign = this.$utils.signObject(jsondata) | 164 | jsondata.sign = this.$utils.signObject(jsondata) |
151 | - parkingQuery(jsondata).then(result => { | 165 | + parkingQuery(url,jsondata).then(result => { |
152 | console.log(result) | 166 | console.log(result) |
153 | let res = result.data | 167 | let res = result.data |
154 | let _dis = res.discountFee | 168 | let _dis = res.discountFee |
155 | let discountFee = _dis.slice(1, _dis.length - 1) | 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,7 +214,8 @@ export default { | ||
214 | code: this.webAppCode, | 214 | code: this.webAppCode, |
215 | appId: this.$utils.myVxAppId | 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 | if (res.code == 0) { | 219 | if (res.code == 0) { |
219 | me.vxPay(res.data, this.orderId) | 220 | me.vxPay(res.data, this.orderId) |
220 | sessionStorage.setItem('openIdData', res.data) | 221 | sessionStorage.setItem('openIdData', res.data) |
@@ -229,6 +230,7 @@ export default { | @@ -229,6 +230,7 @@ export default { | ||
229 | } | 230 | } |
230 | }, | 231 | }, |
231 | vxPay(openIdData, orderIdData) { | 232 | vxPay(openIdData, orderIdData) { |
233 | + let url = process.env.VUE_APP_PAYAPI; | ||
232 | let vm = this | 234 | let vm = this |
233 | var wxParams = {}; | 235 | var wxParams = {}; |
234 | wxParams.orderId = orderIdData; | 236 | wxParams.orderId = orderIdData; |
@@ -241,7 +243,7 @@ export default { | @@ -241,7 +243,7 @@ export default { | ||
241 | wxParams.recordArreaInfos = JSON.stringify(orderIdData); | 243 | wxParams.recordArreaInfos = JSON.stringify(orderIdData); |
242 | wxParams.openId = openIdData; | 244 | wxParams.openId = openIdData; |
243 | wxParams.appId = this.$utils.myVxAppId; | 245 | wxParams.appId = this.$utils.myVxAppId; |
244 | - vxPayQuery(wxParams).then(res => { | 246 | + vxPayQuery(url,wxParams).then(res => { |
245 | if (res.code == 0) { // | 247 | if (res.code == 0) { // |
246 | if (res.data) { | 248 | if (res.data) { |
247 | var data = res.data; | 249 | var data = res.data; |
src/views/parkPay/plateNumber.vue
@@ -334,6 +334,7 @@ export default { | @@ -334,6 +334,7 @@ export default { | ||
334 | created() { | 334 | created() { |
335 | this.carType = this.$route.query.carType | 335 | this.carType = this.$route.query.carType |
336 | this.codeType = this.$route.query.codeType | 336 | this.codeType = this.$route.query.codeType |
337 | + console.log(this.codeType) | ||
337 | }, | 338 | }, |
338 | mounted() { | 339 | mounted() { |
339 | // | 340 | // |
@@ -453,9 +454,10 @@ export default { | @@ -453,9 +454,10 @@ export default { | ||
453 | query: { | 454 | query: { |
454 | carNumber: plateLicense, | 455 | carNumber: plateLicense, |
455 | carNumberColor: this.currentColor, | 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 | }, |