// packageF/storeManagement/components/baseInfo_popup/distribute_type_pop/distribute_type_pop.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    defaultChecks:{
      type:Array,
      value:[]
    },
    dispatchTypeList:{
      type:Array,
      value:[]
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    show:false,
    checkBoxs: [],
  },

  observers:{
    defaultChecks(newValue){
      this.setData({
        checkBoxs: newValue ? newValue : []
      });
    },
  },
  /**
   * 组件的方法列表
   */
  methods: {
    showPopup(){
      this.setData({
        show:!this.data.show
      });
    },
    changeType(event) {
      this.setData({
        checkBoxs: event.detail,
      });
    },
    toggle(event) {
      const { index } = event.currentTarget.dataset;
      const checkbox = this.selectComponent(`.checkboxes-${index}`);
      checkbox.toggle();
    },
    confirmType () {
      this.showPopup();
      this.triggerEvent("confirmType", this.data.checkBoxs);
    },
  }
});
