<template>
	<view>
		<!-- 审核状态回馈 -->
		<view class="width100 height100p" style="background-color: #eb6a53;"
			v-if="applyByMerList && (applyByMerList.status == 2 || applyByMerList.status == 4 || applyByMerList.status == 6)">
			<view class="font18 fcorfff paading10 aliitem"
				v-if="applyByMerList.status == 4 || applyByMerList.status == 6">
				<image src='../../../static/img/error.png' mode="widthFix" class="iconw25 marglerig"></image>审核驳回
			</view>
			<view class="font14 fcorfff paading10" v-if="applyByMerList.status == 4 || applyByMerList.status == 6">
				{{applyByMerList.rejectReason}}
			</view>
			<view class="font18 fcorfff paddtop35 fotct"
				v-if="applyByMerList.status == 2 || applyByMerList.status == 5">
				审核中
			</view>
		</view>

		<!--第三步 未录入结算信息 -->
		<view class="width100 mart10 backcorfff">
			<view class="titlename font18 fontwig6 fcor333">结算信息</view>
			<view class="username">
				<view class="namecont">结算类型</view>
				<input placeholder="请选择结算类型" v-model="lementType" style="width: 70%;" disabled="true"
					placeholder-style="color: #bfbfbf;font-size:14px;padding-top:2px;" @click="showPopup()" />
				<image src="../../../static/img/jtg.png" mode="widthFix" class="iconw"></image>
			</view>
			<view class="titlename fcor666" v-if="lementId == 3">非法人结算授权书</view>
			<view class="width94 displ" v-if="lementId == 3">
				<image :src="uncorporsettelimg" v-if="uncorporsettelimg" @click="upload(10)" mode="widthFix"
					class="width45">
				</image>
				<image src="../../../static/img/businesslic7.png" v-else mode="widthFix" @click="upload(10)"
					class="width45" style="margin-left: 3%;"></image>
				<image src="../../../static/img/businesslic8.png" mode="widthFix" class="width45"
					style="margin-left: 3%;" @click="perImage('../../../static/img/businesslic8.png')"></image>
			</view>
			<view class="notes font13" style="color: #eb5823;border-bottom: 1px solid #f6f6f6;" v-if="lementId == 3">
				<image mode="widthFix" class="iconw" src="../../../static/img/gth.png"></image>
				<text class="width90p">请预览并保存授权书到本地,打印填写完整并签字后拍照上传;图片需清晰完整,以免审核失败</text>
			</view>
			<view class="notes font16" style="border-bottom: 0px;" v-if="lementId == 3">
				<view class="width70 aliitem fcor666">
					非法人身份证照片
				</view>
				<view class="fcor666 alijusend width30 font14"
					@click="perImage('../../../static/img/businesslic3.png')">查看示例
					<image mode="widthFix" style="width: 12px;" src="../../../static/img/jtg.png"></image>
				</view>
			</view>
			<view class="width94 displ mart5" v-if="lementId == 3">
				<image :src="idcardposimg" v-if="idcardposimg" mode="widthFix" class="width45" style="margin-left: 3%;"
					@click="upload(2)"></image>
				<image src="../../../static/img/frontidcard.png" v-else mode="widthFix" class="width45"
					style="margin-left: 3%;" @click="upload(2)"></image>
				<image :src="idcardsideimg" v-if="idcardsideimg" mode="widthFix" class="width45"
					style="margin-left: 3%;" @click="upload(3)"></image>
				<image src="../../../static/img/reverseidcard.png" v-else mode="widthFix" class="width45"
					style="margin-left: 3%;" @click="upload(3)"></image>
			</view>
			<view class="username" v-if="lementId == 3">
				<view class="namecont">姓名</view>
				<input placeholder="请输入姓名" v-model="idcardname" style="width: 70%;"
					placeholder-style="color: #bfbfbf;font-size:14px;padding-top:2px;" />
			</view>
			<view class="username" v-if="lementId == 3">
				<view class="namecont">身份证号</view>
				<input placeholder="请输入身份证号" v-model="idcard" style="width: 70%;"
					placeholder-style="color: #bfbfbf;font-size:14px;padding-top:2px;" />
			</view>
			<view class="username" v-if="lementId == 3">
				<view class="namecont">身份证地址</view>
				<input placeholder="请输入身份证地址" v-model="larIdCardAddress" style="width: 70%;"
					placeholder-style="color: #bfbfbf;font-size:14px;padding-top:2px;" />
			</view>
			<view class="username" style="border-bottom: 0px;" v-if="lementId == 3">
				<view class="namecont">有效期</view>
				<view class="width30 aliitem" @tap="timetype='1'">
					<radio class="checbox" :checked="timetype=='1'" color="#0083f5" /> 选择时间
				</view>
				<view class="width30 aliitem" @tap="timetype='2'">
					<radio class="checbox" :checked="timetype=='2'" color="#0083f5" /> 长期有效
				</view>
			</view>
			<view class="username width80" v-if="lementId == 3">
				<picker mode="date" class="width40 fotct" :value="cardstart_date" :start="startDate" :end="endDate"
					@change="bindDateChange">
					<view class="date">{{cardstart_date}}</view>
				</picker>
				<view class="width10 fotct">至</view>
				<picker v-if="timetype == '1'" mode="date" class="width40 fotct" :value="cardend_date"
					:start="startDate" :end="endDate" @change="bindDateChange2">
					<view class="date">{{cardend_date}}</view>
				</picker>
				<view class="width40 fotct fcor999" v-if="timetype == '2' ">长期有效</view>
			</view>
			<view class="notes font16" style="border-bottom: 0px;" v-if="lementId != 1">
				<view class="width70 aliitem fcor666">
					结算人银行卡照片
				</view>
			</view>
			<view class="width94 displ mart5" v-if="lementId != 1">
				<image :src="settleimg" v-if="settleimg" @click="upload(4)" mode="widthFix" class="width100">
				</image>
				<image src="../../../static/img/businesslic9.png" v-else @click="upload(4)" mode="widthFix"
					class="width100">
				</image>

			</view>
			<!-- 对公结算 -->
			<view class="notes font16" style="border-bottom: 0px;" v-if="lementId == 1">
				<view class="width70 aliitem fcor666">
					开户许可证照片
				</view>
				<view class="fcor666 alijusend width30 font14"
					@click="perImage('../../../static/img/businesslic6.png')">查看示例
					<image mode="widthFix" style="width: 12px;" src="../../../static/img/jtg.png"></image>
				</view>
			</view>
			<view class="width94 displ mart5" v-if="lementId == 1">
				<image mode="widthFix" class="width100" :src="accopenperimg" v-if="accopenperimg" @click="upload(5)">
				</image>
				<image src="../../../static/img/businesslic11.png" mode="widthFix" class="width100" v-else
					@click="upload(5)"></image>
			</view>
			<view class="username" v-if="lementId == 1">
				<view class="namecont">开户持有人</view>
				<input placeholder="请输入开户持有人" v-model="bankName" style="width: 70%;"
					placeholder-style="color: #bfbfbf;font-size:14px;padding-top:2px;" />
			</view>

			<view class="username" v-else>
				<view class="namecont">银行卡持有人</view>
				<input placeholder="请输入银行卡持有人" v-model="bankName" style="width: 70%;"
					placeholder-style="color: #bfbfbf;font-size:14px;padding-top:2px;" />
			</view>

			<view class="username" v-if="lementId == 1">
				<view class="namecont">开户账号</view>
				<input placeholder="请输入开户账号" v-model="bankNo" style="width: 70%;"
					placeholder-style="color: #bfbfbf;font-size:14px;padding-top:2px;" />
			</view>

			<view class="username" v-else>
				<view class="namecont">银行卡号</view>
				<input placeholder="请输入银行卡号" v-model="bankNo" style="width: 70%;"
					placeholder-style="color: #bfbfbf;font-size:14px;padding-top:2px;" />
			</view>

			<view class="username">
				<view class="namecont">开户行地址</view>
				<pickRegions :defaultRegion="defaultRegionCode" class="width70" @getRegion="handleBankCityCode">
					<view style="color: #333333;font-size:14px;padding-top:2px;" v-if="bankregionName">
						{{bankregionName}}
					</view>
					<view style="color: #bfbfbf;font-size:14px;padding-top:2px;" v-else>请选择开户行地址</view>
				</pickRegions>
				<image src="../../../static/img/jtg.png" mode="widthFix" class="iconw"></image>
			</view>

			<view class="username">
				<view class="namecont">所属支行</view>
				<input placeholder="请选择或者输入所属支行" v-model="belongbranch" style="width: 70%;" disabled="true"
					placeholder-style="color: #bfbfbf;font-size:14px;padding-top:2px;" />
				<image src="../../../static/img/jtg.png" mode="widthFix" class="iconw" @click="showdepositaryBank()">
				</image>
			</view>
			<view class="username">
				<view class="namecont">所属银行</view>
				<input placeholder="请输入所属银行" v-model="belongbank" style="width: 70%;"
					placeholder-style="color: #bfbfbf;font-size:14px;padding-top:2px;" />
			</view>
		</view>

		<wybPopup ref="popup" type="bottom" width="500" bgColor="#f6f6f6" radius="6" :showCloseIcon="true">
			<view class="width100">
				<view class="fotct font18 fontwig6 fcor333 mart10 height30">选择商户类型</view>
				<view class="width92 mart20" @click="changelementtype(1)">
					<view class="wybtc" style="height: 40px;">
						<image src="../../../static/img/wyb4.png" mode="widthFix" class="iconw40"></image>
						<view class="width70 margle10">
							<view class="fcor333 font16">对公结算</view>
						</view>
						<image src="../../../static/img/jtg.png" mode="widthFix" class="iconw margle20"></image>
					</view>
				</view>
				<view class="width92 mart20" @click="changelementtype(2)">
					<view class="wybtc" style="height: 40px;">
						<image src="../../../static/img/wyb4.png" mode="widthFix" class="iconw40"></image>
						<view class="width70 margle10">
							<view class="fcor333 font16">对私法人结算</view>
						</view>
						<image src="../../../static/img/jtg.png" mode="widthFix" class="iconw margle20"></image>
					</view>
				</view>
				<view class="width92 mart20" @click="changelementtype(3)">
					<view class="wybtc" style="height: 40px;">
						<image src="../../../static/img/wyb4.png" mode="widthFix" class="iconw40"></image>
						<view class="width70 margle10">
							<view class="fcor333 font16">对私非法人结算</view>
						</view>
						<image src="../../../static/img/jtg.png" mode="widthFix" class="iconw margle20"></image>
					</view>
				</view>
			</view>
		</wybPopup>
		<view class="btn" @tap="submitsotre"
			v-if="!applyByMerList || applyByMerList.status == 4 || applyByMerList.status == 6">提交审核</view>
		<view class="height60"></view>
	</view>
</template>

<script>
	import {
		createApplyUpdateSettle,
		getImgSignedUrl,
		recognizeIdCard,
		recognizeBankCard,
		getBankCardBin,
		recognizeBankAccount,
		getLastApplyByMer
	} from '../../../Utils/Api.js';
	import wybPopup from '../../../components/wyb-popup/wyb-popup.vue';
	import pickRegions from '../../../components/pick-regions/pick-regions.vue';
	let app = getApp();
	export default {
		components: {
			wybPopup,
			pickRegions
		},
		data() {
			const currentDate = this.getDate({
				format: true
			})
			return {
				reqUrl: app.globalData.url, //请求地址
				imgsUrl: app.globalData.imgUrl, //图片访问地址
				lementType: '对公结算', //结算账户类型
				lementId: '1', //结算id
				idcardposimg: '', //查看证件照正面
				idcardsideimg: '', //查看证件照反面
				idcardname: '', //证件姓名
				idcard: '', //身份证号
				larIdCardAddress: '', //身份证地址
				uncorporsettelimg: '', //非法人结算授权书
				uploaduncorporsettelimg: '', //上传非法人结算委托书
				settleimg: '', //结算人银行卡照片
				uploadsettleimg: '', //上传结算人银行卡照片
				accopenperimg: '', //开户许可证图片
				uploadaccopenperimg: '', //上传开户许可图片
				openingbankNo: '', //开户行号
				region: [], //选择区域
				defaultRegion: ['北京市', '市辖区', '东城区'], //默认地区
				defaultRegionCode: '110101', //区级编号
				bankregionName: '', //开户行名字
				bankNo: '', // 银行卡号
				bankName: '', // 银行卡持有人
				belongbank: '', //所属银行
				belongbranch: '', //所属支行
				clearbankNo: '', //清算行号
				timetype: '1', // times:选择时间  longterm: 长期
				cardstart_date: '开始时间', // 身份证开始时间
				cardend_date: '结束时间', //身份证结束时间
				merId: '', //用户id 
				applyByMerList: '' //修改的资料
			}
		},
		onShow() {
			if (app.globalData.depositaryBank) {
				this.belongbranch = app.globalData.depositaryBank;
				var belongbank = this.belongbranch.split('银行');
				this.belongbank = belongbank[0] + '银行';
			}
			if (app.globalData.branchBankNo) {
				this.openingbankNo = app.globalData.branchBankNo;
			}
			if (app.globalData.clearNo) {
				this.clearbankNo = app.globalData.clearNo;
			}
		},
		onUnload() {
			app.globalData.branchBankNo = '';
			app.globalData.clearNo = '';
			app.globalData.depositaryBank = '';
		},
		onLoad(options) {
			this.merId = options.id;
			this.getLastApplyByMer();
		},
		computed: {
			//开始时间转化
			startDate() {
				return this.getDate('start');
			},
			//结束时间转化
			endDate() {
				return this.getDate('end');
			},
		},
		methods: {
			// 获取当前时间
			getDate(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();

				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year + 50;
				}
				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},
			//显示商户弹出
			showPopup() {
				if (this.applyByMerList.status == 4 || this.applyByMerList == '') {
					this.$refs.popup.show();
				}
			},
			//查询修改的结算信息
			getLastApplyByMer() {
				uni.showLoading({
					title: '加载中...'
				})
				let datas = {
					merId: this.merId
				}
				getLastApplyByMer(datas).then(res => {
					uni.hideLoading();
					if (res.return_code == '000000') {
						if (res.return_data.status != 3) {
							this.applyByMerList = res.return_data;
							this.settleimg = res.return_data.bankCardImg;
							if (res.return_data.bankCardImg) {
								this.getImgSignedUrl(4, res.return_data.bankCardImg, 2);
							}
							this.belongbranch = res.return_data.openningBankName;

							this.openingbankNo = res.return_data.openningBankCode;
							this.accopenperimg = res.return_data.openningBankLicenseUrl;
							if (res.return_data.openningBankLicenseUrl) {
								this.getImgSignedUrl(5, res.return_data.openningBankLicenseUrl, 2);
							}
							if (res.return_data.commissionImg) {
								this.getImgSignedUrl(10, res.return_data.commissionImg, 2);
							}

							if (res.return_data.electronicPact) {
								this.electronicProtocolimg = res.return_data.electronicPact
									.split(
										';');
							}
							this.clearbankNo = res.return_data.clearingBankCode;

							this.lementId = res.return_data.settleType;
							if (this.lementId == 1) {
								this.lementType = '对公结算';
							}
							if (this.lementId == 2) {
								this.lementType = '对私法人结算';
							}
							if (this.lementId == 3) {
								this.lementType = '对私非法人结算';
							}
							this.bankregionName = res.return_data.openningBankProvinceName +
								'-' +
								res.return_data.openningBankCityName + '-' + res.return_data.openningBankAreaName;
							this.bankNo = res.return_data.bankCardNo;
							this.bankName = res.return_data.bankCardHolder;
							this.belongbank = res.return_data.bankName;
							this.idcardname = res.return_data.settleIdCardName;
							this.idcard = res.return_data.settleIdCardNo;
							this.timetype = res.return_data.settleIdPeriodType;
							this.bankareaCode = res.return_data.openningBankAreaCode;
							this.larIdCardAddress = res.return_data.settleIdCardAddress;
							this.idcardposimg = res.return_data.settleIdCardPortraitImg;
							this.uploadidcardposimg = res.return_data.settleIdCardPortraitImg;
							this.idcardsideimg = res.return_data.settleIdCardNationalEmblemImg;
							this.uploadidcardsideimg = res.return_data
								.settleIdCardNationalEmblemImg;
							if (res.return_data.settleIdCardPortraitImg) {
								this.getImgSignedUrl(2, res.return_data.settleIdCardPortraitImg, 2);
								this.getImgSignedUrl(3, res.return_data
									.settleIdCardNationalEmblemImg, 2);
							}
							this.cardstart_date = res.return_data.settleIdCardPeriodStart;
							this.cardend_date = res.return_data.settleIdCardPeriodEnd;
						}
					}
				});
			},
			//重新提交
			updatenewvalue() {
				this.applyByMerList = '';
			},
			//选择结算类型
			changelementtype(item) {
				if (item == 1) {
					this.lementId = 1;
					this.lementType = '对公结算';
				}
				if (item == 2) {
					this.lementId = 2;
					this.lementType = '对私法人结算';
				}
				if (item == 3) {
					this.lementId = 3;
					this.lementType = '对私非法人结算';
				}
				this.$refs.popup.hide();
			},
			//上传图片
			upload(item) {
				let that = this;
				// if (that.applyByMerList) {
				// 	return;
				// }
				if (that.applyByMerList.status == 2 || that.applyByMerList.status == 5) {
					return;
				}
				uni.chooseImage({
					count: 1,
					sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
					sourceType: ['camera', 'album'],
					success: function(res) {
						const tempFilePaths = res.tempFilePaths;
						that.uploadFile(tempFilePaths[0], item, 1);
					},
					error: function(e) {
						console.log(e);
					}
				});
			},
			//上传
			uploadFile(item, item1, item2) {
				const that = this
				that.translate(item, 0.2, imgURL => {
					const uploadTask = uni.uploadFile({
						url: that.reqUrl + '/mer/uploadBase64File',
						filePath: imgURL,
						header: {
							"Authorization": app.globalData.token
						},
						name: 'file',
						formData: {
							'merId': that.merId,
							'base64File': imgURL
						},
						success: function(uploadFileRes) {
							that.getImgSignedUrl(item1, JSON.parse(uploadFileRes.data)
								.return_data, item2);
						}
					});
				})
			},
			/**
			 * H5端图片压缩
			 *  参数说明:
			 *  imgSrc 图片url
			 *  scale缩放比例 0-1
			 *  返回base64
			 *  callback 回调设置返回值 
			 */
			translate(imgSrc, scale, callback) {
				var img = new Image();
				img.src = imgSrc;
				img.onload = function() {
					var that = this;
					var h = that.height; // 默认按比例压缩
					var w = that.width;
					var canvas = document.createElement('canvas');
					var ctx = canvas.getContext('2d');
					var width = document.createAttribute("width");
					width.nodeValue = w;
					var height = document.createAttribute("height");
					height.nodeValue = h;
					canvas.setAttributeNode(width);
					canvas.setAttributeNode(height);
					ctx.drawImage(that, 0, 0, w, h);
					var base64 = canvas.toDataURL('image/jpeg', scale); //压缩比例
					canvas = null;
					callback(base64);
				}
			},
			//item 放大图片
			perImage(item) {
				uni.previewImage({
					current: 0, //预览图片的下标
					urls: [item] //预览图片的地址,必须要数组形式,如果不是数组形式就转换成数组形式就可以
				})
			},
			//查看临时图片路径
			getImgSignedUrl(item, item1, item2) {
				let datas = {
					"fileUrl": item1
				}
				getImgSignedUrl(datas).then(res => {
					if (res.return_code == '000000') {
						if (item == 2) {
							if (item2 == 1) {
								this.recognizeIdCard(1, res.return_data);
							} else {
								this.idcardposimg = res.return_data;
							}
							this.uploadidcardposimg = item1;
						}
						if (item == 3) {
							if (item2 == 1) {
								this.recognizeIdCard(2, res.return_data);
							} else {
								this.idcardsideimg = res.return_data;
							}
							this.uploadidcardsideimg = item1;
						}
						if (item == 4) {
							this.uploadsettleimg = item1;
							if (item2 == 1) {
								this.recognizeBankCard(res.return_data);
							} else {
								this.settleimg = res.return_data;
							}
						}
						if (item == 5) {
							this.uploadaccopenperimg = item1;
							if (item2 == 1) {
								this.recognizeBankAccount(res.return_data);
							} else {
								this.accopenperimg = res.return_data;
							}
						}
						if (item == 10) {
							this.uploaduncorporsettelimg = item1;
							this.uncorporsettelimg = res.return_data;
						}
					}
				})
			},
			//身份证识别
			recognizeIdCard(item, items) {
				uni.showLoading({
					title: '识别中...'
				})
				let params = {
					url: items
				}
				recognizeIdCard(params).then(res => {
					uni.hideLoading();
					if (res.return_code == '000000' && res.return_data) {
						if (item == 1) {
							if (JSON.parse(res.return_data.data).data.face != undefined) {
								this.idCardzm = JSON.parse(res.return_data.data).data;
								this.idcardname = this.idCardzm.face.data.name;
								this.idcardposimg = items;
								this.larIdCardAddress = this.idCardzm.face.data.address;
								this.idcard = this.idCardzm.face.data.idNumber;
							} else {
								uni.showToast({
									title: '请上传身份证人脸信息',
									duration: 2000,
									icon: 'none'
								})
							}
						}
						if (item == 2) {
							if (JSON.parse(res.return_data.data).data.back != undefined) {
								this.idCardfm = JSON.parse(res.return_data.data).data;
								let times = this.idCardfm.back.data.validPeriod.split('-');
								this.cardstart_date = times[0];
								this.idcardsideimg = items;
								this.cardend_date = times[1];
							} else {
								uni.showToast({
									title: '请上传身份证国徽信息',
									duration: 2000,
									icon: 'none'
								})
							}
						}
					} else {
						uni.showToast({
							title: '请上传正确的身份证信息',
							duration: 2000,
							icon: 'none'
						})
					}
				})
			},
			//开户行识别
			recognizeBankAccount(item) {
				uni.showLoading({
					title: '识别中...'
				})
				let datas = {
					url: item
				}
				recognizeBankAccount(datas).then(res => {
					uni.hideLoading();
					this.accopenperimg = item;
					if (res.return_code == '000000' && res.return_data) {
						var bankAccount = JSON.parse(res.return_data.data).data;
						this.bankName = bankAccount.legalRepresentative;
						this.bankNo = bankAccount.bankAccount;
						app.globalData.depositaryBank = bankAccount.depositaryBank;
					} else {
						uni.showToast({
							title: '图片识别失败、请重新上传或自动填写内容。',
							duration: 3000,
							icon: 'none'
						})
					}
				})
			},
			//银行卡识别
			recognizeBankCard(item) {
				uni.showLoading({
					title: '识别中...'
				})
				let params = {
					url: item
				}
				recognizeBankCard(params).then(res => {
					uni.hideLoading();
					if (res.return_code == '000000' && res.return_data) {
						this.settleimg = item;
						if (JSON.parse(res.return_data.data).data != undefined) {
							this.bankCardlist = JSON.parse(res.return_data.data).data;
							this.bankNo = this.bankCardlist.cardNumber;
							this.getBankCardBin(this.bankNo);
							this.belongbank = this.bankCardlist.bankName;
						} else {
							uni.showToast({
								title: '请上传正确的银行卡',
								icon: 'none',
								duration: 2000
							})
						}
					} else {
						uni.showToast({
							title: '请上传正确的银行卡',
							icon: 'none',
							duration: 2000
						})
					}

				})
			},
			//查询银行卡信息
			getBankCardBin(item) {
				let datas = {
					cardNo: item
				}
				getBankCardBin(datas).then(res => {
					if (res.return_code == '000000' && res.return_data) {
						this.belongbank = res.return_data.bankName;
						this.bankNo = res.return_data.cardNo;
						this.openingbankNo = res.return_data.bankCode;
						this.belongbranch = res.return_data.bankName;
						this.clearbankNo = res.return_data.clearingBankCode;
					}
				})
			},
			//选择支行
			showdepositaryBank() {
				app.globalData.bankareaCode = this.bankareaCode;
				uni.navigateTo({
					url: '/pages/index/depositaryBank/depositaryBank'
				})
			},
			//选择开户行
			handleBankCityCode(region) {
				this.region = region;
				this.bankareaCode = this.region.map(item => item.code)[2];
				this.bankregionName = this.region.map(item => item.name).join('-');
				app.globalData.bankareaCode = this.bankareaCode;
			},
			//提交门店进行审核
			submitsotre() {
				let that = this;
				if (that.lementId == 1) {
					if (!that.accopenperimg) {
						uni.showToast({
							title: '请上传开户许可证照片',
							icon: "none",
							duration: 2000
						});
						return;
					}
				}
				if (that.lementId == 2 || that.lementId == 3) {
					if (!that.settleimg) {
						uni.showToast({
							title: '请上传银行卡照片',
							icon: "none",
							duration: 2000
						});
						return;
					}
				}
				if (that.lementId == 3) {
					if (!that.idcardposimg) {
						uni.showToast({
							title: '请上传身份证正面照',
							icon: "none",
							duration: 2000
						});
						return;
					}
					if (!that.idcardsideimg) {
						uni.showToast({
							title: '请上传身份证反面照',
							icon: "none",
							duration: 2000
						});
						return;
					}

					if (!that.idcardname) {
						uni.showToast({
							title: '请填写姓名',
							icon: "none",
							duration: 2000
						});
						return;
					}

					if (!that.idcard) {
						uni.showToast({
							title: '请填写身份证号',
							icon: "none",
							duration: 2000
						});
						return;
					}
					if (!that.larIdCardAddress) {
						uni.showToast({
							title: '请填写身份证地址',
							icon: "none",
							duration: 2000
						});
						return;
					}
					if (!that.cardstart_date) {
						uni.showToast({
							title: '请选择身份证开始时间',
							icon: "none",
							duration: 2000
						});
						return;
					}
					if (!that.cardend_date) {
						uni.showToast({
							title: '请选择身份证结束时间',
							icon: "none",
							duration: 2000
						});
						return;
					}
				}


				if (!that.bankareaCode) {
					uni.showToast({
						title: '请选择开户行地址',
						icon: "none",
						duration: 2000
					});
					return;
				}
				if (!that.bankNo) {
					uni.showToast({
						title: '请填写银行卡号',
						icon: "none",
						duration: 2000
					});
					return;
				}
				if (!that.bankName) {
					uni.showToast({
						title: '请填写银行卡持有人',
						icon: "none",
						duration: 2000
					});
					return;
				}
				if (!that.belongbank) {
					uni.showToast({
						title: '请填写所属银行',
						icon: "none",
						duration: 2000
					});
					return;
				}
				if (that.lementId != 3) {
					that.cardstart_date = '';
					that.cardend_date = '';
				} else {
					if (that.timetype == 2) {
						that.cardend_date = '长期有效'
					}
				}

				uni.showModal({
					title: '提交审核',
					content: '确认信息是否正确。',
					success: (res) => {
						if (res.confirm) {
							uni.showLoading({
								title: '提交审核中...'
							})
							let datas = {
								"applyType": 1,
								"merId": that.merId,
								"settleType": that.lementId, //结算类型 1:对公结算  2:对私法人结算  3:对私非法人结算,
								"bankCardImg": that.uploadsettleimg, //"银行卡照片",
								"openningBankName": that.belongbranch, //"银行名称",
								"bankCardNo": that.bankNo, //"银行卡号",
								"openningBankAreaCode": that.bankareaCode, // 开户地址
								"commissionImg": that.uploaduncorporsettelimg, // 结算委托书
								"bankCardHolder": that.bankName, //"银行卡持有人",
								"openningBankCode": that.openingbankNo, //"开户行号",
								"bankName": that.belongbank, //"开户行名称",
								"openningBankLicenseUrl": that.uploadaccopenperimg, //"开户许可证照片",
								"clearingBankCode": that.clearbankNo, //"账户清算行号",
								"settleIdCardName": that.idcardname, //身份证名字
								"settleIdCardNo": that.idcard, //身份证号
								"settleIdCardAddress": that.larIdCardAddress, // 身份证地址
								"settleIdPeriodType": that
									.timetype, //【对私非法人结算】结算人身份证有效期类型  1:有效期   2:长期,
								"settleIdCardPortraitImg": that
									.uploadidcardposimg, //"【对私非法人结算】结算人身份证人像面图片",
								"settleIdCardNationalEmblemImg": that
									.uploadidcardsideimg, //"【对私非法人结算】结算人身份证国徽面图片",
								"settleIdCardPeriodStart": that.cardstart_date, //"【对私非法人结算】结算人身份证有效期开始时间",
								"settleIdCardPeriodEnd": that.cardend_date //"【对私非法人结算】结算人身份证有效期结束时间"
							}
							createApplyUpdateSettle(datas).then(res => {
								uni.hideLoading();
								if (res.return_code == '000000') {
									uni.showToast({
										title: '提交成功',
										icon: 'none',
										duration: 2000
									})
									uni.navigateBack();
								} else {
									uni.showToast({
										title: res.return_msg,
										icon: 'none',
										duration: 2000
									})
								}
							});
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f7f5f6;
	}

	.titlename {
		width: calc(100% - 90upx);
		height: 100upx;
		display: flex;
		align-items: center;
		background-color: rgba($color: #ffffff, $alpha: 0.1);
		padding: 0 45upx;
	}

	.username {
		width: calc(100% - 90upx);
		height: 100upx;
		display: flex;
		align-items: center;
		background-color: rgba($color: #ffffff, $alpha: 0.1);
		border-bottom: 1px solid #f6f6f6;
		padding: 8upx 45upx;

		input {
			width: 50%;
			height: 50upx;
			font-size: 16px;
			color: #333333;
			font-weight: blod;
		}

		.get-code {
			position: absolute;
			display: flex;
			align-items: center;
			justify-content: center;
			right: 7px;
			z-index: 3;
			border: 1px solid #bfbfbf;
			width: 25%;
			padding: 3px 5px;
			border-radius: 22px;

			&:after {
				content: " ";
				width: 1upx;
				height: 50upx;
				position: absolute;
				z-index: 3;
				margin-right: 100%;
				left: 0;
				top: 20upx;
			}
		}

		.namecont {
			color: #666666;
			width: 28%;
		}
	}

	.notes {
		width: calc(100% - 90upx);
		display: flex;
		align-items: center;
		background-color: rgba($color: #ffffff, $alpha: 0.1);
		border-bottom: 1px solid #f6f6f6;
		padding: 20rpx 45rpx;
		color: #bfbfbf;

	}

	.btn {
		color: #FFFFFF;
		background-color: #0083f5;
		width: 90%;
		margin-left: 5%;
		margin-top: 80rpx;
		margin-bottom: 50rpx;
		height: 90rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: 10rpx;
		font-size: 40rpx;
	}

	.wybtc {
		width: calc(100% - 90upx);
		display: flex;
		height: 80px;
		align-items: center;
		background-color: #FFFFFF;
		border-bottom: 1px solid #f6f6f6;
		padding: 15rpx 45rpx;
		border-radius: 8px;
		color: #bfbfbf;
	}
</style>