<template>
  <div class="enterprise">
    <div style="margin: 20px; color: #1d18bc" @click="openFile">
      注册指引 》》
    </div>
    <div class="secendPage">
      <ul>
        <li class="titleLi">
          <div>
            <span class="required">*</span>
            企业名称
          </div>
          <input type="text" placeholder="请填写" v-model="company.qymc" />
          <!--  :readonly="!isnew"-->
        </li>
        <li class="titleLi">
          <div>
            <span class="required">*</span>
            统一社会信用代码：
          </div>
          <input type="text" placeholder="请填写" v-model="company.shxydm" />
          <!--  :readonly="!isnew"-->
        </li>
        <li class="titleLi">
          <div>
            <span class="required">*</span>
            入驻类型：
          </div>
          <div>
            <van-radio-group
              style="display: flex"
              v-model="company.settleInType"
            >
              <van-radio name="1">在园</van-radio>
              <van-radio name="2">挂靠</van-radio>
            </van-radio-group>
          </div>
          <!--  :readonly="!isnew"-->
        </li>
        <li class="titleLi">
          <div>注册资金（万元）：</div>
          <input type="text" placeholder="请填写" v-model="company.zczj" />
        </li>
        <li class="titleLi">
          <div>注册时间：</div>
          <input
            type="text"
            placeholder="请选择"
            @click="takeshow"
            readonly
            v-model="company.zcsj"
          />
        </li>
        <li class="titleLi">
          <div>
            <span class="required">*</span>
            法定代表人：
          </div>
          <input type="text" placeholder="请填写" v-model="company.fddbr" />
        </li>
        <li class="titleLi">
          法人电话：
          <input
            type="text"
            placeholder="请填写"
            v-model="company.legalPersonPhone"
          />
        </li>
        <li class="titleLi">
          <div>企业联系人：</div>
          <input type="text" placeholder="请填写" v-model="company.qylxr" />
        </li>
        <li class="titleLi">
          <div>联系人手机：</div>
          <input type="text" placeholder="请填写" v-model="company.lxdh" />
        </li>
        <li class="titleLi">
          <div>联系人邮箱：</div>
          <input type="text" placeholder="请填写" v-model="company.email" />
        </li>
        <li class="titleLi">
          <div>财务负责人：</div>
          <input type="text" placeholder="请填写" v-model="company.cwfzr" />
        </li>
        <li class="titleLi">
          <div>
            <span class="required">*</span>
            负责人电话：
          </div>
          <input type="text" placeholder="请填写" v-model="company.cwfzrdh" />
        </li>

        <li class="titleLi">
          <div>其他联系方式</div>
          <input
            type="text"
            placeholder="请填写"
            v-model="company.otherContact"
          />
        </li>
        <li class="titleLi area-Li" style="min-height: 5vw">
          <div class="rowStyle">
            所属行业
            <van-button type="primary" size="mini" @click="show3 = true"
              >添加</van-button
            >
          </div>
          <div class="rowStyle" v-for="(item, index) in industryList">
            <input
              :key="index"
              v-model="industryList[index]"
              type="textarea"
              placeholder="请填写"
            />
            <div>
              <van-button
                type="danger"
                size="mini"
                @click="deleteIndustryList(index)"
                >删除</van-button
              >
            </div>
          </div>
          <!-- {{ company.industry ? company.industry : "请选择" }} -->
        </li>
        <!-- <li class="titleLi">
          <div>其他联系方式</div>
          <input
            type="text"
            placeholder="请填写"
            v-model="company.otherContact"
          />
        </li> -->
        <li class="titleLi" v-if="industryList.indexOf('工业') != -1">
          <div>
            <!-- <span class="required">*</span> -->

            {{
              industryList.indexOf("工业") != -1
                ? "土地面积（亩）："
                : "租赁面积："
            }}
          </div>
          <input type="text" placeholder="请填写" v-model="company.landArea" />
        </li>

        <li class="titleLi">
          <div>
            <!-- <span class="required">*</span> -->
            股票代码:
          </div>
          <input
            type="text"
            placeholder="请填写"
            v-model="company.shareCertificateCode"
          />
        </li>
        <!--                <li class="titleLi">-->
        <!--                    <div>-->
        <!--                    <span class="required">*</span>-->
        <!--                    入驻时间：-->
        <!--                    </div>-->
        <!--                    <input-->
        <!--                        type="text"-->
        <!--                        placeholder="请选择"-->
        <!--                        readonly-->
        <!--                        @click="takeshow2"-->
        <!--                        v-model="company.rzsj"-->
        <!--                    />-->
        <!--                </li>-->
        <!--                <li class="titleLi">-->
        <!--                    入住载体：-->
        <!--                    <input-->
        <!--                        type="text"-->
        <!--                        placeholder="带出不可改"-->
        <!--                        readonly-->
        <!--                        v-model="company.ssztmc"-->
        <!--                    />-->
        <!--                </li>-->
        <li class="titleLi">
          <div>注册地址：</div>
          <input type="text" placeholder="请填写" v-model="company.zcdz" />
        </li>
        <li class="titleLi">
          <div><span class="required">*</span>经营地址</div>
          <div
            @click="show4 = true"
            style="width: 80%; white-space: normal; height: auto; display: flex"
          >
            {{ company.jydzStr ? company.jydzStr : "请选择" }}
          </div>
        </li>
        <div>
          <textarea
            class="text-area"
            style="padding: 2vw"
            type="textarea"
            placeholder="请填写经营地址说明"
            v-model="company.jydzRemark"
          />
        </div>
        <li class="titleLi area-Li">
          <div class="rowStyle">
            <div><span class="required">*</span> 主营业务：</div>
            <van-button type="primary" size="mini" @click="addJyfw()"
              >添加</van-button
            >
          </div>
          <div class="rowStyle" v-for="(item, index) in company.jyfw">
            <input
              :key="index"
              v-model="company.jyfw[index]"
              type="textarea"
              placeholder="请填写"
            />
            <div>
              <van-button type="danger" size="mini" @click="deleteJyfw(index)"
                >删除</van-button
              >
            </div>
          </div>

          <!-- <textarea
            class="text-area"
            type="text"
            rows="4"
            placeholder="请说明"
            v-model="company.jyfw"
          /> -->
        </li>
        <!-- <li class="titleLi titleLiLast">
                    是否为：
                    <input
                        type="text"
                        placeholder="带出不可改"
                        v-model="company.qylbbq"
                    />
                </li>
                <li class="titleLi titleLiRadio">
                    <van-radio-group v-model="radio">
                        <van-radio name="1" shape="square">高企</van-radio>
                        <van-radio name="2" shape="square">雏鹰</van-radio>
                        <van-radio name="3" shape="square">。。。</van-radio>
                    </van-radio-group>
                </li> -->
        <li class="titleLi titleLiLast">
          <div>
            <span class="required">*</span>
            营业执照副本（限1张）：
          </div>
        </li>
        <li class="titleLi titleLiUploader">
          <van-uploader
            v-model="fileList"
            multiple
            max-count="1"
            :after-read="afterRead"
            :before-delete="beforeDelete"
          >
            <!--                        <img src="@/assets/image/unUpload.png" class="upLoadImg">-->
          </van-uploader>
        </li>
        <li class="titleLi titleLiLast">荣誉信息（限6张）：</li>
        <li class="titleLi area-Li titleLiLast" style="padding: 0; margin: 0">
          <textarea
            class="text-area"
            type="text"
            rows="6"
            placeholder="请说明"
            v-model="company.honorInformation"
            style="margin: 0"
          />
        </li>
        <li class="titleLi titleLiUploader2">
          <van-uploader
            v-model="fileList2"
            multiple
            max-count="6"
            :after-read="afterRead2"
            :before-delete="beforeDelete2"
          />
        </li>
        <li class="titleLi titleLiLast">企业介绍</li>
        <li class="titleLi area-Li titleLiLast" style="padding: 0; margin: 0">
          <textarea
            class="text-area"
            type="text"
            rows="6"
            placeholder="请说明"
            v-model="company.companyIntro"
            style="margin: 0"
          />
        </li>
      </ul>
    </div>

    <div class="secendPage">
      <ul>
        <li class="titleLi" style="color: #1d18bc; font-size: 4.5vw">
          企业标签
        </li>
        <li
          class="titleLi"
          style="
            display: grid;
            grid-template-columns: 1fr 1fr 1fr 1fr;
            height: 20vw;
          "
        >
          <div
            v-for="(item, index) in tagList"
            :key="index"
            :class="index == selectTag ? 'selectTag' : 'myTag'"
            @click="clickTag(item, index)"
          >
            {{ item.name }}
          </div>
        </li>
      </ul>
      <ul>
        <li
          v-for="(item, index) in checkBoxList"
          :key="index"
          style="height: 15vw; flex-direction: column; align-items: flex-start"
        >
          <van-checkbox
            v-model="item.checked"
            shape="square"
            @change="changeCheck(item)"
            >{{ item.name }}</van-checkbox
          >
          <div class="checkBoxContant">{{ item.explain }}</div>
        </li>
      </ul>
    </div>
    <div class="buttonBox" v-show="btnShow">
      <!--            <button class="turnOff" @click="turnOff">关闭</button>-->
      <!-- <button class="turnOff" @click="commit">暂存</button> -->
      <button class="preservation btn2" @click="submit">提交</button>
    </div>
    <div
      v-show="!btnShow"
      style="padding: 5vw 0; color: orangered; text-align: center"
    >
      入库审核中......
    </div>
    <!-- 时间弹框 -->
    <van-popup v-model="show" position="bottom" :style="{ height: '50%' }">
      <van-datetime-picker
        v-model="currentDate"
        type="date"
        title="选择年月日"
        :min-date="minDate"
        :max-date="maxDate"
        @cancel="show = false"
        @confirm="selectTime"
      />
    </van-popup>
    <van-popup v-model="show2" position="bottom" :style="{ height: '50%' }">
      <van-datetime-picker
        v-model="currentDate"
        type="date"
        title="选择年月日"
        :min-date="minDate"
        :max-date="maxDate"
        @cancel="show2 = false"
        @confirm="selectTime2"
      />
    </van-popup>
    <van-popup v-model="show3" position="bottom" :style="{ height: '50%' }">
      <van-picker
        show-toolbar
        :columns="COMPANY_INDUSTRY"
        value-key="label"
        @confirm="getIndustry"
        @cancel="show3 = false"
      />
    </van-popup>
    <van-popup v-model="show4" round position="bottom">
      <van-cascader
        v-model="cascaderValue"
        title="请选择所在地区"
        :options="TreeData7"
        @close="show = false"
        @finish="onFinish"
        :field-names="{ text: 'label', value: 'id', children: 'children' }"
      />
    </van-popup>
  </div>
</template>
<script>
import {
  editInfo,
  info,
  isFinishComInfo,
  getById,
  getTagInfo,
  add,
} from "@/service/api_company";
import {
  getByCodes,
  getTreeData7,
  insert,
  getAreaByIds,
} from "@/service/api_settle_out";
import { upload } from "@/service/api_upload";
import auth from "@/service/auth";
import { Toast } from "vant";
import constant from "@/common/js/constant";
import wx from "weixin-js-sdk";
import myBus from "@/pages/homeItems/myBus";
export default {
  data() {
    return {
      industryList: [],
      isnew: true,
      radio: "1",
      fileList: [],
      dc_key: ["COMPANY_INDUSTRY"],
      show3: false,
      show4: false,
      fileList2: [],
      fileIdList2: [],
      fileIdList3: [],
      fileIdList4: [],
      fileIdList5: [],
      fileList3: [],
      fileList4: [],
      frsfzzm: "",
      frsfzfm: "",
      selectTag: 0,
      tagList: [
        // { name: '通用属性' },
        // { name: '商务属性' },
        // { name: '科技属性' },
        // { name: '规模属性' },
        // { name: '人才属性' },
        // { name: '其他属性' }
      ],
      checkBoxList: [
        // { name: '集成电路', checked: false, contant: '标签说明处理说明梳理说明处理说明处理说明梳理说明处理说明处理说明梳理说明处理说明处理说… ' },
        // { name: '集成电路', checked: false, contant: '标签说明处理说明梳理说明处理说明处理说明梳理说明处理说明处理说明梳理说明处理说明处理说… ' },
        // { name: '集成电路', checked: false, contant: '标签说明处理说明梳理说明处理说明处理说明梳理说明处理说明处理说明梳理说明处理说明处理说… ' },
        // { name: '集成电路', checked: false, contant: '标签说明处理说明梳理说明处理说明处理说明梳理说明处理说明处理说明梳理说明处理说明处理说… ' }
      ],
      company: {
        settleInType: "1",
        id: auth.currUser().id,
        qymc: auth.currUser().qymc,
        shxydm: "",
        zcsj: "",
        zczj: "",
        fddbr: "",
        jyfw: [],
        qylxr: "",
        lxdh: "",
        rzsj: "",
        ssztmc: "",
        qylbbq: "",
        yyzzfbzp: "",
        ryxxzp: "",
        legalPersonPhone: "",
        email: "",
        cwfzr: "",
        cwfzrdh: "",
        zcdz: "",
        jydz: "",
        honorInformation: "",
        rdInvestment: "",
        jgInvestment: "",
        fourOpennessAmount: "",
        fourConsultAmount: "",
        fourServiceAmount: "",
        fourTransferenceAmount: "",
        qybq: "",
      },
      company2: {
        id: auth.currUser().id,
        qymc: auth.currUser().qymc,
        shxydm: "",
        zcsj: "",
        zczj: "",
        fddbr: "",
        jyfw: "",
        qylxr: "",
        lxdh: "",
        rzsj: "",
        ssztmc: "123",
        qylbbq: "",
        yyzzfbzp: "",
        ryxxzp: "",
        legalPersonPhone: "",
        email: "",
        cwfzr: "",
        cwfzrdh: "",
        zcdz: "",
        jydz: "",
        honorInformation: "",
      },
      show: false,
      show2: false,
      minDate: new Date(1980, 0, 1),
      maxDate: new Date(2025, 10, 1),
      currentDate: new Date(),
      selectTagId: "",
      btnShow: true,
      qybqList: [],
      COMPANY_INDUSTRY: [],
      TreeData7: [],
    };
  },
  mounted() {
    window.localStorage.clear();
    this.getCodes();
    console.log(auth.currUser());
    // this.getInfo()
    // this.getCommit();
    this.getTagList();
    this.getTreeData7();
  },
  methods: {
    openFile() {
      try {
        let url = `https://hswkxc.idea-sf.com/fileService/企业注册.pdf`;
        var ua = navigator.userAgent.toLowerCase();
        if (ua.indexOf("iphone") !== -1 || ua.indexOf("ipad") !== -1) {
          console.log("iphone");
          window.location.href = url + "?time=" + new Date().getTime();
        } else {
          console.log("111");
          wx.miniProgram.navigateTo({
            // url: item.url,
            url:
              "/pages/downloadfile/index?callBackUrl=" +
              encodeURIComponent(window.location.href.split("#")[0]) +
              "&url=" +
              url,
          });
        }
      } catch (error) {
        console.log("error", error);
      }
    },
    async onFinish(e) {
      console.log(e.selectedOptions[e.tabIndex]);
      this.company.jydzStr = "";
      for (let i = 0; i < e.selectedOptions.length; i++) {
        console.log(e.selectedOptions.length, i + 1);
        if (i + 1 != e.selectedOptions.length) {
          this.company.jydzStr += e.selectedOptions[i].label + "/";
        } else {
          this.company.jydzStr += e.selectedOptions[i].label;
        }
      }
      let data = await getAreaByIds({
        ids: e.selectedOptions[e.tabIndex].value,
      });
      console.log(data);
      this.company.jydzStr += `；${data}㎡`;
      console.log(data);
      this.company.jydz = e.selectedOptions[e.tabIndex].value;
      this.show4 = false;
      // company.jydzStr
      console.log(e);
    },
    async getTreeData7() {
      const { data } = await getTreeData7();
      this.TreeData7 = data;

      console.log("getTreeData7", data);
    },
    getIndustry(e) {
      console.log(e);
      this.industryList.push(e.label);
      this.show3 = false;
    },
    takeshow() {
      if (this.isnew) {
        this.show = true;
      }
    },
    takeshow2() {
      if (this.isnew) {
        // console.log(123)
        this.show2 = true;
      }
    },
    getCodes() {
      getByCodes({ codes: JSON.stringify(this.dc_key) }).then((res) => {
        console.log(JSON.parse(res.COMPANY_INDUSTRY.dictValue));
        this.COMPANY_INDUSTRY = JSON.parse(res.COMPANY_INDUSTRY.dictValue);
      });
    },
    turnOff() {
      this.$router.push("/home/home");
    },
    addJyfw() {
      console.log(this.company);
      this.company.jyfw.push("");
    },
    deleteJyfw(i) {
      this.company.jyfw.splice(i, 1);
    },
    deleteIndustryList(i) {
      this.industryList.splice(i, 1);
    },
    getInfo() {
      getById({ id: auth.currUser().id })
        .then((res) => {
          console.log("res", res);
          console.log(
            `res.data.industry.split(",")`,
            res.data.industry.split(",")
          );
          if (res && res.key == 200) {
            this.company = res.data ? res.data : {};
            this.company.jyfw = res.data.jyfw.split(",");
            this.qybqList = this.company.qybq.split(",");

            this.getTagList();
            if (res.data.yyzzfbzp) {
              const a = res.data.yyzzfbzp.split(",");
              this.fileList.push(
                JSON.parse(
                  '{"url":"' +
                    constant.BASE_URI +
                    "/wx/fileController/download/" +
                    a +
                    '","isImage": true}'
                )
              );
            }
            if (res.data.ryxxzp) {
              this.fileIdList2 = res.data.ryxxzp.split(",");
              // console.log(this.fileIdList2);
              this.fileIdList2.forEach((item) => {
                this.fileList2.push(
                  JSON.parse(
                    '{"url":"' +
                      constant.BASE_URI +
                      "/wx/fileController/download/" +
                      item +
                      '","isImage": true}'
                  )
                );
              });
            }
            if (res.data.frsfzh) {
              this.fileIdList5 = res.data.frsfzh.split(",");
              this.frsfzzm = this.fileIdList5[0];
              this.fileList3.push(
                JSON.parse(
                  '{"url":"' +
                    constant.BASE_URI +
                    "/wx/fileController/download/" +
                    this.frsfzzm +
                    '","isImage": true}'
                )
              );
              if (this.fileIdList5.length > 1) {
                this.frsfzfm = this.fileIdList5[1];
                this.fileList4.push(
                  JSON.parse(
                    '{"url":"' +
                      constant.BASE_URI +
                      "/wx/fileController/download/" +
                      this.frsfzfm +
                      '","isImage": true}'
                  )
                );
              }
            }
          } else if (res.key == 426) {
            Toast(res.msg);
            this.$router.push("/login");
          } else {
            Toast(res.msg);
          }
          if (this.company.shxydm && this.company.rzsj) {
            this.isnew = false;
          }
        })
        .then(() => {
          isFinishComInfo({ comId: auth.currUser().id }).then((res) => {
            if (res.errno === 0) {
              this.btnShow = false;
            } else if (res.errno === -1) {
              this.btnShow = true;
            }
          });
        });
    },
    // 获取企业标签信息
    getTagList() {
      getTagInfo().then((res) => {
        this.tagList = res.data;
        this.checkBoxList = res.data[0].children;
        this.checkBoxList.forEach((item) => {
          if (this.qybqList.findIndex((e) => e == item.id) !== -1) {
            item.checked = true;
          }
        });
      });
    },
    clickTag(item, index) {
      this.selectTag = index;
      this.selectTagId = item.id;
      this.tagList.forEach((item) => {
        if (this.selectTagId == item.id) {
          this.checkBoxList = item.children;
        }
      });
      this.checkBoxList.forEach((item) => {
        if (
          this.company.qybq.split(",").findIndex((e) => e == item.id) !== -1
        ) {
          item.checked = true;
        }
      });
    },
    changeCheck(item) {
      console.log(this.qybqList);
      if (item.checked == true) {
        if (this.qybqList.findIndex((e) => e == item.id) == -1) {
          this.qybqList.push(item.id);
        }
      } else {
        const i = this.qybqList.findIndex((e) => e == item.id);
        if (i !== -1) {
          this.qybqList.splice(i, 1);
        }
      }
      this.$nextTick(() => {
        this.company.qybq = this.qybqList.toString();
        console.log(this.company.qybq);
      });
    },
    getCommit() {
      const local = localStorage.getItem("company" + auth.currUser().id);
      if (local) {
        this.company = JSON.parse(local);
        this.qybqList = this.company.qybq.split(",");
        this.getTagList();
        if (this.company.yyzzfbzp) {
          const a = this.company.yyzzfbzp.split(",");
          console.log(this.company.yyzzfbzp);
          this.fileList.push(
            JSON.parse(
              '{"url":"' +
                constant.BASE_URI +
                "/wx/fileController/download/" +
                a +
                '","isImage": true}'
            )
          );
        }
        if (this.company.ryxxzp) {
          this.fileIdList2 = this.company.ryxxzp.split(",");
          // console.log(this.fileIdList2);
          this.fileIdList2.forEach((item) => {
            this.fileList2.push(
              JSON.parse(
                '{"url":"' +
                  constant.BASE_URI +
                  "/wx/fileController/download/" +
                  item +
                  '","isImage": true}'
              )
            );
          });
        }
        if (this.company.frsfzh) {
          this.fileIdList5 = this.company.frsfzh.split(",");
          this.frsfzzm = this.fileIdList5[0];
          this.fileList3.push(
            JSON.parse(
              '{"url":"' +
                constant.BASE_URI +
                "/wx/fileController/download/" +
                this.frsfzzm +
                '","isImage": true}'
            )
          );
          if (this.fileIdList5.length > 1) {
            this.frsfzfm = this.fileIdList5[1];
            this.fileList4.push(
              JSON.parse(
                '{"url":"' +
                  constant.BASE_URI +
                  "/wx/fileController/download/" +
                  this.frsfzfm +
                  '","isImage": true}'
              )
            );
          }
        }
      } else {
        this.getInfo();
      }
    },
    // 暂存本地
    commit() {
      this.company.frsfzh = this.frsfzzm + "," + this.frsfzfm;
      this.company.czrid = auth.currUser().id;
      this.company.czr = auth.currUser().qymc;
      this.$delete(this.company, "czsj");
      localStorage.setItem(
        "company" + auth.currUser().id,
        JSON.stringify(this.company)
      );
      this.$nextTick(() => {
        const local = localStorage.getItem("company" + auth.currUser().id);
        if (local) {
          Toast("暂存成功");
        } else {
          Toast("暂存失败");
        }
      });
    },
    // 提交
    submit() {
      // console.log(this.company.frsfzh)

      if (!this.company.qymc) {
        Toast("请填写企业名称");
      } else if (!this.company.settleInType) {
        Toast("请填写选择入驻类型");
      } else if (!this.company.settleInType || this.company.jyfw.length == 0) {
        Toast("请填写选择主营业务");
      } else if (!this.company.jydzStr) {
        Toast("请填写选择经营地址");
      } else if (!this.company.shxydm) {
        Toast("请填写统一社会信用代码");
      } else if (!this.company.fddbr) {
        Toast("请填写法定代表人");
      } else if (!this.company.cwfzrdh) {
        Toast("请填写财务负责人电话");
      } else if (!this.fileList || this.fileList.length == 0) {
        Toast("请上传营业执照副本");
      } else {
        this.company.industry =
          this.industryList.length > 0 ? this.industryList.join(",") : "";
        this.company.frsfzh = this.frsfzzm + "," + this.frsfzfm;
        // this.company.czrid = auth.currUser().id;
        // this.company.czr = auth.currUser().qymc;
        const jyfw = this.company.jyfw.join(",");
        // console.log(jyfw);
        // console.log({ ...this.company, jyfw: jyfw });
        // return;
        this.$delete(this.company, "czsj");
        this.$delete(this.company, "gxsj");
        insert({ ...this.company, jyfw: jyfw }).then((res) => {
          if (res.key == 200) {
            Toast("提交成功");
            // this.btnShow = false;
            this.$router.replace("/login");
            // localStorage.removeItem("company" + auth.currUser().id);
          } else {
            Toast(res.msg);
          }
        });
      }
    },
    selectTime(e) {
      const dayjs = require("dayjs");
      this.company.zcsj = dayjs(e).format("YYYY-MM-DD");
      this.show = false;
    },
    selectTime2(e) {
      const dayjs = require("dayjs");
      this.company.rzsj = dayjs(e).format("YYYY-MM-DD");
      this.show2 = false;
    },
    afterRead(file) {
      Toast.loading({
        message: "上传中...",
        forbidClick: true,
        duration: 0,
      });
      if (file instanceof Array) {
        file.map((v) => {
          this.uploadImg(v);
        });
      } else {
        this.uploadImg(file);
      }
    },
    afterRead2(file) {
      Toast.loading({
        message: "上传中...",
        forbidClick: true,
        duration: 0,
      });
      if (file instanceof Array) {
        file.map((v) => {
          this.uploadImg2(v);
        });
      } else {
        this.uploadImg2(file);
      }
    },
    afterRead3(file) {
      Toast.loading({
        message: "上传中...",
        forbidClick: true,
        duration: 0,
      });
      if (file instanceof Array) {
        file.map((v) => {
          this.uploadImg3(v);
        });
      } else {
        this.uploadImg3(file);
      }
    },
    afterRead4(file) {
      Toast.loading({
        message: "上传中...",
        forbidClick: true,
        duration: 0,
      });
      if (file instanceof Array) {
        file.map((v) => {
          this.uploadImg4(v);
        });
      } else {
        this.uploadImg4(file);
      }
    },
    beforeDelete(file, detail) {
      const vm = this;
      // name.index代表图片的索引
      vm.company.yyzzfbzp = "";
      this.fileList = [];
    },
    beforeDelete2(file, detail) {
      const vm = this;
      // name.index代表图片的索引
      vm.fileIdList2.splice(detail.index, 1);
      vm.company.ryxxzp = vm.fileIdList2.toString();
      console.log(vm.company.ryxxzp);
      return (file, name) => {
        const fileIndex = name.index;
        vm.fileIdList2[detail.index].splice(fileIndex, 1);
      };
    },
    beforeDelete3(file, detail) {
      const vm = this;
      // name.index代表图片的索引
      vm.frsfzzm = "";
      this.fileList3 = [];
      this.fileIdList3 = [];
    },
    beforeDelete4(file, detail) {
      const vm = this;
      // name.index代表图片的索引
      vm.frsfzfm = "";
      this.fileList4 = [];
      this.fileIdList4 = [];
    },
    uploadImg(file) {
      const _this = this;
      const formParam = new FormData(); // 创建form对象
      formParam.append("file", file.file); // 通过append向form对象添加数据
      const config = {
        headers: {
          "Content-Type": "multipart/form-data",
          "MVVM-Key": String(new Date().getTime()),
          xx: "anything",
        }, // 这里是重点，需要和后台沟通好请求头，Content-Type不一定是这个值
      }; // 添加请求头
      return new Promise((resolve, reject) => {
        // axios.post('http://121.228.7.226:9001/wx/fileController/upload', formParam, config)
        upload(formParam, config)
          .then((response) => {
            if (response.data.length) {
              _this.company.yyzzfbzp = response.data[0];
            }
            Toast.clear();
          })
          .catch((err, x) => {
            reject(err, x);
          });
      });
    },
    uploadImg2(file) {
      const _this = this;
      const formParam = new FormData(); // 创建form对象
      formParam.append("file", file.file); // 通过append向form对象添加数据
      const config = {
        headers: {
          "Content-Type": "multipart/form-data",
          "MVVM-Key": String(new Date().getTime()),
          xx: "anything",
        }, // 这里是重点，需要和后台沟通好请求头，Content-Type不一定是这个值
      }; // 添加请求头
      return new Promise((resolve, reject) => {
        // axios.post('http://121.228.7.226:9001/wx/fileController/upload', formParam, config)
        upload(formParam, config)
          .then((response) => {
            if (response.data.length) {
              response.data.forEach((element) => {
                _this.fileIdList2.push(element);
              });
              _this.company.ryxxzp = _this.fileIdList2.toString();
              // console.log(_this.company.ryxxzp);
            }
            Toast.clear();
          })
          .catch((err, x) => {
            reject(err, x);
          });
      });
    },
    uploadImg3(file) {
      const _this = this;
      const formParam = new FormData(); // 创建form对象
      formParam.append("file", file.file); // 通过append向form对象添加数据
      const config = {
        headers: {
          "Content-Type": "multipart/form-data",
          "MVVM-Key": String(new Date().getTime()),
          xx: "anything",
        }, // 这里是重点，需要和后台沟通好请求头，Content-Type不一定是这个值
      }; // 添加请求头
      return new Promise((resolve, reject) => {
        // axios.post('http://121.228.7.226:9001/wx/fileController/upload', formParam, config)
        upload(formParam, config)
          .then((response) => {
            if (response.data.length) {
              response.data.forEach((element) => {
                _this.fileIdList3.push(element);
              });
              _this.frsfzzm = _this.fileIdList3.toString();
            }
            Toast.clear();
          })
          .catch((err, x) => {
            reject(err, x);
          });
      });
    },
    uploadImg4(file) {
      const _this = this;
      const formParam = new FormData(); // 创建form对象
      formParam.append("file", file.file); // 通过append向form对象添加数据
      const config = {
        headers: {
          "Content-Type": "multipart/form-data",
          "MVVM-Key": String(new Date().getTime()),
          xx: "anything",
        }, // 这里是重点，需要和后台沟通好请求头，Content-Type不一定是这个值
      }; // 添加请求头
      return new Promise((resolve, reject) => {
        // axios.post('http://121.228.7.226:9001/wx/fileController/upload', formParam, config)
        upload(formParam, config)
          .then((response) => {
            if (response.data.length) {
              response.data.forEach((element) => {
                _this.fileIdList4.push(element);
              });
              _this.frsfzfm = _this.fileIdList4.toString();
            }
            Toast.clear();
          })
          .catch((err, x) => {
            reject(err, x);
          });
      });
    },
  },
};
</script>
<style lang="scss">
.enterprise {
  font-size: 4vw;
  .text-area {
    background: #f9f9f9;
    width: 95%;
    margin-top: 2vw;
    resize: none;
    &::placeholder {
      color: #aaaaaa;
    }
  }
  margin: 5vw 2vw;
  .firstPage {
    background: white;
    padding: 3vw 3vw 3vw 3vw;
    margin-top: 5vw;
    border-radius: 15px;
    .title {
      height: 10vw;
      // display: inline-flex;
      align-items: center;
      border-bottom: 1px solid rgb(243, 236, 236);
      margin-bottom: 3vw;
    }
    .titMsg {
      text-indent: 8vw;
      line-height: 6vw;
    }
    .impotTips {
      color: rgb(0, 47, 167);
    }
    .comName {
      white-space: nowrap;
    }
    input {
      width: 80%;
    }
    li {
      display: flex;
      align-items: center;
      min-height: 10vw;
      padding: 5vw 0;
      border-bottom: 1px solid rgb(243, 236, 236);
    }
  }
  .secendPage {
    background: white;
    padding: 3vw 3vw 3vw 3vw;
    margin-top: 5vw;
    border-radius: 15px;
    li {
      display: flex;
      align-items: center;
      justify-content: space-between;
      min-height: 10vw;
      padding: 3vw 0;
      border-bottom: 1px solid rgb(243, 236, 236);
    }
    .titleLi {
      font-size: 3.5vw;
      //font-weight: 700;
      white-space: nowrap;
      color: #333333;
      .required {
        color: red;
      }
      .van-uploader {
        padding: 3vw 0;
      }
    }
    .titleLiRadio {
      .van-radio-group {
        display: flex;
        width: 100%;
        justify-content: space-evenly;
      }
    }
    .titleLiLast {
      border-bottom: none;
      padding-bottom: 0;
    }
    .titleLiUploader {
      padding: 10vw 0;
    }
    .titleLiUploader2 {
      padding: 8vw 0;
    }
    .van-uploader {
      padding: 10vw 0;
    }
    input {
      padding: 15px 0 15px 20px;
      width: 86%;
    }
    textarea {
      padding: 15px 0 15px 20px;
    }
  }

  .buttonBox {
    //background: white;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    margin-top: 3vw;
    margin-bottom: 0;
    padding: 5vw 0;
    button {
      padding: 2vw 10vw;
      border-radius: 15px;
    }
    .turnOff {
      background: white;
      border: 1px solid rgb(0, 47, 167);
      color: rgb(0, 47, 167);
    }
    .btn2 {
      background-color: rgb(0, 47, 167);
      color: white;
      border: white solid 1px;
    }
  }
  input::placeholder {
    color: #777777;
  }
  .area-Li {
    height: auto !important;
    flex-direction: column;
    align-items: flex-start !important;
    .rowStyle {
      display: flex;
      align-items: center;

      justify-content: space-between;
      width: 100%;
    }
    .text-area {
      background: #f9f9f9;
      width: 95%;
      margin-top: 2vw;
      resize: none;
      &::placeholder {
        color: #aaaaaa;
      }
    }
  }
  .upLoadImg {
    width: 10vw;
  }
  .sfzImg {
    width: 18vw;
    margin: 0vw 2vw 2vw 2vw;
  }
  .myTag {
    width: 20vw;
    height: 7vw;
    display: flex;
    font-size: 3.5vw;
    font-weight: 400;
    justify-content: center;
    align-items: center;
    color: #777777;
    border: 1px solid rgba(204, 204, 204, 0.51);
    border-radius: 5px;
    margin: 1vw 0;
    box-sizing: border-box;
  }
  .selectTag {
    width: 20vw;
    height: 7vw;
    display: flex;
    font-size: 3.5vw;
    font-weight: 400;
    justify-content: center;
    align-items: center;
    color: #1d18bc;
    background: rgba(29, 24, 188, 0.05);
    border-radius: 5px;
    margin: 1vw 0;
  }
  .checkBoxContant {
    font-size: 3.5vw;
    color: rgba(119, 119, 119, 1);
    line-height: 5vw;
    padding-left: 8vw;
  }
}
</style>
