my-card.js 1.02 KB
import {
  getBindtapData
} from '../../utils/util';
let app = getApp();
Page({
  data: {
    prizeInfo: []
  },
  onShareAppMessage() {},
  onLoad(options) {
    this.initData();
  },
  initData() {
    app.post({
      url: app.api.fishPrize,
      data: {}
    }).then((result) => {
      let prizeInfo = result;
      prizeInfo.forEach(element => {
        element.endDateStr = new Date(element.endDate).toString("yy-MM-dd");
      });
      this.setData({
        prizeInfo: prizeInfo
      })
      console.log("prizeInfo:", this.data.prizeInfo);
    })
  },
  /**
   * 显示券的详情
   */
  onShowDetailHandler(evt) {
    let curData = getBindtapData(evt);
    app.globalData.curCoupon = curData;
    app.router.push({
      path: "couponDetail"
    })
    console.log("curData:", curData);
    console.log(JSON.stringify(curData));
  },
  // 子组件事件
  evtcomp(evt) {
    let {
      name,
      data
    } = evt.detail;
    switch (name) {

      case "_evt_hide":
        break;

      default:
        break;
    }
  },
})