certification.vue 8.3 KB
Newer Older
王建威's avatar
王建威 committed
1 2 3 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
<template>
	<view class="cer_content">
		<TopBar title="金融分期"/>
		<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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
					social_credit_code: '',
					legal_name: '',
					legal_card: '',
					card_positive: '',
					card_reverse: ''
					
				},
				title: '社会统一信用代码',
				submitFlag: true
			}
		},
		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
101
					sizeType: ['compress'],
王建威's avatar
王建威 committed
102
					count:1,
王建威's avatar
王建威 committed
103
					success: (res) => {
王建威's avatar
王建威 committed
104 105
						uni.showLoading({
							title: '上传中'
王建威's avatar
王建威 committed
106
						})
王建威's avatar
王建威 committed
107 108 109 110 111 112 113 114
						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
115
								uni.hideLoading();
王建威's avatar
王建威 committed
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 168
							}
						});
					}
				})
			},
			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
				}
				this.submitFlag = false;
王建威's avatar
王建威 committed
169 170 171 172
				uni.showToast({
					title: '提交中',
					icon: 'none'
				})
王建威's avatar
王建威 committed
173 174 175 176 177
				uni.request({
					url: '/uni/api/certification/AddRealnameAuth',
					data: this.params,
					method: 'POST',
					success: (res) => {
王建威's avatar
王建威 committed
178
						this.submitFlag = true;
王建威's avatar
王建威 committed
179 180
						if(res.data.code === 0) {
							uni.navigateTo({
王建威's avatar
王建威 committed
181
								url: '/pages/apply/choosetype'
王建威's avatar
王建威 committed
182 183
							});
						} else {
王建威's avatar
王建威 committed
184
							uni.hideToast();
王建威's avatar
王建威 committed
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 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 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 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
							uni.showToast({
								icon: 'none',
								title: res.data.message
							})
						}
					}
				})
			}
		},
		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>