diff --git a/pages/couponorder/detail/index.js b/pages/couponorder/detail/index.js index c98763d..7aa58c4 100644 --- a/pages/couponorder/detail/index.js +++ b/pages/couponorder/detail/index.js @@ -29,25 +29,26 @@ Page({ }, createDate: "", expiredTime: "", - validStartDate:"", - validEndDate:"", + validStartDate: "", + validEndDate: "", updateDate: "", //存储计时器 setInter: "", staticGamedata: {}, showIf: false, curHtml: '', - showhieRq:false, - dynamicRq:"", - expiredSeconds:0, - templTiem:"" + showhieRq: false, + dynamicRq: "", + expiredSeconds: 0, + templTiem: "", + contentType: "" }, - onUnload:function(){ + onUnload: function () { let that = this; clearInterval(that.data.setInter); clearInterval(that.data.templTiem); }, - onHide:function(){ + onHide: function () { let that = this; clearInterval(that.data.setInter); clearInterval(that.data.templTiem); @@ -92,7 +93,7 @@ Page({ // }) // }, 200) // }, - setRq(){ + setRq() { let _this = this _this.setData({ showhieRq: false, @@ -113,10 +114,10 @@ Page({ TYPE: "couponorder", ID: _this.data.dynamicRq }) - if (res.data.expiredSeconds==0){ + if (res.data.expiredSeconds == 0) { + + } else { - }else{ - let inre = setInterval(() => { if (_this.data.expiredSeconds > 1) { _this.setData({ @@ -137,7 +138,7 @@ Page({ } // util.qrcode("qrcode", url, 350, 350); _this.createQrCode(url, "qrcode", 350, 350); - }).catch(err=>{ + }).catch(err => { wx.showToast({ title: err.message, icon: 'none', @@ -176,7 +177,7 @@ Page({ codeS: options.quancode.slice(0, 4) + `******` + options.quancode.slice(14), couponorderstatus: options.couponorderstatus }); - + if ( options.quancode && that.data.couponorderstatus == 0 @@ -185,13 +186,31 @@ Page({ that.setRq()//动态二维码 //这个方法必须在拿到 options.quancode 后调用 that.getHtml(options.quancode); } + + //获取购买须知 + Http.get({ + url: config.api.couponOrderDetail, + data: { + couponOrderId: options.quancode + } + }).then(res => { + console.log(res.data, 'res.data'); + that.setData({ + contentType: res.data.contentType, + data: { + remark: res.data.resmark + } + }); + }).catch(err => { + console.log(err); + }) //获得优惠券的详情 that.data.setInter = setInterval(function () { if ( options.quancode && that.data.couponorderstatus == 0 ) { - + Http.get({ url: config.api.couponOrderDetail, data: { @@ -228,7 +247,7 @@ Page({ pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd hh:mm:ss"), }) } - + }) .catch(err => { wx.showToast({ @@ -240,7 +259,7 @@ Page({ }) } }, 2000); - + /** * 页面需要初始渲染的效果 */ @@ -248,7 +267,7 @@ Page({ url: config.api.couponOrderDetail, data: { couponOrderId: options.quancode - } + } }).then(res => { that.setData({ couponorderstatus: res.data.couponOrderStatus, @@ -259,13 +278,13 @@ Page({ updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"), createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss") }); - if (that.data.data.validStartDate && that.data.data.validEndDate){ + if (that.data.data.validStartDate && that.data.data.validEndDate) { that.setData({ validStartDate: util.formatTime(that.data.data.validStartDate, "yyyy-MM-dd hh:mm:ss"), validEndDate: util.formatTime(that.data.data.validEndDate, "yyyy-MM-dd hh:mm:ss") }) } - + }) .catch(err => { wx.showToast({ @@ -291,13 +310,13 @@ Page({ } }) }, - upDataRq(){ + upDataRq() { console.log(1123) }, createQrCode: function (url, canvasId, cavW, cavH) { //调用插件中的draw方法,绘制二维码图片 let that = this; - QR.api.draw(url, canvasId, cavW, cavH, function (res) { + QR.api.draw(url, canvasId, cavW, cavH, function (res) { that.setData({ tempFilePath: res }) diff --git a/pages/couponorder/detail/index.wxml b/pages/couponorder/detail/index.wxml index 83d119e..45c1ba2 100644 --- a/pages/couponorder/detail/index.wxml +++ b/pages/couponorder/detail/index.wxml @@ -1,6 +1,6 @@ - + @@ -51,20 +51,20 @@ 点一点刷新二维码 - - 二维码在 - {{expiredSeconds}}s - 后失效 - - + + 二维码在 + {{expiredSeconds}}s + 后失效 + + - {{showIdFalg?code:codeS}} - + {{showIdFalg?code:codeS}} + - +