wish.js 1.71 KB
let app = getApp();
Page({
  data: {
    tipsRuleVisible: false,
    userInfo: {},
    wishInfo: {},
    helperInfo: {}
  },
  onShareAppMessage() {},
  onLoad(options) {
    this.initData();
  },
  initData() {
    app.queryIndex().then((result) => {
      this.setData({
        userInfo: app.globalData.userInfo
      })
      this.queryWishbillDetail();
      this.queryWishbillHelpers();
    })
  },
  // 显示规则页面
  onShowRuleHandler() {
    this.setData({
      tipsRuleVisible: true
    })
  },
  // 显示海报图
  onCreatePosterHandler() {
    app.router.push({
      path: "poster"
    })
  },
  // 查看排行榜
  onRankHandler() {
    app.router.push({
      path: "rank"
    })
  },
  // 分享
  onShareHandler() {

  },
  // 获取心愿单详情
  queryWishbillDetail() {
    return new Promise((resolve, reject) => {
      app.post({
        url: app.api.wishbillDetail,
        data: {
          billCode: app.globalData.indexInfo.wishBillCode
        }
      }).then((result) => {
        this.setData({
          wishInfo: result
        })
      })
    });
  },
  // 获取助力列表
  queryWishbillHelpers() {
    return new Promise((resolve, reject) => {
      app.post({
        url: app.api.wishbillHelpers,
        data: {
          billCode: app.globalData.indexInfo.wishBillCode,
          page: 1,
          size: 50
        }
      }).then((result) => {
        this.setData({
          helperInfo: result
        })
      })
    });
  },
  // 子组件事件
  evtcomp(evt) {
    let {
      name,
      data
    } = evt.detail;
    switch (name) {

      case "_evt_hide_mask":
        this.setData({
          tipsRuleVisible: false
        })
        break;

      default:
        break;
    }
  },
})