|  | const util = require("../../../utils/util");
const config = require("../../../config/config.js");
const Http = require("../../../utils/HttpBasics");
//券详情页面
Page({
  data: {
    code: "",
    data: {},
    createDate: "",
    expiredTime: "",
    updateDate: "",
    //存储计时器
    setInter: ""
  },
  onUnload: function () {
    let that = this;
    clearInterval(that.data.setInter);
  },
  onLoad: function (options) {
    console.log(options);
    let that = this;
    that.setData({
      code: options.quancode
    });
    Http.get({
      url: config.api.couponOrderDetail,
      data: {
        couponOrderId: options.quancode
      }
    }).then(res => {
      console.log(res);
      that.setData({
        data: res.data
      });
      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
      });
    })
  },
  phone: function () {
    let that = this;
    console.log(that.data);
    if (that.data.data.merchantLinkPhone) {
      wx.makePhoneCall({
        phoneNumber: that.data.data.merchantLinkPhone
      });
    }
  }
});
 |