applypage2.vue 10.3 KB
Newer Older
王建威's avatar
王建威 committed
1 2
<template>
	<view class="page2_content">
王建威's avatar
王建威 committed
3
		<TopBar title="金融分期"/>
王建威's avatar
王建威 committed
4 5 6 7 8 9 10 11 12 13
		<view class="apply_data_content">
			<view :style="{'margin-top':'40rpx'}">
				<view class="apply_title">法人信息</view>
				<view class="apply_desc">请填写企业法人的详细信息</view>
			</view>
			<view :style="{'margin-top':'40rpx'}">
				<view class="apply_title">法人身份证照片</view>
				<view class="apply_desc">请上传法人手持身份证清晰照片,以便顺利帮您认证</view>
			</view>
			<view class="apply_data_item">
王建威's avatar
王建威 committed
14
				<view v-if="!params.card_positive" class="apply_upload" @click="uploadImage('card_positive')">
王建威's avatar
王建威 committed
15 16 17
					<text class="eosfont icons">&#xe60d;</text>
					<text class="upload_font">手持身份证 (人像面)</text>
				</view>
王建威's avatar
王建威 committed
18 19 20 21 22
				<view v-if="params.card_positive" class="apply_upload">
					<text class="close_icon" @click="clearParams('card_positive')"></text>
					<image class="preview_img" :src="params.card_positive"></image>
				</view>
				<view v-if="!params.card_reverse" class="apply_upload" @click="uploadImage('card_reverse')">
王建威's avatar
王建威 committed
23 24 25
					<text class="eosfont icons">&#xe60d;</text>
					<text class="upload_font">手持身份证 (国徽面)</text>
				</view>
王建威's avatar
王建威 committed
26 27 28 29
				<view v-if="params.card_reverse" class="apply_upload">
					<text class="close_icon" @click="clearParams('card_reverse')"></text>
					<image class="preview_img" :src="params.card_reverse"></image>
				</view>
王建威's avatar
王建威 committed
30 31 32 33 34 35
			</view>
			<view :style="{'margin-top':'60rpx'}">
				<view class="apply_title">补充照片</view>
				<view class="apply_desc">请上传企业法人相关证明清晰照片,以便顺利帮您认证</view>
			</view>
			<view class="apply_data_item">
王建威's avatar
王建威 committed
36
				<view v-if="!params.legal_business_img" class="apply_upload" @click="uploadImage('legal_business_img')">
王建威's avatar
王建威 committed
37 38 39
					<text class="eosfont icons">&#xe60d;</text>
					<text class="upload_font">法人在企业内照片</text>
				</view>
王建威's avatar
王建威 committed
40 41 42 43 44
				<view v-if="params.legal_business_img" class="apply_upload">
					<text class="close_icon" @click="clearParams('legal_business_img')"></text>
					<image class="preview_img" :src="params.legal_business_img"></image>
				</view>
				<view v-if="!params.bank_credit_report" class="apply_upload" @click="uploadImage('bank_credit_report')">
王建威's avatar
王建威 committed
45 46 47
					<text class="eosfont icons">&#xe60d;</text>
					<text class="upload_font">法人银行征信报告</text>
				</view>
王建威's avatar
王建威 committed
48 49 50 51
				<view v-if="params.bank_credit_report" class="apply_upload">
					<text class="close_icon" @click="clearParams('bank_credit_report')"></text>
					<image class="preview_img" :src="params.bank_credit_report"></image>
				</view>
王建威's avatar
王建威 committed
52 53 54 55 56 57
			</view>
			<view :style="{'margin-top':'60rpx'}">
				<view class="apply_title">法人半年银行流水(需含户名)</view>
				<view class="apply_desc">支持(zip/rar)格式</view>
			</view>
			<view class="apply_data_item">
王建威's avatar
王建威 committed
58
				<view class="apply_upload" v-if="!params.legal_card_record" ref="compress">
王建威's avatar
王建威 committed
59
					<text class="eosfont icons">&#xe60d;</text>
王建威's avatar
王建威 committed
60 61
					<text class="upload_font">法人半年银行流水</text>
				</view>
王建威's avatar
王建威 committed
62 63
				<view class="apply_upload" style="line-height: 200rpx;" v-if="params.legal_card_record">
					<text class="close_icon" @click="clearParams('legal_card_record')"></text>
王建威's avatar
王建威 committed
64
					<text class="upload_font">{{compressName}}</text>
王建威's avatar
王建威 committed
65 66 67
				</view>
			</view>
			<view class="apply_btn_box">
王建威's avatar
王建威 committed
68 69
				<view class="apply_btn" @click="backup()">上一步</view>
				<view class="apply_btn next_btn" @click="submit()">下一步</view>
王建威's avatar
王建威 committed
70 71 72 73 74 75
			</view>
		</view>
	</view>
</template>

<script>
王建威's avatar
王建威 committed
76
	import TopBar from '@/components/TopBar/TopBar.vue';
王建威's avatar
王建威 committed
77 78 79
	export default {
		data() {
			return {
王建威's avatar
王建威 committed
80 81 82 83 84 85 86
				params: {
					card_positive: '', //身份证正面
					card_reverse: '', //身份证反面
					legal_business_img: '', //在企业内照片
					bank_credit_report: '', //征信报告
					legal_card_record: '' //个人流水
				},
王建威's avatar
王建威 committed
87 88 89
				compressName: '',
				data: null,
				submitFlag: true,
王建威's avatar
王建威 committed
90 91
				contract_no: '',
				qualification_id: ''
王建威's avatar
王建威 committed
92 93
			}
		},
王建威's avatar
王建威 committed
94 95 96 97 98 99 100 101 102 103 104
		onLoad(option) {
			if(option.contract_no) {
				this.contract_no = option.contract_no;
				uni.request({
					url: `/uni/api/userqualification/GetUserQualification/${option.contract_no}`,
					method: 'GET',
					success: (res) => {
						const d = res.data.data;
						Object.keys(this.params).forEach((item, index) => {
							this.params[item] = d[item]
						});
王建威's avatar
王建威 committed
105 106 107 108 109 110 111 112 113 114 115 116 117
						this.data = {
							contract_no: d.contract_no,
							equipment_id: d.equipment_id,
							property_id: d.property_id
						}
						this.qualification_id = d.qualification_id;
					}
				});
			} else {
				uni.getStorage({
					key: 'installment',
					success: (res) => {
						this.data = res.data;
王建威's avatar
王建威 committed
118 119 120 121
					}
				});
			}
		},
王建威's avatar
王建威 committed
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
		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['legal_card_record'] = data.data;
						this.compressName = fileName;
						uni.hideLoading();
					}
				});
			}	
			// #endif
		},
王建威's avatar
王建威 committed
177 178 179
		methods: {
			uploadImage(key) {
				uni.chooseImage({
王建威's avatar
王建威 committed
180
					sizeType: ['compress'],
王建威's avatar
王建威 committed
181
					count:1,
王建威's avatar
王建威 committed
182
					success: (res) => {
王建威's avatar
王建威 committed
183
						uni.showLoading({
王建威's avatar
王建威 committed
184 185 186 187
							title: '上传中',
							icon: 'none',
							duration:90000
						})
王建威's avatar
王建威 committed
188 189 190 191 192 193 194 195
						const tempFilePaths = res.tempFilePaths
						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
196
								uni.hideLoading();
王建威's avatar
王建威 committed
197 198 199 200 201 202 203 204
							}
						});
					}
				})
			},
			clearParams(key) {
				this.params[key] = '';
			},
王建威's avatar
王建威 committed
205 206 207
			backup() {
				this.$backup();
			},
王建威's avatar
王建威 committed
208
			submit() {
王建威's avatar
王建威 committed
209
				if(!this.submitFlag) return
王建威's avatar
王建威 committed
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
				if(!this.params.card_positive) {
					uni.showToast({
						title: '请上传法人手持身份证正面',
						icon: 'none'
					});
					return
				}
				if(!this.params.card_reverse) {
					uni.showToast({
						title: '请上传法人手持身份证反面',
						icon: 'none'
					});
					return
				}
				if(!this.params.legal_business_img) {
					uni.showToast({
						title: '请上传法人在企业内照片',
						icon: 'none'
					});
					return
				}
				if(!this.params.bank_credit_report) {
					uni.showToast({
						title: '请上传法人银行征信报告',
						icon: 'none'
					});
					return
				}
王建威's avatar
王建威 committed
238
				this.submitFlag = false;
王建威's avatar
王建威 committed
239 240
				uni.showToast({
					title: '提交中',
王建威's avatar
王建威 committed
241 242
					icon: 'none',
					duration: 90000
王建威's avatar
王建威 committed
243
				})
王建威's avatar
王建威 committed
244 245 246 247 248
				uni.request({
					url: '/uni/api/userqualification/EditUserQualification/second',
					method: 'PUT',
					data: {
						...this.params,
王建威's avatar
王建威 committed
249 250
						...this.data,
						qualification_id: this.qualification_id
王建威's avatar
王建威 committed
251 252
					},
					success: (res) => {
王建威's avatar
王建威 committed
253
						this.submitFlag = true;
王建威's avatar
王建威 committed
254 255
						if(res.data.code === 0) {
							uni.navigateTo({
王建威's avatar
王建威 committed
256
								url: `/pages/apply/applypage3?contract_no=${this.contract_no}`
王建威's avatar
王建威 committed
257 258
							});
						} else {
王建威's avatar
王建威 committed
259
							uni.hideToast();
王建威's avatar
王建威 committed
260 261
							uni.showToast({
								icon: 'none',
王建威's avatar
王建威 committed
262
								title: res.data.message
王建威's avatar
王建威 committed
263 264 265 266
							})
						}
					}
				});
王建威's avatar
王建威 committed
267
			}
王建威's avatar
王建威 committed
268 269 270
		},
		components: {
			TopBar
王建威's avatar
王建威 committed
271 272 273 274 275 276 277
		}
	}
</script>

<style lang="less" scoped>
	.page2_content {
		background: #fff;
王建威's avatar
王建威 committed
278
		padding-top: 80rpx;
王建威's avatar
王建威 committed
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
		.apply_title {
			font-size:32rpx;
			font-family:PingFangSC-Medium,PingFang SC;
			font-weight:500;
			line-height: 44rpx;
			color: #212121;
		}
		.apply_desc {
			font-size:24rpx;
			line-height: 34rpx;
			color: #979797;
			margin-top: 8rpx;
		}
		.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
306
					position: relative;
王建威's avatar
王建威 committed
307 308 309 310 311 312 313 314 315 316 317 318 319
					.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
320 321 322 323 324 325 326 327 328 329 330 331 332 333
					.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
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357
				}
			}
			.apply_btn_box {
				display: flex;
				justify-content: space-between;
				width: 678rpx;
				margin: 60rpx 0;
				.apply_btn {
					width:328rpx;
					height:80rpx;
					background:rgba(245,245,245,1);
					border-radius:16rpx;
					background: #f5f5f5;
					line-height: 80rpx;
					font-size: 28rpx;
					text-align: center;
				}
				.next_btn {
					background: #FFCD00;
				}
			}
		}
	}
</style>