<template>
  <!-- 该页面为填写信息的组件 -->
  <!-- 只读文件 -->
  <readOnlyInfo
    v-if="isDisable"
    ref="dgpayRef"
    applyName="dgpay"
    :applyId="channelInfo.applyId"
  />

  <view v-if="!isDisable">
    <uni-collapse ref="collapse">
      <uni-collapse-item title="主体信息" class="coll-title" :open="true">
        <view class="content">
          <JeePayForm text="商户类型">
            <uni-data-checkbox
              v-model="applyDetailInfo.merchantType"
              :localdata="merchantTypeList"
            ></uni-data-checkbox>
          </JeePayForm>

          <template v-if="applyDetailInfo.merchantType != 1">
            <JeePayForm text="营业执照图片">
              <JeepayUpLoad
                ocrFlag="license"
                :imgUrl="applyDetailInfo.licenseImg"
                @uploadSuccess="uploadSuccess($event, 'licenseImg')"
                @clear="clear('licenseImg')"
              />
            </JeePayForm>

            <JeePayForm
              text="商户简称"
              v-model:value="applyDetailInfo.mchShortName"
            />
            <JeePayForm
              text="营业执照编号"
              v-model:value="applyDetailInfo.licenseNo"
            />

            <JeePayForm text="营业执照起始有效期">
              <termOfValidity
                :defaultDate="applyDetailInfo.licenseEffectBegin"
                @publicSelect="publicSelect($event, 'licenseEffectBegin')"
                :isEnd="false"
              />
            </JeePayForm>

            <JeePayForm text="营业执照有效期截止">
              <termOfValidity
                :defaultDate="applyDetailInfo.licenseEffectEnd"
                @publicSelect="publicSelect($event, 'licenseEffectEnd')"
              />
            </JeePayForm>
          </template>

          <JeePayForm
            text="用户名称"
            v-model:value="applyDetailInfo.mchFullName"
          />
					
					<JeePayForm text="管理员账号" v-model:value="applyDetailInfo.loginUserName" tipText="斗拱商户登录名,用于商户平台登录。全局唯一。支持英文、数字、下划线，区分大小写" />
					
          <template v-if="applyDetailInfo.merchantType != 1">
            <JeePayForm text="法人身份证人像面照片">
              <JeepayUpLoad
                ocrFlag="idCard"
                :imgUrl="applyDetailInfo.idcard1Img"
                @uploadSuccess="uploadSuccess($event, 'idcard1Img')"
                @clear="clear('idcard1Img')"
              />
            </JeePayForm>

            <JeePayForm text="法人身份证国徽面照片">
              <JeepayUpLoad
                ocrFlag="idCard"
                :imgUrl="applyDetailInfo.idcard2Img"
                @uploadSuccess="uploadSuccess($event, 'idcard2Img')"
                @clear="clear('idcard2Img')"
              />
            </JeePayForm>

            <JeePayForm
              text="法人身份证姓名"
              v-model:value="applyDetailInfo.idcardName"
            />
            <JeePayForm
              text="法人身份证号"
              v-model:value="applyDetailInfo.idcardNo"
            />

            <JeePayForm text="法人身份证起始有效期">
              <termOfValidity
                :defaultDate="applyDetailInfo.idcardEffectBegin"
                @publicSelect="publicSelect($event, 'idcardEffectBegin')"
                :isEnd="false"
              />
            </JeePayForm>

            <JeePayForm text="法人身份证结束有效期">
              <termOfValidity
                :defaultDate="applyDetailInfo.idcardEffectEnd"
                @publicSelect="publicSelect($event, 'idcardEffectEnd')"
              />
            </JeePayForm>
          </template>
        </view>
      </uni-collapse-item>
      <uni-collapse-item title="经营信息" class="coll-title">
        <view class="content">
          <JeePayForm text="经营类目">
            <jeeDataPicker
              :code="codeBack.mccCode"
              :localdata="mcc"
              @change="publicSelect($event, 'mccCode')"
              paramType="last"
            />
          </JeePayForm>

          <template v-if="applyDetailInfo.merchantType != 1">
            <JeePayForm text="经营类型">
              <uni-data-checkbox
                v-model="applyDetailInfo.busiType"
                :localdata="busiTypeList"
              ></uni-data-checkbox>
            </JeePayForm>

            <JeePayForm
              text="小票名称"
              v-model:value="applyDetailInfo.receiptName"
            />

            <JeePayForm text="公司类型">
              <uni-data-picker
                :localdata="entArray"
                @change="publicSelect($event, 'entType')"
                v-slot:default="{ data }"
                >{{ entText ? entText : "请选择" }}</uni-data-picker
              >
            </JeePayForm>
          </template>

          <JeePayForm
            text="联系人姓名"
            v-model:value="applyDetailInfo.contactName"
          />
          <JeePayForm
            text="联系人手机号"
            v-model:value="applyDetailInfo.contactPhone"
          />
          <JeePayForm
            text="联系人邮箱"
            v-model:value="applyDetailInfo.contactEmail"
          />
          <JeePayForm text="经营省市县">
            <jeeDataPicker
              :code="codeBack.areaCode"
              :localdata="address"
              @change="publicSelect($event, 'areaCode')"
              paramType="arr"
            />
          </JeePayForm>

          <JeePayForm text="经营地址" v-model:value="applyDetailInfo.address" />

          <JeePayForm
            text="客服电话"
            v-model:value="applyDetailInfo.servicePhone"
          />
        </view>
      </uni-collapse-item>
      <uni-collapse-item title="结算账户" class="coll-title">
        <view class="content">
          <JeePayForm text="账户类型">
            <uni-data-checkbox
              v-model="applyDetailInfo.settAccountType"
              :localdata="settAccountTypeList"
            ></uni-data-checkbox>
          </JeePayForm>

          <JeePayForm
            text="银行卡开户名"
            v-model:value="applyDetailInfo.settAccountName"
          />

          <template v-if="applyDetailInfo.settAccountType == 'C'">
            <JeePayForm text="结算卡正面照">
              <JeepayUpLoad
                :imgUrl="applyDetailInfo.settAccountLicenseImg"
                @uploadSuccess="uploadSuccess($event, 'settAccountLicenseImg')"
                @clear="clear('settAccountLicenseImg')"
                ocrFlag="bankCard"
              />
            </JeePayForm>

            <JeePayForm text="结算卡反面照">
              <JeepayUpLoad
                :imgUrl="applyDetailInfo.settBankCardBackImg"
                @uploadSuccess="uploadSuccess($event, 'settBankCardBackImg')"
                @clear="clear('settBankCardBackImg')"
              />
            </JeePayForm>
          </template>

          <JeePayForm
            text="银行卡号"
            v-model:value="applyDetailInfo.settAccountNo"
          />

          <JeePayForm text="银行卡开户地">
            <jeeDataPicker
              :code="codeBack.settAccountBankBranchAreaCode"
              :localdata="address"
              @change="publicSelect($event, 'settAccountBankBranchAreaCode')"
              paramType="arr"
            />
          </JeePayForm>

          <template v-if="applyDetailInfo.settAccountType == 'B'">
            <JeePayForm
              text="银行编码"
              v-model:value="applyDetailInfo.bankCode"
            />
            <JeePayForm
              text="联行行号"
              v-model:value="applyDetailInfo.branchCode"
            />
          </template>
					
					<JeePayForm text="是否为法人信息" :start="false">
					  <uni-data-checkbox  :localdata="[{'value':1,'text':'是'},{'value':0,'text':'否'}]" @change="publicSelect($event, 'isLegal')" />
					</JeePayForm>
					
          <JeePayForm text="结算人身份证人像面照片">
            <JeepayUpLoad
              ocrFlag="idCard"
              :imgUrl="applyDetailInfo.settAccountIdcard1Img"
              @uploadSuccess="uploadSuccess($event, 'settAccountIdcard1Img')"
              @clear="clear('settAccountIdcard1Img')"
            />
          </JeePayForm>

          <JeePayForm text="结算人身份证国徽面照片">
            <JeepayUpLoad
              ocrFlag="idCard"
              :imgUrl="applyDetailInfo.settAccountIdcard2Img"
              @uploadSuccess="uploadSuccess($event, 'settAccountIdcard2Img')"
              @clear="clear('settAccountIdcard2Img')"
            />
          </JeePayForm>

          <JeePayForm
            text="[持卡人]人身份证号"
            v-model:value="applyDetailInfo.settAccountIdcardNo"
          />

          <JeePayForm text="[持卡人]身份证起始有效期">
            <termOfValidity
              :defaultDate="applyDetailInfo.settAccountIdcardEffectBegin"
              @publicSelect="
                publicSelect($event, 'settAccountIdcardEffectBegin')
              "
              :isEnd="false"
            />
          </JeePayForm>

          <JeePayForm text="[持卡人]身份证结束有效期">
            <termOfValidity
              :defaultDate="applyDetailInfo.settAccountIdcardEffectEnd"
              @publicSelect="publicSelect($event, 'settAccountIdcardEffectEnd')"
            />
          </JeePayForm>

          <JeePayForm
            text="[持卡人]手机号"
            v-model:value="applyDetailInfo.settAccountBindPhone"
          />
        </view>
      </uni-collapse-item>

      <uni-collapse-item
        :show-animation="false"
        title="材料信息"
        class="coll-title"
      >
        <view class="content">
          <!-- <JeePayForm text="业务类型" :start="false">
            <uni-data-picker
              :localdata="cashArray"
              @change="publicSelect($event, 'cashType')"
              v-slot:default="{ data }"
              >{{ cashText ? cashText : "不设置" }}</uni-data-picker
            >
          </JeePayForm>

          <JeePayForm text="手续费类型" :start="false">
            <uni-data-picker
              :localdata="selectFeeArray"
              @change="publicSelect($event, 'selectFeeType')"
              v-slot:default="{ data }"
              >{{ selectFeeText ? selectFeeText : "不设置" }}</uni-data-picker
            >
          </JeePayForm>

          <JeePayForm
            text="提现手续费（固定/元）"
            v-model:value="applyDetailInfo.fixAmt"
            :start="false"
            tipText="请输入提现手续费"
            v-if="applyDetailInfo.selectFeeType == '1'"
          />

          <JeePayForm
            text="费率（百分比/%）"
            v-model:value="applyDetailInfo.feeRate"
            :start="false"
            v-if="applyDetailInfo.selectFeeType == '2'"
          />

          <JeePayForm text="结算周期" :start="false">
            <uni-data-picker
              :localdata="settleCycleArray"
              @change="publicSelect($event, 'settleCycle')"
              v-slot:default="{ data }"
              >{{
                settleCycleText ? settleCycleText : "不设置"
              }}</uni-data-picker
            >
          </JeePayForm>

          <JeePayForm
            text="起结金额（元）"
            v-model:value="applyDetailInfo.minAmt"
            :start="false"
          />

          <JeePayForm
            text="留存金额（元）"
            v-model:value="applyDetailInfo.remainedAmt"
            :start="false"
          />
					-->
          <template v-if="applyDetailInfo.merchantType != 1">
            <JeePayForm text="门头照">
              <JeepayUpLoad
                :imgUrl="applyDetailInfo.storeOuterImg"
                @uploadSuccess="uploadSuccess($event, 'storeOuterImg')"
                @clear="clear('storeOuterImg')"
              />
            </JeePayForm>

            <JeePayForm text="店内环境照">
              <JeepayUpLoad
                :imgUrl="applyDetailInfo.storeInnerImg"
                @uploadSuccess="uploadSuccess($event, 'storeInnerImg')"
                @clear="clear('storeInnerImg')"
              />
            </JeePayForm>

            <JeePayForm text="收银台照">
              <JeepayUpLoad
                :imgUrl="applyDetailInfo.storeCashierImg"
                @uploadSuccess="uploadSuccess($event, 'storeCashierImg')"
                @clear="clear('storeCashierImg')"
                :start="false"
              />
            </JeePayForm>

            <!-- <JeePayForm text="组织机构代码证照片">
              <JeepayUpLoad
                :imgUrl="applyDetailInfo.orgCodePic"
                @uploadSuccess="uploadSuccess($event, 'orgCodePic')"
                @clear="clear('orgCodePic')"
                :start="false"
              />
            </JeePayForm> -->

            <JeePayForm text="开户许可证照片">
              <JeepayUpLoad
                :imgUrl="applyDetailInfo.companyAccountLicenseImg"
                @uploadSuccess="
                  uploadSuccess($event, 'companyAccountLicenseImg')
                "
                @clear="clear('companyAccountLicenseImg')"
                :start="false"
              />
            </JeePayForm>

            <!-- <JeePayForm text="税务登记证照片">
              <JeepayUpLoad
                :imgUrl="applyDetailInfo.taxRegPic"
                @uploadSuccess="uploadSuccess($event, 'taxRegPic')"
                @clear="clear('taxRegPic')"
                :start="false"
              />
            </JeePayForm> -->
          </template>

          <JeePayForm
            text="D1结算协议图片"
            v-if="applyDetailInfo.merchantType == 1"
            :start="false"
          >
            <JeepayUpLoad
              :imgUrl="applyDetailInfo.settleAgreePic"
              @uploadSuccess="uploadSuccess($event, 'settleAgreePic')"
              @clear="clear('settleAgreePic')"
              :start="false"
            />
          </JeePayForm>

          <JeePayForm
            text="授权委托书"
            v-if="applyDetailInfo.settAccountType == 'D'"
          >
            <JeepayUpLoad
              :imgUrl="applyDetailInfo.authEnturstPic"
              @uploadSuccess="uploadSuccess($event, 'authEnturstPic')"
              @clear="clear('authEnturstPic')"
              :start="false"
            />
          </JeePayForm>
					
					<JeePayForm text="商务协议" v-if="applyDetailInfo.settAccountType == '3'" :start="false">
					  <JeepayUpLoad :imgUrl="applyDetailInfo.bankPic" @uploadSuccess="uploadSuccess($event, 'bankPic')" @clear="clear('bankPic')" :start="false"/>
					</JeePayForm>
					
					<JeePayForm text="支付宝商户经营类目">
					  <jeeDataPicker :code="applyDetailInfo.aliFeeMcc" :localdata="aliMcc" @change="publicSelect($event, 'aliFeeMcc')" paramType="oneLevel" />
					</JeePayForm>
					
        </view>
      </uni-collapse-item>
    </uni-collapse>
		
		<!-- 费率组件 -->
		<defaultRate ref="defaultRateRef" @autoPos="autoPosHandle" />
		
  </view>

  <!-- 进件完毕后的操作 -->
	<dgEvent v-if="channelInfo.state == 2" />
</template>

<script setup>
import { ref, reactive, inject } from "vue";
import address from "@/components/applyJson/address.json"; // 地址
import mcc from "@/components/applyJson/jeePayMcc.json"; // 行业
import JeepayUpLoad from "@/components/JeepayUpLoad/JeepayUpLoad.vue"; // 图片上传
import readOnlyInfo from "../../components/readOnlyInfo.vue"; // 只读文件
import tool from "@/util/tool.js"; // 工具类函数
import JeePayForm from "@/components/applyComponents/JeePayForm.vue"; // 通用左右结构布局
import termOfValidity from "@/components/applyComponents/termOfValidity.vue"; // 选择证件有效期
import jeeDataPicker from "@/components/applyComponents/dataPicker.vue"; // 通用级联选择
import dgEvent from "./dgEvent.vue"; // 进件完成后的操作
import { filterDcit } from "@/hooks/dict";
import defaultRate from "../../components/defaultRate.vue"; // 默认费率


const merchantTypeList = reactive(filterDcit(["A0", "A2"])); //商户类型
const settAccountTypeList = reactive(filterDcit(["B0", "B1", "B2"])); //账户类型
const busiTypeList = reactive(filterDcit(["G0", "G1"])); // 经营类型
const agreementTypeList = reactive(filterDcit(["M0", "M1"])); // 协议类型

const channelInfo = inject('channelInfo')

const emit = defineEmits(["applyHandle"]);
let defaultRateRef = ref(null); // 费率组件

// 状态分类: 0-未发起、 1-审核中、 2-进件成功、 3-驳回待修改、 4-待验证、 5-待签约
// 当状态为 1 2 4 5 时要开启只读模式，1 3 不开启
let isDisable = ref(false);
if (!["0", "3", "8"].includes(channelInfo.state)) isDisable.value = true;

// 商户进件详细信息（JSON类型字符串）
let applyDetailInfo = reactive({
  merchantType: 3, // 商户类型 默认为3 代表企业
  settAccountType: "B", // 结算账号类型 默认为B 对公
});

// 支付宝经营类目
const aliMcc = reactive([
	{ value: '2015050700000000', text: '美食' },
	{ value: '2015091000052157', text: '超市便利店' },
	{ value: '2015062600004525', text: '休闲娱乐' },
	{ value: '2015062600002758', text: '购物' },
	{ value: '2016062900190124', text: '爱车' },
	{ value: '2015063000020189', text: '生活服务' },
	{ value: '2016042200000148', text: '教育培训' },
	{ value: '2016062900190296', text: '医疗健康' },
	{ value: '2015080600000001', text: '航旅' },
	{ value: '2016062900190337', text: '专业销售/批发' },
	{ value: '2016062900190371', text: '政府/社会组织' },
])

// 公司类型文字回显
let entText = ref("");
// 公司类型列表
const entArray = [
  { value: "1", text: "政府机构" },
  { value: "2", text: "国营企业" },
  { value: "3", text: "私营企业" },
  { value: "4", text: "外资企业" },
  { value: "5", text: "个体工商户" },
  { value: "6", text: "其它组织" },
  { value: "7", text: "事业单位" },
];

// 业务类型文字回显
let cashText = ref("");
// 业务类型列表
const cashArray = [
  { value: "", text: "不设置" },
  { value: "D0", text: "当日到账" },
  { value: "T1", text: "下个工作日到账" },
  { value: "D1", text: "下个自然日到账" },
];

// 手续费类型
let selectFeeText = ref("");
const selectFeeArray = [
  { value: "", text: "不设置" },
  { value: "1", text: "固定费用" },
  { value: "2", text: "费率设置" },
];

// 结算周期
let settleCycleText = ref("");
const settleCycleArray = [
  { value: "", text: "不设置" },
  { value: "T1", text: "下个工作日到账" },
  { value: "D1", text: "下个自然日到账" },
];

// 小微经营类型
let microBizText = ref("");
const microBizArray = [
  { value: "", text: "不设置" },
  { value: "MICRO_TYPE_STORE", text: "门店场所" },
  { value: "MICRO_TYPE_MOBILE", text: "流动经营/便民服务" },
  { value: "MICRO_TYPE_ONLINE", text: "线上商品/服务交易" },
];

// 通用选择函数
const publicSelect = (e, key) => {
	// 是否为法人信息，该字段不提交
	if (key === 'isLegal') {
		if (e.detail.value) {
			applyDetailInfo.settAccountIdcard1Img = applyDetailInfo.idcard1Img
			applyDetailInfo.settAccountIdcard2Img = applyDetailInfo.idcard2Img
			applyDetailInfo.settAccountIdcardNo = applyDetailInfo.idcardNo
			applyDetailInfo.settAccountIdcardEffectBegin  = applyDetailInfo.idcardEffectBegin
			applyDetailInfo.settAccountIdcardEffectEnd = applyDetailInfo.idcardEffectEnd
			applyDetailInfo.settAccountBindPhone = applyDetailInfo.contactPhone 
		} else {
			applyDetailInfo.settAccountIdcard1Img = ''
			applyDetailInfo.settAccountIdcard2Img = ''
			applyDetailInfo.settAccountIdcardNo = ''
			applyDetailInfo.settAccountIdcardEffectBegin = ''
			applyDetailInfo.settAccountIdcardEffectEnd = ''
			applyDetailInfo.settAccountBindPhone = ''
		}
		return 
	}
  applyDetailInfo[key] = e.detail.value;

  if (key === "merchantType") {
    applyDetailInfo.merchantType = Number(e.detail.value);
  } else if (key === "entType") {
    applyDetailInfo.entType = e.detail.value[0].value;
    entText.value = entArray.find(
      (item) => item.value == e.detail.value[0].value
    ).text;
  } else if (key === "cashType") {
    applyDetailInfo.cashType = e.detail.value[0].value;
    cashText.value = cashArray.find(
      (item) => item.value == e.detail.value[0].value
    ).text;
  } else if (key === "selectFeeType") {
    applyDetailInfo.selectFeeType = e.detail.value[0].value;
    selectFeeText.value = selectFeeArray.find(
      (item) => item.value == e.detail.value[0].value
    ).text;
  } else if (key === "settleCycle") {
    applyDetailInfo.settleCycle = e.detail.value[0].value;
    settleCycleText.value = settleCycleArray.find(
      (item) => item.value == e.detail.value[0].value
    ).text;
  } else if (key === "microBizType") {
    applyDetailInfo.microBizType = e.detail.value[0].value;
    microBizText.value = microBizArray.find(
      (item) => item.value == e.detail.value[0].value
    ).text;
  } 
};

// 上传图片成功  及OCR识别回显
const uploadSuccess = (res, name) => {
  applyDetailInfo[name] = res.data;
  if (res.ocrInfo && Object.keys(res.ocrInfo).length < 1) return false;
  // OCR图片识别  idCard-身份证 idcard1Img，idcard2Img  license-营业执照 licenseImg
  if (name == "idcard1Img") {
    applyDetailInfo.idcardName = res.ocrInfo.idcardName; // 法人身份证姓名
    applyDetailInfo.idcardNo = res.ocrInfo.idcardNo; // 法人身份证号
  } else if (name == "idcard2Img") {
    applyDetailInfo.idcardEffectBegin = res.ocrInfo.idcardEffectBegin; // 有效期
    applyDetailInfo.idcardEffectEnd = res.ocrInfo.idcardEffectEnd; // 有效期end
  } else if (name == "licenseImg") {
    applyDetailInfo.licenseEffectBegin = res.ocrInfo.licenseEffectBegin; // 执照有效期
    applyDetailInfo.licenseEffectEnd = res.ocrInfo.licenseEffectEnd; // 有效期end
    applyDetailInfo.mchFullName = res.ocrInfo.mchFullName; // 全称
    applyDetailInfo.licenseNo = res.ocrInfo.licenseNo; // 编号
    applyDetailInfo.address = res.ocrInfo.address;
  } else if (name == "settAccountLicenseImg") {
    applyDetailInfo.settAccountNo = res.ocrInfo.settAccountNo; // 银行卡号
  } else if (name == "settAccountIdcard2Img") {
    applyDetailInfo.settAccountIdcardEffectBegin =
      res.ocrInfo.idcardEffectBegin; // 持卡人有效期
    applyDetailInfo.settAccountIdcardEffectEnd = res.ocrInfo.idcardEffectEnd; // 持卡人有效期end
  } else if (name == "settAccountIdcard1Img") {
    applyDetailInfo.settAccountIdcardNo = res.ocrInfo.idcardNo; // 持卡人身份证号
  } else if (name == "settAccountIdcard2Img") {
    applyDetailInfo.settAccountIdcardEffectBegin =
      res.ocrInfo.idcardEffectBegin; // 持卡人身份证有效期
    applyDetailInfo.settAccountIdcardEffectEnd = res.ocrInfo.idcardEffectEnd; // 持卡人身份证有效期end
  }
};
// 清除图片  仅前端
const clear = (name, url) => (applyDetailInfo[name] = "");

// 发起进件  注意后面的formCheck参数，表单校验要用
const launchApply = (isTempData) =>
  emit("applyHandle", {
    name: "dgpay",
    isTempData,
    applyDetailInfo,
    formCheck: [applyDetailInfo.merchantType, applyDetailInfo.settAccountType],
  });

// 只读组件信息
let dgpayRef = ref(null);

// 行业类型，地理位置回显
let codeBack = reactive({
  areaCode: "", // 商户地理位置回显
  mccCode: "", // 行业回显
  settAccountBankBranchAreaCode: "", // 银行开户地
});

// 合并信息方法, 职能读取，和信息回显，通过此方法合并
const assignObj = (obj) => {
  Object.assign(applyDetailInfo, obj);
  // 行业类型，地理位置回显
  codeBack.areaCode = obj.areaCode ? obj.areaCode[2] : null; // 省市区
  codeBack.mccCode = obj.mccCode; // mcc
  codeBack.settAccountBankBranchAreaCode = obj.settAccountBankBranchAreaCode
    ? obj.settAccountBankBranchAreaCode[2]
    : null; // 银行开户地

  // 公司类型   obj.xxx 用于只读信息页
  if (obj.entType)
    entText.value = ob.entText = entArray.find(
      (item) => item.value == obj.entType
    ).text;
  // 业务类型
  if (obj.cashType)
    cashText.value =
      obj.cashText =
      obj.cashText =
        cashArray.find((item) =>
          item.value == obj.cashType ? obj.cashType : ""
        ).text;
  // 手续费类型
  if (obj.selectFeeType)
    selectFeeText.value = obj.selectFeeText = selectFeeArray.find((item) =>
      item.value == obj.selectFeeType ? obj.selectFeeType : ""
    ).text;
  // 结算周期
  if (obj.settleCycle)
    settleCycleText.value = obj.settleCycleText = settleCycleArray.find(
      (item) => (item.value == obj.settleCycle ? obj.settleCycle : "")
    ).text;
  // 小微经营类型
  if (obj.microBizType)
    microBizText.value = obj.microBizText = microBizArray.find((item) =>
      item.value == obj.microBizType ? obj.microBizType : ""
    ).text;

  // 以下用于只读信息页
  if (isDisable.value) {
    for (var i = 0; i < mcc.length; i++) {
			// mcc码转文字
      let info = mcc[i].children.find((val) => val.value == obj.mccCode);
			info ? obj.mccText = info.text : ''
    }
		if (obj.aliFeeMcc) {
			// 支付宝商户经营类目码转文字
			obj.aliMccText = aliMcc.find(val => val.value == obj.aliFeeMcc).text
		}
		if (obj.cashType) {
			obj.cashText ? obj.cashText : (obj.cashText = "不设置");
		}
		if (obj.selectFeeType) {
			obj.selectFeeText ? obj.selectFeeText : (obj.selectFeeText = "不设置");
		}
    if (obj.settleCycle) {
			obj.settleCycleText ? obj.settleCycleText: (obj.settleCycleText = "不设置");
		}
    obj.areaText = tool.addressBack(obj.areaCode, address); // 地址码转文字
    obj.settAccountBankBranchAreaText = tool.addressBack(
      obj.settAccountBankBranchAreaCode,
      address
    ); // 开户银行所在地码转字
		if (obj.busiType) obj.busiTypeText = (obj.busiType == 1 ?  "实体" : "虚拟")
		
    // 传值给只读组件
    if (dgpayRef.value) dgpayRef.value.getApplyInof(obj);
  }
};

defineExpose({ launchApply, assignObj });

</script>

<style scoped lang="scss">
@import "../../static/information.scss";
</style>
