// packageA/mycomponent/goodsComponent/zhpGroup/zhplist.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    gooddatas: {
      type: null,
    },
  },
  observers: {
    gooddatas: function (datas) {
      if(datas){
        if (datas.description) {
          let des = datas.description.replace(/<img/g, '<img style="width:100%"');
          this.setData({
            description: des,
          });
        }
      }
      
    },
  },
  /**
   * 组件的初始数据
   */
  data: {
    show: false,
    description: "",
  },

  /**
   * 组件的方法列表
   */
  methods: {
    showTap(e) {
      this.setData({
        show: true,
      });
    },
    showTapClose(e) {
      this.setData({
        show: false,
      });
    },
    goDetail(e) {
      if (e.currentTarget.dataset.key == "exchange") {
        if(this.data.gooddatas.is_pearl == 0){
          wx.showToast({
            title: `该商品您未累计拼中次数，还不能奖励${this.data.gooddatas.love_plugin_name}哦~`,
            icon:'none',
            duration:2500
          });
          return;
        }
        wx.navigateTo({
          url: "/packageI/newGroup/redeem/redeem?id="+this.data.gooddatas.id,
        });
      } else {
        wx.navigateTo({
          url: "/packageI/newGroup/zhpgroupDetail/zhpgroupDetail?id=" + this.data.gooddatas.group_id + "&action=2",
        });
      }
    },
  },
});
