You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

554 lines
17 KiB

7 months ago
<template>
<div class="home">
7 months ago
<!-- 中间 -->
<div class="warp_body">
<div class="white-body">
<!-- Tab 切换 -->
<div class="tabs">
<div class="tab-item portrayal" :class="{ active: currentTab === 0 }" @click="currentTab = 0">
<div class="tab-item-title">企业画像</div>
</div>
<div class="tab-item record" :class="{ active: currentTab === 1 }" @click="currentTab = 1">
<div class="tab-item-title">执法记录</div>
</div>
7 months ago
</div>
<!-- 企业画像 Tab -->
<div v-if="currentTab === 0">
<!-- 企业信息卡片 -->
<div class="enterprise-card">
<div v-if="enterpriseData" class="enterprise-info">
<div class="info-item">
<div class="info-label">企业名称</div>
<div class="info-value">{{ enterpriseData.enterpriseName }}</div>
</div>
<template v-if="!isCollapsed">
<div class="info-item">
<div class="info-label">统一社会信用代码</div>
<div class="info-value">{{ enterpriseData.enterpriseNumber }}</div>
</div>
<div class="info-item">
<div class="info-label">法定代表人</div>
<div class="info-value">{{ enterpriseData.legalPerson }}</div>
</div>
<div class="info-item">
<div class="info-label">企业类型</div>
<div class="info-value">{{ enterpriseData.enterpriseType }}</div>
</div>
<div class="info-item">
<div class="info-label">注册资本</div>
<div class="info-value">{{ enterpriseData.registeredCapital }}</div>
</div>
<div class="info-item">
<div class="info-label">成立日期</div>
<div class="info-value">{{ formatDate(enterpriseData.establishmentTime) }}</div>
</div>
<div class="info-item">
<div class="info-label">经营期限</div>
<div class="info-value">{{ enterpriseData.operatingTerm }}</div>
</div>
<div class="info-item">
<div class="info-label">注册地址</div>
<div class="info-value address-value">
<span class="address-text">{{ enterpriseData.enterpriseAddress }}</span>
<span class="expand-text"
v-if="enterpriseData.enterpriseAddress && enterpriseData.enterpriseAddress.length > 20">展开</span>
</div>
</div>
<div class="info-item">
<div class="info-label">经营范围</div>
<div class="info-value scope-value">
<span class="scope-text">{{ enterpriseData.businessScope }}</span>
<span class="expand-text"
v-if="enterpriseData.businessScope && enterpriseData.businessScope.length > 30">展开</span>
</div>
</div>
</template>
<template v-else>
<div class="info-item">
<div class="info-label">统一社会信用代码</div>
<div class="info-value">{{ enterpriseData.enterpriseNumber }}</div>
</div>
</template>
</div>
<van-empty v-else description="暂无企业信息" />
<!-- 分隔箭头 -->
<div class="divider-arrow" @click="toggleCollapse">
<van-icon :name="isCollapsed ? 'arrow-down' : 'arrow-up'" />
</div>
</div>
7 months ago
</div>
<!-- 执法记录 Tab -->
<div v-if="currentTab === 1" class="tab-content">
<!-- 执法记录子Tab -->
<div class="record-tabs">
<div class="record-tab-item" :class="{ active: recordTab === 0 }" @click="recordTab = 0">
<span>全市</span>
</div>
<div class="record-tab-item" :class="{ active: recordTab === 1 }" @click="recordTab = 1">
<span>本单位</span>
</div>
</div>
<!-- 执法记录列表 -->
<div class="record-list">
<div v-for="(item, index) in (recordTab === 0 ? cityRecords : unitRecords)" :key="index"
class="record-card-item">
<div class="record-header">
<div class="record-date">{{ item.date }}</div>
<div class="record-company">{{ enterpriseData?.enterpriseName }}</div>
<div class="record-count">被执法次数:{{ item.count }}次</div>
</div>
<div class="record-timeline" v-if="isRecordExpanded">
<div v-for="(timeline, tIndex) in item.timeline" :key="tIndex" class="timeline-item" :class="{ 'has-line': tIndex !== item.timeline.length - 1 }">
<div class="timeline-dot"></div>
<div class="timeline-content">
<div class="timeline-time">{{ timeline.time }}</div>
<div class="timeline-unit"><span class="unit-label">执法单位:</span>{{ timeline.unit }}</div>
</div>
</div>
</div>
<div class="record-expand" @click="toggleRecordExpand">
<van-icon :name="isRecordExpanded ? 'arrow-up' : 'arrow-down'" />
</div>
</div>
<div v-if="(recordTab === 0 ? cityRecords : unitRecords).length === 0" class="empty-state">
<van-icon name="file-o" class="empty-icon" />
<div class="empty-text">暂无数据</div>
</div>
</div>
7 months ago
</div>
</div>
<!-- 执法记录卡片 -->
<div class="record-card" v-if="currentTab === 0">
<!-- 执法记录子Tab -->
<div class="record-tabs">
<div class="record-tab-item" :class="{ active: recordTab === 0 }" @click="recordTab = 0">
<span>历史执法案件</span>
</div>
<div class="record-tab-item" :class="{ active: recordTab === 1 }" @click="recordTab = 1">
<span>历史处罚案件</span>
</div>
<div class="record-tab-item" :class="{ active: recordTab === 2 }" @click="recordTab = 2">
<span>历史强制案件</span>
</div>
</div>
<van-empty description="暂无执法记录" />
7 months ago
</div>
</div>
<!-- 登记按钮 -->
<div class="addinfo" @click="toSign">登记</div>
</div>
</template>
<script setup name="EnterpriseScanPreview">
import { ref, onMounted } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import { showFailToast } from 'vant';
const router = useRouter();
const route = useRoute();
// ========== 数据 ==========
const currentTab = ref(0);
const recordTab = ref(0);
const isCollapsed = ref(false);
const isRecordExpanded = ref(false);
7 months ago
const enterpriseData = ref(null);
const enterpriseNumber = ref('');
const qrCodeValid = ref(false);
// 当前企业的全市执法记录假数据
const cityRecords = ref([
{
date: '2026-05-12 09:34:01',
count: 2,
timeline: [
{ time: '2026-05-12 09:34:01', unit: '深圳市司法局' },
{ time: '2026-05-12 09:34:01', unit: '深圳市司法局' },
{ time: '2026-05-06 15:44:27', unit: '深圳市司法局' },
],
},
]);
// 当前企业的本单位执法记录假数据
const unitRecords = ref([
{
date: '2026-05-11 10:15:00',
count: 3,
timeline: [
{ time: '2026-05-11 10:15:00', unit: '本单位执法大队' },
{ time: '2026-05-08 16:30:22', unit: '本单位执法大队' },
{ time: '2026-05-03 09:00:15', unit: '本单位执法大队' },
],
},
]);
// ========== 方法 ==========
const toggleCollapse = () => {
isCollapsed.value = !isCollapsed.value;
};
const toggleRecordExpand = () => {
isRecordExpanded.value = !isRecordExpanded.value;
};
7 months ago
// ========== 初始化加载 ==========
onMounted(() => {
// 从 sessionStorage 读取扫码页传递的企业信息
const cached = sessionStorage.getItem('enterpriseScanData');
if (cached) {
try {
const data = JSON.parse(cached);
enterpriseData.value = data;
enterpriseNumber.value = data.enterpriseNumber || '';
qrCodeValid.value = !!data.qrCodeValid;
console.log('企业详情加载成功(来自缓存):', data.enterpriseName);
} catch (e) {
console.error('解析企业缓存数据失败', e);
showFailToast('企业信息解析失败');
}
} else {
showFailToast('缺少企业信息,请重新扫码');
}
});
// ========== 工具方法 ==========
const formatDate = (dateStr) => {
if (!dateStr) return '';
const d = new Date(dateStr);
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
};
// ========== 页面跳转 ==========
const toSign = () => {
router.push({
path: '/enforcement/enforcementRegister',
7 months ago
});
};
</script>
<style lang="less" scoped>
.home {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
background-color: #ebf3fb;
.warp_body {
position: relative;
flex: 1;
overflow-y: auto;
background-image: linear-gradient(to bottom, #ebf3fb, transparent);
}
.white-body {
margin: 0 0.3rem;
width: calc(100% - 0.6rem);
7 months ago
background-color: #fff;
border-radius: 0.27rem;
overflow: hidden;
margin-bottom: 20px;
7 months ago
}
}
.tabs {
display: flex;
padding: 0.3rem 0.3rem 0;
7 months ago
}
.tab-item {
flex: 1;
height: 44px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
.tab-item-title {
font-size: 0.38rem;
}
&.portrayal {
background: url('@/assets/images/tab_bg1_1.png') no-repeat center center;
background-size: 100% 100%;
.tab-item-title {
color: #1989fa;
}
&.active {
background: url('@/assets/images/tab_bg1.png') no-repeat center center;
background-size: 100% 100%;
.tab-item-title {
color: #fff;
}
}
}
&.record {
background: url('@/assets/images/tab_bg.png') no-repeat center center;
background-size: 100% 100%;
.tab-item-title {
color: #1989fa;
}
&.active {
background: url('@/assets/images/tab_bg_1.png') no-repeat center center;
background-size: 100% 100%;
.tab-item-title {
color: #fff;
}
}
}
}
.enterprise-card {
background: #fff;
border-radius: 0.2rem;
padding: 0 0.3rem;
margin-bottom: 0.3rem;
7 months ago
}
.enterprise-info {
.info-item {
display: flex;
padding: 0.25rem 0;
border-bottom: 1px solid #f5f5f5;
&:last-child {
border-bottom: none;
}
}
.info-label {
flex: none;
width: 74px;
font-size: 14px;
color: #000;
line-height: 1.5;
margin-right: 30px;
}
.info-value {
flex: 1;
font-size: 0.35rem;
color: #666;
line-height: 1.5;
word-break: break-all;
}
.address-value,
.scope-value {
display: flex;
align-items: flex-start;
}
.address-text,
.scope-text {
flex: 1;
}
.expand-text {
flex: none;
color: #1367fe;
font-size: 0.32rem;
margin-left: 0.1rem;
cursor: pointer;
}
}
.divider-arrow {
7 months ago
display: flex;
justify-content: center;
padding: 0.2rem 0;
color: #ccc;
7 months ago
font-size: 0.4rem;
cursor: pointer;
7 months ago
}
.record-card {
background: #fff;
border-radius: 0.2rem;
padding: 0 0.3rem;
margin: 0.3rem;
}
.tab-content {
height: calc(100vh - 70px);
background: #fff;
box-sizing: border-box;
}
.record-tabs {
display: flex;
border-bottom: 1px solid #f5f5f5;
margin-bottom: 0.3rem;
}
.record-tab-item {
flex: 1;
text-align: center;
padding: 0.25rem 0;
7 months ago
cursor: pointer;
position: relative;
&.active {
border-bottom: 3px solid #1989fa;
span {
color: #1989fa;
font-weight: 650;
}
}
span {
font-size: 0.35rem;
color: #999;
}
7 months ago
}
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 2rem 0;
.empty-icon {
font-size: 2rem;
color: #ddd;
margin-bottom: 0.3rem;
}
.empty-text {
font-size: 0.35rem;
color: #999;
}
7 months ago
}
.record-card-item {
background: #fff;
border-radius: 8px;
7 months ago
padding: 0.3rem;
margin: 10px;
margin-top: 20px;
box-shadow: 0 0px 8px #e5e5e5;
7 months ago
}
.record-header {
margin-bottom: 0.3rem;
.record-date {
font-size: 14px;
7 months ago
color: #999;
margin-bottom: 0.15rem;
7 months ago
}
.record-company {
font-size: 16px;
color: #000;
font-weight: 600;
padding: 10px 0px 10px 20px;
letter-spacing: 0.05rem;
7 months ago
}
.record-count {
font-size: 14px;
color: #393939dd;
padding-left: 20px;
letter-spacing: 0.02rem;
}
}
.record-timeline {
position: relative;
margin-left: 28px;
margin-top: 26px;
}
.timeline-item.has-line::before {
content: '';
position: absolute;
left: 3px;
top: 20px;
bottom: 0;
width: 2px;
height: 48px;
background: #e5e5e5;
}
.timeline-item {
display: flex;
align-items: flex-start;
padding: 0.1rem 0;
position: relative;
.timeline-dot {
width: 10px;
height: 10px;
border-radius: 50%;
background: #1367fe;
margin-right: 0.2rem;
flex-shrink: 0;
position: relative;
z-index: 1;
top: 4px;
7 months ago
}
.timeline-content {
flex: 1;
min-width: 0;
.timeline-time {
font-size: 16px;
color: #ccc;
font-weight: 400;
}
.timeline-unit {
font-size: 14px;
color: #999;
padding:10px 0px;
.unit-label{
color: #000;
}
}
}
}
.record-expand {
display: flex;
justify-content: center;
padding: 0.2rem 0;
color: #ccc;
font-size: 0.4rem;
7 months ago
}
.addinfo {
position: absolute;
bottom: 3%;
right: 2%;
z-index: 99999;
width: 1.5rem;
height: 1.5rem;
background-color: #1367fe;
border-radius: 50%;
box-shadow: 0 0 0.27rem #1367fe;
color: #fff;
font-size: 0.4rem;
text-align: center;
vertical-align: middle;
padding-top: 0.45rem;
box-sizing: border-box;
}
</style>