<!--
 * @Descripttion: 
 * @version: 
 * @Author: kBank
 * @Date: 2022-11-21 15:11:22
-->
<template>
	<view class="content">
		<u-popup :show="sucShow" closeable :round="10" mode="center" @close="sucShow= false">
			<view class="height-auto">
				<div  class="img_width">
          <rich-text :nodes="cause" :data-nodes="cause" @click="bigDetail" ></rich-text>
        </div>
      

				<div class="button-s" style="margin:50rpx auto" @click="checks(2)">{{ '重新提交' }}</div>
			</view>
		</u-popup>
		<view class="views" v-if="status == 3 || status==4 || status==5 || status==2">
			<div class="img_cen" v-if="status == 3">
				<div class="status-img">
					<image src="../../static/images/markerSpace/status2.png"></image>
				</div>
				<div class="status-size bolds">{{'认证审核中'}}</div>
				<div class="status-size">{{'预计3-5个工作日完成'}}</div>
				<div class="status-size">{{'客服咨询：400-111-2818'}}</div>
			</div>
			<div class="img_cen" v-if="status == 4">
				<div class="status-img">
					<image src="../../static/images/markerSpace/status1.png"></image>
				</div>
				<div class="status-size bolds">{{'认证被驳回(被驳回的原因)'}}</div>
				<div class="button-s" style="margin-top: 30px" @click="sucShow=true">{{ '查看原因' }}</div>
			</div>
			<div class="img_cen" v-if="status == 5">
				<div class="status-img">
					<image src="../../static/images/markerSpace/status3.png"></image>
				</div>
				<div class="status-size bolds">{{'恭喜您，完成经销商认证'}}</div>
				<div class="button-s" style="margin-top: 30px" @click="checks(1)">{{'查看详情'}}</div>
			</div>

		</view>
		<view class="markerSpce" v-if="status==1">
			<view class="tops">
				<view class="text">{{'下载《经销商合同》后打印，手签并填写合同后拍照留存，以备在申请时进行上传。'}}</view>
				<view class="button" @click="downloads">{{'下载经销商合同'}}</view>
				<a href="link"></a>
			</view>
			<u-form labelWidth="140px" :rules="rules" :model="table" ref="uForm">
				<view class="contents">
					<view class="lines-height">
						<view class="lines"></view>
						<view class="text_s">{{'基础信息'}}</view>
					</view>
					<view class="padding-s">
						<u-form-item :label="'会员编号'" :required="required1">
							<u-input v-model="memberCode" class="texts" :disabled=disabled1 placeholder=""
								border="none"></u-input>
						</u-form-item>
					</view>
					<view class="padding-s">
						<u-form-item :label="'会员姓名'" :required="required1">
							<u-input v-model="memberName" class="texts" :disabled="disabled1" placeholder=""
								border="none"></u-input>
						</u-form-item>
					</view>
					<view class="padding-s">
						<u-form-item :label="'营业执照名称'" :required="required1" prop="licenseName">
							<u-input v-model="table.licenseName" 
              maxlength="100"
              class="texts" placeholder-class="place"
								:disabled="disableds" :placeholder="'请输入'" border="none"></u-input>
						</u-form-item>
					</view>
					<view class="padding-s">
						<u-form-item :label="'统一社会信用代码'" :required="required1" prop="creditCode">
							<u-input v-model="table.creditCode" class="texts" placeholder-class="place"
								:disabled="disableds" 
                maxlength="100"
                :placeholder="'请输入'" border="none"></u-input>
						</u-form-item>
					</view>
					<view class="padding-s">
						<u-form-item :label="'法人姓名'" :required="required1" prop="legalName">
							<u-input v-model="table.legalName" class="texts" placeholder-class="place"
								:disabled="disableds" :placeholder="'请输入'" border="none"></u-input>
						</u-form-item>
					</view>
					<view class="padding-s">
						<u-form-item :label="'法人身份证号'" :required="required1" prop="legalIdCard">
							<u-input v-model="table.legalIdCard" class="texts" placeholder-class="place"
								:disabled="disableds" :placeholder="'请输入'" border="none"></u-input>
						</u-form-item>
					</view>
					<view class="padding-s" @click="getDiqu(1)">
						<u-form-item :label="'营业执照注册地址'" :required="required1">
							<view style="padding-left: 20rpx;color: rgb(192, 196, 204)" v-if="address==''">请选择营业执照地址
							</view>
							<view style="padding-left: 20rpx;color: #333" v-else>{{address}}</view>
						</u-form-item>
						<view class="right-icon">
							<u-icon name="arrow-right" color="#090000"></u-icon>
						</view>
					</view>
					<view class="padding-s">
						<u-form-item :label="'详细地址'" :required="required1" prop="licenseAddress">
							<u-input v-model="table.licenseAddress"
              maxlength="200"
              class="texts" placeholder-class="place"
								:disabled="disableds" :placeholder="'请输入'" border="none"></u-input>
						</u-form-item>
					</view>
					<view class="padding-s">
						<u-form-item :label="'联系人'" :required="required1" prop="storePerson">
							<u-input v-model="table.storePerson" class="texts" placeholder-class="place"
								:disabled="disableds" :placeholder="'请输入'" border="none"></u-input>
						</u-form-item>
					</view>
					<view class="padding-s">
						<u-form-item :label="'联系方式'" :required="required1" prop="storePhone">
							<u-input v-model="table.storePhone" class="texts" placeholder-class="place"
								:disabled="disableds" :placeholder="'请输入'" border="none"></u-input>
						</u-form-item>
					</view>
					<view class="padding-s" @click="getDiqu1(2)">
						<u-form-item :label="'详细地址'" :required="required1">
							<view style="padding-left: 20rpx;color: rgb(192, 196, 204)" v-if="address1==''">请选择详细地址
							</view>
							<view style="padding-left: 20rpx;color: #333" v-else>{{address1}}</view>
						</u-form-item>
						<view class="right-icon">
							<u-icon name="arrow-right" color="#090000"></u-icon>
						</view>
					</view>
					<view class="padding-s">
						<u-form-item :label="'详细地址'" :required="required1" prop="storeAddress">
							<u-input v-model="table.storeAddress" 
              maxlength="200"
              class="texts" placeholder-class="place"
								:disabled="disableds" :placeholder="'请输入'" border="none"></u-input>
						</u-form-item>
					</view>
					<picker :value="table.pkBank" :disabled="disableds" mode="selector" @change="bindDateChange1"
						:range="bankCardChioceList" range-key="bankName">
						<view class="padding-s">
							<u-form-item :label="'银行名称'" :required="required1">
								<view style="padding-left: 20rpx;color: rgb(192, 196, 204)" v-if="bankName==''">请选择银行名称
								</view>
								<view v-else-if="bankName!=''" style="margin-left: 20rpx;">
									{{bankName}}
								</view>
							</u-form-item>
							<view class="right-icon">
								<u-icon name="arrow-right" color="#090000"></u-icon>
							</view>
						</view>
					</picker>
					<view class="padding-s">
						<u-form-item :label="'银行账号'" :required="required1" prop="bankAccount">
							<u-input v-model="table.bankAccount" class="texts" placeholder-class="place"
								:disabled="disableds" :placeholder="'请输入'" border="none"></u-input>
						</u-form-item>
					</view>
					<view class="padding-s">
						<u-form-item :label="'开户支行'" :required="required1" prop="bankBranch">
							<u-input v-model="table.bankBranch" class="texts" placeholder-class="place"
								:disabled="disableds" :placeholder="'请输入'" border="none"></u-input>
						</u-form-item>
					</view>
					<view style="height:25rpx;background-color: #f2f2f2;"></view>
					<view class="lines-height">
						<view class="lines"></view>
						<view class="text_s">{{'资质材料'}}</view>
					</view>
					<view class="height">
						<u-form-item :label="'法人身份证正反面'" :required="required1">

						</u-form-item>
						<view class="text">{{'建议：图片大小为1MB以内'}}</view>
						<view class="upload-content">
							<view class="content_s">
								<view>
									<image @click="updateImg(11)" v-if="isEmpty(table.legalCardFront)==true"
										class="img-width" style="width: 200rpx;height: 150rpx;"
										src="@/static/images/markerSpace/idCard-img1.png" />

									<view class="upload-img" style="width: 200rpx;" v-else>
										<image class="img-width" style="width: 200rpx;height: 150rpx;"
											:src="table.legalCardFront"></image>
										<view class="close-icon" @click="delStops('legalCardFront', 11)"
											v-if="isEmpty(table.legalCardFront)==false">
											<u-icon name="close"></u-icon>
										</view>
									</view>
								</view>
								<view>
									<image @click="updateImg(12)" v-if="isEmpty(table.legalCardBack)==true"
										class="img-width" style="width: 200rpx;height: 150rpx;margin-left: 30rpx;"
										src="@/static/images/markerSpace/idCard-img2.png" />

									<view class="upload-img" v-else style="width: 200rpx;margin-left: 30rpx;">
										<image class="img-width" style="width: 200rpx;height: 150rpx; "
											:src="table.legalCardBack"></image>
										<view class="close-icon" @click="delStops('legalCardBack', 12)"
											v-if="isEmpty(table.legalCardBack)==false">
											<u-icon name="close"></u-icon>
										</view>
									</view>
								</view>
							</view>
							<view class="text-s">
								<view class="text-colors" v-for="item in tips1">
									{{item}}
								</view>
							</view>
						</view>
					</view>
					<view class="height">
						<u-form-item :label="'营业执照'" :required="required1">

						</u-form-item>
						<view class="text">{{'建议：图片大小为1MB以内'}}</view>
						<view class="upload-content">
							<view class="content_s">
								<view>
									<view class="upload" @click="updateImg(13)" v-if="isEmpty(table.license)==true">
										<u-icon name="plus"></u-icon>
									</view>
									<view class="upload-img" v-else>
										<image class="img-width" :src="table.license"></image>
										<view class="close-icon" @click="delStops('license', 13)"
											v-if="isEmpty(table.license)==false">
											<u-icon name="close"></u-icon>
										</view>
									</view>
								</view>
							</view>
							<view class="text-s">
								<view class="text-colors" v-for="item in tips1">
									{{item}}
								</view>
							</view>
						</view>
					</view>
					<view class="height">
						<u-form-item :label="'上传已签字的经销商协议'" label-width="200px" :required="required1">
						</u-form-item>
						<view class="text">{{'建议：图片大小为200KB以内'}}</view>
						<view class="upload-content">
							<view class="content_s">
								<view style="display: flex;flex-wrap: wrap;">
									<view class="upload-img" v-for="(item,index) in table.storeAgreementList">
										<image class="img-width" :src="item"></image>
										<view class="close-icon" @click="delStop(index)" v-if="isEmpty(item)">
											<u-icon name="close"></u-icon>
										</view>
									</view>
									<view class="upload"
										:style="table.storeAgreementList.length>=4?'margin-left:10px':''"
										@click="updateImgs(14)">
										<u-icon name="plus"></u-icon>
									</view>
								</view>
							</view>
							<view class="text-s">
								<view class="text-colors" v-for="item in tips1">
									{{item}}
								</view>
							</view>
						</view>
					</view>
					<!--		<view class="height">-->
					<!--		  <u-form-item label="门店视频(0/3)"  :required="required1">-->
					<!--			-->
					<!--		  </u-form-item>	-->
					<!--		 <view class="text">建议:视频大小为5MB以内</view> -->
					<!--		<view class="upload-content">-->
					<!--		<view class="content_s">-->
					<!--			<view>-->
					<!--				<view class="upload" @click="updateVideo(1)" v-if="table.videoDoorhead ==''">-->
					<!--						<u-icon name="plus"></u-icon>-->
					<!--						<view class="text-tips">-->
					<!--							门头展示-->
					<!--						</view>-->
					<!--				</view>-->
					<!--				<view class="upload-img" v-else>-->
					<!--					<video class="img-width" :src="table.videoDoorhead"></video>-->
					<!--					<view class="close-icon"  @click="delStops('videoDoorhead', 1)">-->
					<!--						<u-icon name="close"></u-icon>-->
					<!--					</view>-->
					<!--				</view>-->
					<!--			</view>-->
					<!--			<view>-->
					<!--				<view class="upload" @click="updateVideo(2)" v-if="table.videoStore==''">-->
					<!--						<u-icon name="plus"></u-icon>-->
					<!--						<view class="text-tips">-->
					<!--							店内视频-->
					<!--						</view>-->
					<!--				</view>-->
					<!--				<view class="upload-img" v-else>-->
					<!--					<video class="img-width" :src="table.videoStore"></video>					-->
					<!--					<view class="close-icon"  @click="delStops('videoStore', 2)">-->
					<!--						<u-icon name="close"></u-icon>-->
					<!--					</view>-->
					<!--				</view>-->
					<!--			</view>-->
					<!--			<view>-->
					<!--				<view class="upload" @click="updateVideo(3)" v-if="table.videoProduct==''">-->
					<!--						<u-icon name="plus"></u-icon>-->
					<!--						<view class="text-tips">-->
					<!--							产品展示视频-->
					<!--						</view>-->
					<!--				</view>-->
					<!--				<view class="upload-img" v-else>	-->
					<!--					<video class="img-width" :src="table.videoProduct"></video>		-->
					<!--					<view class="close-icon"  @click="delStops('videoProduct', 3)">-->
					<!--						<u-icon name="close"></u-icon>-->
					<!--					</view>-->
					<!--				</view>-->
					<!--			</view>-->
					<!--		</view>-->
					<!--		<view class="text-s">-->
					<!--			<view class="text-colors" v-for="item in tips2">-->
					<!--				{{item}}-->
					<!--			</view>-->
					<!--			</view>-->
					<!--		</view>-->
					<!--		</view>-->
					<!--		<view class="height">-->
					<!--		  <u-form-item label="门店图片(0/10)" label-width="200px" :required="required1">-->
					<!--		  </u-form-item>	-->
					<!--		 <view class="text">建议:图片大小为200KB以内</view> -->
					<!--		<view class="upload-content">-->
					<!--		<view class="content_s" style="display: flex;flex-wrap: wrap;">-->
					<!--			<view>-->
					<!--				<view class="upload" @click="updateImg(21)" v-if="table.imageDoorhead1==''">-->
					<!--						<u-icon name="plus"></u-icon>-->
					<!--						<view class="text-tips">-->
					<!--							门头展示-->
					<!--						</view>-->
					<!--				</view>-->
					<!--				<view class="upload-img" v-else>-->
					<!--					<image class="img-width" :src="table.imageDoorhead1"></image>-->
					<!--					<view class="close-icon"  @click="delStops('imageDoorhead1', 21)">-->
					<!--						<u-icon name="close"></u-icon>-->
					<!--					</view>-->
					<!--				</view>-->
					<!--			</view>-->
					<!--			<view>-->
					<!--				<view class="upload" @click="updateImg(23)" v-if="table.imageExperience1==''">-->
					<!--						<u-icon name="plus"></u-icon>-->
					<!--						<view class="text-tips">-->
					<!--							体验区-->
					<!--						</view>-->
					<!--				</view>-->
					<!--				<view class="upload-img" v-else>-->
					<!--					<image class="img-width" :src="table.imageExperience1"></image>-->
					<!--					<view class="close-icon"  @click="delStops('imageExperience1', 23)">-->
					<!--						<u-icon name="close"></u-icon>-->
					<!--					</view>-->
					<!--				</view>-->
					<!--			</view>-->
					<!--			<view>-->
					<!--				<view class="upload" @click="updateImg(25)" v-if="table.imageMeeting1==''">-->
					<!--						<u-icon name="plus"></u-icon>-->
					<!--						<view class="text-tips">-->
					<!--							会议室-->
					<!--						</view>-->
					<!--				</view>-->
					<!--				<view class="upload-img" v-else>-->
					<!--					<image class="img-width" :src="table.imageMeeting1"></image>-->
					<!--					<view class="close-icon"  @click="delStops('imageMeeting1', 25)">-->
					<!--						<u-icon name="close"></u-icon>-->
					<!--					</view>-->
					<!--				</view>-->
					<!--			</view>-->
					<!--			<view>-->
					<!--				<view class="upload" @click="updateImg(27)" v-if="table.imageProduct1==''">-->
					<!--						<u-icon name="plus"></u-icon>-->
					<!--						<view class="text-tips">-->
					<!--							产品展示区-->
					<!--						</view>-->
					<!--				</view>-->
					<!--				<view class="upload-img" v-else>-->
					<!--					<image class="img-width" :src="table.imageProduct1"></image>-->
					<!--					<view class="close-icon"  @click="delStops('imageProduct1', 27)">-->
					<!--						<u-icon name="close"></u-icon>-->
					<!--					</view>-->
					<!--				</view>-->
					<!--			</view>-->
					<!--			<view>-->
					<!--				<view class="upload" @click="updateImg(22)" v-if="table.imageDoorhead2==''">-->
					<!--						<u-icon name="plus"></u-icon>-->
					<!--						<view class="text-tips">-->
					<!--							门头展示-->
					<!--						</view>-->
					<!--				</view>-->
					<!--				<view class="upload-img" v-else>-->
					<!--					<image class="img-width" :src="table.imageDoorhead2"></image>-->
					<!--					<view class="close-icon"  @click="delStops('imageDoorhead2', 22)">-->
					<!--						<u-icon name="close"></u-icon>-->
					<!--					</view>-->
					<!--				</view>-->
					<!--			</view>-->
					<!--			<view>-->
					<!--				<view class="upload" @click="updateImg(24)" v-if="table.imageExperience2==''">-->
					<!--						<u-icon name="plus"></u-icon>-->
					<!--						<view class="text-tips">-->
					<!--							体验区-->
					<!--						</view>-->
					<!--				</view>-->
					<!--				<view class="upload-img" v-else>-->
					<!--					<image class="img-width" :src="table.imageExperience2"></image>-->
					<!--					<view class="close-icon"  @click="delStops('imageExperience2', 24)">-->
					<!--						<u-icon name="close"></u-icon>-->
					<!--					</view>-->
					<!--				</view>-->
					<!--			</view>-->
					<!--			<view>-->
					<!--				<view class="upload" @click="updateImg(26)" v-if="table.imageMeeting2==''">-->
					<!--						<u-icon name="plus"></u-icon>-->
					<!--						<view class="text-tips">-->
					<!--							会议室-->
					<!--						</view>-->
					<!--				</view>-->
					<!--				<view class="upload-img" v-else>-->
					<!--					<image class="img-width" :src="table.imageMeeting2"></image>-->
					<!--					<view class="close-icon"  @click="delStops('imageMeeting2', 26)">-->
					<!--						<u-icon name="close"></u-icon>-->
					<!--					</view>-->
					<!--				</view>-->
					<!--			</view>-->
					<!--			<view>-->
					<!--				<view class="upload" @click="updateImg(28)" v-if="table.imageProduct2==''">-->
					<!--						<u-icon name="plus"></u-icon>-->
					<!--						<view class="text-tips">-->
					<!--							产品展示区-->
					<!--						</view>-->
					<!--				</view>-->
					<!--				<view class="upload-img" v-else>-->
					<!--					<image class="img-width" :src="table.imageProduct2"></image>-->
					<!--					<view class="close-icon"  @click="delStops('imageProduct2', 28)">-->
					<!--						<u-icon name="close"></u-icon>-->
					<!--					</view>-->
					<!--				</view>-->
					<!--			</view>-->
					<!--			<view>-->
					<!--				<view class="upload" @click="updateImg(29)" v-if="table.imageLounge1==''">-->
					<!--						<u-icon name="plus"></u-icon>-->
					<!--						<view class="text-tips">-->
					<!--							休息室-->
					<!--						</view>-->
					<!--				</view>-->
					<!--				<view class="upload-img" v-else>-->
					<!--					<image class="img-width" :src="table.imageLounge1"></image>-->
					<!--					<view class="close-icon"  @click="delStops('imageLounge1', 29)">-->
					<!--						<u-icon name="close"></u-icon>-->
					<!--					</view>-->
					<!--				</view>-->
					<!--			</view>-->
					<!--			<view>-->
					<!--				<view class="upload" @click="updateImg(30)" v-if="table.imageLounge2==''">-->
					<!--						<u-icon name="plus"></u-icon>-->
					<!--						<view class="text-tips">-->
					<!--							休息室-->
					<!--						</view>-->
					<!--				</view>-->
					<!--				<view class="upload-img" v-else>-->
					<!--					<image class="img-width" :src="table.imageLounge2"></image>-->
					<!--					<view class="close-icon"  @click="delStops('imageLounge2', 30)">-->
					<!--						<u-icon name="close"></u-icon>-->
					<!--					</view>-->
					<!--				</view>-->
					<!--			</view>-->
					<!--		</view>-->
					<!--		<view class="text-s">-->
					<!--			<view class="text-colors" v-for="item in tips1">-->
					<!--				{{item}}-->
					<!--			</view>-->
					<!--			</view>-->
					<!--		</view>-->
					<!--		</view>-->

				</view>
				<view class="submit" v-if="status == 1 && status_flag==true" @click="submit">{{text}}</view>

				<v-address ref="address" @getAddressData="AddressData" :defaultCode="defaultCode"
					@addressData="addressData"></v-address>

			</u-form>
			<v-address-s ref="address1" @getAddressData1="AddressData1" :defaultCode="defaultCode1"
				@addressData1="addressData1">

			</v-address-s>
		</view>
	</view>
</template>

<script>
	import * as api from '@/config/approve.js'
	import address from '@/components/addressMarket.vue'
	import address1 from '@/components/setAddressMarket.vue'
	import {
		getToken,
		removeToken
	} from '@/config/auth.js'
	export default {
		data() {
			return {
				addressIndex: null,
				status_flag: true,
				cause: '', //驳回原因
				sucShow: false,
				required1: true,
				disabled1: true,
				defaultCode: [],
				defaultCode1: [],
				tips1: [`${'支持'}：jpg,png`, '上传图片不要光线太暗', '要清晰不能虚化，并且满画布显示，要保证亮要充足。'],
				tips2: ['视频格式仅支持mp4', '建议：上传视频要清晰不能虚化，要保证亮要充足。'],
				text: '提交认证',
				bankName: '',
				disableds: false,
				storeTypes: 3,
				memberCode: '',
				memberName: '',
				storeLevelVal: '',
				show1: false,
				status: null, //0未上传过 1已上传正在系统审核 2审核已成功只能查看无法编辑 3审核被驳回
				table: {
					storeType: 3,
					status: 0,
					storeName: "", //名称
					storeLevelVal: "", //经销商等级
					licenseName: "", //营业执照名称
					creditCode: "", //统一社会信用代码
					legalName: "", //法人姓名
					legalIdCard: "", //法人身份证号
					licenseProvince: "", //营业执照省
					licenseCity: "", //营业执照市
					licenseCounty: "", //营业执照区
					licenseAddress: "", //营业执照详细地址
					storePerson: "", //联系人
					storePhone: "", //联系方式
					pkBank: "", //银行名称
					bankAccount: "", //银行账号
					storeProvince: "", //省
					storeCity: "", //市
					storeCounty: "", //区
					storeAddress: "", //详细地址
					storeSign: "", // 经销商标志
					legalCardFront: "", //法人身份证正面
					legalCardBack: "", // 法人身份证反面
					license: "", // 营业执照
					storeAgreementList: [], // 协议列表
					videoDoorhead: "", // 门店门头视频
					videoStore: "", // 门店店内视频
					videoProduct: "", // 门店产品视频
					imageDoorhead1: "", // 门店门头图片1
					imageDoorhead2: "", // 门店门头图片2
					imageExperience1: "", // 门店体验区图片1
					imageExperience2: "", // 门店体验区图片2
					imageMeeting1: "", // 门店会议室图片1
					imageMeeting2: "", // 门店会议室图片2
					imageProduct1: "", // 门店产品图片1
					imageProduct2: "", // 门店产品图片2
					imageLounge1: "", // 门店休息室图片1
					imageLounge2: "", // 门店休息室图片2
					bankBranch: "", //开户支行
				},
				address: '', //营业执照地址
				address1: '', //详细地址
				bankCardChioceList: [],
				rules: {
					storeName: [{
						required: true,
						message: '请输入',
						trigger: "blur"
					}, ],
					licenseName: [{
						required: true,
						message: '请输入',
						trigger: "blur"
					}, ],
					creditCode: [{
						required: true,
						message: '请输入',
						trigger: "blur"
					}, ],
					legalName: [{
						required: true,
						message: '请输入',
						trigger: "blur"
					}, ],
					legalIdCard: [{
						required: true,
						message: '请输入',
						trigger: "blur"
					}, ],
					licenseProvince: [{
						required: true,
						message: '请选择',
						trigger: ['blur', 'change']
					}, ],
					licenseAddress: [{
						required: true,
						message: '请输入',
						trigger: "blur"
					}, ],
					storeAddress: [{
						required: true,
						message: '请输入',
						trigger: "blur"
					}, ],
					storeProvince: [{
						required: true,
						message: '请选择',
						trigger: ['blur', 'change']
					}, ],
					pkBank: [{
						required: false,
						message: '请选择',
						trigger: ['blur', 'change']
					}, ],
					bankAccount: [{
						required: true,
						message: '请输入',
						trigger: "blur"
					}, ],
					bankBranch: [{
						required: true,
						message: '请输入',
						trigger: "blur"
					}, ],
					storePerson: [{
						required: true,
						message: '请输入',
						trigger: "blur"
					}, ],
					storePhone: [{
							required: true,
							message: '请输入联系方式',
							trigger: 'blur',
						},
						{
							min: 11,
							message: '请输入正确的手机号',
							trigger: 'blur'
						},
					],
					storeSign: [{
						required: true,
						message: " ",
						trigger: "blur"
					}, ],
				},
				dataList: {},
			}
		},
		onLoad() {
			this.getBankList()
			this.getUserStatus();
		},
		components: {
			'v-address': address,
			'v-address-s': address1,
		},
		onReady() {
			this.$refs.uForm.setRules(this.rules);
		},
		methods: {
			AddressData(name) {
				this.address = name
			},
			AddressData1(name) {
				console.error("00")
				this.address1 = name
			},
			checks(check) {
				if (check == 1) {
					this.status = 1
					this.flags = 0
					this.disableds = true
					this.text = '重新认证'
					this.status_flag = false

				}
				if (check == 2) {
					this.text = '提交认证'
					this.status = 1
					this.flags = 0
					this.disableds = false
					this.sucShow = false
				}
			},
      // 富文本查看大图
      bigDetail(e){
        let contentimg = e.target.dataset.nodes;
        let imgs = contentimg.match(/<img[^>]+>/g);
        let arrImg=[];
        for(var i=0;i<imgs.length;i++){
          imgs[i].replace(/<img[^>]*src=['"]([^'"]+)[^>]*>/gi,function(match,capture){
            arrImg.push(capture)
          })
        }
        uni.previewImage({
          current:0,
          urls:arrImg,
        })
      },

			getUserStatus() {
				api.makerSpaceDetail({
					storeType: this.storeTypes
				}).then((res) => {
					this.dataList = res.data
					this.memberCode = res.data.memberCode;
					this.memberName = res.data.memberName;
					this.storeLevelVal = res.data.storeLevelVal;
					if (res.data.applyStatus == undefined) {
						this.status = 1
					} else {
						this.status = res.data.applyStatus
						// this.cause = res.data.rejectMsg
            const regex = new RegExp('<img', 'gi')
          this.cause = res.data.rejectMsg.replace(
            regex,
            `<img  style="max-width: 200px;"`
          )
						this.status1 = res.data.applyStatus
						if (res.data.applyStatus != 0) {
							this.flags = 1;
						}
						if (res.data.applyTime) {
							this.creatTime = res.data.applyTime
						}
						if (res.data.approveTime) {
							this.checkTime = res.data.approveTime
						}
						if (this.status > 0) {
							let arr = [];
							let arr1 = [];
							if (res.data.storeProvince) {
								arr1.push(res.data.storeProvince.toString())
								arr1.push(res.data.storeCity.toString())
								if (res.data.storeCounty) {
									arr1.push(res.data.storeCounty.toString())
								}
							}
							if (res.data.licenseProvince) {
								arr.push(res.data.licenseProvince.toString())
								arr.push(res.data.licenseCity.toString())
								if (res.data.licenseCounty) {
									arr.push(res.data.licenseCounty.toString())
								}
							}
							this.defaultCode = [
								res.data.licenseProvince,
								res.data.licenseCity,
								res.data.licenseCounty || '',
							]
							this.defaultCode1 = [
								res.data.storeProvince,
								res.data.storeCity,
								res.data.storeCounty || '',
							]
							setTimeout(() => {
								this.bankCardChioceList.forEach((item) => {
									if (item.pkId == res.data.pkBank) {
										this.bankName = item.bankName
									}
								})
							}, 50)
							this.address = arr //营业执照省市区
							this.address1 = arr1 //联系人省市区
							this.table = {
								storeType: res.data.storeType,
								storeName: res.data.storeName, //名称
								storeLevelVal: res.data.storeLevelVal, //经销商等级
								licenseName: res.data.licenseName, //营业执照名称
								creditCode: res.data.creditCode, //统一社会信用代码
								legalName: res.data.legalName, //法人姓名
								legalIdCard: res.data.legalIdCard, //法人身份证号
								licenseProvince: res.data.licenseProvince, //营业执照省
								licenseCity: res.data.licenseCity, //营业执照市
								licenseCounty: res.data.licenseCounty, //营业执照区
								licenseAddress: res.data.licenseAddress, //营业执照详细地址
								storePerson: res.data.storePerson, //联系人
								storePhone: res.data.storePhone, //联系方式
								pkBank: res.data.pkBank, //银行名称
								bankAccount: res.data.bankAccount, //银行账号
								storeProvince: res.data.storeProvince, //省
								storeCity: res.data.storeCity, //市
								storeCounty: res.data.storeCounty, //区
								storeAddress: res.data.storeAddress, //详细地址
								storeSign: res.data.storeSign ? res.data.storeSign : '', // 经销商标志
								legalCardFront: res.data.legalCardFront, //法人身份证正面
								legalCardBack: res.data.legalCardBack, // 法人身份证反面
								license: res.data.license, // 营业执照
								storeAgreementList: res.data.storeAgreementList || [], // 协议列表
								videoDoorhead: res.data.videoDoorhead, // 门店门头视频
								videoStore: res.data.videoStore, // 门店店内视频
								videoProduct: res.data.videoProduct, // 门店产品视频
								imageDoorhead1: res.data.imageDoorhead1, // 门店门头图片1
								imageDoorhead2: res.data.imageDoorhead2, // 门店门头图片2
								imageExperience1: res.data.imageExperience1, // 门店体验区图片1
								imageExperience2: res.data.imageExperience2, // 门店体验区图片2
								imageMeeting1: res.data.imageMeeting1, // 门店会议室图片1
								imageMeeting2: res.data.imageMeeting2, // 门店会议室图片2
								imageProduct1: res.data.imageProduct1, // 门店产品图片1
								imageProduct2: res.data.imageProduct2, // 门店产品图片2
								imageLounge1: res.data.imageLounge1, // 门店休息室图片1
								imageLounge2: res.data.imageLounge2, // 门店休息室图片2
								bankBranch: res.data.bankBranch //支行
							}
						}
					}
				});
			},
			isEmpty(v) {
				switch (typeof v) {
					case 'undefined':
						return true;
					case 'string':
						if (v.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
						break;
					case 'boolean':
						if (!v) return true;
						break;
					case 'number':
						if (0 === v || isNaN(v)) return true;
						break;
					case 'object':
						if (null === v || v.length === 0) return true;
						for (var i in v) {
							return false;
						}
						return true;
				}
				return false;
			},
			submit() {
				let that = this
				this.$refs.uForm.validate().then((res) => {
					if (this.isEmpty(this.bankName) == true) {
						uni.showToast({
							icon: "none",
							title:'请选择'
						})
						return
					}
					if (this.isEmpty(this.address) == true) {
						uni.showToast({
							icon: "none",
							title:'请选择'
						})
						return
					}
					if (this.isEmpty(this.address1) == true) {
						uni.showToast({
							icon: "none",
						title:'请选择'
						})
						return
					}
					// if(this.isEmpty(this.table.storeSign)==true){
					// 	uni.showToast({
					// 		icon:"none",
					// 		title:"请上传超级工作室标志图片"
					// 	})
					// 	return
					// }
					if (this.isEmpty(this.table.legalCardFront) == true) {
						uni.showToast({
							icon: "none",
								title:'请上传'
						})
						return
					}
					if (this.isEmpty(this.table.legalCardBack)) {
						uni.showToast({
							icon: "none",
								title:'请上传'
						})
						return
					}
					if (this.isEmpty(this.table.license) == true) {
						uni.showToast({
							icon: "none",
								title:'请上传'
						})
						return
					}
					if (this.table.storeAgreementList.length == 0) {
						uni.showToast({
							icon: "none",
							title:'请上传'
						})
						return
					}
					// }
					// if(this.isEmpty(this.table.videoDoorhead)==true){
					// 	uni.showToast({
					// 		icon:"none",
					// 		title:"请上传门店门头视频"
					// 	})
					// 	return
					// }
					// if(this.isEmpty(this.table.videoStore)==true){
					// 	uni.showToast({
					// 		icon:"none",
					// 		title:"请上传门店店内视频"
					// 	})
					// 	return
					// }
					// if(this.isEmpty(this.table.videoProduct)==true){
					// 	uni.showToast({
					// 		icon:"none",
					// 		title:"请上传门店产品视频"
					// 	})
					// 	return
					// }
					// if(this.isEmpty(this.table.imageDoorhead1)==true){
					// 	uni.showToast({
					// 		icon:"none",
					// 		title:"请上传门店门头图片1"
					// 	})
					// 	return
					// }
					// if(this.isEmpty(this.table.imageDoorhead2)==true){
					// 	uni.showToast({
					// 		icon:"none",
					// 		title:"请上传门店门头图片2"
					// 	})
					// 	return
					// }
					// if(this.isEmpty(this.table.imageExperience1)==true){
					// 	uni.showToast({
					// 		icon:"none",
					// 		title:"请上传门店体验区图片1"
					// 	})
					// 	return
					// }
					// if(this.isEmpty(this.table.imageExperience2)==true){
					// 	uni.showToast({
					// 		icon:"none",
					// 		title:"请上传门店体验区图片2"
					// 	})
					// 	return
					// }
					// if(this.isEmpty(this.table.imageMeeting1)==true){
					// 	uni.showToast({
					// 		icon:"none",
					// 		title:"请上传门店会议室图片1"
					// 	})
					// 	return
					// }
					// if(this.isEmpty(this.table.imageMeeting2)==true){
					// 	uni.showToast({
					// 		icon:"none",
					// 		title:"请上传门店会议室图片2"
					// 	})
					// 	return
					// }
					// if(this.isEmpty(this.table.imageProduct1)==true){
					// 	uni.showToast({
					// 		icon:"none",
					// 		title:"请上传门店产品图片1"
					// 	})
					// 	return
					// }
					// if(this.isEmpty(this.table.imageProduct2)==true){
					// 	uni.showToast({
					// 		icon:"none",
					// 		title:"请上传门店产品图片2"
					// 	})
					// 	return
					// }
					//
					// if(this.isEmpty(this.table.imageLounge1)==true){
					// 	uni.showToast({
					// 		icon:"none",
					// 		title:"请上传门店休息室图片1"
					// 	})
					// 	return
					// }
					// if(this.isEmpty(this.table.imageLounge2)==true){
					// 	uni.showToast({
					// 		icon:"none",
					// 		title:"请上传门店休息室图片2"
					// 	})
					// 	return
					// }
					api.submit(this.table).then((res) => {
						if (res.code == '200') {
							uni.showToast({
								icon: "none",
								title: res.msg
							})
							that.getUserStatus();
							that.$forceUpdate()
						}
					})
				})
			},
			delStop(index) {
				if (this.disableds == true) {
					return
				}
				let data = {
					storeType: this.storeTypes,
					filePath: this.table.storeAgreementList[index],
					fileType: 14,
				};
				api.deleteFile(
					`?storeType=${this.storeTypes}&filePath=${this.table.storeAgreementList[index]}&fileType=14`).then(
					(res) => {
						if (res.code == "200") {
							this.table.storeAgreementList.splice(index, 1);
							this.$message({
								message: res.msg,
								type: "success",
							});
						}
					});
			},
			delStops(item, num) {
				if (this.disableds == true) {
					return
				}
				const time = item;
				let data = {
					storeType: this.storeTypes,
					filePath: this.table[item],
					fileType: num,
				};
				api.deleteFile(`?storeType=${this.storeTypes}&filePath=${this.table[item]}&fileType=${num}`).then((
				res) => {
					if (res.code == "200") {
						this.table[item] = "";
						uni.showToast({
							icon: "none",
							title: res.msg
						})
					}
				});
			},
			// 上传多张图片
			updateImgs(types) {
				if (this.disableds == true) {
					return
				}
				const http = uni.$u.http.config.baseURL
				let token = getToken();
				let type = this.storeTypes
				uni.chooseImage({
					sourceType: ['album'], //从相册选择
					success: chooseImageRes => {
						const tempFilePaths = chooseImageRes.tempFilePaths;
						uni.uploadFile({
							url: http +
								`/member/api/maker-space/update-file?storeType=${type}&fileType=${types}`,
							filePath: tempFilePaths[0],
							name: 'file',
							header: {
								Authorization: token
							},
							success: res => {
								if (res.statusCode == 200) {
									let data = JSON.parse(res.data)
									this.table.storeAgreementList.push(data.data.url)
									console.error(this.table.storeAgreementList)
								}
							}
						});
					},
					fail: err => {
						this.myToast('图片上传失败', 'none');
					}
				});
			},
			// 上传单张图片
			updateImg(types) {
				if (this.disableds == true) {
					return
				}
				const http = uni.$u.http.config.baseURL
				let token = getToken();
				let type = this.storeTypes
				uni.chooseImage({
					sourceType: ['album'], //从相册选择
					success: chooseImageRes => {
						const tempFilePaths = chooseImageRes.tempFilePaths;
						uni.uploadFile({
							url: http +
								`/member/api/maker-space/update-file?storeType=${type}&fileType=${types}`,
							filePath: tempFilePaths[0],
							name: 'file',
							header: {
								Authorization: token
							},
							success: res => {
								if (res.statusCode == 200) {
									let data = JSON.parse(res.data)
									switch (types) {
										case 10:
											this.table.storeSign = data.data.url
											break;
										case 11:
											this.table.legalCardFront = data.data.url
											break;
										case 12:
											this.table.legalCardBack = data.data.url
											break;
										case 13:
											this.table.license = data.data.url
											break;
										case 21:
											this.table.imageDoorhead1 = data.data.url
											break;
										case 22:
											this.table.imageDoorhead2 = data.data.url
											break;
										case 23:
											this.table.imageExperience1 = data.data.url
											break;
										case 24:
											this.table.imageExperience2 = data.data.url
											break;
										case 25:
											this.table.imageMeeting1 = data.data.url
											break;
										case 26:
											this.table.imageMeeting2 = data.data.url
											break;
										case 27:
											this.table.imageProduct1 = data.data.url
											break;
										case 28:
											this.table.imageProduct2 = data.data.url
											break;
										case 29:
											this.table.imageLounge1 = data.data.url
											break;
										case 30:
											this.table.imageLounge2 = data.data.url
											break;
									}
								}
							}
						});
					},
					fail: err => {
						this.myToast('图片上传失败', 'none');
					}
				});
			},
			// 上传视频
			updateVideo(types) {
				if (this.disableds == true) {
					return
				}
				const http = uni.$u.http.config.baseURL
				let token = getToken();
				let type = this.storeTypes
				uni.chooseVideo({
					sourceType: ['camera', 'album'],
					success: chooseImageRes => {
						const tempFilePaths = chooseImageRes;
						// console.error(tempFilePaths.tempFilePath)
						uni.uploadFile({
							url: http +
								`/member/api/maker-space/update-file?storeType=${type}&fileType=${types}`,
							filePath: tempFilePaths.tempFilePath,
							name: 'file',
							header: {
								Authorization: token
							},
							success: res => {
								if (res.statusCode == 200) {
									let data = JSON.parse(res.data)
									switch (types) {
										case 1:
											this.table.videoDoorhead = data.data.url
											break;
										case 2:
											this.table.videoStore = data.data.url
											break;
										case 3:
											this.table.videoProduct = data.data.url
											break;
									}
								}
							}
						});
					},
					fail: err => {
						this.myToast('图片上传失败', 'none');
					}
				});
			},
			bindDateChange1(e) {
				if (this.disableds == true) {
					return
				}
				let value = e.detail.value
				this.bankName = this.bankCardChioceList[value].bankName
				this.table.pkBank = this.bankCardChioceList[value].pkId
			},
			getBankList() {
				api.getBankLists().then((res) => {
					this.bankCardChioceList = res.data
				})
			},
			addressData(diqu, obj) {
				this.address = diqu
				this.table.licenseProvince = obj.province
				this.table.licenseCity = obj.city
				this.table.licenseCounty = obj.county
				this.$forceUpdate()
			},
			addressData1(diqu, obj) {
				this.address1 = diqu
				this.table.storeProvince = obj.province
				this.table.storeCity = obj.city
				this.table.storeCounty = obj.county
				this.$forceUpdate()
			},
			getDiqu(index) {
				this.$refs.address.setShow()
			},
			getDiqu1(index) {
				this.$refs.address1.setShow()
			},
			downloads() {
				const link = document.createElement('a');
				link.href = 'https://hzs-in.oss-cn-beijing.aliyuncs.com/agreement/dealer.pdf';
				link.target = '_blank';
				link.download = '经销商协议';

				// 模拟点击<a>元素
				document.body.appendChild(link);
				link.click();
				document.body.removeChild(link);
			},
			toggle(type) {
				this.$refs['popup'].open()
			}
		},
	}
</script>
<style lang="scss" scoped>
	.views {
		background-color: #fff;
		padding-top: 150rpx;
		height: 1334rpx;
		position: relative;
	}

	:v-deep .u-input__content {
		padding-left: 20rpx;
	}

	.bg-colors {
		background-color: #fff !important;
	}

	.height-auto {
		border-radius: 30rpx;
		height: 1000rpx;
		background-color: #fff;
		width: 690rpx;
		overflow: auto;
	}

	.img_width {
		text-align: center;
		// height: 500rpx;
		padding: 80rpx 30rpx;
		width: 600rpx;
		overflow: auto;

		::v-deep img {
			width: 600rpx
		}
	}

	.button-s {
		width: 290rpx;
		height: 66rpx;
		background: #d61820;
		border-radius: 10rpx;
		text-align: center;
		cursor: pointer;
		line-height: 66rpx;
		font-size: 22rpx;
		color: #fff;
		margin: 0 auto;
	}

	.bolds {
		font-weight: bold;
	}

	.status-size {
		margin-top: 10rpx;
		font-size: 30rpx;
		color: #000;
	}

	.status-img {
		image {
			width: 200rpx;
			height: 200rpx;
		}
	}

	.img_cen {
		background-color: #fff;
		text-align: center;
	}

	.submit {
		width: 692rpx;
		height: 92rpx;
		background: #FB3024;
		border-radius: 44rpx;
		margin: 50rpx auto;
		line-height: 92rpx;
		text-align: center;
		color: #fff;
		font-size: 30rpx;
	}

	:v-deep .u-form-item__body__left__content__label {
		font-size: 28rpx;
		color: #333;
	}

	.text-tips {
		z-index: 1;
		position: absolute;
		color: #999;
		font-size: 18rpx;
		top: 15rpx;
	}

	.content_s {
		display: flex;
	}

	.none-s {
		border-bottom: none !important;
	}

	.text-colors {
		color: #FB3024;
		font-size: 24rpx;
		margin-bottom: 10rpx;
	}

	.text-s {
		margin: 20rpx 0 0 20rpx;
	}

	.upload-content {
		margin-top: 20rpx;
	}

	.upload {
		width: 150rpx;
		height: 150rpx;
		background: #FFFFFF;
		border: 1rpx solid #DDDDDD;
		margin-left: 20rpx;
		display: flex;
		justify-content: center;
		position: relative;
		align-items: center;
		margin-bottom: 20rpx;
	}

	.upload-img {
		position: relative;
		width: 150rpx;
		height: 150rpx;
		margin-left: 20rpx;
		margin-bottom: 20rpx;

		.close-icon {
			position: absolute;
			right: 10rpx;
			top: 10rpx;
			z-index: 1;
		}

		.img-width {
			width: 150rpx;
			height: 150rpx;
		}
	}

	.text {
		margin-left: 20rpx;
	}

	.right-icon {
		position: absolute;
		right: 0;
		top: 45rpx;
	}

	:v-deep .u-form-item__body__left__content__label {
		margin-left: 20rpx;
	}

	:v-deep.u-form-item__body__left__content__required {
		margin: 35rpx 10rpx 0 10rpx;
		// position: absolute;
		// top:40rpx;
		color: #FB3024;
		width: 10rpx;
	}

	:v-deep .u-form-item__body {
		padding: 10rpx 0;
	}

	:v-deep .u-form-item__body__right__message {
		padding-bottom: 20rpx;
	}

	.place {
		color: #999;
	}

	:v-deep .uni-input-placeholder {
		// padding-left: 20rpx;
	}

	:v-deep .texts {
		height: 78rpx;
	}

	.padding-s {
		// padding: 0 20rpx;
		line-height: 105rpx;
		border-bottom: 1rpx solid #eee;
		margin: 0 20rpx;
		position: relative;
	}

	.height {
		border-bottom: 1rpx solid #eee;
		margin: 20rpx;
		position: relative;
		padding-bottom: 1rpx solid #eee;
		padding-bottom: 30rpx;
	}

	.lines-height {
		padding: 0 25rpx;
		display: flex;
		background: rgba(251, 48, 36, 0.15);
		line-height: 105rpx;
		height: 105rpx;
		position: relative;
	}

	.text_s {
		color: #FB3024;
		font-size: 28rpx;
		margin-left: 25rpx;
		font-weight: bold;
	}

	.lines {
		position: absolute;
		left: 30rpx;
		top: 40rpx;
		width: 6rpx;
		height: 24rpx;
		background: #FB3024;
		// margin: 30rpx 0 0;
	}

	.contents {
		background-color: #fff;
		margin-top: 10rpx;
		height: 100%;
	}

	.text {
		color: #999;
		font-size: 24rpx;
	}

	.button {
		width: 320rpx;
		height: 76rpx;
		text-align: center;
		margin: 15rpx auto;
		background: #FFAC3E;
		border-radius: 38rpx;
		line-height: 76rpx;
		color: #fff;
		font-size: 24rpx;
	}

	.tops {
		padding: 20rpx 20rpx 30rpx 20rpx;
		// height: 206px;
		background: #FFFFFF;
	}

	page {
		background-color: #f2f2f2;
		width: 100%;
		height: 100%;
	}
</style>