<template>
  <div class="dec-modify-content">
    <div class="dec-flex-list middle">
      <span class="d-left">每次加载数量：</span>
      <div class="d-right" style="width: 100px">
        <a-input-number v-model="arg.dataNum" :min="2" :max="30"/>
      </div>
    </div>
    <template v-if="arg.autoLoad && !arg._hide.includes('autoLoad')">
      <div class="dec-flex-list side" style="margin-bottom: 10px">
        <span class="d-left">是否滚到页底后自动加载数据</span>
        <div class="d-right">
          <a-checkbox :checked="arg.autoLoad=='Y'" @change="autoLoadChange" />
        </div>
      </div>
    </template>
    <div class="dec-flex-list side" style="margin-bottom:0;">
      <span class="d-left big">积分商品设定</span>
    </div>
    <div class="dec-border-box">
      <div class="dec-flex-list side">
        <span class="d-left pdl10">商品样式</span>
        <div class="d-right">
          <a-radio-group v-model="arg.listStyle" button-style="solid" size="small">
            <a-radio-button :value="'two'">双图</a-radio-button>
          </a-radio-group>
        </div>
      </div>
      <div class="dec-flex-list side">
        <span class="d-left pdl10">库存显示</span>
        <div class="d-right">
          <a-switch v-model:checked="show.stock" checked-children="开" un-checked-children="关" />
        </div>
      </div>
      <!-- <div class="dec-flex-list side">
        <span class="d-left pdl10">到期时间</span>
        <div class="d-right">
          <a-switch v-model:checked="show.stop" checked-children="开" un-checked-children="关" />
        </div>
      </div> -->
    </div>
    <div style="height:60px"></div>
  </div>
</template>

<script>
export default {
  props: ['tab', 'checked'],
  inject: ['decAxios','judgeAutoLoad'],
  data() {
    return {
      arg: null,
      show: {},
    }
  },
  created() {
    this.arg = this.tab.arg
    this.show = this.arg.show
  },
  methods: {
    buyChange() {
      this.show.bugStyle = this.show.bug ? 'plus' : ''
    },
    bugTxtChange(){
      let str = this.show.bugTxt
      if(str.length > 4){
        this.show.bugTxt = str.substring(0,4)
      }
    },
    autoLoadChange(e){
      const val = e.target.checked
      if(this.judgeAutoLoad(this.tab.id,val)){
        this.arg.autoLoad = val ? 'Y': 'N'
      }else{
        this.arg.autoLoad = 'N'
      }
    }
  }
}
</script>
