applypage1.vue 13 KB
Newer Older
王建威's avatar
王建威 committed
1 2
<template>
	<view class="page1_content">
zhengxiuming's avatar
zhengxiuming committed
3
		<TopBar title="采购分期"/>
王建威's avatar
王建威 committed
4 5
		<view class="page1_top">
			<view>
王建威's avatar
王建威 committed
6
				<view class="apply_title">企业信息<text class="mustbe">(<text class="mustbe_star">*</text>为必填项)</text></view>
王建威's avatar
王建威 committed
7 8 9 10 11 12
				<view class="apply_desc">请填写企业的详细信息</view>
			</view>
			<!-- <text class="unline_btn">申请线下审核</text> -->
		</view>
		<view class="apply_data_content">
			<view :style="{'margin-top':'40rpx'}">
王建威's avatar
王建威 committed
13
				<view class="apply_title"><text class="mustbe_star">*</text>街道/门头照片</view>
王建威's avatar
王建威 committed
14 15 16
				<view class="apply_desc">请上传所在街道与企业门头清晰照片,以便顺利帮您认证</view>
			</view>
			<view class="apply_data_item">
王建威's avatar
王建威 committed
17
				<view v-if="!params.business_street" class="apply_upload" @click="uploadImage('business_street')">
王建威's avatar
王建威 committed
18 19 20
					<text class="eosfont icons">&#xe60d;</text>
					<text class="upload_font">所在街道照片</text>
				</view>
王建威's avatar
王建威 committed
21 22 23 24 25
				<view v-if="params.business_street" class="apply_upload">
					<text class="close_icon" @click="clearParams('business_street')"></text>
					<image class="preview_img" :src="params.business_street"></image>
				</view>
				<view v-if="!params.business_premises" class="apply_upload" @click="uploadImage('business_premises')">
王建威's avatar
王建威 committed
26 27 28
					<text class="eosfont icons">&#xe60d;</text>
					<text class="upload_font">企业门头照片</text>
				</view>
王建威's avatar
王建威 committed
29 30 31 32
				<view v-if="params.business_premises" class="apply_upload">
					<text class="close_icon" @click="clearParams('business_premises')"></text>
					<image class="preview_img" :src="params.business_premises"></image>
				</view>
王建威's avatar
王建威 committed
33 34
			</view>
			<view :style="{'margin-top':'60rpx'}">
王建威's avatar
王建威 committed
35
				<view class="apply_title"><text class="mustbe_star">*</text>动物诊疗证/兽医证照片</view>
王建威's avatar
王建威 committed
36 37 38
				<view class="apply_desc">请上传动物诊疗证与兽医证照片清晰照片,以便顺利帮您认证</view>
			</view>
			<view class="apply_data_item">
王建威's avatar
王建威 committed
39
				<view v-if="!params.animal_certificate" class="apply_upload" @click="uploadImage('animal_certificate')">
王建威's avatar
王建威 committed
40 41 42
					<text class="eosfont icons">&#xe60d;</text>
					<text class="upload_font">动物诊疗证(含公章) 照片</text>
				</view>
王建威's avatar
王建威 committed
43 44 45 46 47
				<view v-if="params.animal_certificate" class="apply_upload">
					<text class="close_icon" @click="clearParams('animal_certificate')"></text>
					<image class="preview_img" :src="params.animal_certificate"></image>
				</view>
				<view  v-if="!params.vet_certificate" class="apply_upload" @click="uploadImage('vet_certificate')">
王建威's avatar
王建威 committed
48 49 50
					<text class="eosfont icons">&#xe60d;</text>
					<text class="upload_font">兽医证(含公章) 照片</text>
				</view>
王建威's avatar
王建威 committed
51 52 53 54
				<view v-if="params.vet_certificate" class="apply_upload">
					<text class="close_icon" @click="clearParams('vet_certificate')"></text>
					<image class="preview_img" :src="params.vet_certificate"></image>
				</view>
王建威's avatar
王建威 committed
55 56
			</view>
			<view :style="{'margin-top':'60rpx'}">
王建威's avatar
王建威 committed
57
				<view class="apply_title"><text class="mustbe_star">*</text>营业执照/经营场所证明照片</view>
王建威's avatar
王建威 committed
58 59 60
				<view class="apply_desc">请上传营业执照与经营场所清晰照片,以便顺利帮您认证</view>
			</view>
			<view class="apply_data_item">
王建威's avatar
王建威 committed
61
				<view v-if="!params.business_license" class="apply_upload" @click="uploadImage('business_license')">
王建威's avatar
王建威 committed
62 63 64
					<text class="eosfont icons">&#xe60d;</text>
					<text class="upload_font">营业执照(含公章) 照片</text>
				</view>
王建威's avatar
王建威 committed
65 66 67 68 69
				<view v-if="params.business_license" class="apply_upload">
					<text class="close_icon" @click="clearParams('business_license')"></text>
					<image class="preview_img" :src="params.business_license"></image>
				</view>
				<view v-if="!params.certification_materials" class="apply_upload" @click="uploadImage('certification_materials')">
王建威's avatar
王建威 committed
70 71 72
					<text class="eosfont icons">&#xe60d;</text>
					<text class="upload_font">经营场所证明材料照片</text>
				</view>
王建威's avatar
王建威 committed
73 74 75 76
				<view v-if="params.certification_materials" class="apply_upload">
					<text class="close_icon" @click="clearParams('certification_materials')"></text>
					<image class="preview_img" :src="params.certification_materials"></image>
				</view>
王建威's avatar
王建威 committed
77 78 79 80 81
			</view>
			<view :style="{'margin-top':'60rpx'}">
				<view class="apply_title">企业半年银行流水(需含户名)</view>
				<view class="apply_desc">支持(zip/rar)格式</view>
			</view>
王建威's avatar
王建威 committed
82
			<view class="apply_data_item">
王建威's avatar
王建威 committed
83
				<view class="apply_upload" v-if="!params.bank_card_record" ref="compress">
王建威's avatar
王建威 committed
84 85 86
					<text class="eosfont icons">&#xe60d;</text>
					<text class="upload_font">企业半年银行流水</text>
				</view>
王建威's avatar
王建威 committed
87
				<view class="apply_upload" style="line-height: 200rpx;" v-if="params.bank_card_record">
王建威's avatar
王建威 committed
88
					<text class="close_icon" @click="clearParams('bank_card_record')"></text>
王建威's avatar
王建威 committed
89 90
					<text class="upload_font">{{compressName}}</text>
				</view>
王建威's avatar
王建威 committed
91 92
			</view>
		</view>
王建威's avatar
王建威 committed
93
		<text class="next_step_btn" @click="submit()">下一步</text>
王建威's avatar
王建威 committed
94 95 96 97
	</view>
</template>

<script>
王建威's avatar
王建威 committed
98
	import TopBar from '@/components/TopBar/TopBar.vue';
王建威's avatar
王建威 committed
99 100 101
	export default {
		data() {
			return {
王建威's avatar
王建威 committed
102 103 104 105 106 107 108
				params: {
					business_street: '',  //所在街道
					business_premises: '', //企业门头
					animal_certificate: '' ,//动物诊疗证
					vet_certificate: '', //兽医证
					business_license: '', //营业执照
					certification_materials: '', //经营场所
王建威's avatar
王建威 committed
109
					bank_card_record: '', //企业银行流水
王建威's avatar
王建威 committed
110
				},
王建威's avatar
王建威 committed
111 112 113 114 115
				compressName: '',
				data: null,
				submitFlag: true,
				contract_no: '',
				qualification_id: ''
王建威's avatar
王建威 committed
116 117
			}
		},
王建威's avatar
王建威 committed
118
		onLoad(option) {
王建威's avatar
王建威 committed
119
			this.contract_no = option.contract_no || '';
王建威's avatar
王建威 committed
120
			uni.request({
王建威's avatar
王建威 committed
121
				url: `/uni/api/userqualification/GetUserQualification/${option.property_id}/${option.equipment_id}`,
王建威's avatar
王建威 committed
122 123 124 125
				method: 'GET',
				success: (res) => {
					if(res.data.code === 0) {
						const d = res.data.data;
王建威's avatar
王建威 committed
126
						d && Object.keys(this.params).forEach((item, index) => {
王建威's avatar
王建威 committed
127 128
							this.params[item] = d[item]
						});
王建威's avatar
王建威 committed
129 130 131
						if(d !== null) {
							this.qualification_id = d.qualification_id;
							this.data = {
王建威's avatar
王建威 committed
132 133
								equipment_id: d.equipment_id,
								property_id: d.property_id
王建威's avatar
王建威 committed
134 135 136
							}
						} else {
							this.data = {
王建威's avatar
王建威 committed
137 138
								equipment_id: option.equipment_id,
								property_id: option.property_id
王建威's avatar
王建威 committed
139
							}
王建威's avatar
王建威 committed
140
						}
王建威's avatar
王建威 committed
141 142 143 144 145 146 147
					} else {
						uni.getStorage({
							key: 'installment',
							success: (res) => {
								this.data = res.data;
							}
						});
王建威's avatar
王建威 committed
148
					}
王建威's avatar
王建威 committed
149 150 151
				}
				
			});		
王建威's avatar
王建威 committed
152
		},
王建威's avatar
王建威 committed
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
		mounted() {
			// #ifdef H5
			const _input = document.createElement('input');
			_input.type = 'file';
			_input.accept = 'application/x-zip-compressed,application/x-rar-compressed';
			_input.style.position = 'absolute';
			_input.style.top = '0';
			_input.style.width = '100%';
			_input.style.height = '100%';
			_input.style.opacity = '0';
			this.$refs.compress.$el.append(_input);
			_input.onchange = (e) => {
				let file = e.target.files[0];
				let fileName = file.name;
				let pos = fileName.lastIndexOf(".");
				let lastName = fileName.substring(pos, fileName.length);
				if ((lastName.toLowerCase() != ".zip" ) && (lastName.toLowerCase() != ".rar")) {
					uni.showToast({
						title: "文件必须为.zip或.rar类型",
						icon: 'none',
						duration: 2000
					})
					return;
				}
				let url = null;
				if (window.createObjectURL != undefined) {
					// basic
					url = window.createObjectURL(file);
				} else if (window.webkitURL != undefined) {
					// webkit or chrome
					url = window.webkitURL.createObjectURL(file);
				} else if (window.URL != undefined) {
					// mozilla(firefox)
					url = window.URL.createObjectURL(file);
				}
				uni.showLoading({
					title: '上传中'
				})
				uni.uploadFile({
					url: '/uni/api/resources',
					filePath: url,
					name: 'file',
					formData: {
						name: file.name
					},
					success: (uploadFileRes) => {
						const data = JSON.parse(uploadFileRes.data)
						this.params['bank_card_record'] = data.data;
						this.compressName = fileName;
						uni.hideLoading();
					}
				});
			}	
			// #endif
		},
王建威's avatar
王建威 committed
208
		methods: {
王建威's avatar
王建威 committed
209
			uploadImage(key) {
王建威's avatar
王建威 committed
210
				uni.chooseImage({
王建威's avatar
王建威 committed
211
					sizeType: ['compress'],
王建威's avatar
王建威 committed
212
					count:1,
王建威's avatar
王建威 committed
213
					success: (res) => {
王建威's avatar
王建威 committed
214
						const tempFilePaths = res.tempFilePaths;
王建威's avatar
王建威 committed
215 216
						uni.showLoading({
							title: '上传中'
王建威's avatar
王建威 committed
217
						})
王建威's avatar
王建威 committed
218 219 220 221 222 223 224
						uni.uploadFile({
							url: '/uni/api/resources',
							filePath: tempFilePaths[0],
							name: 'file',
							success: (uploadFileRes) => {
								const data = JSON.parse(uploadFileRes.data)
								this.params[key] = data.data;
王建威's avatar
王建威 committed
225
								uni.hideLoading();
王建威's avatar
王建威 committed
226 227 228 229 230 231 232 233 234
							}
						});
					}
				})
			},
			clearParams(key) {
				this.params[key] = '';
			},
			submit() {
王建威's avatar
王建威 committed
235
				if(!this.submitFlag) return
王建威's avatar
王建威 committed
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
				if(!this.params.business_street) {
					uni.showToast({
						title: '请上传所在街道照片',
						icon: 'none'
					});
					return
				}
				if(!this.params.business_premises) {
					uni.showToast({
						title: '请上传企业门头照片',
						icon: 'none'
					});
					return
				}
				if(!this.params.animal_certificate) {
					uni.showToast({
						title: '请上传动物诊疗证照片',
						icon: 'none'
					});
					return
				}
				if(!this.params.vet_certificate) {
					uni.showToast({
						title: '请上传兽医证照片',
						icon: 'none'
					});
					return
				}
				if(!this.params.business_license) {
					uni.showToast({
						title: '请上传营业执照照片',
						icon: 'none'
					});
					return
				}
				if(!this.params.business_premises) {
					uni.showToast({
						title: '请上传经营场所材料照片',
						icon: 'none'
					});
					return
				}
王建威's avatar
王建威 committed
278 279 280
				this.submitFlag = false;
				const methond = this.qualification_id ? 'PUT' : 'POST';
				const url = this.qualification_id ? '/uni/api/userqualification/EditUserQualification/first' : '/uni/api/userqualification/AddUserQualification';
王建威's avatar
王建威 committed
281 282
				uni.showToast({
					title: '提交中',
王建威's avatar
王建威 committed
283 284
					icon: 'none',
					duration: 90000
王建威's avatar
王建威 committed
285
				});
王建威's avatar
王建威 committed
286
				uni.request({
王建威's avatar
王建威 committed
287 288
					url: url,
					method: methond,
王建威's avatar
王建威 committed
289 290
					data: {
						...this.params,
王建威's avatar
王建威 committed
291 292
						...this.data,
						qualification_id: this.qualification_id
王建威's avatar
王建威 committed
293 294
					},
					success: (res) => {
王建威's avatar
王建威 committed
295
						this.submitFlag = true;
王建威's avatar
王建威 committed
296
						if(res.data.code === 0) {
王建威's avatar
王建威 committed
297
							this.qualification_id = res.data.data.qualification_id;
王建威's avatar
王建威 committed
298 299 300 301 302 303
							uni.setStorage({
								key: 'installment',
								data: {
									...this.data,
									qualification_id: res.data.data.qualification_id
								},
王建威's avatar
王建威 committed
304
								success: (res) => {
王建威's avatar
王建威 committed
305 306 307 308 309 310
									uni.navigateTo({
										url: `/pages/apply/applypage2?contract_no=${this.contract_no}`
									});
								}
							})
						} else {
王建威's avatar
王建威 committed
311
							uni.hideToast();
王建威's avatar
王建威 committed
312 313
							uni.showToast({
								icon: 'none',
王建威's avatar
王建威 committed
314
								title: res.data.message
王建威's avatar
王建威 committed
315 316
							})
						}
王建威's avatar
王建威 committed
317 318
					}
				});
王建威's avatar
王建威 committed
319
			}
王建威's avatar
王建威 committed
320 321 322
		},
		components: {
			TopBar
王建威's avatar
王建威 committed
323 324 325 326 327 328
		}
	}
</script>

<style lang="less" scoped>
	.page1_content {
王建威's avatar
王建威 committed
329
		padding-top: 80rpx;
王建威's avatar
王建威 committed
330 331 332
		.mustbe_star {
			color: red;
		}
王建威's avatar
王建威 committed
333 334 335 336 337 338
		.apply_title {
			font-size:32rpx;
			font-family:PingFangSC-Medium,PingFang SC;
			font-weight:500;
			line-height: 44rpx;
			color: #212121;
王建威's avatar
王建威 committed
339 340 341 342 343 344 345 346
			.mustbe {
				font-size: 28rpx;
				line-height: 40rpx;
				color: #212121;
				margin-left: 10rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
			}
王建威's avatar
王建威 committed
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386
		}
		.apply_desc {
			font-size:24rpx;
			line-height: 34rpx;
			color: #979797;
			margin-top: 8rpx;
		}
		.page1_top {
			height: 150rpx;
			padding: 28rpx 36rpx 26rpx 36rpx;
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.unline_btn {
				width: 200rpx;
				height: 64rpx;
				line-height: 64rpx;
				border: 1px solid #DCDCDC;
				background: #fff;
				border-radius: 16rpx;
				color: #212121;
				font-size: 24rpx;
				text-align: center;
			}
		}
		.apply_data_content {
			background: #fff;
			padding: 0 36rpx;
			box-sizing: border-box;
			width: 100%;
			.apply_data_item {
				display: flex;
				justify-content: space-between;
				.apply_upload {
					margin-top: 40rpx;
					width: 328rpx;
					height: 200rpx;
					background: rgba(248,248,248,1);
					border-radius: 16rpx;
王建威's avatar
王建威 committed
387
					position: relative;
王建威's avatar
王建威 committed
388 389 390 391 392 393 394 395 396 397 398 399 400
					.icons {
						width: 36rpx;
						height: 36rpx;
						color: #AEAEAE;
						display: block;
						margin: 72rpx auto 10rpx;
					}
					.upload_font {
						font-size: 24rpx;
						color: #AEAEAE;
						display: block;
						text-align: center;
					}
王建威's avatar
王建威 committed
401 402 403 404 405 406 407 408 409 410 411 412 413 414
					.preview_img {
						width: 100%;
						height: 100%;
					}
					.close_icon {
						width: 28rpx;
						height: 28rpx;
						position: absolute;
						top: -14rpx;
						right: -14rpx;
						background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAYFBMVEUhISFVSRlWSRlpWBZxXxWfgw6jhg30xAH38Ob38ef38ej49O369vH69vL7+PT8+/n+/v3+/v7/zQD/zQL/1Cb/2T7/4GT/43H/43L/54f/88P/9Mj/+eX//ff//v7///+7HAjXAAAA3ElEQVQoz4XSWRKDIAwAUKFW4tIqQS2uvf8tK4iAojZ/5DFMEhJ9byLyD9M4TufYy1ogilr2AQ4N2miGHc6dQC9ENzucWzxEO1vsMIhuw0GEKAaDupYkZmuaxYmuasVe5+KIaGUkinWi1yjRJJUyai6h1FijU2dYK5y2cpQSayimBUdb4aLOEMc/yP1n6eFZ7hVEGSO7gkrXCmW2I9NKYYdAtyE87BAyHozvaccH75vBQ1pdfxlAzi8/GwBel2sCSvnFgimEvHKr+fFWUyOkb3621GAiK0q+XOA+/gCtlj2I+YoKDQAAAABJRU5ErkJggg==') no-repeat;
						background-size: 100% 100%;
						z-index: 10;
					}
王建威's avatar
王建威 committed
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430
				}
			}
		}
		.next_step_btn {
			width: 678rpx;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			background: #FFCD00;
			margin: 63rpx auto 42rpx;
			display: block;
			border-radius: 16rpx;
			font-size: 28rpx;
		}
	}
</style>