From 9bac797d0cd87a7fb02cac5190ab18e9b90b9a05 Mon Sep 17 00:00:00 2001 From: liugongyu <290219706@qq.com> Date: Wed, 18 May 2022 15:32:32 +0800 Subject: [PATCH] 卡券发放 --- common/common.js | 7 +++++++ common/requestServer.js | 4 ++-- pages.json | 37 ++++++++++++++++++++++--------------- pages/businessCard/businessCard.vue | 11 +++++------ pages/businessCard/buyCard.vue | 10 ++-------- pages/businessCard/cardDetail.vue | 265 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------- pages/businessCard/printCard.vue | 238 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- pages/businessCard/provideCard.vue | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------- 8 files changed, 312 insertions(+), 411 deletions(-) diff --git a/common/common.js b/common/common.js index c243734..a7f8ac6 100644 --- a/common/common.js +++ b/common/common.js @@ -35,6 +35,10 @@ const couponRuleParkPage = serverUrl + "/business/h5/coupon/couponRuleParkPage"; const couponIssuedParkPage = serverUrl + "/business/h5/couponIssued/couponIssuedParkPage"; // 商户卡券-卡券发放-生成领券的动态码 const getCouponDynamicQR = serverUrl + "/business/h5/couponsend/getCouponDynamicQR"; +// 商户卡券-卡券发放-生成领券的静态码下载地址 +const getCouponStaticQR = serverUrl + "/business/h5/couponsend/getCouponStaticQR"; +// 卡券申领明细总览 +const couponDetailSummary = serverUrl + "/business/h5/couponIssued/couponDetailSummary"; //陈彪接口 @@ -219,6 +223,9 @@ export default { couponRuleParkPage, couponIssuedParkPage, getCouponDynamicQR, + getCouponStaticQR, + couponDetailSummary, + //陈彪接口 rechargeList, walletKindType, diff --git a/common/requestServer.js b/common/requestServer.js index 1e7e4d6..da33ece 100644 --- a/common/requestServer.js +++ b/common/requestServer.js @@ -52,7 +52,7 @@ export const myRequest = (options) => { uni.hideLoading(); uni.showToast({ title: result.message, - icon: 'error', + icon: 'none', duration: 2000 }); } @@ -65,7 +65,7 @@ export const myRequest = (options) => { console.log("请求失败", error); uni.showToast({ title: error.message, - icon: 'error', + icon: 'none', duration: 2000 }) // 失败数据 diff --git a/pages.json b/pages.json index 22d7618..1f89798 100644 --- a/pages.json +++ b/pages.json @@ -13,10 +13,11 @@ }, "pages": [ // pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + { - "path": "pages/businessCard/provideCard", + "path": "pages/businessCard/buyCard", "style": { - "navigationBarTitleText": "商户卡券发放" + "navigationBarTitleText": "商户卡券购买" } }, { @@ -25,7 +26,6 @@ "navigationBarTitleText": "商户卡券" } }, - { "path": "pages/businessCard/cardDetail", "style": { @@ -33,6 +33,24 @@ "enablePullDownRefresh": true } }, + + { + "path": "pages/businessCard/provideCard", + "style": { + "navigationBarTitleText": "商户卡券发放" + } + }, + { + "path": "pages/businessCard/printCard", + "style": { + "navigationBarTitleText": "商户卡券打印" + } + }, + + + + + { "path": "pages/rechargeDetail/rechargeDetail", "style": { @@ -70,20 +88,9 @@ } }, - { - "path": "pages/businessCard/printCard", - "style": { - "navigationBarTitleText": "商户卡券打印" - } - }, - { - "path": "pages/businessCard/buyCard", - "style": { - "navigationBarTitleText": "商户卡券购买" - } - }, + { diff --git a/pages/businessCard/businessCard.vue b/pages/businessCard/businessCard.vue index 63f1801..8211917 100644 --- a/pages/businessCard/businessCard.vue +++ b/pages/businessCard/businessCard.vue @@ -85,20 +85,19 @@ export default { }, toBuy(i) { uni.navigateTo({ - url: '../businessCard/buyCard?optionData='+JSON.stringify(i) + url: '../businessCard/buyCard?optionData=' + JSON.stringify(i) }); }, - printClick(i){ + printClick(i) { uni.navigateTo({ - url: '../businessCard/cardPrint?optionData='+JSON.stringify(i) + url: '../businessCard/cardPrint?optionData=' + JSON.stringify(i) }); }, - provideCard(i){ + provideCard(i) { uni.navigateTo({ - url: '../businessCard/provideCard?optionData='+JSON.stringify(i) + url: '../businessCard/provideCard?optionData=' + JSON.stringify(i) }); } - } } diff --git a/pages/businessCard/buyCard.vue b/pages/businessCard/buyCard.vue index 1837613..0d401cc 100644 --- a/pages/businessCard/buyCard.vue +++ b/pages/businessCard/buyCard.vue @@ -110,11 +110,7 @@ export default { }) return { vModelValue: 3, - title: 'picker', - array: ['全部', '充值', '支付'], - arrayWay: ['所有方式', '微信', '线下公对公'], - index: 0, - indexWay: 0, + benginDate: currentDate, overDate: currentDate, @@ -232,8 +228,6 @@ export default { /deep/ .uni-section{ padding-bottom: 10px; } - /*/deep/ .uni-datetime-picker-btn-text{*/ - /*display: none;*/ - /*}*/ + diff --git a/pages/businessCard/cardDetail.vue b/pages/businessCard/cardDetail.vue index e56869d..789e06d 100644 --- a/pages/businessCard/cardDetail.vue +++ b/pages/businessCard/cardDetail.vue @@ -1,6 +1,8 @@ @@ -250,11 +252,14 @@ export default { endTime: currentDate, pageNum: '1',//当前页 pageSize: '10',//每页条数 - totalPages:'1', // 总条数 + totalPages: '1', // 总条数 // isLoadAll: false, // reload: false, status: 'no-more', dataList: [], + issuedCount: 0,// 被领取张数 + usedCount: 0,// 使用张数 + totalFee: 0, // 金额 } }, onLoad(params) { @@ -262,6 +267,7 @@ export default { withShareTicket: true }) this.fetchData() + this.couponDetailSummary() }, onShow() { var me = this; @@ -288,8 +294,6 @@ export default { this.pageNum++; this.fetchData() } - - }, computed: { startDate() { @@ -301,15 +305,13 @@ export default { }, methods: { fetchData: function () { - - let that = this that.status = 'loading' let paramsData = { pageNum: this.pageNum, pageSize: this.pageSize, - beginTime: this.beginTime+' 00:00:00', - endTime: this.endTime+' 23:59:59', + beginTime: this.beginTime + ' 00:00:00', + endTime: this.endTime + ' 23:59:59', cardType: this.cardType.toString(), //卡券类型 :1-单次券,2-时长券,3-满减券,4-金额券,5-包天券 isUesed: this.isUesed.toString(), //1:已使用/绑定 0:未使用 } @@ -320,9 +322,9 @@ export default { data: that.$common.requestSign(paramsData) }).then(res => { // const resDataArray = that.dataList.concat(res.data.dataList); - if(res.data.pageTotals<10){ + if (res.data.pageTotals < 10) { this.status = 'no-more' - }else{ + } else { this.status = 'more' } that.totalPages = res.data.pageTotals; @@ -330,6 +332,27 @@ export default { console.log(that.dataList.length) }) }, + couponDetailSummary: function () { + let that = this + that.status = 'loading' + let paramsData = { + beginTime: this.beginTime + ' 00:00:00', + endTime: this.endTime + ' 23:59:59', + cardType: this.cardType.toString(), //卡券类型 :1-单次券,2-时长券,3-满减券,4-金额券,5-包天券 + isUesed: this.isUesed.toString(), //1:已使用/绑定 0:未使用 + } + // 首页信息获取 接口 + that.$myRequest({ + url: that.$common.couponDetailSummary, + method: 'POST', + data: that.$common.requestSign(paramsData) + }).then(res => { + console.log(res) + this.issuedCount = res.data.issuedCount // 被领取张数 + this.usedCount = res.data.usedCount // 使用张数 + this.totalFee = res.data.totalFee // 金额 + }) + }, bindPickerChange: function (e, storage) { console.log('picker发送选择改变,携带值为', e.detail.value) this.index = e.detail.value @@ -339,6 +362,7 @@ export default { this.totalPages = 1 this.dataList = [] this.couponIssuedParkPage() + this.couponDetailSummary() }, bindPickerChangeWay: function (e, storage) { console.log(storage) @@ -349,6 +373,7 @@ export default { this.totalPages = 1 this.dataList = [] this.couponIssuedParkPage() + this.couponDetailSummary() }, bindStartDateChange: function (e) { console.log(e.detail.value) @@ -358,6 +383,7 @@ export default { this.totalPages = 1 this.dataList = [] this.couponIssuedParkPage() + this.couponDetailSummary() }, bindEndDateChange: function (e) { this.endTime = e.detail.value @@ -366,6 +392,7 @@ export default { this.totalPages = 1 this.dataList = [] this.couponIssuedParkPage() + this.couponDetailSummary() }, getDate(type) { const date = new Date(); diff --git a/pages/businessCard/printCard.vue b/pages/businessCard/printCard.vue index 47e5ea0..4413573 100644 --- a/pages/businessCard/printCard.vue +++ b/pages/businessCard/printCard.vue @@ -1,32 +1,29 @@ diff --git a/pages/businessCard/provideCard.vue b/pages/businessCard/provideCard.vue index b491afd..fb70e7b 100644 --- a/pages/businessCard/provideCard.vue +++ b/pages/businessCard/provideCard.vue @@ -18,13 +18,13 @@ - - + + - - + + @@ -39,37 +39,39 @@ export default { qrShow: false, cardTypeName: '',// 卡类型名称 cardRuleName: '',// 卡名称 - plName:'', // 停车场 - price:'', // 卡价格 - cardNum:'', // 库存 + plName: '', // 停车场 + price: '', // 卡价格 + cardNum: '', // 库存 + timer: null, // 定时器 + qrUrl: '',// 二维码url + provideText:'停止自动发放', + cardRelParkNo:'',//商券规则关联车场和商户编码 } }, onLoad(params) { wx.showShareMenu({ withShareTicket: true }) - // let option = JSON.parse(params.optionData) - // console.log(option) - // this.cardTypeName = option.cardTypeName - // this.cardRuleName = option.cardRuleName - // this.plName = option.plName - // this.price = option.value - // this.cardNum = option.cardNum + let option = JSON.parse(params.optionData) + console.log(option) + this.cardRelParkNo = option.cardRelParkNo + this.cardTypeName = option.cardTypeName + this.cardRuleName = option.cardRuleName + this.plName = option.plName + this.price = option.value + this.cardNum = option.cardNum // this.maxNum = option.cardNum this.getCouponDynamicQR() }, onShow() { var me = this; - - }, - computed: { - }, + computed: {}, methods: { getCouponDynamicQR() { let that = this let paramsData = { - cardRelParkNo: '123qwe', + cardRelParkNo: this.cardRelParkNo, codeType: '2' } // 首页信息获取 接口 @@ -79,13 +81,18 @@ export default { data: that.$common.requestSign(paramsData) }).then(res => { console.log(res) - let qrUrl = res.data.qrUrl - that.qrFun(qrUrl) //调用二维码方法 - console.log(qrUrl) + that.qrUrl = res.data.qrUrl + that.qrFun(that.qrUrl) //调用二维码方法 + that.timer = setInterval(() => { + // 业务逻辑 + console.log('11') + that.qrFun(that.qrUrl) //调用二维码方法 + }, 300000) + console.log(that.qrUrl) }) }, //**生成二维码**// - qrFun: function(text) { + qrFun: function (text) { this.qrShow = true uQRCode.make({ canvasId: 'qrcode', @@ -97,85 +104,51 @@ export default { foregroundColor: '#000000', fileType: 'jpg', errorCorrectLevel: uQRCode.errorCorrectLevel.H, - success: res => {} + success: res => { + } }) + }, + stopProvide: function () { + let that = this + // provideText:'停止自动发放' + if(that.provideText == '停止自动发放'){ + that.provideText = '开始自动发放' + clearInterval(that.timer) + that.timer = null; + }else{ + that.provideText = '停止自动发放' + that.qrFun(that.qrUrl) //调用二维码方法 + that.timer = setInterval(() => { + // 业务逻辑 + console.log('11') + that.qrFun(that.qrUrl) //调用二维码方法 + }, 300000) + } + }, + toPrintCard: function () { + uni.navigateTo({ + + url: '../businessCard/printCard?cardRelParkNo='+this.cardRelParkNo+ + '&cardTypeName='+ this.cardTypeName+ + '&cardRuleName='+this.cardRuleName+ + '&plName='+this.plName+ + '&price='+this.price+ + '&cardNum='+this.cardNum + }); } } } -- libgit2 0.21.4