const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' const util = require("../../../utils/util"); const config = require("../../../config/config.js"); const Http = require("../../../utils/HttpBasics"); //券详情页面 Page({ data: { navigationBarHeight, data: {}, createDate: "", expiredTime: "", updateDate: "", //存储计时器 setInter: "", showPage:false, curHtml:"", }, onUnload: function () { let that = this; clearInterval(that.data.setInter); }, onHide: function () { let that = this; clearInterval(that.data.setInter); }, onLoad: function (options) { let that = this; console.log(options.quancode) this.getHtml(options.quancode) Http.get({ url: config.api.couponOrderDetail, data: { couponOrderId: options.quancode } }).then(res => { that.setData({ data: res.data, showPage:true }); that.setData({ expiredTime: util.fmtDate(that.data.data.expiredTime), 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") }); // util.barcode("barcode", options.quancode, 510, 100); util.qrcode("qrcode", options.quancode, 350, 350); }) .catch(err => { wx.showToast({ title: err.errMsg, icon: 'none', duration: 2000, mask: false }); }) }, getHtml(couponChannelId) { Http.get({ url: config.api.couponHtmlDetailForPkg, data: { // couponChannelId: '433119630735183872' couponOrderId: couponChannelId } }).then(res => { if (res.code == 200 && res.data.html) { this.setData({ curHtml: decodeURI(res.data.html) }) } }) }, phone: function () { let that = this; if (that.data.data.merchantLinkPhone) { wx.makePhoneCall({ phoneNumber: that.data.data.merchantLinkPhone }); } } });