| @@ -4,14 +4,22 @@ const config = require("../../../config/config.js"); | |||||
| const Http = require("../../../utils/HttpBasics"); | const Http = require("../../../utils/HttpBasics"); | ||||
| let app = getApp(); | let app = getApp(); | ||||
| const imgurl = require("../../../utils/imgurl"); | const imgurl = require("../../../utils/imgurl"); | ||||
| const QR = require("../../../utils/memberqrcode.js"); | |||||
| Page({ | Page({ | ||||
| // https://formall.oss-accelerate.aliyuncs.com/cimg/wm01.jpg | |||||
| /** | /** | ||||
| * 页面的初始数据 | * 页面的初始数据 | ||||
| */ | */ | ||||
| data: { | data: { | ||||
| navigationBarHeight, | navigationBarHeight, | ||||
| data: {} | |||||
| topLine: imgurl.topLine.url, | |||||
| btomLine: imgurl.btomLine.url, | |||||
| data: {}, | |||||
| showIdFalg: false, | |||||
| code: '', | |||||
| codeS: '', | |||||
| tempFilePath: '', | |||||
| isShowQR: true | |||||
| }, | }, | ||||
| cardDetail(couponOrderId) { | cardDetail(couponOrderId) { | ||||
| @@ -19,7 +27,7 @@ Page({ | |||||
| Http.get({ | Http.get({ | ||||
| url: config.api.cardDetail, | url: config.api.cardDetail, | ||||
| data: { | data: { | ||||
| couponOrderId: couponOrderId | |||||
| couponOrderId: couponOrderId, | |||||
| } | } | ||||
| }) | }) | ||||
| .then(res => { | .then(res => { | ||||
| @@ -29,20 +37,28 @@ Page({ | |||||
| that.setData({ | that.setData({ | ||||
| showPage: true, | showPage: true, | ||||
| data: res.data, | data: res.data, | ||||
| supportTransfer: res.data.supportTransfer | |||||
| supportTransfer: res.data.supportTransfer, | |||||
| code: res.data.id, | |||||
| codeS: res.data.id.slice(0, 4) + `******` + res.data.id.slice(14), | |||||
| }) | }) | ||||
| if (res.data.wxCardInfo.status) { | |||||
| this.setData({ | |||||
| isShowQR: false | |||||
| }) | |||||
| } else { | |||||
| that.getQR(res.data.id, res.data.tenantId) | |||||
| } | |||||
| /** | /** | ||||
| * 若可转赠获取用户头像信息 | * 若可转赠获取用户头像信息 | ||||
| */ | */ | ||||
| if (res.data.supportTransfer) { | |||||
| that.getUserInfo() | |||||
| } | |||||
| if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length <= 4) { | |||||
| if (that.data.merchantVoList && that.data.merchantVoList.length <= 4) { | |||||
| that.setData({ | that.setData({ | ||||
| height: that.data.cardDetail.merchantVoList.length * 140 + 'rpx', | |||||
| height: that.data.merchantVoList.length * 140 + 'rpx', | |||||
| showMore: false | showMore: false | ||||
| }) | }) | ||||
| } else if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length > 4) { | |||||
| } else if (that.data.merchantVoList && that.data.cardDetail.length > 4) { | |||||
| that.setData({ | that.setData({ | ||||
| height: 4 * 140 + 'rpx' | height: 4 * 140 + 'rpx' | ||||
| }) | }) | ||||
| @@ -54,6 +70,124 @@ Page({ | |||||
| }) | }) | ||||
| }, | }, | ||||
| showId() { | |||||
| let this_ = this; | |||||
| if (!this_.data.showIdFalg) { | |||||
| wx.showModal({ | |||||
| content: '是否查看完整券码', | |||||
| success(res) { | |||||
| if (res.confirm) { | |||||
| this_.setData({ | |||||
| showIdFalg: true | |||||
| }) | |||||
| } else if (res.cancel) { | |||||
| console.log('用户点击取消') | |||||
| } | |||||
| } | |||||
| }) | |||||
| } else { | |||||
| this.setData({ | |||||
| showIdFalg: false | |||||
| }) | |||||
| } | |||||
| }, | |||||
| // 获取动态二维码 | |||||
| getQR(cardId, cardTenantId) { | |||||
| Http.get({ | |||||
| url: `/couponOrder/cardDynamicId?cardId=${cardId}&cardTenantId=${cardTenantId}`, | |||||
| }).then(res => { | |||||
| console.log(res.data); | |||||
| this.setData({ | |||||
| expiredSeconds: res.data.expiredSeconds | |||||
| }) | |||||
| let url = JSON.stringify({ | |||||
| END: "C", | |||||
| TYPE: "card", | |||||
| ID: res.data.dynamicRq, | |||||
| TENANTID: res.data.cardTenantId | |||||
| }) | |||||
| this.createQrCode(url, "qrcode", 350, 350); | |||||
| }).catch(err => { | |||||
| wx.showToast({ | |||||
| title: err.message, | |||||
| icon: none | |||||
| }) | |||||
| }) | |||||
| }, | |||||
| goGive() { | |||||
| wx.navigateTo({ | |||||
| url: `/pages/ConsumeDetail/ConsumeDetail?cardId=${this.data.data.id}`, | |||||
| }) | |||||
| }, | |||||
| // 扫一扫去支付 | |||||
| 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)) { | |||||
| let value = JSON.parse(res.result); | |||||
| if (value.END == 'B' && value.TYPE == 'merchant' && value.ID) { | |||||
| Http.get({ | |||||
| url: config.api.findByCode, | |||||
| data: { | |||||
| merchantCode: value.ID, | |||||
| } | |||||
| }) | |||||
| .then(res => { | |||||
| if (res.code == 200) { | |||||
| let merChantDetail = JSON.stringify(res.data); | |||||
| if (merChantDetail && that.data.data.id && that.data.data.remainingamount / 100) { | |||||
| merChantDetail = encodeURIComponent(merChantDetail) | |||||
| wx.navigateTo({ | |||||
| url: `/pages/scanPay/scanPay?merChant=${merChantDetail}&cardid=${that.data.data.id}&remainingAmount=${that.data.data.remainingamount}`, | |||||
| }) | |||||
| } | |||||
| } | |||||
| }) | |||||
| .catch(err => { | |||||
| console.log(err) | |||||
| }) | |||||
| } else { | |||||
| wx.showToast({ | |||||
| title: "未识别到商户二维码", | |||||
| icon: "none", | |||||
| mask: false | |||||
| }) | |||||
| } | |||||
| } else { | |||||
| wx.showToast({ | |||||
| title: "未识别到商户二维码", | |||||
| icon: "none", | |||||
| mask: false | |||||
| }) | |||||
| } | |||||
| }, | |||||
| fail: (res) => { | |||||
| wx.showToast({ | |||||
| title: "未识别到商户二维码", | |||||
| icon: "none", | |||||
| mask: false | |||||
| }) | |||||
| } | |||||
| }) | |||||
| }, | |||||
| createQrCode: function (url, canvasId, cavW, cavH) { | |||||
| console.log('createQrCode!'); | |||||
| //调用插件中的draw方法,绘制二维码图片 | |||||
| let that = this; | |||||
| QR.api.draw(url, canvasId, cavW, cavH, function (res) { | |||||
| that.setData({ | |||||
| tempFilePath: res | |||||
| }) | |||||
| }); | |||||
| }, | |||||
| /** | /** | ||||
| * 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
| */ | */ | ||||
| @@ -10,9 +10,9 @@ | |||||
| <text class="title">{{data.title}}</text> | <text class="title">{{data.title}}</text> | ||||
| <view class="time">{{data.subTitle}}</view> | <view class="time">{{data.subTitle}}</view> | ||||
| <view class="money"> | <view class="money"> | ||||
| <text wx:if="{{data.type == 8&&data.price == data.couponPrice}}">余额:<text style="color: red;">{{data.couponPrice/100}}</text>元</text> | |||||
| <text wx:if="{{data.type == 8&&data.price != data.couponPrice}}">余额:<text style="color: red;">{{data.salePrice/100}}</text>元</text> | |||||
| <text wx:if="{{data.type != 8}}">余额:<text style="color: red;">{{data.couponPrice/100}}</text>元</text> | |||||
| <text wx:if="{{data.type == 8&&data.price == data.couponPrice}}">余额:<text style="color: red;">{{data.remainingAmount/100}}</text>元</text> | |||||
| <text wx:if="{{data.type == 8&&data.price != data.remainingAmount/100}}">余额:<text style="color: red;">{{data.salePrice/100}}</text>元</text> | |||||
| <text wx:if="{{data.type != 8}}">余额:<text style="color: red;">{{data.remainingAmount/100}}</text>元</text> | |||||
| <!-- <del>¥{{data.price/100}}</del> --> | <!-- <del>¥{{data.price/100}}</del> --> | ||||
| <text class="refund" wx:if="{{data.autoRefund == 1}}"> | <text class="refund" wx:if="{{data.autoRefund == 1}}"> | ||||
| <text>过期不退款</text> | <text>过期不退款</text> | ||||
| @@ -20,9 +20,9 @@ | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <view class="timevalidity" wx:if="{{data.validStatus != 0}}"> | |||||
| <view class="timevalidity" wx:if="{{!data.validStatus}}"> | |||||
| <text>有效期至:</text> | <text>有效期至:</text> | ||||
| <text>{{expiredTime}}</text> | |||||
| <text>{{data.expiredTime}}</text> | |||||
| </view> | </view> | ||||
| <view class="timevalidity" wx:if="{{data.validStatus == 0}}"> | <view class="timevalidity" wx:if="{{data.validStatus == 0}}"> | ||||
| <text>有效期:</text> | <text>有效期:</text> | ||||
| @@ -39,14 +39,21 @@ | |||||
| <image wx:if="{{data.couponOrderStatus==2}}" src="{{wm02Url}}" mode='widthFix'></image> | <image wx:if="{{data.couponOrderStatus==2}}" src="{{wm02Url}}" mode='widthFix'></image> | ||||
| <image wx:if="{{data.couponOrderStatus==3}}" src="{{wm03Url}}" mode='widthFix'></image> | <image wx:if="{{data.couponOrderStatus==3}}" src="{{wm03Url}}" mode='widthFix'></image> | ||||
| <image wx:if="{{data.couponOrderStatus==0&&data.validStatus==0}}" src="{{wm04Url}}" mode='widthFix'></image> | <image wx:if="{{data.couponOrderStatus==0&&data.validStatus==0}}" src="{{wm04Url}}" mode='widthFix'></image> | ||||
| <view class="panel" wx:if="{{data.couponOrderStatus==0&&data.validStatus!=0}}"> | |||||
| <view class="panel" wx:if="{{true}}"> | |||||
| <!-- <view class="qrcode"> | <!-- <view class="qrcode"> | ||||
| <canvas canvas-id="qrcode" /> | <canvas canvas-id="qrcode" /> | ||||
| </view> --> | </view> --> | ||||
| <view class="canWrap"> | |||||
| <view class="canWrap" wx:if="{{isShowQR}}"> | |||||
| <canvas canvas-id="qrcode" style="width: 1200rpx; height: 800rpx;" /> | <canvas canvas-id="qrcode" style="width: 1200rpx; height: 800rpx;" /> | ||||
| </view> | </view> | ||||
| <image src="{{tempFilePath}}" mode="aspectFit" /> | |||||
| <image wx:if="{{isShowQR}}" src="{{tempFilePath}}" mode="aspectFit" /> | |||||
| <view class="canWrap" wx:if="{{!isShowQR}}"> | |||||
| <canvas canvas-id="qrcode" style="width: 1200rpx; height: 800rpx;" /> | |||||
| </view> | |||||
| <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="setRq"> | ||||
| <image class="updataRqCode" mode='widthFix' src="{{upDataRqUrlF}}"></image> | <image class="updataRqCode" mode='widthFix' src="{{upDataRqUrlF}}"></image> | ||||
| <view class="upDataRq">点一点刷新二维码</view> | <view class="upDataRq">点一点刷新二维码</view> | ||||
| @@ -87,7 +94,7 @@ | |||||
| <view class='bottom' bindtap='more' wx:if="{{showMore}}">{{more}}</view> --> | <view class='bottom' bindtap='more' wx:if="{{showMore}}">{{more}}</view> --> | ||||
| <image class='line' mode="widthFix" src="{{btomLine}}"></image> | <image class='line' mode="widthFix" src="{{btomLine}}"></image> | ||||
| <view class='note'> | |||||
| <!-- <view class='note'> | |||||
| <view style='height:60rpx;line-height:60rpx;'> | <view style='height:60rpx;line-height:60rpx;'> | ||||
| <text class="shiji">实付金额:</text> | <text class="shiji">实付金额:</text> | ||||
| <text class='moneys'>{{data.couponPrice/100}}</text> | <text class='moneys'>{{data.couponPrice/100}}</text> | ||||
| @@ -113,9 +120,9 @@ | |||||
| <text>订单编号:</text> | <text>订单编号:</text> | ||||
| <text>{{data.orderId}}</text> | <text>{{data.orderId}}</text> | ||||
| </view> | </view> | ||||
| <!-- <view><text>手机号</text><text>2018.05.25</text></view> --> | |||||
| </view> | |||||
| <view class='notes' style="border-bottom:0"> | |||||
| <view><text>手机号</text><text>2018.05.25</text></view> | |||||
| </view> --> | |||||
| <!-- <view class='notes' style="border-bottom:0"> | |||||
| <view> | <view> | ||||
| <text>购买须知</text> | <text>购买须知</text> | ||||
| </view> | </view> | ||||
| @@ -125,11 +132,17 @@ | |||||
| <view wx:if="{{data.contentType==1}}"> | <view wx:if="{{data.contentType==1}}"> | ||||
| <rich-text nodes="{{curHtml}}"></rich-text> | <rich-text nodes="{{curHtml}}"></rich-text> | ||||
| </view> | </view> | ||||
| </view> --> | |||||
| <view class="bottomBtn"> | |||||
| <button class="btn" bindtap="goGive">转送给微信好友</button> | |||||
| <button class="btn" bindtap='gotoPay'>扫一扫付款</button> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <view class='game' bindtap="gotogame" wx-if="{{showIf}}"> | |||||
| <view class='game-entry'> | |||||
| <image src="{{newUrl}}" class='gameimg' mode='widthFix'></image> | |||||
| </view> | |||||
| </view> | |||||
| <view class='game' bindtap="gotogame" wx-if="{{showIf}}"> | |||||
| <view class='game-entry'> | |||||
| <image src="{{newUrl}}" class='gameimg' mode='widthFix'></image> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| @@ -368,4 +368,14 @@ page { | |||||
| height: 40rpx; | height: 40rpx; | ||||
| float: left; | float: left; | ||||
| margin: 20rpx 0 0 20rpx !important; | margin: 20rpx 0 0 20rpx !important; | ||||
| } */ | |||||
| } */ | |||||
| .bottomBtn { | |||||
| padding: 50rpx; | |||||
| } | |||||
| .bottomBtn .btn { | |||||
| color: #fff; | |||||
| font-weight: 600; | |||||
| background-color: #ff7e2d; | |||||
| margin-bottom: 20rpx; | |||||
| } | |||||
| @@ -35,8 +35,11 @@ | |||||
| <text>{{item.title}}</text> | <text>{{item.title}}</text> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <!-- <view hover-class='active' bindtap='gotoPay' data-remainingAmount="{{item.remainingAmount/100}}" data-cardId="{{item.id}}" data-couponorderstatus="{{item.couponOrderStatus}}" wx:if="{{item.couponOrderStatus==4}}" class="btns" style='color:{{item.background}}!important'>扫一扫付款</view> --> | <!-- <view hover-class='active' bindtap='gotoPay' data-remainingAmount="{{item.remainingAmount/100}}" data-cardId="{{item.id}}" data-couponorderstatus="{{item.couponOrderStatus}}" wx:if="{{item.couponOrderStatus==4}}" class="btns" style='color:{{item.background}}!important'>扫一扫付款</view> --> | ||||
| <!-- <view hover-class='active' bindtap='gotoPay' data-remainingAmount="{{item.remainingAmount/100}}" data-cardId="{{item.id}}" data-couponorderstatus="{{item.couponOrderStatus}}" wx:if="{{item.couponOrderStatus==4}}" class="btns">扫一扫付款</view> --> | <!-- <view hover-class='active' bindtap='gotoPay' data-remainingAmount="{{item.remainingAmount/100}}" data-cardId="{{item.id}}" data-couponorderstatus="{{item.couponOrderStatus}}" wx:if="{{item.couponOrderStatus==4}}" class="btns">扫一扫付款</view> --> | ||||
| <view hover-class='active' bindtap='gotoBuy' wx:if="{{item.couponOrderStatus!=4}}" style='color:rgba(179,180,181,1);bottom:20rpx' class="btns clearfix">再次购买</view> | <view hover-class='active' bindtap='gotoBuy' wx:if="{{item.couponOrderStatus!=4}}" style='color:rgba(179,180,181,1);bottom:20rpx' class="btns clearfix">再次购买</view> | ||||
| <text class='txtstatus' wx:if="{{item.couponOrderStatus == 5}}">已过期</text> | <text class='txtstatus' wx:if="{{item.couponOrderStatus == 5}}">已过期</text> | ||||
| <text class='txtstatus' wx:if="{{item.couponOrderStatus == 6}}">余额已用完</text> | <text class='txtstatus' wx:if="{{item.couponOrderStatus == 6}}">余额已用完</text> | ||||
| @@ -147,6 +147,7 @@ Page({ | |||||
| }); | }); | ||||
| }) | }) | ||||
| }, | }, | ||||
| showId() { | showId() { | ||||
| let this_ = this; | let this_ = this; | ||||
| if (!this_.data.showIdFalg) { | if (!this_.data.showIdFalg) { | ||||
| @@ -167,7 +168,6 @@ Page({ | |||||
| showIdFalg: false | showIdFalg: false | ||||
| }) | }) | ||||
| } | } | ||||
| }, | }, | ||||
| onLoad: function (options) { | onLoad: function (options) { | ||||