Commit 9bac797d0cd87a7fb02cac5190ab18e9b90b9a05

Authored by 刘淇
1 parent de98ac5b

卡券发放

common/common.js
... ... @@ -35,6 +35,10 @@ const couponRuleParkPage = serverUrl + "/business/h5/coupon/couponRuleParkPage";
35 35 const couponIssuedParkPage = serverUrl + "/business/h5/couponIssued/couponIssuedParkPage";
36 36 // 商户卡券-卡券发放-生成领券的动态码
37 37 const getCouponDynamicQR = serverUrl + "/business/h5/couponsend/getCouponDynamicQR";
  38 +// 商户卡券-卡券发放-生成领券的静态码下载地址
  39 +const getCouponStaticQR = serverUrl + "/business/h5/couponsend/getCouponStaticQR";
  40 +// 卡券申领明细总览
  41 +const couponDetailSummary = serverUrl + "/business/h5/couponIssued/couponDetailSummary";
38 42  
39 43 //陈彪接口
40 44  
... ... @@ -219,6 +223,9 @@ export default {
219 223 couponRuleParkPage,
220 224 couponIssuedParkPage,
221 225 getCouponDynamicQR,
  226 + getCouponStaticQR,
  227 + couponDetailSummary,
  228 +
222 229 //陈彪接口
223 230 rechargeList,
224 231 walletKindType,
... ...
common/requestServer.js
... ... @@ -52,7 +52,7 @@ export const myRequest = (options) => {
52 52 uni.hideLoading();
53 53 uni.showToast({
54 54 title: result.message,
55   - icon: 'error',
  55 + icon: 'none',
56 56 duration: 2000
57 57 });
58 58 }
... ... @@ -65,7 +65,7 @@ export const myRequest = (options) => {
65 65 console.log("请求失败", error);
66 66 uni.showToast({
67 67 title: error.message,
68   - icon: 'error',
  68 + icon: 'none',
69 69 duration: 2000
70 70 })
71 71 // 失败数据
... ...
pages.json
... ... @@ -13,10 +13,11 @@
13 13 },
14 14 "pages": [
15 15 // pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
  16 +
16 17 {
17   - "path": "pages/businessCard/provideCard",
  18 + "path": "pages/businessCard/buyCard",
18 19 "style": {
19   - "navigationBarTitleText": "商户卡券发放"
  20 + "navigationBarTitleText": "商户卡券购买"
20 21 }
21 22 },
22 23 {
... ... @@ -25,7 +26,6 @@
25 26 "navigationBarTitleText": "商户卡券"
26 27 }
27 28 },
28   -
29 29 {
30 30 "path": "pages/businessCard/cardDetail",
31 31 "style": {
... ... @@ -33,6 +33,24 @@
33 33 "enablePullDownRefresh": true
34 34 }
35 35 },
  36 +
  37 + {
  38 + "path": "pages/businessCard/provideCard",
  39 + "style": {
  40 + "navigationBarTitleText": "商户卡券发放"
  41 + }
  42 + },
  43 + {
  44 + "path": "pages/businessCard/printCard",
  45 + "style": {
  46 + "navigationBarTitleText": "商户卡券打印"
  47 + }
  48 + },
  49 +
  50 +
  51 +
  52 +
  53 +
36 54 {
37 55 "path": "pages/rechargeDetail/rechargeDetail",
38 56 "style": {
... ... @@ -70,20 +88,9 @@
70 88 }
71 89 },
72 90  
73   - {
74   - "path": "pages/businessCard/printCard",
75   - "style": {
76   - "navigationBarTitleText": "商户卡券打印"
77   - }
78   - },
79 91  
80 92  
81   - {
82   - "path": "pages/businessCard/buyCard",
83   - "style": {
84   - "navigationBarTitleText": "商户卡券购买"
85   - }
86   - },
  93 +
87 94  
88 95  
89 96 {
... ...
pages/businessCard/businessCard.vue
... ... @@ -85,20 +85,19 @@ export default {
85 85 },
86 86 toBuy(i) {
87 87 uni.navigateTo({
88   - url: '../businessCard/buyCard?optionData='+JSON.stringify(i)
  88 + url: '../businessCard/buyCard?optionData=' + JSON.stringify(i)
89 89 });
90 90 },
91   - printClick(i){
  91 + printClick(i) {
92 92 uni.navigateTo({
93   - url: '../businessCard/cardPrint?optionData='+JSON.stringify(i)
  93 + url: '../businessCard/cardPrint?optionData=' + JSON.stringify(i)
94 94 });
95 95 },
96   - provideCard(i){
  96 + provideCard(i) {
97 97 uni.navigateTo({
98   - url: '../businessCard/provideCard?optionData='+JSON.stringify(i)
  98 + url: '../businessCard/provideCard?optionData=' + JSON.stringify(i)
99 99 });
100 100 }
101   -
102 101 }
103 102 }
104 103 </script>
... ...
pages/businessCard/buyCard.vue
... ... @@ -110,11 +110,7 @@ export default {
110 110 })
111 111 return {
112 112 vModelValue: 3,
113   - title: 'picker',
114   - array: ['全部', '充值', '支付'],
115   - arrayWay: ['所有方式', '微信', '线下公对公'],
116   - index: 0,
117   - indexWay: 0,
  113 +
118 114 benginDate: currentDate,
119 115 overDate: currentDate,
120 116  
... ... @@ -232,8 +228,6 @@ export default {
232 228 /deep/ .uni-section{
233 229 padding-bottom: 10px;
234 230 }
235   - /*/deep/ .uni-datetime-picker-btn-text{*/
236   - /*display: none;*/
237   - /*}*/
  231 +
238 232  
239 233 </style>
... ...
pages/businessCard/cardDetail.vue
1 1 <template>
2 2 <view>
3   - <view class="statistics yellow-bg uni-list-cell-pd" style="color: #fff">共18张券被领取,合计金额100.00元,其中已使用16张</view>
  3 + <view class="statistics yellow-bg uni-list-cell-pd" style="color: #fff">
  4 + 共{{issuedCount}}张券被领取,合计金额{{$common.moneyFormat(totalFee)}}元,其中已使用{{usedCount}}张
  5 + </view>
4 6  
5 7  
6 8 <view class="uni-list">
... ... @@ -77,7 +79,8 @@
77 79 <view class="uni-flex uni-space-between" style="padding: 10px 0">
78 80 <view>
79 81 <text class="color-blue paddingRight">领取时间</text>
80   - <uni-dateformat :date="i.issuedEffDate" format="yyyy-MM-dd hh:mm:ss"></uni-dateformat>
  82 + <uni-dateformat :date="i.issuedEffDate"
  83 + format="yyyy-MM-dd hh:mm:ss"></uni-dateformat>
81 84 </view>
82 85 <view class="color-green" v-if="i.isUesed=='1'">
83 86 已使用
... ... @@ -89,8 +92,10 @@
89 92 <view class="uni-flex uni-space-between">
90 93 <view>
91 94 <text class="color-red paddingRight">使用时间</text>
92   - <uni-dateformat v-if="i.isUesed=='1'" :date="i.usedDate" format="yyyy-MM-dd hh:mm:ss"></uni-dateformat>
93   - <uni-dateformat v-else :date="i.exp_data" format="yyyy-MM-dd hh:mm:ss"></uni-dateformat>
  95 + <uni-dateformat v-if="i.isUesed=='1'" :date="i.usedDate"
  96 + format="yyyy-MM-dd hh:mm:ss"></uni-dateformat>
  97 + <uni-dateformat v-else :date="i.exp_data"
  98 + format="yyyy-MM-dd hh:mm:ss"></uni-dateformat>
94 99 </view>
95 100 <view class="color-green">
96 101 {{i.fullCutValue}}元/张
... ... @@ -102,123 +107,120 @@
102 107 </uni-list>
103 108 </uni-section>
104 109 </view>
105   - <uni-load-more :status="status" />
  110 + <uni-load-more :status="status"/>
106 111 </view>
107 112  
108 113  
109   -
110   -
111   -
112 114 <!--<uni-section title="8折(折扣券)" type="line">-->
113   - <!--<uni-list>-->
114   - <!--<uni-list-item>-->
115   - <!--<template v-slot:body>-->
116   - <!--<view class="slot-box uni-con-width">-->
117   - <!--<view class="uni-flex uni-space-between ">-->
118   - <!--<view class="color-blue">-->
119   - <!--JE000100011-->
120   - <!--</view>-->
121   - <!--<view class="color-blue">-->
122   - <!--京A123456-->
123   - <!--</view>-->
124   - <!--</view>-->
125   - <!--<view class="uni-flex uni-space-between" style="padding: 10px 0">-->
126   - <!--<view>-->
127   - <!--<text class="color-blue paddingRight">领取时间</text>-->
128   - <!--2020-11-01 01:01:01-->
129   - <!--</view>-->
130   - <!--<view class="color-green">-->
131   - <!--已使用-->
132   - <!--</view>-->
133   - <!--</view>-->
134   - <!--<view class="uni-flex uni-space-between">-->
135   - <!--<view>-->
136   - <!--<text class="color-red paddingRight">使用时间</text>-->
137   - <!--2020-11-01 01:01:01-->
138   - <!--</view>-->
139   - <!--<view class="color-green">-->
140   - <!--5元/张-->
141   - <!--</view>-->
142   - <!--</view>-->
143   - <!--</view>-->
144   - <!--</template>-->
145   - <!--</uni-list-item>-->
146   - <!--</uni-list>-->
  115 + <!--<uni-list>-->
  116 + <!--<uni-list-item>-->
  117 + <!--<template v-slot:body>-->
  118 + <!--<view class="slot-box uni-con-width">-->
  119 + <!--<view class="uni-flex uni-space-between ">-->
  120 + <!--<view class="color-blue">-->
  121 + <!--JE000100011-->
  122 + <!--</view>-->
  123 + <!--<view class="color-blue">-->
  124 + <!--京A123456-->
  125 + <!--</view>-->
  126 + <!--</view>-->
  127 + <!--<view class="uni-flex uni-space-between" style="padding: 10px 0">-->
  128 + <!--<view>-->
  129 + <!--<text class="color-blue paddingRight">领取时间</text>-->
  130 + <!--2020-11-01 01:01:01-->
  131 + <!--</view>-->
  132 + <!--<view class="color-green">-->
  133 + <!--已使用-->
  134 + <!--</view>-->
  135 + <!--</view>-->
  136 + <!--<view class="uni-flex uni-space-between">-->
  137 + <!--<view>-->
  138 + <!--<text class="color-red paddingRight">使用时间</text>-->
  139 + <!--2020-11-01 01:01:01-->
  140 + <!--</view>-->
  141 + <!--<view class="color-green">-->
  142 + <!--5元/张-->
  143 + <!--</view>-->
  144 + <!--</view>-->
  145 + <!--</view>-->
  146 + <!--</template>-->
  147 + <!--</uni-list-item>-->
  148 + <!--</uni-list>-->
147 149 <!--</uni-section>-->
148 150  
149 151  
150 152 <!--<uni-section title="8折(折扣券)" type="line">-->
151   - <!--<uni-list>-->
152   - <!--<uni-list-item>-->
153   - <!--<template v-slot:body>-->
154   - <!--<view class="slot-box uni-con-width">-->
155   - <!--<view class="uni-flex uni-space-between ">-->
156   - <!--<view class="color-blue">-->
157   - <!--JE000100011-->
158   - <!--</view>-->
159   - <!--<view class="color-blue">-->
160   - <!--京A123456-->
161   - <!--</view>-->
162   - <!--</view>-->
163   - <!--<view class="uni-flex uni-space-between" style="padding: 10px 0">-->
164   - <!--<view>-->
165   - <!--<text class="color-blue paddingRight">领取时间</text>-->
166   - <!--2020-11-01 01:01:01-->
167   - <!--</view>-->
168   - <!--<view class="color-red">-->
169   - <!--已失效-->
170   - <!--</view>-->
171   - <!--</view>-->
172   - <!--<view class="uni-flex uni-space-between">-->
173   - <!--<view>-->
174   - <!--<text class="color-red paddingRight">失效时间</text>-->
175   - <!--2020-11-01 01:01:01-->
176   - <!--</view>-->
177   - <!--<view class="color-green">-->
178   - <!--5元/张-->
179   - <!--</view>-->
180   - <!--</view>-->
181   - <!--</view>-->
182   - <!--</template>-->
183   - <!--</uni-list-item>-->
184   - <!--</uni-list>-->
  153 + <!--<uni-list>-->
  154 + <!--<uni-list-item>-->
  155 + <!--<template v-slot:body>-->
  156 + <!--<view class="slot-box uni-con-width">-->
  157 + <!--<view class="uni-flex uni-space-between ">-->
  158 + <!--<view class="color-blue">-->
  159 + <!--JE000100011-->
  160 + <!--</view>-->
  161 + <!--<view class="color-blue">-->
  162 + <!--京A123456-->
  163 + <!--</view>-->
  164 + <!--</view>-->
  165 + <!--<view class="uni-flex uni-space-between" style="padding: 10px 0">-->
  166 + <!--<view>-->
  167 + <!--<text class="color-blue paddingRight">领取时间</text>-->
  168 + <!--2020-11-01 01:01:01-->
  169 + <!--</view>-->
  170 + <!--<view class="color-red">-->
  171 + <!--已失效-->
  172 + <!--</view>-->
  173 + <!--</view>-->
  174 + <!--<view class="uni-flex uni-space-between">-->
  175 + <!--<view>-->
  176 + <!--<text class="color-red paddingRight">失效时间</text>-->
  177 + <!--2020-11-01 01:01:01-->
  178 + <!--</view>-->
  179 + <!--<view class="color-green">-->
  180 + <!--5元/张-->
  181 + <!--</view>-->
  182 + <!--</view>-->
  183 + <!--</view>-->
  184 + <!--</template>-->
  185 + <!--</uni-list-item>-->
  186 + <!--</uni-list>-->
185 187 <!--</uni-section>-->
186 188  
187 189 <!--<uni-section title="8折(折扣券)" type="line">-->
188   - <!--<uni-list>-->
189   - <!--<uni-list-item>-->
190   - <!--<template v-slot:body>-->
191   - <!--<view class="slot-box uni-con-width">-->
192   - <!--<view class="uni-flex uni-space-between ">-->
193   - <!--<view class="color-blue">-->
194   - <!--JE000100011-->
195   - <!--</view>-->
196   - <!--<view class="color-blue">-->
197   - <!--京A123456-->
198   - <!--</view>-->
199   - <!--</view>-->
200   - <!--<view class="uni-flex uni-space-between" style="padding: 10px 0">-->
201   - <!--<view>-->
202   - <!--<text class="color-blue paddingRight">领取时间</text>-->
203   - <!--2020-11-01 01:01:01-->
204   - <!--</view>-->
205   - <!--<view class="color-blue">-->
206   - <!--未使用-->
207   - <!--</view>-->
208   - <!--</view>-->
209   - <!--<view class="uni-flex uni-space-between">-->
210   - <!--<view>-->
211   - <!--<text class="color-green paddingRight">有效截止</text>-->
212   - <!--2020-11-01 01:01:01-->
213   - <!--</view>-->
214   - <!--<view class="color-green">-->
215   - <!--5元/张-->
216   - <!--</view>-->
217   - <!--</view>-->
218   - <!--</view>-->
219   - <!--</template>-->
220   - <!--</uni-list-item>-->
221   - <!--</uni-list>-->
  190 + <!--<uni-list>-->
  191 + <!--<uni-list-item>-->
  192 + <!--<template v-slot:body>-->
  193 + <!--<view class="slot-box uni-con-width">-->
  194 + <!--<view class="uni-flex uni-space-between ">-->
  195 + <!--<view class="color-blue">-->
  196 + <!--JE000100011-->
  197 + <!--</view>-->
  198 + <!--<view class="color-blue">-->
  199 + <!--京A123456-->
  200 + <!--</view>-->
  201 + <!--</view>-->
  202 + <!--<view class="uni-flex uni-space-between" style="padding: 10px 0">-->
  203 + <!--<view>-->
  204 + <!--<text class="color-blue paddingRight">领取时间</text>-->
  205 + <!--2020-11-01 01:01:01-->
  206 + <!--</view>-->
  207 + <!--<view class="color-blue">-->
  208 + <!--未使用-->
  209 + <!--</view>-->
  210 + <!--</view>-->
  211 + <!--<view class="uni-flex uni-space-between">-->
  212 + <!--<view>-->
  213 + <!--<text class="color-green paddingRight">有效截止</text>-->
  214 + <!--2020-11-01 01:01:01-->
  215 + <!--</view>-->
  216 + <!--<view class="color-green">-->
  217 + <!--5元/张-->
  218 + <!--</view>-->
  219 + <!--</view>-->
  220 + <!--</view>-->
  221 + <!--</template>-->
  222 + <!--</uni-list-item>-->
  223 + <!--</uni-list>-->
222 224 <!--</uni-section>-->
223 225 </view>
224 226 </template>
... ... @@ -250,11 +252,14 @@ export default {
250 252 endTime: currentDate,
251 253 pageNum: '1',//当前页
252 254 pageSize: '10',//每页条数
253   - totalPages:'1', // 总条数
  255 + totalPages: '1', // 总条数
254 256 // isLoadAll: false,
255 257 // reload: false,
256 258 status: 'no-more',
257 259 dataList: [],
  260 + issuedCount: 0,// 被领取张数
  261 + usedCount: 0,// 使用张数
  262 + totalFee: 0, // 金额
258 263 }
259 264 },
260 265 onLoad(params) {
... ... @@ -262,6 +267,7 @@ export default {
262 267 withShareTicket: true
263 268 })
264 269 this.fetchData()
  270 + this.couponDetailSummary()
265 271 },
266 272 onShow() {
267 273 var me = this;
... ... @@ -288,8 +294,6 @@ export default {
288 294 this.pageNum++;
289 295 this.fetchData()
290 296 }
291   -
292   -
293 297 },
294 298 computed: {
295 299 startDate() {
... ... @@ -301,15 +305,13 @@ export default {
301 305 },
302 306 methods: {
303 307 fetchData: function () {
304   -
305   -
306 308 let that = this
307 309 that.status = 'loading'
308 310 let paramsData = {
309 311 pageNum: this.pageNum,
310 312 pageSize: this.pageSize,
311   - beginTime: this.beginTime+' 00:00:00',
312   - endTime: this.endTime+' 23:59:59',
  313 + beginTime: this.beginTime + ' 00:00:00',
  314 + endTime: this.endTime + ' 23:59:59',
313 315 cardType: this.cardType.toString(), //卡券类型 :1-单次券,2-时长券,3-满减券,4-金额券,5-包天券
314 316 isUesed: this.isUesed.toString(), //1:已使用/绑定 0:未使用
315 317 }
... ... @@ -320,9 +322,9 @@ export default {
320 322 data: that.$common.requestSign(paramsData)
321 323 }).then(res => {
322 324 // const resDataArray = that.dataList.concat(res.data.dataList);
323   - if(res.data.pageTotals<10){
  325 + if (res.data.pageTotals < 10) {
324 326 this.status = 'no-more'
325   - }else{
  327 + } else {
326 328 this.status = 'more'
327 329 }
328 330 that.totalPages = res.data.pageTotals;
... ... @@ -330,6 +332,27 @@ export default {
330 332 console.log(that.dataList.length)
331 333 })
332 334 },
  335 + couponDetailSummary: function () {
  336 + let that = this
  337 + that.status = 'loading'
  338 + let paramsData = {
  339 + beginTime: this.beginTime + ' 00:00:00',
  340 + endTime: this.endTime + ' 23:59:59',
  341 + cardType: this.cardType.toString(), //卡券类型 :1-单次券,2-时长券,3-满减券,4-金额券,5-包天券
  342 + isUesed: this.isUesed.toString(), //1:已使用/绑定 0:未使用
  343 + }
  344 + // 首页信息获取 接口
  345 + that.$myRequest({
  346 + url: that.$common.couponDetailSummary,
  347 + method: 'POST',
  348 + data: that.$common.requestSign(paramsData)
  349 + }).then(res => {
  350 + console.log(res)
  351 + this.issuedCount = res.data.issuedCount // 被领取张数
  352 + this.usedCount = res.data.usedCount // 使用张数
  353 + this.totalFee = res.data.totalFee // 金额
  354 + })
  355 + },
333 356 bindPickerChange: function (e, storage) {
334 357 console.log('picker发送选择改变,携带值为', e.detail.value)
335 358 this.index = e.detail.value
... ... @@ -339,6 +362,7 @@ export default {
339 362 this.totalPages = 1
340 363 this.dataList = []
341 364 this.couponIssuedParkPage()
  365 + this.couponDetailSummary()
342 366 },
343 367 bindPickerChangeWay: function (e, storage) {
344 368 console.log(storage)
... ... @@ -349,6 +373,7 @@ export default {
349 373 this.totalPages = 1
350 374 this.dataList = []
351 375 this.couponIssuedParkPage()
  376 + this.couponDetailSummary()
352 377 },
353 378 bindStartDateChange: function (e) {
354 379 console.log(e.detail.value)
... ... @@ -358,6 +383,7 @@ export default {
358 383 this.totalPages = 1
359 384 this.dataList = []
360 385 this.couponIssuedParkPage()
  386 + this.couponDetailSummary()
361 387 },
362 388 bindEndDateChange: function (e) {
363 389 this.endTime = e.detail.value
... ... @@ -366,6 +392,7 @@ export default {
366 392 this.totalPages = 1
367 393 this.dataList = []
368 394 this.couponIssuedParkPage()
  395 + this.couponDetailSummary()
369 396 },
370 397 getDate(type) {
371 398 const date = new Date();
... ...
pages/businessCard/printCard.vue
1 1 <template>
2 2 <view>
3   - <uni-section title="50%(折扣券)" type="line">
  3 + <uni-section :title="`${cardRuleName}(${cardTypeName})`" type="line">
4 4 <uni-card padding="0" spacing="0">
5 5 <uni-list>
6   - <uni-list-item title="适应车场" rightText="万达商业广场" >
  6 + <uni-list-item title="适应车场" :rightText="plName">
7 7 <text></text>
8 8 </uni-list-item>
9   - <uni-list-item title="价格:¥5/张" rightText="商户库存:0张"></uni-list-item>
  9 + <uni-list-item :title="`价格:¥${price}/张`" :rightText="`商户库存:${cardNum}张`"></uni-list-item>
10 10 </uni-list>
11 11 </uni-card>
12 12 </uni-section>
13 13  
14   - <view class=" uni-card" style="padding: 10px 0">
15   - <view style="width: 80%;height: 100px;border: 1px solid #ccc;margin: 0 auto">
16   -
17   - </view>
  14 + <view class=" uni-card text-center" style="padding: 10px 0">
  15 + <image :src="qrUrl"></image>
18 16 </view>
19 17  
20   - <view style="padding: 15px">
  18 +
  19 + <view class=" uni-card" style="padding: 10px 15px">
21 20 二维码有效期:(自打印时间算起)
22   - <uni-number-box @change="changeValue" />
  21 + <uni-number-box @change="changeValue" min="1"/>
23 22 </view>
24 23  
25   -
26   -
27 24 <view class="uni-padding-wrap uni-common-mt">
28 25 <!--<button type="primary" style="margin-bottom: 15px">停止自动发放</button>-->
29   - <button type="warn">立即打印</button>
  26 + <button type="warn" @click="changeTime">立即打印</button>
30 27 </view>
31 28  
32 29  
... ... @@ -34,190 +31,87 @@
34 31 </template>
35 32  
36 33 <script>
37   -import common from "../../common/common.js";
  34 +import uQRCode from '../../common/uqrcode.js' //引入uqrcode.js
38 35 export default {
39 36 data() {
40   - const currentDate = this.getDate({
41   - format: true
42   - })
43 37 return {
44   - numberValue: 0,
45   - title: 'picker',
46   - array: ['全部', '充值', '支付'],
47   - arrayWay: ['所有方式', '微信', '线下公对公'],
48   - index: 0,
49   - indexWay: 0,
50   - benginDate: currentDate,
51   - overDate: currentDate,
52   - rows:[],
53   - pageNum:1,//当前页
54   - pageSize:1,//每页条数
55   - reload:false,
56   - status:'more',
57   - contentText:{
58   - contentdown:'上拉加载更多~',
59   - contentrefresh:'正在加载更多~',
60   - contentmore:'我是有底线的~'
61   - },
62   - iconType:'auto', // 图标样式
  38 + cardTypeName: '',// 卡类型名称
  39 + cardRuleName: '',// 卡名称
  40 + plName: '', // 停车场
  41 + price: '', // 卡价格
  42 + cardNum: '', // 库存
  43 + cardRelParkNo: '',//商券规则关联车场和商户编码
  44 + numberValue: '1',
  45 + hour: '9999999999999999999999',
  46 + qrUrl: '', // 图片地址
63 47 }
64 48 },
65 49 onLoad(params) {
66 50 wx.showShareMenu({
67 51 withShareTicket: true
68 52 })
69   - // this.mycarNumber = params.carNumber;
70   - // this.myorderId = params.orderId;
71   - // this.myparkCode = params.parkCode;
72   - // this.myorderState = params.orderState;
73   - // this.totalFee = params.totalFee
74   - // this.unPayFee = params.unPayFee
75   - // if (params.orderState == 5) {
76   - // //停车补缴单 103
77   - // this.mypaySrcType = '103'
78   - // } else {
79   - // this.mypaySrcType = '101'
80   - // }
81   - // // this.GetbillQueryInfo(this.mycarNumber, this.myorderId, this.myparkCode);
82   - // this.getWxCode();
83   - // this.PDlogin();
84   - //console.log("xxxmake = "+this.makedateFormat());
  53 + console.log(params)
  54 + let option = params
  55 + this.cardRelParkNo = option.cardRelParkNo
  56 + this.cardTypeName = option.cardTypeName
  57 + this.cardRuleName = option.cardRuleName
  58 + this.plName = option.plName
  59 + this.price = option.price
  60 + this.cardNum = option.cardNum
  61 + this.getCouponStaticQR()
85 62 },
86 63 onShow() {
87 64 var me = this;
88   - var userInfo = me.getGlobalUser("globalUser");
89   - if (userInfo != null) {
90   - me.phoneNumb = userInfo.userPhone;
91   - }
92   - var pages = getCurrentPages();
93   - var currPage = pages[pages.length - 1]; //当前页面
94   - console.log('currPage.data.selCoupon = ' + currPage.data.selCoupon);
95   - me.selCoupon = currPage.data.selCoupon;
96   - console.log(JSON.stringify(me.selCoupon));
97   - // me.GetbillQueryInfo(me.mycarNumber, me.myorderId, me.myparkCode, me.selCoupon.cardNo, me.selCoupon.couponType, me.selCoupon
98   - // .discValue);
99   - // GetbillQueryInfo(carnum, orderId, parkCode, cardNo, couponType, disValue) {
100   - },
101   - computed: {
102   - startDate() {
103   - return this.getDate('start');
104   - },
105   - endDate() {
106   - return this.getDate('end');
107   - }
108 65 },
  66 + computed: {},
109 67 methods: {
110   - change(value) {
  68 + changeValue(value) {
111 69 this.numberValue = value
112 70 },
113   - actionsClick(text){
114   - uni.showToast({
115   - title:text,
116   - icon:'none'
  71 + getCouponStaticQR() {
  72 + let that = this
  73 + let paramsData = {
  74 + cardRelParkNo: this.cardRelParkNo,
  75 + codeType: '2',
  76 + hour: this.hour
  77 + }
  78 + // 首页信息获取 接口
  79 + that.$myRequest({
  80 + url: that.$common.getCouponStaticQR,
  81 + method: 'POST',
  82 + data: that.$common.requestSign(paramsData)
  83 + }).then(res => {
  84 + console.log(res)
  85 + that.qrUrl = res.data.qrUrl
  86 + console.log(that.qrUrl)
117 87 })
118 88 },
119   - bindPickerChange: function (e) {
120   - console.log('picker发送选择改变,携带值为', e.detail.value)
121   - this.index = e.detail.value
122   - },
123   - bindPickerChangeWay: function (e) {
124   - console.log('picker发送选择改变,携带值为', e.detail.value)
125   - this.indexWay = e.detail.value
126   - },
127   - bindStartDateChange: function (e) {
128   - this.benginDate = e.detail.value
129   - },
130   - bindEndDateChange: function (e) {
131   - this.overDate = e.detail.value
132   - },
133   - getDate(type) {
134   - const date = new Date();
135   - let year = date.getFullYear();
136   - let month = date.getMonth() + 1;
137   - let day = date.getDate();
138   - if (type === 'start') {
139   - year = year - 60;
140   - } else if (type === 'end') {
141   - year = year + 2;
142   - }
143   - month = month > 9 ? month : '0' + month;
144   - day = day > 9 ? day : '0' + day;
145   - return `${year}-${month}-${day}`;
  89 + //**生成二维码**//
  90 + qrFun: function (text) {
  91 + this.qrShow = true
  92 + uQRCode.make({
  93 + canvasId: 'qrcode',
  94 + componentInstance: this,
  95 + text: text,
  96 + size: 150,
  97 + margin: 0,
  98 + backgroundColor: '#ffffff',
  99 + foregroundColor: '#000000',
  100 + fileType: 'jpg',
  101 + errorCorrectLevel: uQRCode.errorCorrectLevel.H,
  102 + success: res => {
  103 + }
  104 + })
146 105 },
  106 + changeTime: function () {
  107 + this.hour = this.numberValue
  108 + this.getCouponStaticQR()
  109 + }
147 110 }
148 111 }
149 112 </script>
150 113  
151 114 <style lang="scss" scoped>
152   - /deep/ .uni-section{
153   - padding-bottom: 10px;
154   - }
155   - .rechargeWrap{
156   - position: relative;
157   - .rechargeArrow{
158   - position: absolute;
159   - right: 10px;
160   - top: 30px;
161   - font-size: 20px;
162   - color: #999;
163   - }
164   - }
165   - .recordCon {
166   - padding-right: 35px;
167   - color: #999;
168   - display: flex;
169   - justify-content: space-between;
170   - }
171   -
172   - .container {
173   - overflow: hidden;
174   - }
175   -
176   - .custom-cover {
177   - flex: 1;
178   - flex-direction: row;
179   - position: relative;
180   - }
181   -
182   - .cover-content {
183   - position: absolute;
184   - bottom: 0;
185   - left: 0;
186   - right: 0;
187   - height: 40px;
188   - background-color: rgba($color: #000000, $alpha: 0.4);
189   - display: flex;
190   - flex-direction: row;
191   - align-items: center;
192   - padding-left: 15px;
193   - font-size: 14px;
194   - color: #fff;
195   - }
196 115  
197   - .card-actions {
198   - display: flex;
199   - flex-direction: row;
200   - justify-content: space-around;
201   - align-items: center;
202   - height: 45px;
203   - border-top: 1px #eee solid;
204   - }
205   - .card-actions-item {
206   - display: flex;
207   - flex-direction: row;
208   - align-items: center;
209   - }
210   - .card-actions-item-text {
211   - font-size: 12px;
212   - color: #666;
213   - margin-left: 5px;
214   - }
215   - .cover-image {
216   - flex: 1;
217   - height: 150px;
218   - }
219   - .no-border {
220   - border-width: 0;
221   - }
222 116  
223 117 </style>
... ...
pages/businessCard/provideCard.vue
... ... @@ -18,13 +18,13 @@
18 18 </view>
19 19  
20 20 <view class="tip-wrap">
21   - <uni-notice-bar single text="温馨提示:" />
22   - <uni-notice-bar single text="卡券自动发放,扫码领券后会自动刷新卡券二维码。" />
  21 + <uni-notice-bar single text="温馨提示:"/>
  22 + <uni-notice-bar single text="卡券自动发放,扫码领券后会自动刷新卡券二维码。"/>
23 23 </view>
24 24  
25 25 <view class="uni-padding-wrap uni-common-mt">
26   - <button type="primary" style="margin-bottom: 15px">停止自动发放</button>
27   - <button type="warn">打印静态二维码</button>
  26 + <button type="primary" style="margin-bottom: 15px" @click="stopProvide">{{provideText}}</button>
  27 + <button type="warn" @click="toPrintCard">打印静态二维码</button>
28 28 </view>
29 29  
30 30  
... ... @@ -39,37 +39,39 @@ export default {
39 39 qrShow: false,
40 40 cardTypeName: '',// 卡类型名称
41 41 cardRuleName: '',// 卡名称
42   - plName:'', // 停车场
43   - price:'', // 卡价格
44   - cardNum:'', // 库存
  42 + plName: '', // 停车场
  43 + price: '', // 卡价格
  44 + cardNum: '', // 库存
  45 + timer: null, // 定时器
  46 + qrUrl: '',// 二维码url
  47 + provideText:'停止自动发放',
  48 + cardRelParkNo:'',//商券规则关联车场和商户编码
45 49 }
46 50 },
47 51 onLoad(params) {
48 52 wx.showShareMenu({
49 53 withShareTicket: true
50 54 })
51   - // let option = JSON.parse(params.optionData)
52   - // console.log(option)
53   - // this.cardTypeName = option.cardTypeName
54   - // this.cardRuleName = option.cardRuleName
55   - // this.plName = option.plName
56   - // this.price = option.value
57   - // this.cardNum = option.cardNum
  55 + let option = JSON.parse(params.optionData)
  56 + console.log(option)
  57 + this.cardRelParkNo = option.cardRelParkNo
  58 + this.cardTypeName = option.cardTypeName
  59 + this.cardRuleName = option.cardRuleName
  60 + this.plName = option.plName
  61 + this.price = option.value
  62 + this.cardNum = option.cardNum
58 63 // this.maxNum = option.cardNum
59 64 this.getCouponDynamicQR()
60 65 },
61 66 onShow() {
62 67 var me = this;
63   -
64   - },
65   - computed: {
66   -
67 68 },
  69 + computed: {},
68 70 methods: {
69 71 getCouponDynamicQR() {
70 72 let that = this
71 73 let paramsData = {
72   - cardRelParkNo: '123qwe',
  74 + cardRelParkNo: this.cardRelParkNo,
73 75 codeType: '2'
74 76 }
75 77 // 首页信息获取 接口
... ... @@ -79,13 +81,18 @@ export default {
79 81 data: that.$common.requestSign(paramsData)
80 82 }).then(res => {
81 83 console.log(res)
82   - let qrUrl = res.data.qrUrl
83   - that.qrFun(qrUrl) //调用二维码方法
84   - console.log(qrUrl)
  84 + that.qrUrl = res.data.qrUrl
  85 + that.qrFun(that.qrUrl) //调用二维码方法
  86 + that.timer = setInterval(() => {
  87 + // 业务逻辑
  88 + console.log('11')
  89 + that.qrFun(that.qrUrl) //调用二维码方法
  90 + }, 300000)
  91 + console.log(that.qrUrl)
85 92 })
86 93 },
87 94 //**生成二维码**//
88   - qrFun: function(text) {
  95 + qrFun: function (text) {
89 96 this.qrShow = true
90 97 uQRCode.make({
91 98 canvasId: 'qrcode',
... ... @@ -97,85 +104,51 @@ export default {
97 104 foregroundColor: '#000000',
98 105 fileType: 'jpg',
99 106 errorCorrectLevel: uQRCode.errorCorrectLevel.H,
100   - success: res => {}
  107 + success: res => {
  108 + }
101 109 })
  110 + },
  111 + stopProvide: function () {
  112 + let that = this
  113 + // provideText:'停止自动发放'
  114 + if(that.provideText == '停止自动发放'){
  115 + that.provideText = '开始自动发放'
  116 + clearInterval(that.timer)
  117 + that.timer = null;
  118 + }else{
  119 + that.provideText = '停止自动发放'
  120 + that.qrFun(that.qrUrl) //调用二维码方法
  121 + that.timer = setInterval(() => {
  122 + // 业务逻辑
  123 + console.log('11')
  124 + that.qrFun(that.qrUrl) //调用二维码方法
  125 + }, 300000)
  126 + }
  127 + },
  128 + toPrintCard: function () {
  129 + uni.navigateTo({
  130 +
  131 + url: '../businessCard/printCard?cardRelParkNo='+this.cardRelParkNo+
  132 + '&cardTypeName='+ this.cardTypeName+
  133 + '&cardRuleName='+this.cardRuleName+
  134 + '&plName='+this.plName+
  135 + '&price='+this.price+
  136 + '&cardNum='+this.cardNum
  137 + });
102 138 }
103 139 }
104 140 }
105 141 </script>
106 142  
107 143 <style lang="scss" scoped>
108   - /deep/ .uni-section{
  144 + /deep/ .uni-section {
109 145 padding-bottom: 10px;
110 146 }
111   - .rechargeWrap{
112   - position: relative;
113   - .rechargeArrow{
114   - position: absolute;
115   - right: 10px;
116   - top: 30px;
117   - font-size: 20px;
118   - color: #999;
119   - }
120   - }
121   - .recordCon {
122   - padding-right: 35px;
123   - color: #999;
124   - display: flex;
125   - justify-content: space-between;
126   - }
127 147  
128   - .container {
129   - overflow: hidden;
130   - }
131 148  
132   - .custom-cover {
133   - flex: 1;
134   - flex-direction: row;
135   - position: relative;
136   - }
137 149  
138   - .cover-content {
139   - position: absolute;
140   - bottom: 0;
141   - left: 0;
142   - right: 0;
143   - height: 40px;
144   - background-color: rgba($color: #000000, $alpha: 0.4);
145   - display: flex;
146   - flex-direction: row;
147   - align-items: center;
148   - padding-left: 15px;
149   - font-size: 14px;
150   - color: #fff;
151   - }
152 150  
153   - .card-actions {
154   - display: flex;
155   - flex-direction: row;
156   - justify-content: space-around;
157   - align-items: center;
158   - height: 45px;
159   - border-top: 1px #eee solid;
160   - }
161   - .card-actions-item {
162   - display: flex;
163   - flex-direction: row;
164   - align-items: center;
165   - }
166   - .card-actions-item-text {
167   - font-size: 12px;
168   - color: #666;
169   - margin-left: 5px;
170   - }
171   - .cover-image {
172   - flex: 1;
173   - height: 150px;
174   - }
175   - .no-border {
176   - border-width: 0;
177   - }
178   - .tip-wrap /deep/ .uni-noticebar{
  151 + .tip-wrap /deep/ .uni-noticebar {
179 152 margin-bottom: 0;
180 153 }
181 154 </style>
... ...