const util = require('../../../utils/util.js');
Component({
  properties: {
    show:{
      type: Boolean,
      observer: function (newVal) {
        this.setData({ show: newVal });
        if (this.data.show) {
          this.getPopupContent()
        }
      }
    },
    theam:{
      type: String,
      value:'redContent',
      observer: function (newVal) {
        this.setData({ theam: newVal });
      }
    },
    wheelId:{
      type: String,
      observer: function (newVal) {
        this.setData({ wheelId: newVal });
      }
    }
  },
  data: {
    show:false,
    height:'60%',
    theam:'',
    wheelId:'',
    content:{}
  },
  methods: {
    // 获取弹窗内容
    getPopupContent(){
      let that=this;
      util.ajax({
        func: "v2/market/wheel/info",
        data: {wheelId:that.data.wheelId}
      }, function (res) {
        if (res.code==0) {
          that.setData({content:res.data})
        } else {
          util.showTips(res.reason);
        }
      })
    },
    // 关闭弹窗
    closeTip(e){
      this.colse(e.detail)
    },
    // 确定
    closePopup(){
      this.colse(false)
    },
    colse(data){
      this.triggerEvent("close",{
        status:data,
        type:'rules'
      } );
    }
  }
})