Skip to content

Commit 649c24e

Browse files
author
puhui999
committed
【功能完善】商城: 客服商品组件显示优化
1 parent fdee8d8 commit 649c24e

File tree

5 files changed

+70
-160
lines changed

5 files changed

+70
-160
lines changed

src/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { toNumber } from 'lodash-es'
1+
import {toNumber} from 'lodash-es'
22

33
/**
44
*

src/views/mall/promotion/kefu/components/KeFuMessageList.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,11 @@
7575
v-if="KeFuMessageContentTypeEnum.PRODUCT === item.contentType"
7676
:picUrl="getMessageContent(item).picUrl"
7777
:price="getMessageContent(item).price"
78-
:skuText="getMessageContent(item).introduction"
78+
:sales-count="getMessageContent(item).salesCount"
7979
:spuId="getMessageContent(item).spuId"
80+
:stock="getMessageContent(item).stock"
8081
:title="getMessageContent(item).spuName"
81-
:titleWidth="400"
82-
class="max-w-70%"
83-
priceColor="#FF3000"
82+
class="max-w-300px"
8483
/>
8584
</MessageItem>
8685
<!-- 订单消息 -->
@@ -392,7 +391,7 @@ const showTime = computed(() => (item: KeFuMessageRespVO, index: number) => {
392391
393392
&-content {
394393
margin: 0;
395-
padding: 0;
394+
padding: 10px;
396395
position: relative;
397396
height: 100%;
398397
width: 100%;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
交易订单
2525
</div>
2626
</el-header>
27-
<el-main class="kefu-content">
27+
<el-main class="kefu-content p-10px!">
2828
<div v-if="!isEmpty(conversation)" v-loading="loading">
2929
<!-- 基本信息 -->
3030
<UserBasicInfo v-if="activeTab === '会员信息'" :user="user" mode="kefu">
@@ -33,7 +33,7 @@
3333
</template>
3434
</UserBasicInfo>
3535
<!-- 账户信息 -->
36-
<el-card v-if="activeTab === '会员信息'" class="h-full" shadow="never">
36+
<el-card v-if="activeTab === '会员信息'" class="h-full mt-10px" shadow="never">
3737
<template #header>
3838
<CardTitle title="账户信息" />
3939
</template>

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
<template>
22
<ProductItem
33
v-for="item in list"
4-
:spu-id="item.spuId"
54
:key="item.id"
65
:picUrl="item.picUrl"
76
:price="item.price"
8-
:skuText="item.introduction"
7+
:sales-count="item.salesCount"
8+
:spu-id="item.spuId"
9+
:stock="item.stock"
910
:title="item.spuName"
10-
:titleWidth="400"
1111
class="mb-10px"
12-
priceColor="#FF3000"
1312
/>
1413
</template>
1514

Lines changed: 60 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,27 @@
11
<template>
2-
<div @click.stop="openDetail(props.spuId)" style="cursor: pointer;">
3-
<div>
4-
<slot name="top"></slot>
2+
<div class="product-warp" style="cursor: pointer" @click.stop="openDetail(spuId)">
3+
<!-- 左侧商品图片-->
4+
<div class="product-warp-left mr-24px">
5+
<el-image
6+
:initial-index="0"
7+
:preview-src-list="[picUrl]"
8+
:src="picUrl"
9+
class="product-warp-left-img"
10+
fit="contain"
11+
preview-teleported
12+
@click.stop
13+
/>
514
</div>
6-
<div
7-
:style="[{ borderRadius: radius + 'px', marginBottom: marginBottom + 'px' }]"
8-
class="ss-order-card-warp flex items-stretch justify-between bg-white"
9-
>
10-
<div class="img-box mr-24px">
11-
<el-image
12-
:initial-index="0"
13-
:preview-src-list="[picUrl]"
14-
:src="picUrl"
15-
class="order-img"
16-
fit="contain"
17-
preview-teleported
18-
@click.stop
19-
/>
15+
<!-- 右侧商品信息 -->
16+
<div class="product-warp-right">
17+
<div class="description">{{ title }}</div>
18+
<div class="my-5px">
19+
<span class="mr-20px">库存: {{ stock || 0 }}</span>
20+
<span>销量: {{ salesCount || 0 }}</span>
2021
</div>
21-
<div
22-
:style="[{ width: titleWidth ? titleWidth + 'px' : '' }]"
23-
class="box-right flex flex-col justify-between"
24-
>
25-
<div v-if="title" class="title-text ss-line-2">{{ title }}</div>
26-
<div v-if="skuString" class="spec-text mt-8px mb-12px">{{ skuString }}</div>
27-
<div class="groupon-box">
28-
<slot name="groupon"></slot>
29-
</div>
30-
<div class="flex">
31-
<div class="flex items-center">
32-
<div
33-
v-if="price && Number(price) > 0"
34-
:style="[{ color: priceColor }]"
35-
class="price-text flex items-center"
36-
>
37-
¥{{ fenToYuan(price) }}
38-
</div>
39-
<div v-if="num" class="total-text flex items-center">x {{ num }}</div>
40-
<slot name="priceSuffix"></slot>
41-
</div>
42-
</div>
43-
<div class="tool-box">
44-
<slot name="tool"></slot>
45-
</div>
46-
<div>
47-
<slot name="rightBottom"></slot>
48-
</div>
22+
<div class="flex justify-between items-center">
23+
<span class="price">¥{{ fenToYuan(price) }}</span>
24+
<el-button size="small" text type="primary">详情</el-button>
4925
</div>
5026
</div>
5127
</div>
@@ -57,7 +33,7 @@ import { fenToYuan } from '@/utils'
5733
const { push } = useRouter()
5834
5935
defineOptions({ name: 'ProductItem' })
60-
const props = defineProps({
36+
defineProps({
6137
spuId: {
6238
type: Number,
6339
default: 0
@@ -70,134 +46,70 @@ const props = defineProps({
7046
type: String,
7147
default: ''
7248
},
73-
titleWidth: {
74-
type: Number,
75-
default: 0
76-
},
77-
skuText: {
78-
type: [String, Array],
79-
default: ''
80-
},
8149
price: {
8250
type: [String, Number],
8351
default: ''
8452
},
85-
priceColor: {
86-
type: [String],
87-
default: ''
88-
},
89-
num: {
53+
salesCount: {
9054
type: [String, Number],
91-
default: 0
92-
},
93-
score: {
94-
type: [String, Number],
95-
default: ''
96-
},
97-
radius: {
98-
type: [String],
9955
default: ''
10056
},
101-
marginBottom: {
102-
type: [String],
57+
stock: {
58+
type: [String, Number],
10359
default: ''
10460
}
10561
})
10662
107-
/** SKU 展示字符串 */
108-
const skuString = computed(() => {
109-
if (!props.skuText) {
110-
return ''
111-
}
112-
if (typeof props.skuText === 'object') {
113-
return props.skuText.join(',')
114-
}
115-
return props.skuText
116-
})
117-
11863
/** 查看商品详情 */
11964
const openDetail = (spuId: number) => {
120-
console.log(props.spuId)
12165
push({ name: 'ProductSpuDetail', params: { id: spuId } })
12266
}
12367
</script>
12468

12569
<style lang="scss" scoped>
126-
.ss-order-card-warp {
127-
padding: 20px;
128-
border-radius: 10px;
129-
border: 1px var(--el-border-color) solid;
130-
background-color: var(--app-content-bg-color);
131-
132-
.img-box {
133-
width: 80px;
134-
height: 80px;
135-
border-radius: 10px;
136-
overflow: hidden;
70+
.button {
71+
background-color: #007bff;
72+
color: white;
73+
border: none;
74+
padding: 5px 10px;
75+
cursor: pointer;
76+
}
13777
138-
.order-img {
139-
width: 80px;
140-
height: 80px;
78+
.product-warp {
79+
width: 100%;
80+
background-color: rgba(128, 128, 128, 0.5); // 透明色,暗黑模式下也能体现
81+
border-radius: 8px;
82+
display: flex;
83+
align-items: center;
84+
padding: 10px;
85+
86+
&-left {
87+
width: 70px;
88+
89+
&-img {
90+
width: 100%;
91+
height: 100%;
92+
border-radius: 8px;
14193
}
14294
}
14395
144-
.box-right {
96+
&-right {
14597
flex: 1;
146-
position: relative;
14798
148-
.tool-box {
149-
position: absolute;
150-
right: 0;
151-
bottom: -10px;
99+
.description {
100+
width: 100%;
101+
font-size: 16px;
102+
font-weight: bold;
103+
display: -webkit-box;
104+
-webkit-line-clamp: 1; /* 显示一行 */
105+
-webkit-box-orient: vertical;
106+
overflow: hidden;
107+
text-overflow: ellipsis;
152108
}
153-
}
154-
155-
.title-text {
156-
font-size: 13px;
157-
font-weight: 500;
158-
line-height: 20px;
159-
}
160-
161-
.spec-text {
162-
font-size: 10px;
163-
font-weight: 400;
164-
color: #999999;
165-
min-width: 0;
166-
overflow: hidden;
167-
text-overflow: ellipsis;
168-
display: -webkit-box;
169-
-webkit-line-clamp: 1;
170-
-webkit-box-orient: vertical;
171-
}
172-
173-
.price-text {
174-
font-size: 11px;
175-
font-weight: 500;
176-
font-family: OPPOSANS;
177-
}
178-
179-
.total-text {
180-
font-size: 10px;
181-
font-weight: 400;
182-
line-height: 16px;
183-
color: #999999;
184-
margin-left: 8px;
185-
}
186-
}
187109
188-
.ss-line {
189-
min-width: 0;
190-
overflow: hidden;
191-
text-overflow: ellipsis;
192-
display: -webkit-box;
193-
-webkit-box-orient: vertical;
194-
195-
&-1 {
196-
-webkit-line-clamp: 1;
197-
}
198-
199-
&-2 {
200-
-webkit-line-clamp: 2;
110+
.price {
111+
color: #ff3000;
112+
}
201113
}
202114
}
203115
</style>

0 commit comments

Comments
 (0)