auth.vue 11.5 KB
<template>
	<view>
		<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>
			<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 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.siteProvinceId" :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.siteRegionId"
							v-model="form.siteRegionId" :localdata="options">
						</uni-data-picker>
						<uni-data-picker readonly :clear-icon="false" v-else-if="form.siteCityId"
							v-model="form.siteCityId" :localdata="options">
						</uni-data-picker>
						<uni-data-picker readonly :clear-icon="false" v-else-if="form.siteProvinceId"
							v-model="form.siteProvinceId" :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 'lodash'
	import {
		onMounted,
		ref
	} from 'vue'
	import {
		onLoad
	} 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([])
	onLoad(() => {
		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>