| 
							- // pages/spellGroup/mySpellGroup/index.js
 - var config = require("../../../config/config.js");
 - const Http = require("../../../utils/HttpBasics");
 - const imgurl = require("../../../utils/imgurl");
 - const utils = require("../../../utils/util.js")
 - Page({
 - 
 -   /**
 -    * 页面的初始数据
 -    */
 -   data: {
 -     teljpgUrl: imgurl.teljpg.url,
 -     wmhome: imgurl.wmhome.url,
 -     couponChannelId: '',
 -     couponId: '',
 -     data: null,
 -     spellData: null,
 -     canSpell: true,
 -     canBuyIf: true,
 -     clock: "00",
 -     day: "00",
 -     hour: "00",
 -     min: "00",
 -     sec: "00",
 -     showTime: true
 -   },
 - 
 -   /**
 -    * 生命周期函数--监听页面加载
 -    */
 -   onLoad: function (options) {
 -     this.setData({
 -       couponChannelId: options.couponChannelId,
 -       couponId: options.couponId
 -     })
 -     if (options && options.couponChannelId) {
 -       this.getDetail(options.couponChannelId);
 -     }
 -   },
 -   gotoIndex: function () {
 -     wx.switchTab({
 -       url: '/pages/main/index',
 -     })
 -   },
 -   /**
 -    * 拨打电话
 -    */
 -   phone: function (e) {
 -     let that = this;
 -     wx.makePhoneCall({
 -       phoneNumber: e.target.dataset.merchantlinkphone
 -     });
 -   },
 -   /**
 -    * 直接购买
 -    */
 -   gotoBuy(e) {
 -     console.log(22222)
 -     this.setData({
 -       canBuyIf: false
 -     })
 -     wx.navigateTo({
 -       url: '/pages/integralmall/payIntegcoupondetail/index?couponChannelId=' + this.data.couponChannelId + '&couponId=' + this.data.couponId,
 -     })
 -   },
 -   // 时间格式化输出,如11:03 25:19 每1s都会调用一次
 -   dateformat(micro_second) {
 -     // 总秒数
 -     var second = Math.floor(micro_second / 1000);
 -     // 天数
 -     var day = Math.floor(second / 3600 / 24) < 10 ? "0" + Math.floor(second / 3600 / 24) : Math.floor(second / 3600 / 24);
 -     // 小时
 -     var hr = Math.floor(second / 3600 % 24) < 10 ? "0" + Math.floor(second / 3600 % 24) : Math.floor(second / 3600 % 24);
 -     // 分钟
 -     var min = Math.floor(second / 60 % 60) < 10 ? "0" + Math.floor(second / 60 % 60) : Math.floor(second / 60 % 60);
 -     // 秒
 -     var sec = Math.floor(second % 60) < 10 ? "0" + Math.floor(second % 60) : Math.floor(second % 60);
 - 
 -     // return day + "天" + hr + "小时" + min + "分钟" + sec + "秒";
 -     return {
 -       a1: day,
 -       b1: hr,
 -       c1: min,
 -       d1: sec
 -     }
 -   },
 -   /**
 -    * 获取券详情信息
 -    */
 -   getDetail(couponChannelId) {
 -     let that = this;
 -     Http.get({
 -       url: config.api.couponDetail,
 -       data: {
 -         couponChannelId: couponChannelId
 -       }
 -     }).then(res => {
 -       wx.stopPullDownRefresh();
 -       let data = res.data;
 -       data.price = (data.price / 100).toFixed(2)
 -       data.salePrice = (data.salePrice / 100).toFixed(2);
 -       data.validStartDate = utils.formatTime(data.validStartDate, 'yyyy-MM-dd')
 -       data.validEndDate = utils.formatTime(data.validEndDate, 'yyyy-MM-dd')
 -       that.setData({
 -         data
 -       });
 -     });
 -   },
 -   /**
 -    * 生命周期函数--监听页面初次渲染完成
 -    */
 -   onReady: function () {
 - 
 -   },
 - 
 -   /**
 -    * 生命周期函数--监听页面显示
 -    */
 -   onShow: function () {
 -     this.setData({
 -       canSpell: true,
 -       canBuyIf: true,
 -       showTime: true
 -     })
 -   },
 - 
 -   /**
 -    * 生命周期函数--监听页面隐藏
 -    */
 -   onHide: function () {
 -     this.setData({
 -       showTime: false
 -     })
 -   },
 - 
 -   /**
 -    * 生命周期函数--监听页面卸载
 -    */
 -   onUnload: function () {
 -     this.setData({
 -       showTime: false
 -     })
 -   },
 - 
 -   /**
 -    * 页面相关事件处理函数--监听用户下拉动作
 -    */
 -   onPullDownRefresh: function (e) {
 -     let that = this;
 -     that.getDetail(that.data.couponChannelId);
 -   },
 - 
 -   /**
 -    * 页面上拉触底事件的处理函数
 -    */
 -   onReachBottom: function () {
 - 
 -   }
 - })
 
 
  |