auth.vue 11.3 KB
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 73 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 101 102 103 104 105 106 107 108 109 110 111 112 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 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 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 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 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402
<template>
	<view>
		<view v-if="showDirectly&&directUnderFlag==0">
		<view class="flexbox">
			<view>
				有效日期至 <text class="text-primary">{{form?.validityDate?.slice(0,10) }}</text>
			</view>
			<view>
				<text v-if="activeStatus==0&&authenticationStatusa" class="text-danger">未激活</text>
				<text v-else>
					<text v-if="authenticationStatusa == 0 ||!authenticationStatusa" class="text-danger">未认证</text>
					<text v-if="authenticationStatusa == 1" class="text-success">认证中</text>
					<text v-if="authenticationStatusa == 2" class="text-success">已认证</text>
					<text v-if="authenticationStatusa == 3" class="text-danger">认证未通过</text>
					<text v-if="authenticationStatusa == 4" class="text-danger">即将过期</text>
					<text v-if="authenticationStatusa == 5" class="text-danger">已过期</text>
				</text>

			</view>
		</view>
		<view class="flexbox" style="justify-content: end;padding: 0 30rpx 40rpx;">
			<button class="btn-red" style="margin: 0 20rpx 0 0;" size="mini"
				v-if="activeStatus==0&&authenticationStatusa" @click="payTheFees">激活</button>
			<view v-else>
				<button class="btn-red" style="margin: 0 20rpx 0 0;" size="mini" :disabled="btn"
						@click="payTheFees">去缴费</button>
				<button class="btn-red-kx" style="margin: 0 20rpx 0 0;" size="mini" v-if="form.deptType!=1"
						@click="auditEditFN">审核详情</button>
			</view>
		</view>
</view>
		<view class="mainbox">
			<uni-list>
				<uni-list-item v-if="authenticationStatusa != 1&&authenticationStatusa != 0&&authenticationStatusa != 3"
					title="所属协会" :rightText="form.aname">

				</uni-list-item>
				<uni-list-item title="会员编号" v-if="form.menCode" :rightText="form.menCode" />
				<uni-list-item title="机构名称" :rightText="form.name" />
				<uni-list-item title="所属省份">
					<template v-slot:footer>
						<view class="frrr">
							<uni-data-picker readonly :clear-icon="false"
								v-model="form.belongProvinceId" :localdata="options">
							</uni-data-picker>
							
						</view>

					</template>
				</uni-list-item>
				<uni-list-item title="社会信用代码"
					v-if="authenticationStatusa != 1&&authenticationStatusa != 0&&authenticationStatusa != 3&&newResult||form.associateId&&form.associateId>0||activeStatus==1"
					:rightText="form.creditCode" />
				<uni-list-item v-if="form.certSiteContact" title="联系人" :rightText="form.certSiteContact" />
				<uni-list-item v-else title="联系人" :rightText="form.contact" />
				<uni-list-item v-if="form.certSiteTel" title="联系方式" :rightText="form.certSiteTel" />
				<uni-list-item v-else title="联系方式" :rightText="form.phone" />
				<uni-list-item title="认证地址">
					<template v-slot:footer>
						<view class="frrr">
						<uni-data-picker readonly :clear-icon="false" v-if="form.certRegionId"
							v-model="form.certRegionId" :localdata="options">
						</uni-data-picker>
						<uni-data-picker readonly :clear-icon="false" v-else-if="form.certCityId"
							v-model="form.certCityId" :localdata="options">
						</uni-data-picker>
						<uni-data-picker readonly :clear-icon="false" v-else-if="form.certProvinceId"
							v-model="form.certProvinceId" :localdata="options">
						</uni-data-picker>
						</view>
					</template>
				</uni-list-item>
				<uni-list-item title="认证详细地址" :rightText="form.certAddress" />
				<uni-list-item title="法人姓名" :rightText="form.certLegal||'--'" />

				<uni-list-item v-if="form.deptType==6" title="是否为考点" :rightText="form.isPoints==0?'是':'否'" />
				<uni-list-item title="法人身份证" clickable>
					<template v-slot:footer>
						<view v-if="form.legalIdcPhotoArr&&form.legalIdcPhotoArr?.length>0" class="frrr">
							<image class="ylImage" mode="aspectFit" @click="showImage(form.legalIdcPhotoArr,index)"
								v-for="(item,index) in form.legalIdcPhotoArr" :key="item" :src="item">
							</image>
						</view>
					</template>
				</uni-list-item>

				<uni-list-item title="营业执照" clickable>
					<template v-slot:footer>
						<view class="frrr" @click="download(form.businessLicenseArr[0]?.url)"
							v-if="form.businessLicenseArr&&form.businessLicenseArr?.length>0">
							<text class="text-primary">{{form.businessLicenseArr[0]?.name}}</text>
						</view>
					</template>
				</uni-list-item>
				<uni-list-item title="机构照片" clickable>
					<template v-slot:footer >
						<view class="frrr">
							<view v-if="form.picturesArr&&form.picturesArr?.length>0" class="photoBook"
									@click="showImage(form.picturesArr,0)">
									<image mode="aspectFit" class="ylImage" :src="form.picturesArr[0]">
									</image>
									<text>{{form.picturesArr?.length}}</text>
								</view>
							
						</view>
					</template>
				</uni-list-item>
			</uni-list>
		</view>
	
		<view class="height1"></view>
	</view>
</template>

<script setup>
	import * as api from '@/common/api.js'
	import config from '@/config.js'
	import * as loginServer from '@/common/login.js';

	import _ from 'underscore'
	import {
		ref
	} from 'vue'
	import {
		onLoad,onShow
	} from '@dcloudio/uni-app'
	const app = getApp()
	const form = ref({
		type: 1
	})
	const userType = ref()
	const activeStatus = ref(0)
	const directUnderFlag = ref(0)
	const showDirectly = ref(true)
	const authenticationStatusa = ref()
	const result = ref(false)
	const newResult = ref(false)
	const btn = ref(false)
	const type = ref(true)
	const flag = ref(false)
	const pr = ref({})
	const applicationForMembership1 = ref({})
	const options = ref([])
	onShow(() => {
		init()
	})

	function init() {
		api.regionsList().then(res => {
			options.value = res.data
		})
		api.getMyOwnMemberInfo().then(res => {
			console.log(res)
			userType.value = app.globalData.userType
			newResult.value = res.data.newResult
			result.value = res.data.result
			authenticationStatusa.value = res.data.authenticationStatus
			showDirectly.value = !res.data.memberInfo.associateId
			activeStatus.value = res.data.memberInfo.activeStatus
			pr.value = res.data.pr
			directUnderFlag.value = res.data.memberInfo.directUnderFlag
			if (authenticationStatusa.value == 0) {
				btn.value = false
			} else if (authenticationStatusa.value == 1) {
				btn.value = true
			} else {
				btn.value = !result.value
			}
			// 认证信息
			if (authenticationStatusa.value == 0 || authenticationStatusa.value == 3) {
				type.value = false
			}
			// 至少审核通过一次
			if (authenticationStatusa.value != 0) {
				if (newResult.value) {
					// 至少认证过一次
					flag.value = true
				}
			}
			if (!res.data.memberInfo) {
				res.data.memberInfo = {}
			}
			if (!res.data.dept) {
				res.data.dept = {}
			}
			form.value = {
				...res.data.dept,
				...res.data.memberInfo
			}
			// 入会材料
			if (form.value.materials) {
				form.value.materials1 = JSON.parse(form.value.materials)
				// form.value.materials = JSON.parse(form.value.materials)
			}
			// 入会申请书
			if (form.value.applicationForMembership) {
				form.value.applicationForMembership1 = JSON.parse(form.value.applicationForMembership)
				// form.value.applicationForMembership = JSON.parse(form.value.applicationForMembership)
			}
			applicationForMembership1.value = form.value.applicationForMembership || []
			form.value.deptType = res.data.dept.deptType
			
			if (form.value.businessLicense) {
				form.value.businessLicenseArr = []
				try{
					form.value.businessLicenseArr = JSON.parse(form.value.businessLicense) || []
				}catch(e){
					form.value.businessLicenseArr=[{url:form.value.businessLicense,name:'营业执照'}]
				}
				console.log('营业执照',form.value.businessLicenseArr)
			}
			if (form.value.certLegalIdcPhoto && form.value.certLegalIdcPhoto!=null) {
				form.value.legalIdcPhotoArr = []
				var arr = form.value.certLegalIdcPhoto?.split(',') || []
				if (arr.length > 0) {
					arr = _.map(arr, (p) => {
						if(p.indexOf('http')==-1){
							console.log(p)
							p = config.baseUrl_api + p
						}
						return p
					})
					form.value.legalIdcPhotoArr = arr
				}
				console.log('法人身份证',form.value.legalIdcPhotoArr)
			}
			if (form.value.certPictures) {
					form.value.picturesArr = []
					var arr = form.value.certPictures.split(',') || []
					if (arr.length > 0) {
						arr = _.map(arr, (p) => {
							if(p.indexOf('http')==-1){
								p = config.baseUrl_api + p
							}
							return p
						})
						form.value.picturesArr = arr
					}
					console.log(form.value.picturesArr)
				}
			
		})
	}

	function auditEditFN() {
		uni.navigateTo({
			url: `/myCenter/reviewList`
		})
	}
	function showImage(arr, index) {
		uni.previewImage({
			urls: arr,
			current: index,
			success: function(res) {
	
			}
		})
	}
	
		function download(url) {
			console.log(url)
			if (url.indexOf('.png') > -1 || url.indexOf('.jpg') > -1) {
				if(url.indexOf('http')>-1){
					uni.previewImage({
						urls: [url],
						success: function(res) {
					
						}
					})
				} else {
					uni.previewImage({
						urls: [config.baseUrl_api + url],
						success: function(res) {
						}
					})
				}
			} else {
				if(url.indexOf('http')>-1){
					goWebView(url)
				} else {
					goWebView(config.baseUrl_api + url)
				}
			}
		}
	
		function goWebView(url) {
			url = url.replace("http://", "https://")
			uni.showLoading({
				title: '下载中'
			});
			uni.downloadFile({
				url: url,
				success: function(res) {
					uni.hideLoading();
					var filePath = res.tempFilePath;
					uni.showLoading({
						title: '正在打开'
					});
					uni.openDocument({
						filePath: filePath,
						showMenu: true,
						success: function(res) {
							uni.hideLoading();
						},
						fail: function(err) {
							uni.hideLoading();
							uni.showToast({
								title: err,
								icon: 'none',
								duration: 2000
							});
						}
					});
				},
				fail: function(error) {
					uni.hideLoading();
					uni.showToast({
						title: `下载失败`,
						icon: 'none',
						duration: 2000
					});
				}
			});
		}
	function payTheFees(){
		if (!form.value.name) {
			uni.showToast({
				title: `请先完善团体信息`,
				icon: 'none'
			});
		}
		uni.navigateTo({
			url:`/myCenter/perfect`
		})
	}
</script>

<style scoped lang="scss">
	.height1{height: 100rpx;}
	.photobox {
		position: relative;
		margin: 30rpx auto;
	
		.photo {
			width: 210rpx;
			height: 280rpx;
			background-color: #f4f4f4;
			display: block;
			margin: auto;
		}
	}
	.ylImage {
		width: 300rpx;
		height: 200rpx;
		display: block;
		box-shadow: 0 0 10rpx #ddd;
		border-radius: 8rpx;
	}
	
	.photoBook{position: relative;border-radius: 10rpx;    overflow: hidden;
		&::after{content: '';position: absolute;width: 100%;height: 100%;top: 0;left: 0;
		background: linear-gradient(180deg,rgba(0, 0, 0, 0),rgba(0, 0, 0, 0.7));
	}
		text{    position: absolute;z-index: 1;
	font-size: 24rpx;
	color: #fff;
	bottom: 4rpx;
	right: 8rpx;}
	}
	.frrr{width: 100%;text-align: right;
    text-align: right;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;}
	:deep(.selected-list){font-size: 32rpx;padding: 0;}
	:deep(.input-value){padding: 0;}
	:deep(.uni-list-item__extra-text) {
		font-size: 32rpx;color: #000;
	}

	:deep(.uni-list-item__extra) {
		flex: 1 1 auto;
	}

	:deep(.uni-list-item__content) {
		flex: 0 0 auto;
	}

	:deep(.uni-list-item__content-title) {
		color: #999;
	}

	.flexbox {
		padding: 30rpx;
		background-color: #fff;
		justify-content: space-between;
	}

	.mainbox {
		margin: 30rpx;
	}
</style>