<template>
  <view class="door-page">
    <van-tabs :active="activeTab" @change="onChange">
      <block v-for="(item, index) in tabs" :key="index">
        <van-tab :title="item"></van-tab>
      </block>
    </van-tabs>
    <!-- <view
      v-if="activeTab === 0 && showEditBtn"
      style="text-align: right; margin-top: 5px; margin-right: 15px"
    >
      <button
        class="edit-btn"
        type="primary"
        size="mini"
        @click="editDoorplate"
      >
        {{ !isEdit ? "编辑" : "取消" }}
      </button>
    </view> -->
    <!-- 企业 -->
    <view
      v-if="
        activeTab === 0 &&
        doorInfo.baseInfo.type !== DOOR_TYPE.HOUSE.VALUE &&
        doorInfo.ownerCorpInfo &&
        !showEditBtn
      "
      class="company-base"
    >
      <view class="company-name">
        {{ doorInfo.ownerCorpInfo.qc }}
      </view>
      <view class="company-status">
        <view class="company-status__label">工商状态：</view>
        <view class="company-status__value">{{
          doorInfo.ownerCorpInfo.gszt
        }}</view>
      </view>
      <view class="info-list">
        <view class="info-item">
          <view class="legal"> 法定代表人 </view>
          <view class="legal-value">
            {{ doorInfo.ownerCorpInfo.fddbrxm }}
          </view>
        </view>
        <view class="info-item">
          <view class="money"> 注册资本 </view>
          <view class="money-value">
            {{ doorInfo.ownerCorpInfo.zczb }}
          </view>
        </view>
        <view class="info-item">
          <view class="found-date"> 成立日期 </view>
          <view class="found-value">
            {{ doorInfo.ownerCorpInfo.clrq }}
          </view>
        </view>
      </view>
    </view>
    <!-- 企业或个人基本信息 -->
    <view class="base-info" v-if="activeTab === 0">
      <view class="header">
        <view class="header-title">
          <image src="/static/images/common/icon_desc.png"></image>
          <view class="title">门牌信息</view>
        </view>

        <view class="" v-if="!showEditBtn">{{
          doorInfo.baseInfo.type === DOOR_TYPE.HOUSE.VALUE ? "个人" : "企业"
        }}</view>
      </view>
      <view class="house-info">
        <!--旧代码,现在改为优化的代码-->
        <!--<view class="list">-->
        <!--  <text class="label">房屋编码</text>-->
        <!--  <text class="value">{{-->
        <!--    $parseStrEmpty(doorInfo.baseInfo.doorplateCode)-->
        <!--  }}</text>-->
        <!--</view>-->
        <!--<view class="list">-->
        <!--  <text class="label">标准地址</text>-->
        <!--  <text class="value">{{-->
        <!--    $parseStrEmpty(doorInfo.baseInfo.bzdz1)-->
        <!--  }}</text>-->
        <!--</view>-->
        <!--<view class="list">-->
        <!--  <text class="label">所属辖区</text>-->
        <!--  <text class="value">{{-->
        <!--    $parseStrEmpty(doorInfo.baseInfo.ssqh)-->
        <!--  }}</text>-->
        <!--</view>-->
        <!--门牌简称-->
        <view class="list">
          <text class="label">门牌简称</text>
          <text class="value">{{getDoorplateName(doorDetailsNew.doorplateName)}}</text>
        </view>
        <!--标准地址-->
        <view class="list">
          <text class="label">标准地址</text>
          <text class="value">{{doorDetailsNew.houseNumberAddress}}</text>
        </view>
        <!--所属辖区-->
        <view class="list">
          <text class="label">所属辖区</text>
          <text class="value">{{doorDetailsNew.streetName}}</text>
        </view>
        <!--所属社区-->
        <view class="list">
          <text class="label">所属社区</text>
          <text class="value">{{doorDetailsNew.communityName}}</text>
        </view>
        <!--门址类型-->
        <view class="list">
          <text class="label">门址类型</text>
          <text class="value">{{doorDetailsNew.houseNumberType}}</text>
        </view>
      </view>
    </view>
    <view
      class="detail-info"
      v-if="
        activeTab === 0 &&
        (doorInfo.baseInfo.type === DOOR_TYPE.STORE.VALUE ||
          doorInfo.baseInfo.type === DOOR_TYPE.ENTERPRISE.VALUE) &&
        bindStatus === DOOR_BIND_STATUS.BINDED.VALUE &&
        !showEditBtn
      "
    >
      <view class="header">
        <view class="header-title">
          <image src="/static/images/common/icon_enterprise.png"></image>
          <view class="title">企业信息</view>
        </view>
      </view>
      <!--  企业信息 -->
      <view class="houser-info" v-if="doorInfo.ownerCorpInfo">
        <view class="item">
          <text class="item__label">企业名称</text>
          <text class="item__value">{{ doorInfo.ownerCorpInfo.qc }}</text>
        </view>
        <view class="item">
          <text class="item__label">统一社会信用代码</text>
          <text class="item__value">{{ doorInfo.ownerCorpInfo.tyshxydm }}</text>
        </view>
        <view class="item">
          <text class="item__label">法人/负责人</text>
          <text class="item__value">{{ doorInfo.ownerCorpInfo.fddbrxm }}</text>
        </view>
        <view class="item">
          <text class="item__label">法人/负责人联系电话</text>
          <text class="item__value">{{
            doorInfo.ownerCorpInfo.fddbrlxdh
          }}</text>
        </view>
        <view class="item">
          <text class="item__label">所属行业</text>
          <text class="item__value">{{ doorInfo.ownerCorpInfo.sshy }}</text>
        </view>
        <view class="item">
          <text class="item__label">经营范围</text>
          <text class="item__value">{{ doorInfo.ownerCorpInfo.jyfw }}</text>
        </view>
      </view>
      <view class="block--empty" v-else> </view>
    </view>
    <view
      v-if="
        activeTab === 0 &&
        doorInfo.baseInfo.type !== DOOR_TYPE.HOUSE.VALUE &&
        bindStatus === DOOR_BIND_STATUS.BINDED.VALUE &&
        !showEditBtn
      "
      class="enterprise"
    >
      <!-- 企业标签 -->
      <view v-if="doorInfo.jyxxResVo" class="industry-tags base-info tags">
        <view class="header">
          <view class="header-title">
            <image src="/static/images/common/icon_enterprise.png"></image>
            <view class="title">行业标签</view>
          </view>
        </view>
        <view class="tags-cont">
          {{ doorInfo.jyxxResVo.xybq }}
        </view>
      </view>
      <!-- 产业标签 -->
      <view v-if="doorInfo.jyxxResVo" class="company-tags base-info tags">
        <view class="header">
          <view class="header-title">
            <image src="/static/images/common/icon_enterprise.png"></image>
            <view class="title">产业标签</view>
          </view>
        </view>
        <view class="tags-cont">
          {{ doorInfo.jyxxResVo.cybq }}
        </view>
      </view>
      <!-- 其他标签 -->
      <view v-if="doorInfo.jyxxResVo" class="other-tags base-info tags">
        <view class="header">
          <view class="header-title">
            <image src="/static/images/common/icon_enterprise.png"></image>
            <view class="title">其他标签</view>
          </view>
        </view>
        <view class="tags-cont">
          {{ doorInfo.jyxxResVo.qtrybq }}
        </view>
      </view>
      <view v-if="doorInfo.cfhfxResVo" class="base-info">
        <view class="header">
          <view class="header-title">
            <image src="/static/images/common/icon_enterprise.png"></image>
            <view class="title">企业处罚和风险</view>
          </view>
        </view>
        <view class="risk-overview">
          <view class="title">风险扫描</view>
          <view class="item" @click="handleGoDanger('处罚信息')">
            <view class="label">
              <view class="name">处罚信息</view>
              <view class="count">{{
                doorInfo.cfhfxCountResVo.cfxxCount
              }}</view>
            </view>
            <view class="value" v-if="doorInfo.cfhfxCountResVo.cfxxCount === 0"
              >该企业暂无处罚信息</view
            >
            <view class="value" v-else
              >该企业有处罚信息({{
                doorInfo.cfhfxCountResVo.cfxxCount
              }}条)</view
            >
          </view>
          <view class="item" @click="handleGoDanger('严重失信')">
            <view class="label">
              <view class="name">严重失信</view>
              <view class="count">{{
                doorInfo.cfhfxCountResVo.yzsxCount
              }}</view>
            </view>
            <view class="value" v-if="doorInfo.cfhfxCountResVo.yzsxCount === 0"
              >该企业暂无严重失信行为</view
            >
            <view class="value" v-else
              >该企业有严重失信行为({{
                doorInfo.cfhfxCountResVo.yzsxCount
              }}条)</view
            >
          </view>
          <view class="item" @click="handleGoDanger('经营异常')">
            <view class="label">
              <view class="name">经营异常</view>
              <view class="count">{{
                doorInfo.cfhfxCountResVo.jyycCount
              }}</view>
            </view>
            <view class="value" v-if="doorInfo.cfhfxCountResVo.jyycCount === 0"
              >该企业暂无经营异常信息</view
            >
            <view class="value" v-else
              >该企业有经营异常信息({{
                doorInfo.cfhfxCountResVo.jyycCount
              }}条)</view
            >
          </view>
        </view>
      </view>
    </view>
    <view
      class="detail-info enterprise"
      v-if="
        activeTab === 0 &&
        doorInfo.baseInfo.type === DOOR_TYPE.HOUSE.VALUE &&
        bindStatus === DOOR_BIND_STATUS.BINDED.VALUE &&
        !showEditBtn
      "
    >
      <view class="header">
        <view class="header-title">
          <image src="/static/images/common/icon_house.png"></image>
          <view class="title">房主及产权信息</view>
        </view>
      </view>
      <view class="houser-info" v-if="doorInfo.ownerPersonInfo">
        <view class="item">
          <text class="item__label">户主姓名</text>
          <text class="item__value">{{ doorInfo.ownerPersonInfo.xm }}</text>
        </view>
        <view class="item">
          <text class="item__label">身份证号码</text>
          <text class="item__value">{{
            doorInfo.ownerPersonInfo.gmsfzhm || 330283201506080327
          }}</text>
        </view>
        <view class="item">
          <text class="item__label">联系电话</text>
          <text class="item__value">{{ doorInfo.ownerPersonInfo.lxfs }}</text>
        </view>
        <view class="item">
          <text class="item__label">户籍地址</text>
          <text class="item__value">{{ doorInfo.ownerPersonInfo.hjdxz }}</text>
        </view>
        <view class="item">
          <text class="item__label">现住地址</text>
          <text class="item__value">{{ doorInfo.ownerPersonInfo.xzdxz }}</text>
        </view>
      </view>
      <view class="block--empty" v-else> </view>
    </view>
    <view
      v-if="
        doorInfo.baseInfo.type === DOOR_TYPE.HOUSE.VALUE &&
        activeTab === 0 &&
        bindStatus === DOOR_BIND_STATUS.BINDED.VALUE &&
        !showEditBtn
      "
      class="table-wrapper"
    >
      <view class="header">
        <view class="header-title">
          <image src="/static/images/common/icon_active_me.png"></image>
          <view class="title">住户信息</view>
        </view>
      </view>
      <view class="table">
        <view class="tr">
          <view class="th">姓名</view>
          <view class="th">操作</view>
        </view>
        <block v-if="tableData.length">
          <block v-for="(item, index) in tableData" :key="index">
            <view class="tr bg-g" v-if="index % 2 == 0">
              <view class="td">{{ item.xm }}</view>
              <view
                class="td"
                style="color: #1676fe"
                @tap="handleShow"
                :data-user="item"
                >查看</view
              >
            </view>

            <view class="tr bg-g2" v-else>
              <view class="td">{{ item.xm }}</view>
              <view
                class="td"
                style="color: #1676fe"
                @tap="handleShow"
                :data-user="item"
                >查看</view
              >
            </view>
          </block>
        </block>
        <block v-else>
          <view class="tr bg-g2">
            <view class="td"></view>
            <view class="td" style="color: #1676fe"></view>
          </view>
        </block>
      </view>
    </view>
    <template v-if="activeTab === 1 && relationInfo.length">
      <view
        class="relation-event"
        v-for="(item, index) in relationInfo"
        :key="index"
        @tap="handleJump(item)"
      >
        <view class="header">
          <view class="header-title">
            <image src="/static/images/common/icon_report.png"></image>
            <view class="title">{{ item.createUserName }}</view>
          </view>

          <view class="status">
            <text class="status__label status__resource">{{ item.type }}</text>
            <!--  <text class="status__label status__jjcd">一般</text> -->
            <text class="status__label status__event">{{ item.status }}</text>
          </view>
        </view>
        <view class="event-detail">{{ item.context }}</view>
        <view class="event-address">
          <view class="event-address__label">事件地址:</view>
          <text class="event-address__value">{{ item.address }}</text>
        </view>
        <view class="event-footer">
          <!--     <view class="event-type">巡查走访/商铺环境</view> -->
          <view v-if="item.createTime" class="event-time">{{
            item.createTime
          }}</view>
        </view>
      </view>
    </template>
    <uni-popup class="custom-popup" ref="popupRenter">
      <view class="renter-info">
        <view class="popup-title">住户人员信息</view>
        <view class="item">
          <view class="item__label">姓名</view>
          <view class="item__value">{{ curUser.xm }}</view>
        </view>
        <view class="item">
          <view class="item__label">身份证号</view>
          <view class="item__value">{{ curUser.gmsfzhm }}</view>
        </view>
        <view class="item">
          <view class="item__label">联系电话</view>
          <view class="item__value">{{ curUser.lxfs }}</view>
        </view>
        <view class="item">
          <view class="item__label">户籍地址</view>
          <view class="item__value">{{ curUser.hjdxz }}</view>
        </view>
        <view class="item">
          <view class="item__label">现住地址</view>
          <view class="item__value">{{ curUser.xzdxz }}</view>
        </view>
      </view>
    </uni-popup>

    <!-- 门牌信息不全，用户补充信息 -->
    <view v-if="isEdit && activeTab === 0" class="mp-form">
      <view class="doorplateType">
        <view class="label">门牌类型：</view>
        <radio-group @change="radioChanged">
          <label style="margin-right: 20px">
            <radio
              class="radio"
              value="1"
              :checked="doorplateType != DOOR_TYPE.HOUSE.VALUE"
            ></radio>
            <text>企业/商铺</text>
          </label>
          <label>
            <radio
              class="radio"
              value="2"
              :checked="doorplateType == DOOR_TYPE.HOUSE.VALUE"
            ></radio>
            <text>个人</text>
          </label>
        </radio-group>
      </view>
      <view class="title">{{
        doorplateType != DOOR_TYPE.HOUSE.VALUE ? "企业信息" : "个人信息"
      }}</view>
      <view class="form" v-if="doorplateType !== DOOR_TYPE.HOUSE.VALUE">
        <uni-forms
          ref="form"
          :model="formData"
          :label-width="300"
          label-align="left"
          label-position="top"
        >
          <uni-forms-item label="企业名称：" name="qc">
            <uni-easyinput
              type="text"
              v-model="formData.qc"
              placeholder="请输入"
            />
          </uni-forms-item>
          <uni-forms-item label="统一社会信用代码：" name="tyshxydm">
            <uni-easyinput
              type="text"
              v-model="formData.tyshxydm"
              placeholder="请输入"
            />
          </uni-forms-item>
          <uni-forms-item label="法人/负责人：" name="fddbrxm">
            <uni-easyinput
              type="text"
              v-model="formData.fddbrxm"
              placeholder="请输入"
            />
          </uni-forms-item>
          <uni-forms-item label="法人/负责人联系电话：" name="fddbrlxdh">
            <uni-easyinput
              type="number"
              v-model="formData.fddbrlxdh"
              placeholder="请输入"
            />
          </uni-forms-item>
          <uni-forms-item label="所属行业：" name="sshyCode">
            <uni-data-select
              v-model="formData.sshyCode"
              :localdata="sshyOptions"
              placeholder="请选择"
            ></uni-data-select>
          </uni-forms-item>
          <uni-forms-item label="经营范围：" name="jyfw">
            <uni-easyinput
              type="textarea"
              v-model="formData.jyfw"
              placeholder="请输入"
              autoHeight
            />
          </uni-forms-item>
        </uni-forms>
      </view>
      <view v-else>
        <uni-forms
          ref="form"
          :model="formData"
          :label-width="300"
          label-align="left"
          label-position="top"
          v-if="doorplateType === DOOR_TYPE.HOUSE.VALUE"
        >
          <uni-forms-item label="姓名：" name="xm">
            <uni-easyinput
              type="text"
              v-model="formData.xm"
              placeholder="请输入"
            />
          </uni-forms-item>
          <uni-forms-item label="身份证号码：" name="gmsfzhm">
            <uni-easyinput
              type="idcard"
              v-model="formData.gmsfzhm"
              placeholder="请输入"
            />
          </uni-forms-item>
          <uni-forms-item label="联系电话：" name="phone">
            <uni-easyinput
              type="number"
              v-model="formData.phone"
              placeholder="请输入"
            />
          </uni-forms-item>
          <uni-forms-item label="不动产权证照片(首页和信息页)：" name="picsBdc">
            <file-upload2
              ref="files"
              :maxCount="2"
              placeholder="添加不动产照片"
            ></file-upload2>
          </uni-forms-item>
          <uni-forms-item label="户籍地址：" name="hjdxz">
            <uni-easyinput
              type="text"
              v-model="formData.hjdxz"
              placeholder="请输入"
            />
          </uni-forms-item>
          <uni-forms-item label="现住地址：" name="xzdxz">
            <uni-easyinput
              type="text"
              v-model="formData.xzdxz"
              placeholder="请输入"
            />
          </uni-forms-item>
        </uni-forms>
      </view>
      <view style="display: flex; align-items: center">
        <checkbox-group @change="handleCheckChange">
          <checkbox :checked="disable" />
        </checkbox-group>
        <view class="agreement-text"
          >我已阅读并同意
          <text class="agreeName" @click="handleService">《用户服务协议》</text
          >和
          <text class="agreeName" @click="handlePrivate">《隐私协议》</text>
        </view>
      </view>
      <custom-popup ref="customDialogRef"></custom-popup>
      <button
        class="submit-button"
        :style="
          disable ? 'background-color:#3a78f5' : 'background-color:#abaeb1'
        "
        :disabled="!disable"
        @tap="saveHzInfo"
      >
        提交
      </button>
    </view>
  </view>
</template>

<script>
import { DOOR_TYPE, DOOR_BIND_STATUS } from "@/utils/const";
import { getDictionaryByName } from "@/api/system";
import { getRelateInfo } from "@/api/help";
import {getDoorplateInfoNew, saveHzInfo} from "@/api/control";
import agreements from "@/common/js/agreement";

const app = getApp();
export default {
  data() {
    return {
      DOOR_BIND_STATUS,
      activeTab: 0,
      tabs: ["门牌信息", "关联事件"],
      userInfo: {},
      tableData: [],
      showPopup: false,
      curUser: {
        xm: "",
        relation: "",
        gmsfzhm: "",
        lxfs: "",
        hjdxz:
          "",
        xzdxz:
          "",
      },
      DOOR_TYPE,
      doorInfo: {
        doorplateCode: "",
        wxBindStatus: 1,
        baseInfo: {
          mpid: "",
          doorplateCode: "",
          type: 2,
          bzdz1: "",
          bzdz: "",
          ssqh: "",
          longitude: "",
          latitude: "",
        },
        ownerCorpInfo: null,
        ownerPersonInfo: null,
        residentInfo: [
          {
            szmp: "",
            xm: "",
            gmsfzhm: "",
            lxfs: "",
            hjdxz: "",
            xzdxz: "",
          },
        ],
      },
      relationInfo: [],
      bindStatus: null,
      showEditBtn: false,
      isEdit: false,
      doorplateType: "",
      doorplateCode: "",
      formData: {},
      sshyOptions: [],
      sshyDic: {},
      formRules: {
        qc: {
          rules: [{ required: true, errorMessage: "企业名称不能为空" }],
        },
        tyshxydm: {
          rules: [{ required: true, errorMessage: "统一社会信用代码不能为空" }],
        },
        fddbrxm: {
          rules: [{ required: true, errorMessage: "法人、负责人不能为空" }],
        },
        sshyCode: {
          rules: [{ required: true, errorMessage: "所属行业不能为空" }],
        },
        xm: {
          rules: [{ required: true, errorMessage: "姓名不能为空" }],
        },
        picsBdc: {
          rules: [{ required: true, errorMessage: "不动产权证照片不能为空" }],
        },
        gmsfzhm: {
          rules: [
            { required: true, errorMessage: "身份证号码不能为空" },
            {
              validateFunction: function (rule, value, data, callback) {
                const reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
                if (!reg.test(value)) {
                  callback("身份证号码不合法");
                }
                return true;
              },
            },
          ],
        },
        phone: {
          rules: [
            { required: true, errorMessage: "联系电话不能为空" },
            {
              validateFunction: function (rule, value, data, callback) {
                const reg = /^1\d{10}$/;
                if (!reg.test(value)) {
                  callback("手机号码不合法");
                }
                return true;
              },
            },
          ],
        },
      },
      disable: false,
      doorDetailsNew:{}, //门牌详情从新接口获取信息,不再从全局获取
    };
  },
  onLoad() {
    this.userInfo = uni.getStorageSync("userInfo") || {};
    this.doorInfo = app.globalData.doorInfo;
    //获取门牌详情
    getDoorplateInfoNew({
      //门牌id
      id: uni.getStorageSync("doorplateInfo")[0].baseInfo.mpid
    }).then((res)=>{
      this.doorDetailsNew = res.data;
    })
    if (app.globalData.doorInfo.residentInfo) {
      this.tableData = app.globalData.doorInfo.residentInfo;
    }
    this.doorplateType = this.doorInfo.baseInfo.type;
    this.doorplateCode = this.doorInfo.baseInfo.doorplateCode;
    this.bindStatus = app.globalData.bindStatus;
    if (this.bindStatus === DOOR_BIND_STATUS.NOT_ALLOW.VALUE) {
      this.showEditBtn = true;
    }
    this.getDictionaryByName();
    this.getRelateInfo();
  },
  methods: {
    // 查询字典
    getDictionaryByName() {
      getDictionaryByName({ dicName: "sshyList" }).then((res) => {
        res.data.forEach((item) => {
          this.sshyOptions.push({ value: item.code, text: item.name });
          this.sshyDic[item.code] = item.name;
        });
      });
    },
    handleJump(item) {
      if (item.type === "一键反映") {
        uni.navigateTo({
          url: `/subPages/pages/alarm/alarmDetail?uuid=${item.uuid}`,
        });
      } else {
        uni.navigateTo({
          url: `/subPages/pages/help/helpDetail?uuid=${item.uuid}`,
        });
      }
    },
    async getRelateInfo() {
      const res = await getRelateInfo({
        placeId: this.doorInfo.baseInfo.doorplateCode,
        current: 1,
        size: 100,
      });
      this.relationInfo = res.data;
    },
    onChange(e) {
      // #ifdef MP-WEIXIN || MP-ALIPAY
      this.setData({
        activeTab: e.detail.index,
      });
      // #endif
      // #ifdef H5
      this.setData({
        activeTab: e,
      });
      // #endif
    },

    handleShow(e) {
      this.setData({
        curUser: e.currentTarget.dataset.user,
      });
      /*  this.setData({
        showPopup: true,
      }); */
      this.$refs.popupRenter.open();
    },

    handleClosePopup() {
      this.setData({
        showPopup: false,
      });
    },
    handleGoDanger(val) {
      uni.navigateTo({
        url: `/subPages/pages/door/enterpriseRisk?title=${val}`,
      });
    },
    // 点击右上角编辑按钮
    editDoorplate() {
      this.isEdit = !this.isEdit;
      setTimeout(() => {
        this.$refs.form.setRules(this.formRules);
      }, 200);
    },
    // 保存门牌户主信息
    saveHzInfo() {
      let fileList = [];
      if (this.doorplateType === DOOR_TYPE.HOUSE.VALUE) {
        fileList = this.$refs.files.fileList;
        this.formData.picsBdc = fileList
          .map((obj) => {
            return obj.fileId;
          })
          .join(",");
        this.$refs.form.formData.picsBdc = this.formData.picsBdc;
      }
      this.$refs.form
        .validate()
        .then((res) => {
          const data = {
            userInfoId: this.userInfo.uuid,
            doorplateType: this.doorplateType,
            doorplateCode: this.doorplateCode,
          };
          if (this.doorplateType === DOOR_TYPE.HOUSE.VALUE) {
            data.ownerPersonVo = this.formData;
            if (fileList.length < 2) {
              uni.showToast({
                title: "请上传不动产权证的首页和信息页照片",
                icon: "none",
              });
              return;
            }
          } else {
            data.ownerCorpVo = this.formData;
            data.ownerCorpVo.sshy = this.sshyDic[this.formData.sshyCode];
          }
          uni.showModal({
            title: "提交确认",
            content: "您确定提交信息吗？",
            success: function (res) {
              if (res.confirm) {
                saveHzInfo(data).then((res) => {
                  if (res.code === 0) {
                    setTimeout(() => {
                      uni.redirectTo({
                        url: "/subPages/pages/door/complete",
                      });
                    }, 500);
                  }
                });
              } else if (res.cancel) {
                console.log("用户点击取消");
              }
            },
          });
        })
        .catch((err) => {
          console.log("表单错误信息：", err);
        });
    },
    radioChanged(event) {
      this.doorplateType =
        event.detail.value === "1"
          ? DOOR_TYPE.ENTERPRISE.VALUE
          : DOOR_TYPE.HOUSE.VALUE;
      setTimeout(() => {
        this.$refs.form.setRules(this.formRules);
      }, 200);
    },
    // 勾选用户协议和隐私协议
    handleCheckChange(e) {
      this.disable = !this.disable;
    },
    // 查看用户协议
    handleService() {
      this.$refs.customDialogRef.open({
        content: agreements["SERVICE_AGREEMENT"],
      });
    },
    // 查看隐私协议
    handlePrivate() {
      this.$refs.customDialogRef.open({
        content: agreements["PRIVATE_AGREEMENT"],
      });
    },
    /**
     * 返回门牌简称
     */
    getDoorplateName(name) {
      if (!name) {
        return '';
      }
      let index = name.indexOf("区") + 1;
      return name.substring(index);
    }
  },
};
</script>
<style>
@import "./door.css";
</style>
<style lang="scss" scoped>
/* 空白 */
.block--empty {
  height: 0px;
}
.house-info {
  .value {
    word-break: break-all; /* 英文字母换行 */
  }
}
.company-base {
  padding: 20rpx 30rpx 30rpx 30rpx;
  background-color: #ffffff;
  border-radius: 10rpx;
  margin: 20rpx 0;
  .company-name {
    font-size: 20px;
    /*  line-height: 38px; */
  }
  .company-status {
    font-size: 14px;
    display: flex;
  }
  .info-list {
    display: flex;
    justify-content: space-between;
    .info-item {
      display: flex;
      flex-direction: column;
      .info-label {
        font-size: 12px;
        line-height: 38px;
      }
      .info-value {
        font-size: 12px;
        line-height: 38px;
      }
    }
  }
}
.tags {
  .tags-cont {
    color: blue;
  }
}
.risk-overview {
  padding: 5px 0;
  background-color: #f8f5f5;
  display: flex;
  justify-content: space-between;
  .title {
    width: 14px;
    font-size: 12px;
    color: #db7676;
    background-color: #ecd0d0;
  }
  .item {
    width: 31%;
    padding: 0 5px;
    .label {
      font-size: 13px;
      color: #333333;
      margin-bottom: 3px;
      display: flex;
      .name {
        width: 100px;
      }
      .count {
        padding: 0 10px;
        text-align: center;
        color: #dd7070;
        background-color: #ecd0d0;
        border-radius: 3px;
      }
    }
    .value {
      width: 100%;
      text-align: left;
      font-size: 12px;
      color: #999999;
    }
  }
}

.edit-btn {
  // position: absolute;
  // top: 20px;
  // right: 10px;
  background-color: #3a78f5;
  // z-index: 999;
}
.mp-form {
  padding: 10px 15px;
  background-color: #fff;
  .doorplateType {
    padding: 10px 0;
    .label {
      font-size: 14px;
      font-weight: 400;
      color: #333;
      padding-bottom: 7px;
    }
    .radio {
      margin-right: 5px;
      color: #999;
    }
  }
  .title {
    font-size: 16px;
    font-weight: 800;
    color: #333;
    padding: 10px 0;
  }
  .submit-button {
    width: 100%;
    border-radius: 15rpx;
    margin-top: 40px;
  }
}
.corp-info {
  padding: 10px 15px;
  background-color: #fff;
  .title {
    padding-bottom: 15px;
    font-size: 17px;
    font-weight: 800;
    color: #333;
  }
  .cell-list {
    display: flex;
    margin-bottom: 10px;
    .label {
      width: 150px;
      color: #333;
    }
    .value {
      width: calc(100% - 150px);
      color: #999;
      text-align: left;
    }
  }
}
.person-info {
  padding: 10px 15px;
  background-color: #fff;
  .title {
    padding-bottom: 15px;
    font-size: 17px;
    font-weight: 800;
    color: #333;
  }
  .cell-list {
    display: flex;
    margin-bottom: 10px;
    .label {
      width: 100px;
      color: #333;
    }
    .value {
      width: calc(100% - 100px);
      color: #999;
      text-align: left;
    }
  }
}
.agreement-text {
  /*  margin-top: 10px; */
  font-size: 12px;
}
.agreeName {
  color: #329cff;
}
/* 住户弹框 */
.custom-popup {
  ::v-deep .uni-popup__wrapper{
    width: 80%;
  }
  .popup-title {
    padding: 8px;
    padding-bottom: 10px;
    font-size: 16px;
    font-weight: 900;
    color: #333333;
  }
  .item {
    display: flex;
    line-height: 56rpx;
    &__label {
      width: 80px;
      padding-left: 5px;
    }
    &__value {
      color: #aaa;
      flex: 1;
    }
  }
  .renter-info {
    background-color: #fff;
    border-radius: 8px;
    padding: 10px;
  }
}
</style>
