changeVipDetail.vue 5.54 KB
<template>
	<view>
		<uni-collapse>
			<uni-collapse-item :title="n.personCode+' - '+n.oldName" v-for="n in list" :key="n.id" open>
				<view class="collapseBody">
					<view>
						<label>姓名:</label>
						{{n.oldName}}
						<text class="text-primary" v-if="n.oldName!=n.newName">变更为 </text>
						<text class="text-danger" v-if="n.oldName!=n.newName">{{ n.newName }}</text>
					</view>
					<view>
						<label>性别:</label>
						{{ n.oldSex==0?'男':'女' }}
						<text class="text-primary" v-if="n.oldSex!=n.newSex">变更为 </text>
						<text class="text-danger" v-if="n.oldSex!=n.newSex">{{ n.newSex==0?'男':'女' }}</text>
					</view>
					<view>
						<label>证件类型:</label>
						{{ cardType[n.oldIdcType].label }}
						<text class="text-primary" v-if="n.oldIdcType!=n.newIdcType">变更为 </text>
						<text class="text-danger" v-if="n.oldIdcType!=n.newIdcType">{{ cardType[n.newIdcType].label }}
						</text>
					</view>
					<view>
						<label>证件号:</label>
						{{ n.oldIdcCode }}
						<text class="text-primary" v-if="n.oldIdcCode!=n.newIdcCode">变更为 </text>
						<text class="text-danger" v-if="n.oldIdcCode!=n.newIdcCode">{{ n.newIdcCode }}</text>
					</view>
					<view>
						<label>出生日期:</label>
						{{ n.oldBirth?.slice(0,10) }}
						<text v-if="n.oldBirth!=n.newBirth" class="text-gray">变更为 </text>
						<text class="text-danger" v-if="n.oldBirth!=n.newBirth">{{ n.newBirth?.slice(0,10) }}</text>
					</view>
					<view v-if="n.fileUrl">
						<label>附件: </label>
						<text class="text-primary" @click="showImg(n)">
							查看附件
						</text>
					</view>
					<view>
						<label>会员状态:</label>
						<text class="text-primary" v-if="n.personCertStage==0">
							新会员
						</text>
						<text class="text-primary" v-if="n.personCertStage==1">
							待提交
						</text>
						<text class="text-warning" v-if="n.personCertStage==2">
							缴费中
						</text>
						<text class="text-success" v-if="n.personCertStage==3">
							正常
						</text>
						<text class="text-danger" v-if="n.personCertStage==4">
							过期
						</text>
					</view>
				</view>

			</uni-collapse-item>
		</uni-collapse>

	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import * as api from '@/common/api.js'
	import config from '@/config.js'
	const queryParams = ref({})
	const total = ref(0)
	const list = ref([])
	const popup = ref(null)
	const type = ref('')
	const form = ref({})
	const cardType = ref([{
			label: '身份证',
			value: '0'
		},
		{
			label: '港澳台通行证 ',
			value: '1'
		},
		{
			label: '中国护照',
			value: '2'
		},
		{
			label: '护照',
			value: '3'
		},
		{
			label: '户口本',
			value: '4'
		},
		{
			label: '香港身份证',
			value: '5'
		}
	])
	onLoad((option) => {
		if (option.rangeId) {
			queryParams.value.rangeId = option.rangeId
			getList()
		}
	})

	function getList() {
		uni.showLoading({
			title: '加载中'
		})
		api.addInfoModeList(queryParams.value).then(res => {
			list.value = res.rows
			list.value.forEach(item => {
				item.fileUrl = JSON.parse(item.fileUrl)
			})
			total.value = res.total
			uni.hideLoading()
		})
	}

	function handleChange(a, b) {
		type.value = b
		form.value = a
		console.log(form.value.newName)
		popup.value.open()
	}

	function handleDelete(row) {
		uni.showModal({
			content: `确认删除会员${row.newName}`,
			success: function(res) {
				if (res.confirm) {
					api.infoMod([row.id]).then(res => {
						uni.showToast({
							title: '操作成功'
						})
						getList()
					})
				}
			}
		})
	}

	function showImg(n) {
		var str = config.baseUrl_api + n.fileUrl[0]?.url
		if (n.fileUrl[0]?.url.indexOf('png') > -1 || n.fileUrl[0]?.url.indexOf('jpg') > -1 || n.fileUrl[0]?.url.indexOf(
				'jpeg') > -1) {
			uni.previewImage({
				urls: [str],
				success: function(res) {
					console.log('success', res)
				},
				fail: function(res) {
					console.log('fail', res)
				},
				complete: function(res) {
					console.log('complete', res)
				}
			})
		} else {
			goWebView(str)
		}
	}

	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
				});
			}
		});
	}
</script>
<style scoped lang="scss">
	.flexbox {
		padding: 30rpx 30rpx 0
	}

	.danger-button {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.collapseBody {
		padding: 0 30rpx;
		box-sizing: border-box;
		font-size: 28rpx;

		view {
			margin: 0 0 20rpx;

			label {
				width: 5em;
				color: #999;
				display: inline-block;
				text-align: right;
			}
		}
	}

	.popBody {
		background: #fff;
		padding: 30rpx;
	}
</style>