<template>
  <div>
    <div class="container normal-panel normal-margin">
      <slot name="save"></slot>
    </div>
    <div style="overflow-x:hidden">
      <el-row :gutter="16">
        <el-col :span="8">
          <div style="height:110px" class="container normal-panel normal-margin">
            <p class="normal-title normal-margin">分配规则</p>
            <div class="flex-align-center normal-margin">
              <p>自动分配&emsp;</p>
              <el-switch
                v-model="form.autodistribution"
                :active-value="1"
                :inactive-value="0">
              </el-switch>
            </div>
            <p>默认按经销商档案属地省市县分配</p>
          </div>
        </el-col>
        <el-col :span="16">
          <div style="height:110px" class="container normal-panel normal-margin">
            <p class="normal-title normal-margin">到期规则</p>
            <el-row :gutter="20">
              <el-col :span="12">
                <p style="color:#666;font-size:14px" class="normal-margin">未分配到期时间</p>
                <div class="flex-align-center">
                  <p style="width:100px;">设置周期(天)</p>
                  <el-input size="small" placeholder="设置周期(天)" v-model="form.cluelife" style="width:200px"></el-input>
                </div>
              </el-col>
              <el-col :span="12">
                <p style="color:#666;font-size:14px" class="normal-margin">已分配待跟进撤回时间</p>
                <div class="flex-align-center">
                  <p style="width:100px;">设置周期(天)</p>
                  <el-input size="small" placeholder="设置周期(天)" v-model="form.linklife"  style="width:200px"></el-input>
                </div>
              </el-col>
            </el-row>
          </div>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      form:{
        "sat_orderclueruleid":0,
        "autodistribution":true,
        "cluelife":11,
        "linklife":11
      }
    }
  },
  methods:{
    async queryOrdercluerule () {
      const res = await this.$api.requested({
        "classname":"webmanage.saletool.orderclue.ordercluerule",
        "method": "queryOrdercluerule",
        "content": {
        }
      })
      this.form = res.data[0]
    },
    async updateOrderclueruleMain () {
      const res = await this.$api.requested({
        "classname":"webmanage.saletool.orderclue.ordercluerule",
        "method": "updateOrderclueruleMain",
        "content": this.form
      })
      this.tool.showMessage(res,this.queryOrdercluerule)
    }
  },
  mounted () {
    this.queryOrdercluerule()
  }
}

</script>
<style>
</style>