<template>
	<view class="cmain">
		<view class="form_group">
			<view class="lable re">企业名称</view>
			<input type="text" placeholder="请输入" v-model="item.name" :disabled="item.judgeStatus==1?true:false" />
		</view>
		<view class="form_group">
			<view class="lable re">税号</view>
			<input type="text" placeholder="请输入" v-model="item.dutyParagraph" :disabled="item.judgeStatus==1?true:false"/>
		</view>
		<view class="form_group">
			<view class="lable re">法人姓名</view>
			<input type="text" placeholder="请输入" v-model="item.corporateName" :disabled="item.judgeStatus==1?true:false" />
		</view>
		<view class="form_group">
			<view class="lable re">法人身份证号</view>
			<input type="text" maxlength="18" placeholder="请输入" v-model="item.corporateIdCard" :disabled="item.judgeStatus==1?true:false" />
		</view>
		<view class="form_group">
			<view class="lable re">联系号码</view>
			<input type="text" maxlength="11" placeholder="请输入" v-model="item.linkPhone" :disabled="item.judgeStatus==1?true:false" />
		</view>
		<view class="form_group">
			<view class="lable re">银行编号</view>
			<input type="text" placeholder="请输入" v-model="item.bankNo" :disabled="item.judgeStatus==1?true:false" />
		</view>
		<view class="form_group">
			<view class="lable re">开户行</view>
			<input type="text" placeholder="请输入" v-model="item.bankName" :disabled="item.judgeStatus==1?true:false" />
		</view>
		<view class="form_group">
			<view class="lable re">银行账号</view>
			<input type="text" maxlength="16" placeholder="请输入" v-model="item.bankAccount" :disabled="item.judgeStatus==1?true:false" />
		</view>
		<view class="form_group">
			<view class="lable re">企业地址</view>
			<input type="text" placeholder="请输入" v-model="item.address" :disabled="item.judgeStatus==1?true:false" />
		</view>
		<view class="form_group">
			<view class="lable re">法人身份证</view>
			<card v-model="item.pic" pic="../../../static/images/yyzz.png"></card>
		</view>
		<view class="form_group">
			<view class="lable re">营业执照</view>
			<card v-model="item.pic" pic="../../../static/images/yyzz.png"></card>
		</view>
		<button class="btn" @click="save()" v-if="item.judgeStatus != 1">提交审核</button>
	</view>
</template>

<script>
export default {
	data() {
		return {
			item: {},
			param: {},
		};
	},
	onLoad(e) {
		this.param.appUserId = this.getUser().id
		this.http.request({
			url: '/level-two-server/app/TbPurchaser/auditStatus',
			data: this.param,
			success: res => {
				if (res.data.data) {
					this.item = res.data.data;
					uni.setNavigationBarTitle({ title: '我的认证资料' });
				} else {
					uni.setNavigationBarTitle({ title: '填写认证资料' });
				}
			}
		});
	},
	methods: {
		save() {
			let rule = [
				{ name: 'name', checkType: 'notnull', errorMsg: '请输入企业名称' },
				{ name: 'dutyParagraph', checkType: 'notnull', errorMsg: '请输入税号' },
				{ name: 'corporateName', checkType: 'notnull', errorMsg: '请法人姓名' }
			];
			if (!this.verify.check(this.item, rule)) {
				uni.showModal({ content: this.verify.error, showCancel: false });
				return false;
			}
			this.item.loginUserId = this.getUser().id
			this.item.businessLicense = "1111"
			this.http.request({
				url: '/level-two-server/app/TbPurchaser/identification',
				method: 'POST',
				data: this.item,
				contentType: 'application/json;charset=UTF-8',
				success: res => {
					uni.showToast({ title: '提交成功' });
					uni.$emit('purchaserAuth');
					uni.navigateBack();
				}
			});
		}
	}
};
</script>

<style lang="scss">
.btn {
	margin-top: 25px;
}
</style>
