Skip to content

Commit 40d7f57

Browse files
author
puhui999
committed
【功能完善】商城客服: 会员足迹样式调整
1 parent 34fe09e commit 40d7f57

File tree

1 file changed

+68
-24
lines changed

1 file changed

+68
-24
lines changed

src/views/mall/promotion/kefu/components/member/MemberInfo.vue

Lines changed: 68 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,35 @@
22
<template>
33
<el-container class="kefu">
44
<el-header class="kefu-header">
5-
<el-tabs v-model="activeName" class="kefu-tabs" @tab-click="handleClick">
6-
<el-tab-pane label="最近浏览" name="a" />
7-
<el-tab-pane label="订单列表" name="b" />
8-
</el-tabs>
5+
<div
6+
:class="{ 'kefu-header-item-activation': tabActivation('会员信息') }"
7+
class="kefu-header-item cursor-pointer flex items-center justify-center"
8+
@click="handleClick('会员信息')"
9+
>
10+
会员信息
11+
</div>
12+
<div
13+
:class="{ 'kefu-header-item-activation': tabActivation('最近浏览') }"
14+
class="kefu-header-item cursor-pointer flex items-center justify-center"
15+
@click="handleClick('最近浏览')"
16+
>
17+
最近浏览
18+
</div>
19+
<div
20+
:class="{ 'kefu-header-item-activation': tabActivation('交易订单') }"
21+
class="kefu-header-item cursor-pointer flex items-center justify-center"
22+
@click="handleClick('交易订单')"
23+
>
24+
交易订单
25+
</div>
926
</el-header>
1027
<el-main class="kefu-content">
1128
<div v-show="!isEmpty(conversation)">
1229
<el-scrollbar ref="scrollbarRef" always @scroll="handleScroll">
1330
<!-- 最近浏览 -->
14-
<ProductBrowsingHistory v-if="activeName === 'a'" ref="productBrowsingHistoryRef" />
15-
<!-- 订单列表 -->
16-
<OrderBrowsingHistory v-if="activeName === 'b'" ref="orderBrowsingHistoryRef" />
31+
<ProductBrowsingHistory v-if="activeTab === '最近浏览'" ref="productBrowsingHistoryRef" />
32+
<!-- 交易订单 -->
33+
<OrderBrowsingHistory v-if="activeTab === '交易订单'" ref="orderBrowsingHistoryRef" />
1734
</el-scrollbar>
1835
</div>
1936
<el-empty v-show="isEmpty(conversation)" description="请选择左侧的一个会话后开始" />
@@ -22,7 +39,6 @@
2239
</template>
2340

2441
<script lang="ts" setup>
25-
import type { TabsPaneContext } from 'element-plus'
2642
import ProductBrowsingHistory from './ProductBrowsingHistory.vue'
2743
import OrderBrowsingHistory from './OrderBrowsingHistory.vue'
2844
import { KeFuConversationRespVO } from '@/api/mall/promotion/kefu/conversation'
@@ -32,25 +48,26 @@ import { ElScrollbar as ElScrollbarType } from 'element-plus/es/components/scrol
3248
3349
defineOptions({ name: 'MemberBrowsingHistory' })
3450
35-
const activeName = ref('a')
36-
51+
const activeTab = ref('会员信息')
52+
const tabActivation = computed(() => (tab: string) => activeTab.value === tab)
3753
/** tab 切换 */
3854
const productBrowsingHistoryRef = ref<InstanceType<typeof ProductBrowsingHistory>>()
3955
const orderBrowsingHistoryRef = ref<InstanceType<typeof OrderBrowsingHistory>>()
40-
const handleClick = async (tab: TabsPaneContext) => {
41-
activeName.value = tab.paneName as string
56+
const handleClick = async (tab: string) => {
57+
activeTab.value = tab
4258
await nextTick()
4359
await getHistoryList()
4460
}
4561
4662
/** 获得历史数据 */
47-
// TODO @puhui:不要用 a、b 哈。就订单列表、浏览列表这种噶
4863
const getHistoryList = async () => {
49-
switch (activeName.value) {
50-
case 'a':
64+
switch (activeTab.value) {
65+
case '会员信息':
66+
break
67+
case '最近浏览':
5168
await productBrowsingHistoryRef.value?.getHistoryList(conversation.value)
5269
break
53-
case 'b':
70+
case '交易订单':
5471
await orderBrowsingHistoryRef.value?.getHistoryList(conversation.value)
5572
break
5673
default:
@@ -60,11 +77,13 @@ const getHistoryList = async () => {
6077
6178
/** 加载下一页数据 */
6279
const loadMore = async () => {
63-
switch (activeName.value) {
64-
case 'a':
80+
switch (activeTab.value) {
81+
case '会员信息':
82+
break
83+
case '最近浏览':
6584
await productBrowsingHistoryRef.value?.loadMore()
6685
break
67-
case 'b':
86+
case '交易订单':
6887
await orderBrowsingHistoryRef.value?.loadMore()
6988
break
7089
default:
@@ -75,7 +94,7 @@ const loadMore = async () => {
7594
/** 浏览历史初始化 */
7695
const conversation = ref<KeFuConversationRespVO>({} as KeFuConversationRespVO) // 用户会话
7796
const initHistory = async (val: KeFuConversationRespVO) => {
78-
activeName.value = 'a'
97+
activeTab.value = '会员信息'
7998
conversation.value = val
8099
await nextTick()
81100
await getHistoryList()
@@ -95,9 +114,6 @@ const handleScroll = debounce(() => {
95114

96115
<style lang="scss" scoped>
97116
.kefu {
98-
margin: 0;
99-
padding: 0;
100-
height: 100%;
101117
width: 300px !important;
102118
background-color: #fff;
103119
border-left: var(--el-border-color) solid 1px;
@@ -107,12 +123,40 @@ const handleScroll = debounce(() => {
107123
box-shadow: 0 0 0 0 #dcdfe6;
108124
display: flex;
109125
align-items: center;
110-
justify-content: center;
126+
justify-content: space-around;
111127
112128
&-title {
113129
font-size: 18px;
114130
font-weight: bold;
115131
}
132+
133+
&-item {
134+
height: 100%;
135+
width: 100%;
136+
position: relative;
137+
138+
&-activation::before {
139+
content: '';
140+
position: absolute; /* 绝对定位 */
141+
top: 0;
142+
left: 0;
143+
right: 0;
144+
bottom: 0; /* 覆盖整个元素 */
145+
border-bottom: 2px solid black; /* 边框样式 */
146+
pointer-events: none; /* 确保点击事件不会被伪元素拦截 */
147+
}
148+
149+
&:hover::before {
150+
content: '';
151+
position: absolute; /* 绝对定位 */
152+
top: 0;
153+
left: 0;
154+
right: 0;
155+
bottom: 0; /* 覆盖整个元素 */
156+
border-bottom: 2px solid black; /* 边框样式 */
157+
pointer-events: none; /* 确保点击事件不会被伪元素拦截 */
158+
}
159+
}
116160
}
117161
118162
&-content {

0 commit comments

Comments
 (0)