<template>
  <div class="app-container">
    <van-nav-bar
      title="修改方案信息"
      fixed
      placeholder
      left-arrow
      @click-left="onClickLeft"
    />
    <div class="main_box">
      <van-cell>
        <template #title>
          <van-icon name="../../../static/images/lawEnforcement/icon/icon_zxfa.png" size="20"></van-icon>
          <span class="custom-title">投诉建议<i class="bgBlue"></i></span>
        </template>
      </van-cell>
      <van-field name="radio" label="是否公开" input-align="right">
        <template #input>
          <van-radio-group v-model="radio" direction="horizontal">
            <van-radio name="1">是</van-radio>
            <van-radio name="2">否</van-radio>
          </van-radio-group>
        </template>
      </van-field>
      <van-field label="方案名称" v-model="form.payee" input-align="right" label-width="auto" placeholder="请输入方案名称"/>
      <van-field
        readonly
        clickable
        name="picker"
        :value="value"
        label="检查开始日期"
        placeholder="点击选择开始日期"
        @click="showPicker = true"
        input-align="right"
        right-icon="calendar-o"
      />
      <van-popup v-model="showPicker" position="bottom">
        <van-datetime-picker
          v-model="showPicker"
          type="date"
          title="选择年月日"
          :min-date="minDate"
          :max-date="maxDate"
        />
      </van-popup>
      <van-field
        readonly
        clickable
        name="picker"
        :value="value"
        label="检查结束日期"
        placeholder="点击选择结束日期"
        @click="showPicker = true"
        input-align="right"
        right-icon="calendar-o"
      />
      <van-popup v-model="showPicker" position="bottom">
        <van-datetime-picker
          v-model="showPicker"
          type="date"
          title="选择年月日"
          :min-date="minDate"
          :max-date="maxDate"
        />
      </van-popup>
      <van-field label="检查方式" v-model="form.payeeAccount" input-align="right" label-width="auto" placeholder="请输入检查方式"/>
      <van-field label="检查部门" v-model="bankType" input-align="right" label-width="auto" placeholder="请输入检查部门"/>
      <van-field label="检查事项" v-model="form.bankDeposit" input-align="right" label-width="auto" placeholder="请输入检查事项"/>
      <van-field label="检查类型" v-model="form.bankDeposit" input-align="right" label-width="auto" placeholder="请输入检查类型"/>
      <van-field label="检察方案描述" v-model="form.bankDeposit" input-align="right" label-width="auto" readonly/>
      <van-field v-model="form.remark" type="textarea" rows="3" label-width="auto" placeholder="请输入检察方案描述"/>
    </div>

    <div class="main_box" style="margin-top: 10px;">
      <van-cell>
        <template #title>
          <van-icon name="../../../static/images/lawEnforcement/icon/icon_zxry.png" size="20"></van-icon>
          <span class="custom-title">执行人员<i class="bgBlue"></i></span>
        </template>
      </van-cell>
      <div class="peopleList">
        <van-row>
          <van-col :span="4">序号</van-col>
          <van-col :span="10">执行人员</van-col>
          <van-col :span="10">执法证号</van-col>
        </van-row>

        <van-row>
          <van-col :span="4">1</van-col>
          <van-col :span="10">张薇</van-col>
          <van-col :span="10">456444666123A0FW</van-col>
        </van-row>

        <van-row>
          <van-col :span="4">2</van-col>
          <van-col :span="10">张薇</van-col>
          <van-col :span="10">456444666123A0FW</van-col>
        </van-row>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "programmeDetail",
    data() {
      return {
        showBankType:false,
        showPayeeType:false,
        showPicker:false,
        form:{},

        bankType:'',
        payeeType:'',
        value:'',

        bankTypeOptions:[],
        payeeTypeOptions:[],
        minDate: new Date(2020, 0, 1),
        maxDate: new Date(2025, 10, 1),
        currentDate: new Date(2021, 0, 17),
      };
    },
    created() {

    },
    methods: {
      getDictionaries(){
        getPayee(this.$route.query.id).then((response) => {
          this.houseGetDicts("bank_type").then((res) => {
            for(var i = 0 ; i < res.data.length ; i++){
              this.bankTypeOptions.push({text:res.data[i].dictLabel,value:res.data[i].dictValue});
            }
            this.bankType = this.selectDictLabel(res.data, response.data.bankType);
          });
          this.houseGetDicts("payee_type").then((res) => {
            for(var i = 0 ; i < res.data.length ; i++){
              this.payeeTypeOptions.push({text:res.data[i].dictLabel,value:res.data[i].dictValue});
            }
            this.payeeType = this.selectDictLabel(res.data, response.data.payeeType);
          });
          this.form = response.data;
        });
      },
      onConfirmBankType(data){
        this.bankType = data.text;
        this.form.bankType = data.value;
        this.showBankType = false;
      },
      onConfirmPayeeType(data){
        this.payeeType = data.text;
        this.form.payeeType = data.value;
        this.showPayeeType = false;
      },
      goAdd(){
        console.log(this.form)
        updatePayee(this.form).then(response => {
          this.$toast.success('修改成功');
          setTimeout(function(){
            history.go(-1)
          },2000)
        });
      },
      goBack(){
        window.history.go(-1)
      }
    },
  }
</script>

<style scoped lang="scss">
  .app-container {
    padding: 2% 0;
  }
  /deep/ .van-radio--horizontal{
    margin-left: 0.32rem;
    margin-right: 0;
  }
  .peopleList{
    padding-right: 3%;
    .van-row{
      margin-bottom: 10PX;
      .van-col{
        text-align: center;
        font-size: 14PX;
      }
      &:first-child{
        .van-col{
          color: #1D6FE9;
        }
      }
    }
  }
  .main_title{
    font-size: 0.4rem;
    color: #1D6FE9;
    margin: 0.2rem 6%;
    margin-top: 0;
    position: relative;
  }
  .main_box{
    width: 96%;
    margin: 0 auto;
    border-radius: 6px;
    box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
    overflow: hidden;
    background-color: #FFF;
    .van-icon{
      vertical-align: middle;
    }
    .custom-title{
      font-size: 17PX;
      color: #333333;
      vertical-align: middle;
      line-height: 1;
      position: relative;
    }
    .tap{
      color: #1D6FE9;
    }
    .bgBlue{
      display: block;
      position: absolute;
      width: 17PX;
      height: 17PX;
      border-radius: 50%;
      background-color: rgba(29,111,233,0.26);
      top: -2PX;
      right: -8PX;
    }
  }
  .submitButton{
    width: 80%;
    margin: 0 auto;
    background-color: #1D6FE9;
  }

  .addFamily{
    position: absolute;
    top: -2px;
    right: 0;
    border-radius: 50%;
  }
</style>
