auction-detail.js 1.35 KB
import {
  getBindtapData
} from '../../utils/util';

let app = getApp();
Page({
  data: {
    authorizeVisible: false,
    productInfo: {},
    navBackTimeout: 0,
  },
  onShareAppMessage() {},
  showAuth() {
    this.setData({
      authorizeVisible: true
    })
  },
  onLoad(options) {
    this.queryAuctionDetail(options.code);
  },
  onShow() {},

  /**
   * 秒杀详情
   */
  queryAuctionDetail(code) {
    let _this = this;
    return new Promise((resolve, reject) => {
      app.post({
        url: app.api.auctionDetail,
        data: {
          auctionCode: code
        }
      }).then((result) => {
        this.setData({
          productInfo: result
        })
        // wx.setNavigationBarTitle({
        //   title: result.auctionName || "拍卖活动"
        // })
        resolve();
      }).catch((err) => {
        clearTimeout(_this.data.navBackTimeout);
        _this.data.navBackTimeout = setTimeout(() => {
          wx.navigateBack({
            delta: 1
          });
        }, 1000);
      });
    })
  },

  // 隐藏蒙层
  hideMask() {
    this.setData({
      authorizeVisible: false,
    })
  },
  // 子组件事件
  evtcomp(evt) {
    let {
      name,
      data
    } = evt.detail;
    switch (name) {

      // 隐藏弹窗
      case "_evt_hide_mask":
        this.hideMask();
        break;

      default:
        break;
    }
  },
})