ykt-team-wxapp/pages/archive/bind-popup.vue

134 lines
3.9 KiB
Vue
Raw Normal View History

2026-01-20 19:36:49 +08:00
<template>
<uni-popup ref="popup" type="center" :mask-click="false">
<view class="bg-white rounded overflow-hidden" style="width: 690rpx;">
<view class="flex items-center justify-between px-15 py-12 border-b">
<view class="text-lg font-semibold text-dark">通过档案手机号验证</view>
<uni-icons type="closeempty" :size="24" color="#999" @click="close"></uni-icons>
</view>
<view class="px-15 pt-15 text-base text-dark">
2026-05-08 16:57:16 +08:00
您在"{{ corpName }}"医客通平台已存在档案请选择档案绑定
2026-01-20 19:36:49 +08:00
</view>
<scroll-view scroll-y="true" class="popup-content-scroll">
<view class="px-15 py-12">
2026-05-08 16:57:16 +08:00
<view v-for="customer in list" :key="customer._id" class="flex items-center p-10 mb-10 rounded-sm bg-gray"
@click="id = customer._id">
2026-01-20 19:36:49 +08:00
<view class="flex-grow w-0 mr-5 text-base leading-normal text-dark">
<view class="flex items-center">
<view class="flex-shrink-0 min-w-60">姓名</view>
2026-05-08 16:57:16 +08:00
<view>{{ customer.maskName }}</view>
2026-01-20 19:36:49 +08:00
</view>
2026-05-15 15:38:48 +08:00
<!-- <view class="flex items-center">
2026-01-20 19:36:49 +08:00
<view class="flex-shrink-0 min-w-60">性别</view>
<view>{{ customer.sex || '--' }}</view>
2026-05-15 15:38:48 +08:00
</view> -->
2026-01-20 19:36:49 +08:00
<view class="flex items-center">
<view class="flex-shrink-0 min-w-60">手机号</view>
<view>{{ customer.mobile }}</view>
</view>
</view>
<image class="check-icon" :src="`/static/form/${id === customer._id ? 'checked' : 'uncheck'}.svg`"></image>
</view>
</view>
</scroll-view>
<view class="footer-buttons">
<button-footer hideden-shadow confirmText="确定" :showCancel="false" @confirm="confirm()" />
</view>
2026-05-15 15:38:48 +08:00
<view class="flex justify-end px-15 pb-10">
<view class="mr-5 text-base text-dark">以上档案都不对可以</view>
<view class="px-10 text-base leading-normal text-primary border-auto rounded-sm" @click="close()">新增档案</view>
</view>
2026-01-20 19:36:49 +08:00
</view>
</uni-popup>
2026-05-08 16:57:16 +08:00
<verify-name-popup
:visible="showVerifyPopup"
:customer="customer"
@close="onVerifyClose"
@confirm="onVerifyConfirm"
/>
2026-01-20 19:36:49 +08:00
</template>
<script setup>
2026-05-08 16:57:16 +08:00
import { computed, ref, watch } from 'vue';
2026-01-20 19:36:49 +08:00
import { toast } from '@/utils/widget';
import ButtonFooter from '@/components/button-footer.vue';
2026-05-08 16:57:16 +08:00
import VerifyNamePopup from './verify-name-popup.vue';
2026-01-20 19:36:49 +08:00
const emits = defineEmits(['close', 'confirm'])
const props = defineProps({
corpName: {
type: String,
default: ''
},
customers: {
type: Array,
default: () => []
},
visible: {
type: Boolean,
default: false
}
})
const popup = ref()
const id = ref('')
2026-05-08 16:57:16 +08:00
const showVerifyPopup = ref(false)
const list = computed(() => props.customers.map(i => {
const name = typeof i.name === 'string' ? i.name.trim() : '';
const maskName = name.length > 1 ? name.slice(0, 1) + '*'.repeat(name.length - 1) : '*';
return {
...i,
maskName
}
}))
const customer = computed(() => {
const selected = list.value.find(i => i._id === id.value)
return selected ? selected : {}
})
2026-01-20 19:36:49 +08:00
function close() {
emits('close')
}
function confirm() {
if (props.customers.some(i => i._id === id.value && id.value)) {
2026-05-08 16:57:16 +08:00
showVerifyPopup.value = true
2026-01-20 19:36:49 +08:00
} else {
toast('请选择档案')
}
}
2026-05-08 16:57:16 +08:00
function onVerifyClose() {
showVerifyPopup.value = false
}
function onVerifyConfirm() {
emits('confirm', id.value)
}
2026-01-20 19:36:49 +08:00
watch(() => props.visible, n => {
if (n) {
2026-05-15 15:38:48 +08:00
popup.value && popup.value.open();
if(props.customers && props.customers.length === 1 && props.customers[0] && props.customers[0]._id){
id.value = props.customers[0]._id
}
2026-01-20 19:36:49 +08:00
} else {
popup.value && popup.value.close()
}
})
</script>
<style lang="scss" scoped>
.min-w-60 {
min-width: 120rpx;
}
.check-icon {
width: 48rpx;
height: 48rpx;
}
2026-05-08 16:57:16 +08:00
.popup-content-scroll {
2026-05-15 15:38:48 +08:00
max-height: 50vh;
2026-02-05 17:11:17 +08:00
}
2026-01-20 19:36:49 +08:00
</style>