<template>
	<view class="companyApply">
		<u-form :model="form" ref="form" label-position='top' label-width='150' border-bottom='false'>
			<u-form-item label="企业证件照全称（必填）" prop="name" border-bottom='false' required='true'>
				<u-input border style="width:100%;" :disabled='istest' v-model="form.name" placeholder='输入企业证件照' />
			</u-form-item>
			<u-form-item label="法人姓名" prop="idNumber" border-bottom='false' required='true'>
				<u-input border style="width:100%;" :disabled='istest' v-model="form.idNumber" placeholder='输入法人姓名' />
			</u-form-item>
			<u-form-item label="上传营业执照正本" prop="idNumber" border-bottom='false' required='true'>
				<u-upload width='100px' height='100px' :action="action" :disabled='istest' :header="headers"
					:auto-upload="true" :show-progress="false" max-count="1" :deletable="true"
					:file-list="form.certificateUrl"
					@on-success="(data,index,lists) => {fielUploadSuc(data,index,lists) }"
					@on-remove="(index, lists, name)=>{deleteUpfile(index)}"
					@on-error="(data,index, lists)=>{errorUpfile(data,index, lists)}">
					<!-- <view slot="addBtn" class="slot-btn">
						<img v-if="form.certificateUrl" :src="form.certificateUrl" mode="aspectFill"
							style="width: 100px;height: 100px;">
						<div v-else class="upliacla">
							<p style="font-size: 18px;">+</p>
							<p>选择图片</p>
						</div>
					</view> -->
				</u-upload>
			</u-form-item>
		</u-form>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				headers: {
					Authorization: 'Bearer ' + uni.getStorageSync('accessToken'),
				},
				form: {},
				action: this.http.baseUrl + '/upload'
			}
		},
		onLoad() {},
		onReady() {

		},
		methods: {
			fielUploadSuc(data, index) {
				if (data.code === 200) {
					this.form.certificateUrl = data.filePath
				}
			},
			deleteUpfile(index, lists) {
				this.form.certificateUrl = ''
			},
			errorUpfile(data, index) {},
		}
	}
</script>

<style lang="scss" scoped>
	.companyApply {
		padding: 25rpx;
		box-sizing: border-box;
	}
</style>