// pages/product/productDetail/productDetail.js
var util = require('../../../../utils/util.js')
let app = getApp();

Page({
  /**
   * 页面的初始数据
   */
  
  data: {
    year:'',
    month: '',
    day: '',
    hour: '',
    minute: '',
    token:'',
    contactNumber:'',
  },
  onLoad: function (option){
    let contactNumber= option.contactNumber
    this.setData({ contactNumber: contactNumber})
    let Millisecond = new Date().getTime();
    let zong = Millisecond + 72 * 60 * 60 * 1000;
    let time = new Date(zong);
    this.setData({
      year: time.getFullYear(),
      month: time.getMonth() + 1,
      day: time.getDate(),
      hour: time.getHours(),
      minute: time.getMinutes()
    })
    wx.setNavigationBarTitle({
      title: '同业预留占位确认'
    })

  },
  draw:function(){
    // this.data.contactNumber
    app.$api('b2b_post_MiniProgramGetAccountInfoByPhone', { account: this.data.contactNumber, }).then(res => {
      var token = res.token;
      var secretKey = res.secretKey;
      var uid = res.customerId;
      var groupId = res.groupId;

      // wx.reLaunch({
      wx.navigateTo({
        url: '../luckdraw/luckdraw?token=' + token + '&secretKey=' + secretKey + '&uid=' + uid + '&groupId=' + groupId,
      })
    }).catch(err => {

    })
    
  },
  draw_t:function(){
    wx.showToast({
      title: '活动还在筹备中，敬请期待！',
      icon: 'none',
      duration: 2000
    })
  }


})