diff --git a/pages/cardorder/cardUse/cardUse.js b/pages/cardorder/cardUse/cardUse.js index 1dc0977..b6d3e17 100644 --- a/pages/cardorder/cardUse/cardUse.js +++ b/pages/cardorder/cardUse/cardUse.js @@ -14,12 +14,15 @@ Page({ navigationBarHeight, topLine: imgurl.topLine.url, btomLine: imgurl.btomLine.url, + upDataRqUrlF: imgurl.upDataRqF.url, data: {}, showIdFalg: false, code: '', codeS: '', tempFilePath: '', - isShowQR: true + QRdata: {}, + isShowQR: true, + showhieRq: false }, cardDetail(couponOrderId) { @@ -48,6 +51,14 @@ Page({ }) } else { that.getQR(res.data.id, res.data.tenantId, res.data.wxCardInfo.ownerUserId) + const tempObj = { + id: res.data.id, + tenantId: res.data.tenantId, + ownerUserId: res.data.wxCardInfo.ownerUserId + } + this.setData({ + QRdata: tempObj + }) } /** @@ -92,15 +103,38 @@ Page({ } }, + reQR() { + this.setData({ + showhieRq: false + }) + const QRdata = this.data.QRdata + this.getQR(QRdata.id, QRdata.tenantId, QRdata.ownerUserId) + }, + // 获取动态二维码 getQR(cardId, cardTenantId, cUserId) { Http.get({ url: `/couponOrder/cardDynamicId?cardId=${cardId}&cardTenantId=${cardTenantId}&cUserId=${cUserId}`, }).then(res => { console.log(res.data); - this.setData({ - expiredSeconds: res.data.expiredSeconds - }) + let timer + let expiredSeconds = res.data.expiredSeconds + if (expiredSeconds) { + timer = setInterval(() => { + if (expiredSeconds != 0) { + this.setData({ + expiredSeconds: expiredSeconds + }) + expiredSeconds-- + } else { + clearInterval(timer) + this.setData({ + showhieRq: true + }) + } + }, 1000); + } + let url = JSON.stringify({ END: "C", TYPE: "Ecard", @@ -109,9 +143,10 @@ Page({ }) this.createQrCode(url, "qrcode", 350, 350); }).catch(err => { + console.log(err, 'err'); wx.showToast({ title: err.message, - icon: none + icon: 'none' }) }) }, @@ -122,11 +157,26 @@ Page({ }) }, + // 无法转赠 + goGiveNone() { + if (this.data.data.amount !== this.data.data.remainingAmount) { + wx.showToast({ + title: '该卡已消费,不支持转增', + icon: 'none' + }) + } else { + wx.showToast({ + title: '该卡不支持转增', + icon: "error" + }) + } + + }, + // 扫一扫去支付 gotoPay: function () { app.globalData.previewFlag = true let that = this; - console.log(that.data.data.id, that.data.data.remainingAmount / 100); wx.scanCode({ success: (res) => { if (util.isJSON(res.result)) { @@ -141,10 +191,11 @@ Page({ .then(res => { if (res.code == 200) { let merChantDetail = JSON.stringify(res.data); - if (merChantDetail && that.data.data.id && that.data.data.remainingamount / 100) { + if (merChantDetail && that.data.data.id && (that.data.data.remainingAmount)) { merChantDetail = encodeURIComponent(merChantDetail) + console.log(that.data.data, 'data'); wx.navigateTo({ - url: `/pages/scanPay/scanPay?merChant=${merChantDetail}&cardid=${that.data.data.id}&remainingAmount=${that.data.data.remainingamount}`, + url: `/pages/scanPay/scanPay?merChant=${merChantDetail}&cardid=${that.data.data.id}&remainingAmount=${that.data.data.remainingAmount / 100}`, }) } } diff --git a/pages/cardorder/cardUse/cardUse.wxml b/pages/cardorder/cardUse/cardUse.wxml index 2f90b27..62393ad 100644 --- a/pages/cardorder/cardUse/cardUse.wxml +++ b/pages/cardorder/cardUse/cardUse.wxml @@ -54,12 +54,12 @@ - + 点一点刷新二维码 - 二维码在 + 二维码在 {{expiredSeconds}}s 后失效 @@ -134,8 +134,9 @@ --> - - + + + diff --git a/pages/cardorder/cardUse/cardUse.wxss b/pages/cardorder/cardUse/cardUse.wxss index afe2384..36421cb 100644 --- a/pages/cardorder/cardUse/cardUse.wxss +++ b/pages/cardorder/cardUse/cardUse.wxss @@ -98,7 +98,7 @@ page { } .barnumtext::before { - content: "优惠券码:"; + content: "电子卡卡号:"; font-size: 24rpx; color: #999; } @@ -370,7 +370,10 @@ page { margin: 20rpx 0 0 20rpx !important; } */ .bottomBtn { + position: sticky; + bottom: 0; padding: 50rpx; + z-index: 99999; } .bottomBtn .btn { @@ -378,4 +381,11 @@ page { font-weight: 600; background-color: #ff7e2d; margin-bottom: 20rpx; +} + +.bottomBtn .btnGrey { + color: #fff; + font-weight: 600; + background-color: #808080; + margin-bottom: 20rpx; } \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 129c309..4867405 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -171,7 +171,6 @@ Page({ }) }) } else if (options && options.couponChannelId && !options.spellGroup && app.globalData.type != 'sd') { - console.log(3333333333333333) // 转赠判断 if (options.cuserId) { wx.redirectTo({ diff --git a/pages/scanPay/scanPay.js b/pages/scanPay/scanPay.js index 92349c3..3ba2c48 100644 --- a/pages/scanPay/scanPay.js +++ b/pages/scanPay/scanPay.js @@ -26,7 +26,8 @@ Page({ /** * 生命周期函数--监听页面加载 */ - onLoad: function(options) { + onLoad: function (options) { + console.log(options, 'options'); let that = this; let merChant = decodeURIComponent(options.merChant) that.setData({ @@ -43,7 +44,7 @@ Page({ inputValue: e.detail.value }) }, - suretoPay: function(e) { + suretoPay: function (e) { let that = this; if (e.currentTarget.dataset.sure == 'sure' && that.data.checked) { wx.showLoading({ @@ -58,7 +59,7 @@ Page({ }) } }, - gotoPayMoney: function() { + gotoPayMoney: function () { let that = this; const startSoterAuthentication = () => { wx.startSoterAuthentication({ @@ -131,17 +132,17 @@ Page({ } }) }, - gotoPay: function() { + gotoPay: function () { let that = this; console.log(that.data.cardid) Http.post({ - url: config.api.cardPayOrder, - data: { - cardId: that.data.cardid, - merchantId: that.data.merChant.id, - totalFee: that.data.inputValue - } - }) + url: config.api.cardPayOrder, + data: { + cardId: that.data.cardid, + merchantId: that.data.merChant.id, + totalFee: that.data.inputValue + } + }) .then(res => { if (res.code == 200) { wx.hideLoading(); @@ -168,7 +169,7 @@ Page({ }) }) }, - check: function(e) { + check: function (e) { let that = this; console.log(e.currentTarget.dataset.id) if (e) { @@ -202,13 +203,13 @@ Page({ title: '加载中', }) console.log("222") - setTimeout(function() { + setTimeout(function () { wx.hideLoading(); }, 1500) that.gotoPayMoney(); } }, - gotonewcard: function() { + gotonewcard: function () { wx.navigateTo({ url: '/pages/discountCardList/discountCardList' }) @@ -226,9 +227,9 @@ Page({ couponOrderStatus: 4 } Http.get({ - url: config.api.cardorderList, - data: data - }) + url: config.api.cardorderList, + data: data + }) .then(res => { console.log(res) if (res.code == 200) { @@ -259,7 +260,7 @@ Page({ }) }) }, - showModel: function() { + showModel: function () { this.setData({ showModel: false, showInput: false,