Component({
  mixins: [],
  data: {
    showTop: false,
    buyDescribe: {}
  },
  props: {
    onGetPurchaseInfo: () => []
  },

  didMount() {},

  didUpdate(_, {
    showTop
  }) {
    if (this.data.showTop && showTop !== this.data.showTop) {
      this.getPurchaseInfo();
    }
  },

  didUnmount() {},

  methods: {
    // 获取简介信息
    async getPurchaseInfo() {
      const [err, buyDescribe] = await this.props.onGetPurchaseInfo();
      buyDescribe && this.setData({
        buyDescribe
      });

      if (err) {
        return my.showToast({
          type: 'fail',
          content: err.msg
        });
      }
    },

    openBuyInfo() {
      this.setData({
        showTop: true
      });
    },

    closeBuyInfo() {
      this.setData({
        showTop: false
      });
    }

  }
});