<template>
  <div>
    <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="120px" label-position="left">

      <el-card>
        <div class="tit">开票申请</div>

        <el-row :gutter="10">
          <el-col :span="12">
            <el-form-item label="客户名称" prop="field101">
              <el-input v-model="formData.field101" placeholder="点击选择客户" :disabled='true' clearable
                :style="{ width: '100%' }"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开票日期" prop="field102">
              <el-date-picker v-model="formData.field102" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                :style="{ width: '100%' }" placeholder="请选择开票日期" clearable></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同编号" prop="field103">
              <el-input v-model="formData.field103" placeholder="点击选择项目" :disabled='true' clearable
                :style="{ width: '100%' }"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同名称" prop="field104">
              <el-input v-model="formData.field104" :disabled='true' clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同金额" prop="field105">
              <el-input v-model="formData.field105" :disabled='true' clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="期次" prop="field106">
              <el-input v-model="formData.field106" placeholder="请输入期次" clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="累计开票金额" prop="field107">
              <el-input v-model="formData.field107" :disabled='true' clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="累计回款金额" prop="field108">
              <el-input v-model="formData.field108" :disabled='true' clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="税率" prop="field109">
              <el-select v-model="formData.field109" placeholder="请选择税率" clearable :style="{ width: '100%' }">
                <el-option v-for="(item, index) in field109Options" :key="index" :label="item.label" :value="item.value"
                  :disabled="item.disabled"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="发票类型" prop="field110">
              <el-radio-group v-model="formData.field110" size="medium">
                <el-radio v-for="(item, index) in field110Options" :key="index" :label="item.value"
                  :disabled="item.disabled">{{ item.label }}</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开票金额(含税)" prop="field111">
              <el-input v-model="formData.field111" placeholder="请输入开票金额(含税)" clearable
                :style="{ width: '100%' }"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="金额大写" prop="field112">
              <el-input v-model="formData.field112" placeholder="系统自动生成" :disabled='true' clearable
                :style="{ width: '100%' }"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开票金额(税额)" prop="field113">
              <el-input v-model="formData.field113" placeholder="系统自动计算" :disabled='true' clearable
                :style="{ width: '100%' }"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开票金额(非税)" prop="field114">
              <el-input v-model="formData.field114" placeholder="系统自动计算" :disabled='true' clearable
                :style="{ width: '100%' }"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="开票内容" prop="field115">
              <el-input v-model="formData.field115" type="textarea" placeholder="请输入开票内容"
                :autosize="{ minRows: 4, maxRows: 4 }" :style="{ width: '100%' }"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="发票编号" prop="field116">
              <el-input v-model="formData.field116" placeholder="请输入发票编号" clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="备注" prop="field117">
              <el-input v-model="formData.field117" placeholder="请输入备注" clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="23">
            <el-form-item label="附件" prop="field118">
              <el-upload ref="field118" :file-list="field118fileList" :action="field118Action" :auto-upload="false"
                :before-upload="field118BeforeUpload">
                <el-button size="small" type="primary" icon="el-icon-upload">点击上传</el-button>
              </el-upload>
            </el-form-item>
          </el-col>

        </el-row>

      </el-card>

      <el-card>
        <div class="tit">客户开票信息</div>

        <el-row :gutter="10">
          <el-col :span="23">
            <el-form-item label="开票公司名称" prop="field119">
              <el-input v-model="formData.field119" placeholder="请输入开票公司名称" clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="23">
            <el-form-item label="纳税人识别号" prop="field120">
              <el-input v-model="formData.field120" placeholder="请输入纳税人识别号" clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="23">
            <el-form-item label="开户银行" prop="field121">
              <el-input v-model="formData.field121" placeholder="请输入开户银行" clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="23">
            <el-form-item label="账号" prop="field122">
              <el-input v-model="formData.field122" placeholder="请输入账号" clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="23">
            <el-form-item label="开户地址及电话" prop="field123">
              <el-input v-model="formData.field123" placeholder="请输入开户地址及电话" clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>

        </el-row>
      </el-card>


      <el-card>
        <div class="tit">发票邮寄信息</div>



        <el-row :gutter="10">



          <el-col :span="23">
            <el-form-item label="收票地址" prop="field124">
              <el-input v-model="formData.field124" placeholder="请输入收票地址" clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="23">
            <el-form-item label="联系人" prop="field125">
              <el-input v-model="formData.field125" placeholder="请输入联系人" clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="23">
            <el-form-item label="联系电话" prop="field126">
              <el-input v-model="formData.field126" placeholder="请输入联系电话" clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="23">
            <el-form-item label="邮寄时间" prop="field127">
              <el-input v-model="formData.field127" placeholder="请输入邮寄时间" clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="23">
            <el-form-item label="邮寄方式" prop="field128">
              <el-input v-model="formData.field128" placeholder="请输入邮寄方式" clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="23">
            <el-form-item label="邮寄单号" prop="field129">
              <el-input v-model="formData.field129" placeholder="请输入邮寄单号" clearable :style="{ width: '100%' }">
              </el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item size="large">
              <el-button type="primary" @click="submitForm">提交</el-button>
              <el-button @click="resetForm">重置</el-button>
            </el-form-item>
          </el-col>
        </el-row>


      </el-card>


    </el-form>
  </div>
</template>
<script>
export default {
  components: {},
  props: [],
  data() {
    return {
      formData: {
        field101: undefined,
        field102: null,
        field103: undefined,
        field104: undefined,
        field105: undefined,
        field106: undefined,
        field107: undefined,
        field108: undefined,
        field109: undefined,
        field110: undefined,
        field111: undefined,
        field112: undefined,
        field113: undefined,
        field114: undefined,
        field115: undefined,
        field116: undefined,
        field117: undefined,
        field118: null,
        field119: undefined,
        field120: undefined,
        field121: undefined,
        field122: undefined,
        field123: undefined,
        field124: undefined,
        field125: undefined,
        field126: undefined,
        field127: undefined,
        field128: undefined,
        field129: undefined,
      },
      rules: {
        field101: [{
          required: true,
          message: '点击选择客户',
          trigger: 'blur'
        }],
        field102: [],
        field103: [{
          required: true,
          message: '点击选择项目',
          trigger: 'blur'
        }],
        field104: [],
        field105: [],
        field106: [{
          required: true,
          message: '请输入期次',
          trigger: 'blur'
        }],
        field107: [],
        field108: [],
        field109: [],
        field110: [],
        field111: [],
        field112: [],
        field113: [],
        field114: [],
        field115: [],
        field116: [],
        field117: [],
        field119: [],
        field120: [],
        field121: [],
        field122: [],
        field123: [],
        field124: [],
        field125: [],
        field126: [],
        field127: [],
        field128: [],
        field129: [],
      },
      field118Action: 'https://jsonplaceholder.typicode.com/posts/',
      field118fileList: [],
      field109Options: [{
        "label": "选项一",
        "value": 1
      }, {
        "label": "选项二",
        "value": 2
      }],
      field110Options: [{
        "label": "专票",
        "value": 1
      }, {
        "label": "普票",
        "value": 2
      }, {
        "label": "收据",
        "value": 3
      }],
    }
  },
  computed: {},
  watch: {},
  created() { },
  mounted() { },
  methods: {
    submitForm() {
      this.$refs['elForm'].validate(valid => {
        if (!valid) return
        // TODO 提交表单
      })
    },
    resetForm() {
      this.$refs['elForm'].resetFields()
    },
    field118BeforeUpload(file) {
      let isRightSize = file.size / 1024 / 1024 < 2
      if (!isRightSize) {
        this.$message.error('文件大小超过 2MB')
      }
      return isRightSize
    },
    submitUpload() {
      this.$refs['field118'].submit()
    },
  }
}

</script>
<style>
.el-upload__tip {
  line-height: 1.2;
}

.tit {
  font-size: 17px;
  margin-bottom: 10px;
}
</style>
  