certification.vue 10.1 KB
Newer Older
王建威's avatar
王建威 committed
1 2
<template>
	<view class="cer_content">
zhengxiuming's avatar
zhengxiuming committed
3
		<TopBar title="采购分期"/>
王建威's avatar
王建威 committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
		<view class="apply_data_content">
			<view :style="{'margin-top':'40rpx'}">
				<view class="apply_title">选择单位类型</view>
			</view>
			<view>
				<text class="busi_type" :class="{act: params.enterprise_type === 1}" @click="changeEnterpriseType(1)">企业</text>
				<text class="busi_type" :class="{act: params.enterprise_type === 2}" @click="changeEnterpriseType(2)">个体工商户</text>
			</view>
			<view :style="{'margin-top':'40rpx'}">
				<view class="apply_title">资质信息</view>
			</view>
			<view class="sign_title">企业名称</view>
			<view>
				<input type="text" class="sign_input" v-model="params.enterprise_name">
			</view>
			<view class="selector">
				<picker @change="changeCompanyType" mode="selector" :range="range">
					<view>{{range[index]}}</view>
				</picker>
				<text class="eosfont icon">&#xe608;</text>
			</view>
			<view>
				<input type="text" class="sign_input" v-model="params.social_credit_code">
			</view>
			<view class="sign_title">法定代表人姓名</view>
			<view>
				<input type="text" class="sign_input" v-model="params.legal_name">
			</view>
			<view class="sign_title">法定代表人身份证号</view>
			<view>
				<input type="text" class="sign_input" v-model="params.legal_card">
			</view>
			<view :style="{'margin-top':'40rpx'}">
				<view class="apply_title">法人身份证照片</view>
				<view class="apply_desc">请上传法人身份证清晰照片,以便顺利帮您认证</view>
			</view>
			<view class="apply_data_item">
				<view v-if="!params.card_positive" class="apply_upload" @click="uploadImage('card_positive')">
					<text class="eosfont icons">&#xe60d;</text>
					<text class="upload_font">身份证 (人像面)</text>
				</view>
				<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')">
					<text class="eosfont icons">&#xe60d;</text>
					<text class="upload_font">身份证 (国徽面)</text>
				</view>
				<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>
			</view>
		</view>
		<view class="submitBtn" @click="submit()">提交</view>
	</view>
</template>

<script>
	import TopBar from '@/components/TopBar/TopBar.vue'
	export default {
		data() {
			return {
				range: ['社会统一信用代码', '组织机构代码', '工商注册号'],
				index: 0,
				params: {
					enterprise_type: 1,
					enterprise_name: '',
王建威's avatar
王建威 committed
73
					organ_type: 11,
王建威's avatar
王建威 committed
74 75 76 77 78 79 80 81
					social_credit_code: '',
					legal_name: '',
					legal_card: '',
					card_positive: '',
					card_reverse: ''
					
				},
				title: '社会统一信用代码',
王建威's avatar
王建威 committed
82 83
				submitFlag: true,
				month_rule_id: '', // 从连续包月跳转过来
王建威's avatar
王建威 committed
84 85
				is_deposit: '' ,// 从连续包月跳转过来
				auth_id: ''
王建威's avatar
王建威 committed
86 87
			}
		},
王建威's avatar
王建威 committed
88
		onLoad(options) {
王建威's avatar
王建威 committed
89 90 91
			this.month_rule_id = options.month_rule_id || '';
			this.is_deposit = options.is_deposit || '';
			this.auth_id = options.auth_id || '';
王建威's avatar
王建威 committed
92
		},
王建威's avatar
王建威 committed
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
		methods: {
			changeEnterpriseType(type) {
				this.params.enterprise_type = type;
			},
			changeCompanyType(e) {
				const index = e.target.value;
				this.index = index;
				this.title =  this.range[index];
				switch(index) {
					case 0: this.params.organ_type = 11; break;
					case 1: this.params.organ_type = 10; break;
					case 2: this.params.organ_type = 12; break;
				}
			},
			uploadImage(key) {
				uni.chooseImage({
王建威's avatar
王建威 committed
109
					sizeType: ['compress'],
王建威's avatar
王建威 committed
110
					count:1,
王建威's avatar
王建威 committed
111
					success: (res) => {
王建威's avatar
王建威 committed
112 113
						uni.showLoading({
							title: '上传中'
王建威's avatar
王建威 committed
114
						})
王建威's avatar
王建威 committed
115 116 117 118 119 120 121 122
						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
123
								uni.hideLoading();
王建威's avatar
王建威 committed
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
							}
						});
					}
				})
			},
			clearParams(key) {
				this.params[key] = '';
			},
			submit() {
				if(!this.submitFlag) return
				if(!this.params.enterprise_name) {
					uni.showToast({
						title: '请填写企业名称',
						icon: 'none'
					});
					return
				}
				if(!this.params.social_credit_code) {
					uni.showToast({
						title: `请填写${this.title}`,
						icon: 'none'
					});
					return
				}
				if(!this.params.legal_name) {
					uni.showToast({
						title: '请填写法人姓名',
						icon: 'none'
					});
					return
				}
				if(this.params.legal_card.length !== 18 && this.params.legal_card.length !== 15) {
					uni.showToast({
						title: '请填写正确的法人身份证号',
						icon: 'none'
					});
					return
				}
				if(!this.params.card_positive) {
					uni.showToast({
						title: '请上传法人身份证正面',
						icon: 'none'
					});
					return
				}
				if(!this.params.card_reverse) {
					uni.showToast({
						title: '请上传法人身份证反面',
						icon: 'none'
					});
					return
				}
王建威's avatar
王建威 committed
176 177 178 179 180 181 182 183 184
				let url = '',
					method = '';
				if(this.auth_id) {
					url = `/uni/api/certification/EditRealnameAuth/${this.auth_id}`;
					method = 'PUT'
				} else {
					url = '/uni/api/certification/AddRealnameAuth';
					method = 'POST';
				}
王建威's avatar
王建威 committed
185
				this.submitFlag = false;
王建威's avatar
王建威 committed
186 187 188
				uni.showToast({
					title: '提交中',
					icon: 'none'
王建威's avatar
王建威 committed
189
				});
王建威's avatar
王建威 committed
190
				uni.request({
王建威's avatar
王建威 committed
191
					url: url,
王建威's avatar
王建威 committed
192
					data: this.params,
王建威's avatar
王建威 committed
193
					method: method,
王建威's avatar
王建威 committed
194
					success: (res) => {
王建威's avatar
王建威 committed
195
						this.submitFlag = true;
王建威's avatar
王建威 committed
196
						if(res.data.code === 0) {
王建威's avatar
王建威 committed
197 198 199 200 201
							if(this.month_rule_id) {
								// 从连续包月跳转过来
								this.monthlySign();
								return
							}
王建威's avatar
王建威 committed
202 203 204 205
							// uni.navigateTo({
							// 	url: '/pages/apply/choosetype'
							// });
							const d = uni.getStorageSync('installment');
王建威's avatar
王建威 committed
206
							uni.navigateTo({
王建威's avatar
王建威 committed
207
								url: `/pages/apply/applypage1?property_id=${d.property_id}&equipment_id=${d.equipment_id}`
王建威's avatar
王建威 committed
208 209
							});
						} else {
王建威's avatar
王建威 committed
210
							uni.hideToast();
王建威's avatar
王建威 committed
211 212 213 214 215 216 217
							uni.showToast({
								icon: 'none',
								title: res.data.message
							})
						}
					}
				})
王建威's avatar
王建威 committed
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
			},
			//连续包月签署合同
			monthlySign() {
				uni.request({
					url: '/uni/api/month_signcontract/AddContract',
					method: 'POST',
					dataType: 'json',
					data: {
						is_deposit: this.is_deposit,
						month_rule_id: this.month_rule_id
					},
					success:(res) => {
						if(res.data.code === 0) {
							// 是否交押金
							uni.showToast({
								title: '合同已签署',
								icon: 'none'
							})
							if(this.is_deposit === '1') {
								// 交押金
								setTimeout(() => {
									uni.hideLoading();
									this.$jump(`/pages/monthlyDeposit/monthlyDeposit?month_apply_id=${res.data.data.month_apply_id}`,2);
								}, 2000);
							} else {
								// 不交押金
								setTimeout(() => {
									uni.hideLoading();
									this.$jump(`/pages/monthlyPlan/monthlyPlan?month_apply_id=${res.data.data.month_apply_id}`,2);
								}, 2000);
							}
						} else {
							uni.showToast({
								title: res.data.message,
								icon: 'none'
							})
						}
					}
				})
王建威's avatar
王建威 committed
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 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 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 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 387
			}
		},
		components: {
			TopBar
		}
	}
</script>

<style lang="less" scoped>
	.cer_content {
		background: #fff;
		padding-top: 80rpx;
		.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;
					position: relative;
					.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;
					}
					.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;
					}
				}
			}
		}
		.busi_type {
			width: 180rpx;
			height: 60rpx;
			line-height: 60rpx;
			display: inline-block;
			margin: 20rpx 36rpx 0 0;
			font-size: 28rpx;
			text-align: center;
			border-radius: 30rpx;
			background: #ececec;
			color: #212121;
		}
		.busi_type.act {
			background: #FAC341;
			color: #fff;
		}
		.sign_title {
			color: #464646;
			height:40rpx;
			font-size:28rpx;
			margin-top: 32rpx;
		}
		.sign_input {
			width:100%;
			height:72rpx;
			background:rgba(248,248,248,1);
			border-radius:16rpx;
			margin-top: 20rpx;
			line-height: 72rpx;
			padding: 0 20rpx;
			box-sizing: border-box;
			font-size: 28rpx;
			color: #212121;
		}
		.selector {
			background: #f8f8f8;
			height: 72rpx;
			line-height: 72rpx;
			font-size: 28rpx;
			margin-top: 40rpx;
			border-radius: 16rpx;
			padding: 0 20rpx;
			position: relative;
		}
		.icon {
			position: absolute;
			right: 20rpx;
			top: 0;
		}
		.submitBtn {
			width: 678rpx;
			height: 72rpx;
			line-height: 72rpx;
			font-size: 28rpx;
			text-align: center;
			background-color: #FFCD00;
			border-radius: 16rpx;
			margin: 36rpx auto;
		}
	}
</style>