applypage2.vue 10.5 KB
Newer Older
王建威's avatar
王建威 committed
1 2
<template>
	<view class="page2_content">
zhengxiuming's avatar
zhengxiuming committed
3
		<TopBar title="采购分期"/>
王建威's avatar
王建威 committed
4 5
		<view class="apply_data_content">
			<view :style="{'margin-top':'40rpx'}">
王建威's avatar
王建威 committed
6
				<view class="apply_title">法人信息<text class="mustbe">(<text class="mustbe_star">*</text>为必填项)</text></view>
王建威's avatar
王建威 committed
7 8 9
				<view class="apply_desc">请填写企业法人的详细信息</view>
			</view>
			<view :style="{'margin-top':'40rpx'}">
王建威's avatar
王建威 committed
10
				<view class="apply_title"><text class="mustbe_star">*</text>法人身份证照片</view>
王建威's avatar
王建威 committed
11 12 13
				<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
			</view>
			<view :style="{'margin-top':'60rpx'}">
王建威's avatar
王建威 committed
32
				<view class="apply_title"><text class="mustbe_star">*</text>补充照片</view>
王建威's avatar
王建威 committed
33 34 35
				<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
		onLoad(option) {
王建威's avatar
王建威 committed
95 96 97
			this.contract_no = option.contract_no || '';
			const d = uni.getStorageSync('installment');
			uni.request({
王建威's avatar
王建威 committed
98
				url: `/uni/api/userqualification/GetUserQualification/${d.property_id}/${d.equipment_id}`,
王建威's avatar
王建威 committed
99 100
				method: 'GET',
				success: (res) => {
王建威's avatar
王建威 committed
101
					const s = res.data.data;
王建威's avatar
王建威 committed
102
					Object.keys(this.params).forEach((item, index) => {
王建威's avatar
王建威 committed
103
						this.params[item] = s[item]
王建威's avatar
王建威 committed
104 105
					});
					this.data = {
王建威's avatar
王建威 committed
106 107
						equipment_id: s.equipment_id || d.equipment_id,
						property_id: s.property_id || d.property_id
王建威's avatar
王建威 committed
108
					}
王建威's avatar
王建威 committed
109
					this.qualification_id = s.qualification_id;
王建威's avatar
王建威 committed
110 111
				}
			});
王建威's avatar
王建威 committed
112
		},
王建威's avatar
王建威 committed
113 114 115 116 117 118 119 120 121 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
		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
168 169 170
		methods: {
			uploadImage(key) {
				uni.chooseImage({
王建威's avatar
王建威 committed
171
					sizeType: ['compress'],
王建威's avatar
王建威 committed
172
					count:1,
王建威's avatar
王建威 committed
173
					success: (res) => {
王建威's avatar
王建威 committed
174
						uni.showLoading({
王建威's avatar
王建威 committed
175 176 177
							title: '上传中',
							duration:90000
						})
王建威's avatar
王建威 committed
178 179 180 181 182 183 184 185
						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
186
								uni.hideLoading();
王建威's avatar
王建威 committed
187 188 189 190 191 192 193 194
							}
						});
					}
				})
			},
			clearParams(key) {
				this.params[key] = '';
			},
王建威's avatar
王建威 committed
195 196 197
			backup() {
				this.$backup();
			},
王建威's avatar
王建威 committed
198
			submit() {
王建威's avatar
王建威 committed
199
				if(!this.submitFlag) return
王建威's avatar
王建威 committed
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
				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
228
				this.submitFlag = false;
王建威's avatar
王建威 committed
229 230
				uni.showToast({
					title: '提交中',
王建威's avatar
王建威 committed
231 232
					icon: 'none',
					duration: 90000
王建威's avatar
王建威 committed
233
				})
王建威's avatar
王建威 committed
234 235 236 237 238
				uni.request({
					url: '/uni/api/userqualification/EditUserQualification/second',
					method: 'PUT',
					data: {
						...this.params,
王建威's avatar
王建威 committed
239 240
						...this.data,
						qualification_id: this.qualification_id
王建威's avatar
王建威 committed
241 242
					},
					success: (res) => {
王建威's avatar
王建威 committed
243
						this.submitFlag = true;
王建威's avatar
王建威 committed
244 245
						if(res.data.code === 0) {
							uni.navigateTo({
王建威's avatar
王建威 committed
246
								url: `/pages/apply/applypage3?contract_no=${this.contract_no}`
王建威's avatar
王建威 committed
247 248
							});
						} else {
王建威's avatar
王建威 committed
249
							uni.hideToast();
王建威's avatar
王建威 committed
250 251
							uni.showToast({
								icon: 'none',
王建威's avatar
王建威 committed
252
								title: res.data.message
王建威's avatar
王建威 committed
253 254 255 256
							})
						}
					}
				});
王建威's avatar
王建威 committed
257
			}
王建威's avatar
王建威 committed
258 259 260
		},
		components: {
			TopBar
王建威's avatar
王建威 committed
261 262 263 264 265 266 267
		}
	}
</script>

<style lang="less" scoped>
	.page2_content {
		background: #fff;
王建威's avatar
王建威 committed
268
		padding-top: 80rpx;
王建威's avatar
王建威 committed
269 270 271
		.mustbe_star {
			color: red;
		}
王建威's avatar
王建威 committed
272 273 274 275 276 277
		.apply_title {
			font-size:32rpx;
			font-family:PingFangSC-Medium,PingFang SC;
			font-weight:500;
			line-height: 44rpx;
			color: #212121;
王建威's avatar
王建威 committed
278 279 280 281 282 283 284 285
			.mustbe {
				font-size: 28rpx;
				line-height: 40rpx;
				color: #212121;
				margin-left: 10rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
			}
王建威's avatar
王建威 committed
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
		}
		.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
307
					position: relative;
王建威's avatar
王建威 committed
308 309 310 311 312 313 314 315 316 317 318 319 320
					.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
321 322 323 324 325 326 327 328 329 330 331 332 333 334
					.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
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358
				}
			}
			.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>