<template>
  <div id="release">
    <el-row>
      <el-col :span="24" class="release">
        <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
          <el-tab-pane label="需求发布" name="first">
            <el-col :span="24" class="info">
              <el-form ref="xuqiuForm" :model="xuqiuForm" label-width="100px">
                <el-form-item label="产品名称">
                  <el-input v-model="xuqiuForm.name" placeholder="请输入供需信息名称"></el-input>
                </el-form-item>
                <el-form-item label="产品类别">
                  <el-select v-model="xuqiuForm.type" placeholder="请选择产品类别">
                    <el-option label="类别一" value="type1"></el-option>
                    <el-option label="类别二" value="type2"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="单位/个人">
                  <el-input v-model="xuqiuForm.comPany"></el-input>
                </el-form-item>
                <el-form-item label="产品价格">
                  <el-input v-model="xuqiuForm.jiage"></el-input>
                </el-form-item>
                <el-form-item label="联系电话">
                  <el-input v-model="xuqiuForm.tel"></el-input>
                </el-form-item>
                <el-form-item label="产品图片">
                  <el-upload
                    action="https://jsonplaceholder.typicode.com/posts/"
                    list-type="picture-card"
                    :on-preview="handlePictureCardPreview"
                    :on-remove="handleRemove"
                  >
                    <i class="el-icon-plus"></i>
                    <div class="el-upload__tip" slot="tip">最多上传6张，每最大10M</div>
                  </el-upload>
                </el-form-item>
                <el-form-item label="产品简介">
                  <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 3 }" placeholder="请输入内容" v-model="xuqiuForm.content"></el-input>
                </el-form-item>
                <el-col :span="24" class="btn">
                  <el-button type="primary" @click="onSubmit">发布</el-button>
                </el-col>
              </el-form>
            </el-col>
          </el-tab-pane>
          <el-tab-pane label="供给发布" name="second">
            <el-col :span="24" class="info">
              <el-form ref="gongjiForm" :model="gongjiForm" label-width="100px">
                <el-form-item label="产品名称">
                  <el-input v-model="gongjiForm.name" placeholder="请输入供需信息名称"></el-input>
                </el-form-item>
                <el-form-item label="产品类别">
                  <el-select v-model="gongjiForm.type" placeholder="请选择产品类别">
                    <el-option label="类别一" value="type1"></el-option>
                    <el-option label="类别二" value="type2"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="服务项目">
                  <el-input v-model="gongjiForm.service"></el-input>
                </el-form-item>
                <el-form-item label="服务范围">
                  <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 3 }" placeholder="请输入内容" v-model="gongjiForm.fanwei"></el-input>
                </el-form-item>
                <el-form-item label="产品单价">
                  <el-input v-model="gongjiForm.danjia"></el-input>
                </el-form-item>
                <el-form-item label="交易方式">
                  <el-radio-group v-model="gongjiForm.jiaoyi">
                    <el-radio label="转让"></el-radio>
                    <el-radio label="公用"></el-radio>
                    <el-radio label="竞价"></el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="产品简介">
                  <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 3 }" placeholder="请输入内容" v-model="gongjiForm.content"></el-input>
                </el-form-item>
                <el-col :span="24" class="btn">
                  <el-button type="primary" @click="onSubmit">发布</el-button>
                </el-col>
              </el-form>
            </el-col>
          </el-tab-pane>
          <el-tab-pane label="产品发布" name="third">
            <el-col :span="24" class="info">
              <el-form ref="chanpinForm" :model="chanpinForm" label-width="100px">
                <el-form-item label="产品类别">
                  <el-select v-model="chanpinForm.type" placeholder="请选择产品类别">
                    <el-option label="服务" value="type1"></el-option>
                    <el-option label="产品" value="type2"></el-option>
                    <el-option label="技术" value="type3"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="产品名称">
                  <el-input v-model="gongjiForm.name" placeholder="请输入供需信息名称"></el-input>
                </el-form-item>
                <el-form-item label="产品类型">
                  <el-select v-model="chanpinForm.leixing" placeholder="请选择产品类型">
                    <el-option label="金属治炼" value="type1"></el-option>
                    <el-option label="机械" value="type2"></el-option>
                    <el-option label="能源" value="type3"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="应用领域">
                  <el-input v-model="chanpinForm.lingyu"></el-input>
                </el-form-item>
                <el-form-item label="服务范围">
                  <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 3 }" placeholder="请输入内容" v-model="chanpinForm.fanwei"></el-input>
                </el-form-item>
                <el-row>
                  <el-col :span="12">
                    <el-form-item label="产品单价">
                      <el-input v-model="chanpinForm.danjia"></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="产品单位">
                      <el-select v-model="chanpinForm.danwei">
                        <el-option label="公斤" value="type1"></el-option>
                        <el-option label="套" value="type2"></el-option>
                        <el-option label="件" value="type3"></el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-form-item label="交易方式">
                  <el-radio-group v-model="chanpinForm.jiaoyi">
                    <el-radio label="转让"></el-radio>
                    <el-radio label="公用"></el-radio>
                    <el-radio label="竞价"></el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="产品简介">
                  <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 3 }" placeholder="请输入内容" v-model="chanpinForm.content"></el-input>
                </el-form-item>
                <el-col :span="24" class="btn">
                  <el-button type="primary" @click="onSubmit">发布</el-button>
                </el-col>
              </el-form>
            </el-col>
          </el-tab-pane>
          <el-tab-pane label="定时任务补偿" name="fourth">
            <el-col :span="24" class="info">
              <el-form ref="chanpinForm" :model="chanpinForm" label-width="100px">
                <el-form-item label="产品类别">
                  <el-select v-model="chanpinForm.type" placeholder="请选择产品类别">
                    <el-option label="服务" value="type1"></el-option>
                    <el-option label="产品" value="type2"></el-option>
                    <el-option label="技术" value="type3"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="产品名称">
                  <el-input v-model="gongjiForm.name" placeholder="请输入供需信息名称"></el-input>
                </el-form-item>
                <el-form-item label="产品类型">
                  <el-select v-model="chanpinForm.leixing" placeholder="请选择产品类型">
                    <el-option label="金属治炼" value="type1"></el-option>
                    <el-option label="机械" value="type2"></el-option>
                    <el-option label="能源" value="type3"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="应用领域">
                  <el-input v-model="chanpinForm.lingyu"></el-input>
                </el-form-item>
                <el-form-item label="服务范围">
                  <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 3 }" placeholder="请输入内容" v-model="chanpinForm.fanwei"></el-input>
                </el-form-item>
                <el-row>
                  <el-col :span="12">
                    <el-form-item label="产品单价">
                      <el-input v-model="chanpinForm.danjia"></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="产品单位">
                      <el-select v-model="chanpinForm.danwei">
                        <el-option label="公斤" value="type1"></el-option>
                        <el-option label="套" value="type2"></el-option>
                        <el-option label="件" value="type3"></el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-form-item label="交易方式">
                  <el-radio-group v-model="chanpinForm.jiaoyi">
                    <el-radio label="转让"></el-radio>
                    <el-radio label="公用"></el-radio>
                    <el-radio label="竞价"></el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="产品简介">
                  <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 3 }" placeholder="请输入内容" v-model="chanpinForm.content"></el-input>
                </el-form-item>
                <el-col :span="24" class="btn">
                  <el-button type="primary" @click="onSubmit">发布</el-button>
                </el-col>
              </el-form>
            </el-col>
          </el-tab-pane>
        </el-tabs>
      </el-col>
      <el-dialog :visible.sync="dialogVisible">
        <img width="100%" :src="dialogImageUrl" alt="" />
      </el-dialog>
    </el-row>
  </div>
</template>

<script>
export default {
  name: 'release',
  props: {
    xuqiuForm: null,
    gongjiForm: null,
    chanpinForm: null,
  },
  components: {},
  data: () => ({
    activeName: 'first',
    dialogImageUrl: '',
    dialogVisible: false,
  }),
  created() {},
  computed: {},
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    },
    onSubmit() {
      console.log('submit!');
    },
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
  },
};
</script>

<style lang="less" scoped>
/deep/.el-tabs__item {
  padding: 0 53px;
  font-size: 18px;
  color: #888;
  height: 60px;
  line-height: 60px;
}
/deep/.el-tabs__header {
  margin: 0;
}
/deep/.el-tabs--card > .el-tabs__header {
  border-bottom: 1px solid #215299;
}
/deep/.el-tabs--card > .el-tabs__header .el-tabs__nav {
  border: none;
}
/deep/.el-tabs--top.el-tabs--card > .el-tabs__header .el-tabs__item:nth-child(2) {
  padding-left: 53px;
}
/deep/.el-tabs--top.el-tabs--card > .el-tabs__header .el-tabs__item:last-child {
  padding-right: 53px;
}
/deep/.el-tabs__item.is-active {
  background-color: #215299;
  color: #fff;
}
.info {
  padding: 40px 20px;
}
/deep/.el-form-item__label {
  font-size: 18px;
  color: #888;
}
/deep/.el-textarea__inner {
  height: 94px !important;
}
.btn {
  text-align: center;
  border-top: 1px dashed #ccc;
  padding: 30px 0;
}
/deep/.btn .el-button {
  padding: 12px 50px;
  font-size: 18px;
}
</style>
