Files
smartDriveEEUniApp/pages-subpackage/ai_features/customer_count/customer-count-popup.vue
2026-02-07 19:51:03 +08:00

283 lines
6.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<uni-popup ref="popup" type="center" :mask-click="true" @change="onPopupChange">
<view class="customer-count-popup">
<view class="popup-header">
<text class="popup-title">接待客户数统计</text>
<view class="popup-close" @click="close">
<text class="close-icon">×</text>
</view>
</view>
<scroll-view class="popup-content" scroll-y="true">
<!-- 统计卡片 -->
<view class="popup-stats-card">
<view class="popup-stat-item">
<text class="popup-stat-value">{{ totalCustomers }}</text>
<text class="popup-stat-label">累计接待客户</text>
</view>
<view class="popup-stat-item">
<text class="popup-stat-value">{{ todayCustomers }}</text>
<text class="popup-stat-label">今日接待客户</text>
</view>
</view>
<!-- 图表区域 -->
<view class="popup-chart-section">
<text class="popup-section-title">接待趋势图</text>
<view class="popup-chart-placeholder">
<text class="popup-placeholder-text">📈 图表区域</text>
<text class="popup-placeholder-desc">此处将显示客户接待趋势图表</text>
</view>
</view>
<!-- 数据列表 -->
<view class="popup-data-list">
<text class="popup-section-title">接待记录</text>
<view class="popup-list-item" v-for="(item, index) in dataList" :key="index">
<view class="popup-item-left">
<text class="popup-item-date">{{ item.date }}</text>
<text class="popup-item-desc">{{ item.description }}</text>
</view>
<view class="popup-item-right">
<text class="popup-item-count">{{ item.count }} </text>
</view>
</view>
</view>
</scroll-view>
</view>
</uni-popup>
</template>
<script>
export default {
name: 'CustomerCountPopup',
props: {
openTrigger: {
type: Number,
default: 0
}
},
data() {
return {
totalCustomers: '1,258',
todayCustomers: '23',
dataList: [
{ date: '2024-02-07', description: '今日接待客户', count: '23' },
{ date: '2024-02-06', description: '昨日接待客户', count: '31' },
{ date: '2024-02-05', description: '前日接待客户', count: '28' },
{ date: '2024-02-04', description: '工作日接待客户', count: '35' },
{ date: '2024-02-03', description: '周末接待客户', count: '18' }
]
}
},
watch: {
openTrigger(newVal) {
// 当触发器变化时,自动打开弹窗
if (newVal > 0) {
this.$nextTick(() => {
this.open();
});
}
}
},
methods: {
open() {
// 安全地访问 refs如果组件还未准备好则重试
if (this.$refs && this.$refs.popup) {
this.$refs.popup.open();
} else {
// 如果 refs 还未准备好,延迟重试
setTimeout(() => {
if (this.$refs && this.$refs.popup) {
this.$refs.popup.open();
}
}, 100);
}
},
close() {
if (this.$refs && this.$refs.popup) {
this.$refs.popup.close();
}
},
onPopupChange(e) {
if (!e.show) {
this.$emit('close')
}
}
}
}
</script>
<style scoped>
.customer-count-popup {
width: 680rpx;
max-height: 80vh;
background-color: #FFFFFF;
border-radius: 16rpx;
display: flex;
flex-direction: column;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.2);
overflow: hidden;
position: relative;
}
.popup-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 6rpx 32rpx;
border-bottom: 1rpx solid #E0E0E0;
flex-shrink: 0;
background-color: #FFFFFF;
box-sizing: border-box;
}
.popup-title {
font-size: 24rpx;
font-weight: 500;
color: #333;
}
.popup-close {
width: 40rpx;
height: 40rpx;
min-width: 40rpx;
min-height: 40rpx;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
flex-shrink: 0;
background-color: rgba(0, 0, 0, 0.05);
border-radius: 50%;
transition: background-color 0.2s;
}
.popup-close:active {
background-color: rgba(0, 0, 0, 0.1);
}
.close-icon {
font-size: 32rpx;
color: #333;
line-height: 1;
display: block;
}
.popup-content {
flex: 1;
min-height: 0;
overflow-y: auto;
max-height: calc(80vh - 52rpx);
}
.popup-stats-card {
display: flex;
margin: 20rpx 30rpx;
background: #f8f9fa;
border-radius: 16rpx;
padding: 40rpx 30rpx;
}
.popup-stat-item {
flex: 1;
text-align: center;
}
.popup-stat-item:not(:last-child) {
border-right: 1rpx solid #e9ecef;
}
.popup-stat-value {
display: block;
font-size: 48rpx;
font-weight: bold;
color: #007aff;
margin-bottom: 10rpx;
}
.popup-stat-label {
display: block;
font-size: 24rpx;
color: #666666;
}
.popup-chart-section,
.popup-data-list {
margin: 20rpx 30rpx;
background: #f8f9fa;
border-radius: 16rpx;
overflow: hidden;
}
.popup-section-title {
display: block;
font-size: 32rpx;
font-weight: bold;
color: #333333;
padding: 30rpx;
border-bottom: 1rpx solid #e9ecef;
background: #ffffff;
}
.popup-chart-placeholder {
padding: 80rpx 30rpx;
text-align: center;
background: #ffffff;
}
.popup-placeholder-text {
display: block;
font-size: 48rpx;
margin-bottom: 20rpx;
}
.popup-placeholder-desc {
display: block;
font-size: 28rpx;
color: #666666;
}
.popup-list-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 30rpx;
border-bottom: 1rpx solid #f0f0f0;
background: #ffffff;
}
.popup-list-item:last-child {
border-bottom: none;
}
.popup-item-left {
flex: 1;
}
.popup-item-date {
display: block;
font-size: 28rpx;
font-weight: bold;
color: #333333;
margin-bottom: 8rpx;
}
.popup-item-desc {
display: block;
font-size: 24rpx;
color: #666666;
}
.popup-item-right {
text-align: right;
}
.popup-item-count {
display: block;
font-size: 28rpx;
font-weight: bold;
color: #007aff;
}
</style>