Commit 9d632cab9edfbddebac035d5b3400a9620d3793b

Authored by 刘淇
1 parent 1412df89

购买卡券接口添加plNo参数

common/common.js
1 1 import md5 from './md5.min.js';
2 2 // 江阴正式环境
3 3 var serverUrl = "https://bus.jycrtc.com";
4   -// 测试 http://test.jycrtc.com:8096 正式 https://bus.jycrtc.com
  4 +// 测试 http://221.228.70.87:8096 正式 https://bus.jycrtc.com
5 5 var serverPayUrl = ''
6 6 // 测试环境
7 7 // var serverUrl = "http://test.jycrtc.com:8096";
... ...
pages/businessCard/provideCard.vue
... ... @@ -65,15 +65,34 @@ export default {
65 65 this.getCouponDynamicQR()
66 66 that.timer = setInterval(() => {
67 67 // 业务逻辑
68   - console.log('11')
  68 + console.log(that.dateFormat(Date.parse(new Date())))
69 69 that.getCouponDynamicQR() //调用二维码方法
70 70 }, 60000)
71 71 },
  72 + onUnload() {
  73 + if(this.timer) {
  74 + clearTimeout(this.timer);
  75 + this.timer = null;
  76 + }
  77 + },
72 78 onShow() {
73 79 var me = this;
74 80 },
75 81 computed: {},
76 82 methods: {
  83 + dateFormat(time) {
  84 + let date = new Date(time);
  85 + let year = date.getFullYear();
  86 + // 在日期格式中,月份是从0开始的,因此要加0,使用三元表达式在小于10的前面加0,以达到格式统一 如 09:11:05
  87 + let month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  88 + let day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
  89 + let hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  90 + let minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  91 + let seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  92 + // 拼接
  93 + return year + "年" + month + "月" + day + "日" + hours + ":" + minutes + ":" + seconds;
  94 + // return year + "-" + month + "-" + day;
  95 + },
77 96 getCouponDynamicQR() {
78 97 let that = this
79 98 let paramsData = {
... ...
pages/index/index.vue
... ... @@ -21,7 +21,7 @@
21 21 <button type="primary" @click="login">登录</button>
22 22 </view>
23 23 <view class="uni-common-mt login-foot">
24   - 点击”登录“,即表示你同意<view style="color: blue;">《商户用户协议》</view>
  24 + 点击"登录",即表示你同意<view style="color: blue;">《商户用户协议》</view>
25 25 </view>
26 26 </view>
27 27 <view class="bg-white" v-else>
... ...
pages/parkPay/parkPay.vue
1 1 <template>
2   - <view>
  2 + <view>
3 3  
4   - <!-- <view class="order-time">
  4 + <!-- <view class="order-time">
5 5 剩余支付时间: {{appOrderTimeout}}
6 6 </view> -->
7 7  
8   - <view class="order-title">
9   - 订单详情
10   - </view>
11   - <view class="order-info">
12   - 车牌号:{{mycarNumber | tranNull}}
13   - </view>
14   - <view class="order-line"></view>
15   - <view class="order-info">
16   - 停车场:{{parkName | tranNull}}
17   - </view>
18   - <view class="order-line"></view>
19   - <view class="order-info">
20   - 进场时间:{{parkInTime | tranNull}}
21   - </view>
22   - <view class="order-line"></view>
23   - <view class="order-info">
24   - 停车时间:{{staytime | timeFormatter}}
25   - </view>
26   - <view class="order-line"></view>
27   - <view class="order-info">
28   - 总计费用:{{due |toFixed2}}元
29   - </view>
30   - <view class="order-line"></view>
  8 + <view class="order-title">
  9 + 订单详情
  10 + </view>
  11 + <view class="order-info">
  12 + 车牌号:{{mycarNumber | tranNull}}
  13 + </view>
  14 + <view class="order-line"></view>
  15 + <view class="order-info">
  16 + 停车场:{{parkName | tranNull}}
  17 + </view>
  18 + <view class="order-line"></view>
  19 + <view class="order-info">
  20 + 进场时间:{{parkInTime | tranNull}}
  21 + </view>
  22 + <view class="order-line"></view>
  23 + <view class="order-info">
  24 + 停车时间:{{staytime | timeFormatter}}
  25 + </view>
  26 + <view class="order-line"></view>
  27 + <view class="order-info">
  28 + 总计费用:{{due |toFixed2}}元
  29 + </view>
  30 + <view class="order-line"></view>
31 31  
32   - <view class="flex-row-justify-between">
33   - <view class="order-info">
34   - 需支付金额
35   - </view>
36   - <view class="flex-row-justify-end">
37   - <view class="order-info" style="font-weight:bold;font-size:18px;">
38   - {{orderFee | toFixed2}}
39   - </view>
40   - <view class="order-info" style="margin-right: 50upx;margin-left: 0px;">
41   - 元
42   - </view>
43   - </view>
44   - </view>
45   - <!-- <view class="uni-list-cell-pd pos-rel">
46   - <input class="" type="number"
47   - style="background-color: #fff;height:40px;line-height: 40px;padding-left: 15px;font-size: 20px;" v-model="rechargeNum"
48   - @input="checkNum" :maxlength="maxlength" placeholder="确认支付金额(单位:元)">
49   - <view class="pos-abs paywarp">
50   - 元
51   - </view>
52   - </view> -->
53   - <view class="order-line-bold"></view>
  32 + <view class="flex-row-justify-between">
  33 + <view class="order-info">
  34 + 需支付金额
  35 + </view>
  36 + <view class="flex-row-justify-end">
  37 + <view class="order-info" style="font-weight:bold;font-size:18px;">
  38 + {{orderFee | toFixed2}}
  39 + </view>
  40 + <view class="order-info" style="margin-right: 50upx;margin-left: 0px;">
  41 + 元
  42 + </view>
  43 + </view>
  44 + </view>
  45 + <!-- <view class="uni-list-cell-pd pos-rel">
  46 + <input class="" type="number"
  47 + style="background-color: #fff;height:40px;line-height: 40px;padding-left: 15px;font-size: 20px;" v-model="rechargeNum"
  48 + @input="checkNum" :maxlength="maxlength" placeholder="确认支付金额(单位:元)">
  49 + <view class="pos-abs paywarp">
  50 + 元
  51 + </view>
  52 + </view> -->
  53 + <view class="order-line-bold"></view>
54 54  
55   - <view class="order-title">
56   - 支付方法
57   - </view>
58   - <view class="order-line"></view>
  55 + <view class="order-title">
  56 + 支付方法
  57 + </view>
  58 + <view class="order-line"></view>
59 59  
60   - <view class="orderwaysview">
61   - <!--<image src="../../static/orderInfo/orderinfo-wechat.png" class="orderways"></image>-->
62   - <view class="order-info" style="margin-left: 15px;">
63   - 商户余额
64   - </view>
65   - <image src="../../static/orderInfo/orderinfo-sel.png" class="orderwaysSel"></image>
  60 + <view class="orderwaysview">
  61 + <!--<image src="../../static/orderInfo/orderinfo-wechat.png" class="orderways"></image>-->
  62 + <view class="order-info" style="margin-left: 15px;">
  63 + 商户余额
  64 + </view>
  65 + <image src="../../static/orderInfo/orderinfo-sel.png" class="orderwaysSel"></image>
66 66  
67   - </view>
  67 + </view>
68 68  
69   - <view class="order-line"></view>
70   - <button @click="payClick" class="button-sp-area" type="primary" plain="true">确认支付</button>
  69 + <view class="order-line"></view>
  70 + <button @click="payClick" class="button-sp-area" type="primary" plain="true" :loading="loadingFlag"
  71 + :disabled="disabledFlag">{{btnText}}
  72 + </button>
71 73  
72   - </view>
  74 + </view>
73 75 </template>
74 76  
75 77 <script>
76   - export default {
77   - data() {
78   - return {
79   - businessId: '',
80   - orderId: '',
81   - mycarNumber: '',
82   - parkName: '',
83   - parkInTime: '',
84   - staytime: '',
85   - due: '',
86   - orderFee: '',
87   - // appOrderTimeout:'0',
88   - totalFee: '', //应收
89   - // rechargeNum: '',
90   - // maxlength: 6 //默认一个长度
91   - }
92   - },
93   - onLoad(params) {
94   - wx.showShareMenu({
95   - withShareTicket: true
96   - })
97   - let data = JSON.parse(params.optionData)
98   - this.mycarNumber = data.carNumber
99   - this.parkName = data.parkName;
100   - this.parkInTime = data.parkInTime;
101   - this.staytime = data.parkDuration;
102   - this.due = data.totalFee;
103   - this.orderFee = data.unPayFee;
104   - // this.rechargeNum = data.unPayFee / 100;
105   - this.orderId = data.orderId;
106   - },
107   - onShow() {},
108   - methods: {
109   - checkNum(e) {
110   - let value = e.detail.value;
111   - let dot = value.indexOf('.'); //包含小数点
112   - let reg = /^[0-9]+$/; //正整数
113   - if (dot > -1) {
114   - this.maxlength = dot + 3; //长度是小数点后两位
115   - if (value.length > dot + 3) {}
116   - }
117   - if (reg.test(value)) { //如果是正整数不包含小数点
118   - this.maxlength = 6;
119   - }
120   - },
121   - payClick() {
122   - let that = this;
123   - let orderFee = that.orderFee;
124   -
125   - let paramsData = {
126   - payType: '35',
127   - paySrcType: '101',
128   - orderId: that.orderId,
129   - payFee: orderFee,
130   - }
131   - // 获取 接口
132   - that.$myRequest({
133   - url: that.$common.accountPay,
134   - method: 'POST',
135   - data: that.$common.requestSign(paramsData)
136   - }).then(res => {
137   - console.log('余额支付:' + res)
138   - uni.showToast({
139   - title: "支付成功",
140   - icon: 'success',
141   - duration: 2000
142   - });
143   - setTimeout(function() {
144   - let pages = getCurrentPages(); //当前页
145   - let beforePage = pages[pages.length - 2];
146   - uni.navigateBack({
147   - success: function() {
148   - beforePage.onLoad();
149   - }
150   - })
151   - }, 2000);
152   - })
153   -
154   - },
155   -
156   - // payClick() {
157   - // let that = this;
158   - // let orderFee = that.orderFee;
159   - // let rechargeNum = that.rechargeNum;
160   - // if (rechargeNum <= 0) {
161   - // return uni.showToast({
162   - // title: '不能输入小于等于0的金额',
163   - // icon: 'error'
164   - // })
165   - // } else if (rechargeNum === " ") {
166   - // return uni.showToast({
167   - // title: '金额不能为空',
168   - // icon: 'error'
169   - // })
170   - // } else if (rechargeNum > orderFee) {
171   - // return uni.showToast({
172   - // title: '金额不能大于需支付金额',
173   - // icon: 'error'
174   - // })
175   - // } else {
  78 +export default {
  79 + data() {
  80 + return {
  81 + loadingFlag: false,
  82 + disabledFlag: false,
  83 + btnText:'确认支付',
  84 + businessId: '',
  85 + orderId: '',
  86 + mycarNumber: '',
  87 + parkName: '',
  88 + parkInTime: '',
  89 + staytime: '',
  90 + due: '',
  91 + orderFee: '',
  92 + // appOrderTimeout:'0',
  93 + totalFee: '', //应收
  94 + // rechargeNum: '',
  95 + // maxlength: 6 //默认一个长度
  96 + }
  97 + },
  98 + onLoad(params) {
  99 + wx.showShareMenu({
  100 + withShareTicket: true
  101 + })
  102 + let data = JSON.parse(params.optionData)
  103 + this.mycarNumber = data.carNumber
  104 + this.parkName = data.parkName;
  105 + this.parkInTime = data.parkInTime;
  106 + this.staytime = data.parkDuration;
  107 + this.due = data.totalFee;
  108 + this.orderFee = data.unPayFee;
  109 + // this.rechargeNum = data.unPayFee / 100;
  110 + this.orderId = data.orderId;
  111 + },
  112 + onShow() {
  113 + },
  114 + methods: {
  115 + checkNum(e) {
  116 + let value = e.detail.value;
  117 + let dot = value.indexOf('.'); //包含小数点
  118 + let reg = /^[0-9]+$/; //正整数
  119 + if (dot > -1) {
  120 + this.maxlength = dot + 3; //长度是小数点后两位
  121 + if (value.length > dot + 3) {
  122 + }
  123 + }
  124 + if (reg.test(value)) { //如果是正整数不包含小数点
  125 + this.maxlength = 6;
  126 + }
  127 + },
  128 + payClick() {
  129 + let that = this;
  130 + that.loadingFlag = true
  131 + that.disabledFlag = true
  132 + that.btnText = '支付中,请稍后'
  133 + let orderFee = that.orderFee;
  134 + let paramsData = {
  135 + payType: '35',
  136 + paySrcType: '101',
  137 + orderId: that.orderId,
  138 + payFee: orderFee,
  139 + }
  140 + // 获取 接口
  141 + that.$myRequest({
  142 + url: that.$common.accountPay,
  143 + method: 'POST',
  144 + data: that.$common.requestSign(paramsData)
  145 + }).then(res => {
  146 + console.log(res)
  147 + console.log('1')
176 148  
177   - // let paramsData = {
178   - // payType: '35',
179   - // paySrcType: '101',
180   - // orderId: that.orderId,
181   - // payFee: (rechargeNum * 100).toString(),
182   - // }
183   - // // 获取 接口
184   - // that.$myRequest({
185   - // url: that.$common.accountPay,
186   - // method: 'POST',
187   - // data: that.$common.requestSign(paramsData)
188   - // }).then(res => {
189   - // console.log('余额支付:' + res)
190   - // uni.showToast({
191   - // title: "支付成功",
192   - // icon: 'success',
193   - // duration: 2000
194   - // });
195   - // setTimeout(function() {
196   - // let pages = getCurrentPages(); //当前页
197   - // let beforePage = pages[pages.length - 2];
198   - // uni.navigateBack({
199   - // success: function() {
200   - // beforePage.onLoad();
201   - // }
202   - // })
203   - // }, 2000);
204   - // })
205   - // }
  149 + that.loadingFlag = false
  150 + that.disabledFlag = false
  151 + if(res.code == '0'){
  152 + that.btnText = '支付完成'
  153 + console.log('余额支付:' + res)
  154 + uni.showToast({
  155 + title: "支付成功",
  156 + icon: 'success',
  157 + duration: 500
  158 + });
  159 + setTimeout(function () {
  160 + let pages = getCurrentPages(); //当前页
  161 + let beforePage = pages[pages.length - 2];
  162 + uni.navigateBack({
  163 + success: function () {
  164 + beforePage.onLoad();
  165 + }
  166 + })
  167 + }, 1000);
  168 + }else {
  169 + that.btnText = '支付失败,重新支付'
  170 + }
206 171  
207   - // },
208   - }
209   - }
  172 + })
  173 + },
  174 + // payClick() {
  175 + // let that = this;
  176 + // let orderFee = that.orderFee;
  177 + // let rechargeNum = that.rechargeNum;
  178 + // if (rechargeNum <= 0) {
  179 + // return uni.showToast({
  180 + // title: '不能输入小于等于0的金额',
  181 + // icon: 'error'
  182 + // })
  183 + // } else if (rechargeNum === " ") {
  184 + // return uni.showToast({
  185 + // title: '金额不能为空',
  186 + // icon: 'error'
  187 + // })
  188 + // } else if (rechargeNum > orderFee) {
  189 + // return uni.showToast({
  190 + // title: '金额不能大于需支付金额',
  191 + // icon: 'error'
  192 + // })
  193 + // } else {
  194 + // let paramsData = {
  195 + // payType: '35',
  196 + // paySrcType: '101',
  197 + // orderId: that.orderId,
  198 + // payFee: (rechargeNum * 100).toString(),
  199 + // }
  200 + // // 获取 接口
  201 + // that.$myRequest({
  202 + // url: that.$common.accountPay,
  203 + // method: 'POST',
  204 + // data: that.$common.requestSign(paramsData)
  205 + // }).then(res => {
  206 + // console.log('余额支付:' + res)
  207 + // uni.showToast({
  208 + // title: "支付成功",
  209 + // icon: 'success',
  210 + // duration: 2000
  211 + // });
  212 + // setTimeout(function() {
  213 + // let pages = getCurrentPages(); //当前页
  214 + // let beforePage = pages[pages.length - 2];
  215 + // uni.navigateBack({
  216 + // success: function() {
  217 + // beforePage.onLoad();
  218 + // }
  219 + // })
  220 + // }, 2000);
  221 + // })
  222 + // }
  223 + // },
  224 + }
  225 +}
210 226 </script>
211 227  
212 228 <style scoped lang="scss">
213   - .order-time {
214   - padding: 5px 0;
215   - background: #f0ad4e;
216   - text-align: center;
217   - color: #fff;
218   - }
  229 + .order-time {
  230 + padding: 5px 0;
  231 + background: #f0ad4e;
  232 + text-align: center;
  233 + color: #fff;
  234 + }
219 235  
220   - .order-title {
221   - font-size: 18px;
222   - margin-left: 16px;
223   - margin-top: 15px;
224   - font-weight: bold;
225   - color: #404040;
226   - }
  236 + .order-title {
  237 + font-size: 18px;
  238 + margin-left: 16px;
  239 + margin-top: 15px;
  240 + font-weight: bold;
  241 + color: #404040;
  242 + }
227 243  
228   - .order-info {
229   - font-size: 14px;
230   - margin-left: 15px;
231   - margin-top: 12px;
232   - color: #404040;
233   - }
  244 + .order-info {
  245 + font-size: 14px;
  246 + margin-left: 15px;
  247 + margin-top: 12px;
  248 + color: #404040;
  249 + }
234 250  
235   - .order-line {
236   - background: #D9D9D9;
237   - height: 1px;
238   - margin-top: 12px;
239   - margin-left: 15px;
240   - padding: 0px;
241   - overflow: hidden;
242   - /* 透明度 */
243   - opacity: 0.5;
244   - }
  251 + .order-line {
  252 + background: #D9D9D9;
  253 + height: 1px;
  254 + margin-top: 12px;
  255 + margin-left: 15px;
  256 + padding: 0px;
  257 + overflow: hidden;
  258 + /* 透明度 */
  259 + opacity: 0.5;
  260 + }
245 261  
246   - .order-line-bold {
247   - background: #FAFAFA;
248   - height: 12px;
249   - margin-top: 12px;
250   - padding: 0px;
251   - overflow: hidden;
252   - }
  262 + .order-line-bold {
  263 + background: #FAFAFA;
  264 + height: 12px;
  265 + margin-top: 12px;
  266 + padding: 0px;
  267 + overflow: hidden;
  268 + }
253 269  
254   - .flex-row-justify-between {
255   - display: flex;
256   - flex-direction: row;
257   - justify-content: space-between;
258   - }
  270 + .flex-row-justify-between {
  271 + display: flex;
  272 + flex-direction: row;
  273 + justify-content: space-between;
  274 + }
259 275  
260   - .flex-row-justify-end {
261   - display: flex;
262   - flex-direction: row;
263   - /* 水平对齐*/
264   - align-items: baseline;
  276 + .flex-row-justify-end {
  277 + display: flex;
  278 + flex-direction: row;
  279 + /* 水平对齐*/
  280 + align-items: baseline;
265 281  
266   - }
  282 + }
267 283  
268   - .order-discount {
269   - color: #C8C7CC;
270   - margin-right: 20 upx;
271   - /* margin-right: 12px ; */
272   - /* margin-top:12px ; */
  284 + .order-discount {
  285 + color: #C8C7CC;
  286 + margin-right: 20 upx;
  287 + /* margin-right: 12px ; */
  288 + /* margin-top:12px ; */
273 289  
274   - }
  290 + }
275 291  
276   - .orderwaysview {
277   - display: flex;
278   - flex-direction: row;
279   - }
  292 + .orderwaysview {
  293 + display: flex;
  294 + flex-direction: row;
  295 + }
280 296  
281   - .orderways {
282   - width: 18px;
283   - height: 18px;
284   - margin-left: 15px;
285   - margin-top: 14px;
286   - }
  297 + .orderways {
  298 + width: 18px;
  299 + height: 18px;
  300 + margin-left: 15px;
  301 + margin-top: 14px;
  302 + }
287 303  
288   - .orderwaysSel {
289   - width: 16px;
290   - height: 16px;
291   - margin-left: auto;
292   - margin-right: 14px;
293   - margin-top: 14px;
294   - /* justify-content:flex-end; */
295   - }
  304 + .orderwaysSel {
  305 + width: 16px;
  306 + height: 16px;
  307 + margin-left: auto;
  308 + margin-right: 14px;
  309 + margin-top: 14px;
  310 + /* justify-content:flex-end; */
  311 + }
296 312  
297   - .button-sp-area {
298   - margin: 0 auto;
299   - width: 60%;
300   - margin-top: 40px;
  313 + .button-sp-area {
  314 + margin: 0 auto;
  315 + width: 60%;
  316 + margin-top: 40px;
301 317  
302   - }
  318 + }
303 319  
304   - .paywarp {
305   - top: 12px;
306   - right: 30px;
307   - font-size: 20px;
308   - height: 40px;
309   - line-height: 40px;
310   - }
  320 + .paywarp {
  321 + top: 12px;
  322 + right: 30px;
  323 + font-size: 20px;
  324 + height: 40px;
  325 + line-height: 40px;
  326 + }
311 327 </style>
... ...