| @@ -14,12 +14,15 @@ Page({ | |||||
| navigationBarHeight, | navigationBarHeight, | ||||
| topLine: imgurl.topLine.url, | topLine: imgurl.topLine.url, | ||||
| btomLine: imgurl.btomLine.url, | btomLine: imgurl.btomLine.url, | ||||
| upDataRqUrlF: imgurl.upDataRqF.url, | |||||
| data: {}, | data: {}, | ||||
| showIdFalg: false, | showIdFalg: false, | ||||
| code: '', | code: '', | ||||
| codeS: '', | codeS: '', | ||||
| tempFilePath: '', | tempFilePath: '', | ||||
| isShowQR: true | |||||
| QRdata: {}, | |||||
| isShowQR: true, | |||||
| showhieRq: false | |||||
| }, | }, | ||||
| cardDetail(couponOrderId) { | cardDetail(couponOrderId) { | ||||
| @@ -48,6 +51,14 @@ Page({ | |||||
| }) | }) | ||||
| } else { | } else { | ||||
| that.getQR(res.data.id, res.data.tenantId, res.data.wxCardInfo.ownerUserId) | 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) { | getQR(cardId, cardTenantId, cUserId) { | ||||
| Http.get({ | Http.get({ | ||||
| url: `/couponOrder/cardDynamicId?cardId=${cardId}&cardTenantId=${cardTenantId}&cUserId=${cUserId}`, | url: `/couponOrder/cardDynamicId?cardId=${cardId}&cardTenantId=${cardTenantId}&cUserId=${cUserId}`, | ||||
| }).then(res => { | }).then(res => { | ||||
| console.log(res.data); | 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({ | let url = JSON.stringify({ | ||||
| END: "C", | END: "C", | ||||
| TYPE: "Ecard", | TYPE: "Ecard", | ||||
| @@ -109,9 +143,10 @@ Page({ | |||||
| }) | }) | ||||
| this.createQrCode(url, "qrcode", 350, 350); | this.createQrCode(url, "qrcode", 350, 350); | ||||
| }).catch(err => { | }).catch(err => { | ||||
| console.log(err, 'err'); | |||||
| wx.showToast({ | wx.showToast({ | ||||
| title: err.message, | 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 () { | gotoPay: function () { | ||||
| app.globalData.previewFlag = true | app.globalData.previewFlag = true | ||||
| let that = this; | let that = this; | ||||
| console.log(that.data.data.id, that.data.data.remainingAmount / 100); | |||||
| wx.scanCode({ | wx.scanCode({ | ||||
| success: (res) => { | success: (res) => { | ||||
| if (util.isJSON(res.result)) { | if (util.isJSON(res.result)) { | ||||
| @@ -141,10 +191,11 @@ Page({ | |||||
| .then(res => { | .then(res => { | ||||
| if (res.code == 200) { | if (res.code == 200) { | ||||
| let merChantDetail = JSON.stringify(res.data); | 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) | merChantDetail = encodeURIComponent(merChantDetail) | ||||
| console.log(that.data.data, 'data'); | |||||
| wx.navigateTo({ | 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}`, | |||||
| }) | }) | ||||
| } | } | ||||
| } | } | ||||
| @@ -54,12 +54,12 @@ | |||||
| </view> | </view> | ||||
| <image wx:if="{{!isShowQR}}" src="https://formall.oss-accelerate.aliyuncs.com/cimg/stoped.png" mode="aspectFit" /> | <image wx:if="{{!isShowQR}}" src="https://formall.oss-accelerate.aliyuncs.com/cimg/stoped.png" mode="aspectFit" /> | ||||
| <view class="closeRq" wx:if="{{showhieRq}}" bindtap="setRq"> | |||||
| <view class="closeRq" wx:if="{{showhieRq}}" bindtap="reQR"> | |||||
| <image class="updataRqCode" mode='widthFix' src="{{upDataRqUrlF}}"></image> | <image class="updataRqCode" mode='widthFix' src="{{upDataRqUrlF}}"></image> | ||||
| <view class="upDataRq">点一点刷新二维码</view> | <view class="upDataRq">点一点刷新二维码</view> | ||||
| </view> | </view> | ||||
| <view class="coedTiem" wx:if="{{!showhieRq&&expiredSeconds>1}}">二维码在 | |||||
| <view class="coedTiem" wx:if="{{!showhieRq&&expiredSeconds>0}}">二维码在 | |||||
| <text style="color:red">{{expiredSeconds}}s</text> | <text style="color:red">{{expiredSeconds}}s</text> | ||||
| 后失效 | 后失效 | ||||
| </view> | </view> | ||||
| @@ -134,8 +134,9 @@ | |||||
| </view> | </view> | ||||
| </view> --> | </view> --> | ||||
| <view class="bottomBtn"> | <view class="bottomBtn"> | ||||
| <button class="btn" bindtap="goGive">转送给微信好友</button> | |||||
| <button class="btn" bindtap='gotoPay'>扫一扫付款</button> | |||||
| <button wx:if="{{isShowQR}}" class="btn" bindtap='gotoPay'>扫一扫付款</button> | |||||
| <button wx:if="{{data.supportTransfer==1}}" class="btn" bindtap="goGive">转送给微信好友</button> | |||||
| <!-- <button wx:else class="btnGrey" bindtap="goGiveNone">转送给微信好友</button> --> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| @@ -98,7 +98,7 @@ page { | |||||
| } | } | ||||
| .barnumtext::before { | .barnumtext::before { | ||||
| content: "优惠券码:"; | |||||
| content: "电子卡卡号:"; | |||||
| font-size: 24rpx; | font-size: 24rpx; | ||||
| color: #999; | color: #999; | ||||
| } | } | ||||
| @@ -370,7 +370,10 @@ page { | |||||
| margin: 20rpx 0 0 20rpx !important; | margin: 20rpx 0 0 20rpx !important; | ||||
| } */ | } */ | ||||
| .bottomBtn { | .bottomBtn { | ||||
| position: sticky; | |||||
| bottom: 0; | |||||
| padding: 50rpx; | padding: 50rpx; | ||||
| z-index: 99999; | |||||
| } | } | ||||
| .bottomBtn .btn { | .bottomBtn .btn { | ||||
| @@ -378,4 +381,11 @@ page { | |||||
| font-weight: 600; | font-weight: 600; | ||||
| background-color: #ff7e2d; | background-color: #ff7e2d; | ||||
| margin-bottom: 20rpx; | margin-bottom: 20rpx; | ||||
| } | |||||
| .bottomBtn .btnGrey { | |||||
| color: #fff; | |||||
| font-weight: 600; | |||||
| background-color: #808080; | |||||
| margin-bottom: 20rpx; | |||||
| } | } | ||||
| @@ -171,7 +171,6 @@ Page({ | |||||
| }) | }) | ||||
| }) | }) | ||||
| } else if (options && options.couponChannelId && !options.spellGroup && app.globalData.type != 'sd') { | } else if (options && options.couponChannelId && !options.spellGroup && app.globalData.type != 'sd') { | ||||
| console.log(3333333333333333) | |||||
| // 转赠判断 | // 转赠判断 | ||||
| if (options.cuserId) { | if (options.cuserId) { | ||||
| wx.redirectTo({ | wx.redirectTo({ | ||||
| @@ -26,7 +26,8 @@ Page({ | |||||
| /** | /** | ||||
| * 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
| */ | */ | ||||
| onLoad: function(options) { | |||||
| onLoad: function (options) { | |||||
| console.log(options, 'options'); | |||||
| let that = this; | let that = this; | ||||
| let merChant = decodeURIComponent(options.merChant) | let merChant = decodeURIComponent(options.merChant) | ||||
| that.setData({ | that.setData({ | ||||
| @@ -43,7 +44,7 @@ Page({ | |||||
| inputValue: e.detail.value | inputValue: e.detail.value | ||||
| }) | }) | ||||
| }, | }, | ||||
| suretoPay: function(e) { | |||||
| suretoPay: function (e) { | |||||
| let that = this; | let that = this; | ||||
| if (e.currentTarget.dataset.sure == 'sure' && that.data.checked) { | if (e.currentTarget.dataset.sure == 'sure' && that.data.checked) { | ||||
| wx.showLoading({ | wx.showLoading({ | ||||
| @@ -58,7 +59,7 @@ Page({ | |||||
| }) | }) | ||||
| } | } | ||||
| }, | }, | ||||
| gotoPayMoney: function() { | |||||
| gotoPayMoney: function () { | |||||
| let that = this; | let that = this; | ||||
| const startSoterAuthentication = () => { | const startSoterAuthentication = () => { | ||||
| wx.startSoterAuthentication({ | wx.startSoterAuthentication({ | ||||
| @@ -131,17 +132,17 @@ Page({ | |||||
| } | } | ||||
| }) | }) | ||||
| }, | }, | ||||
| gotoPay: function() { | |||||
| gotoPay: function () { | |||||
| let that = this; | let that = this; | ||||
| console.log(that.data.cardid) | console.log(that.data.cardid) | ||||
| Http.post({ | 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 => { | .then(res => { | ||||
| if (res.code == 200) { | if (res.code == 200) { | ||||
| wx.hideLoading(); | wx.hideLoading(); | ||||
| @@ -168,7 +169,7 @@ Page({ | |||||
| }) | }) | ||||
| }) | }) | ||||
| }, | }, | ||||
| check: function(e) { | |||||
| check: function (e) { | |||||
| let that = this; | let that = this; | ||||
| console.log(e.currentTarget.dataset.id) | console.log(e.currentTarget.dataset.id) | ||||
| if (e) { | if (e) { | ||||
| @@ -202,13 +203,13 @@ Page({ | |||||
| title: '加载中', | title: '加载中', | ||||
| }) | }) | ||||
| console.log("222") | console.log("222") | ||||
| setTimeout(function() { | |||||
| setTimeout(function () { | |||||
| wx.hideLoading(); | wx.hideLoading(); | ||||
| }, 1500) | }, 1500) | ||||
| that.gotoPayMoney(); | that.gotoPayMoney(); | ||||
| } | } | ||||
| }, | }, | ||||
| gotonewcard: function() { | |||||
| gotonewcard: function () { | |||||
| wx.navigateTo({ | wx.navigateTo({ | ||||
| url: '/pages/discountCardList/discountCardList' | url: '/pages/discountCardList/discountCardList' | ||||
| }) | }) | ||||
| @@ -226,9 +227,9 @@ Page({ | |||||
| couponOrderStatus: 4 | couponOrderStatus: 4 | ||||
| } | } | ||||
| Http.get({ | Http.get({ | ||||
| url: config.api.cardorderList, | |||||
| data: data | |||||
| }) | |||||
| url: config.api.cardorderList, | |||||
| data: data | |||||
| }) | |||||
| .then(res => { | .then(res => { | ||||
| console.log(res) | console.log(res) | ||||
| if (res.code == 200) { | if (res.code == 200) { | ||||
| @@ -259,7 +260,7 @@ Page({ | |||||
| }) | }) | ||||
| }) | }) | ||||
| }, | }, | ||||
| showModel: function() { | |||||
| showModel: function () { | |||||
| this.setData({ | this.setData({ | ||||
| showModel: false, | showModel: false, | ||||
| showInput: false, | showInput: false, | ||||