mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-11-06 17:09:01 +08:00
refactor(category): 重构分类页面UI
- 重构分类页面导航栏,将标题+搜索框改为仅搜索框样式 - 优化分类页面左侧列表与右侧内容区域的布局及视觉样式 - 重写搜索栏宽度计算逻辑 - 优化分类滚动组件、侧边列表、排序栏及子标签栏的交互样式 - 增加分类头部图片条件渲染及商品列表嵌入模式样式 - 关闭商品列表划线价默认显示配置
This commit is contained in:
@@ -9,14 +9,19 @@
|
||||
@click="$emit('change', item)"
|
||||
>
|
||||
<template v-if="mode === 'icon'">
|
||||
<view class="cs-icon">
|
||||
<u-image width="88rpx" height="88rpx" shape="circle" :src="item.image">
|
||||
<template #loading><u-loading-icon></u-loading-icon></template>
|
||||
</u-image>
|
||||
<view class="cs-icon-box">
|
||||
<view class="cs-icon">
|
||||
<u-image width="80rpx" height="80rpx" shape="circle" :src="item.image" mode="aspectFill">
|
||||
<template #loading><u-loading-icon></u-loading-icon></template>
|
||||
</u-image>
|
||||
</view>
|
||||
</view>
|
||||
<text class="cs-name">{{ item.name }}</text>
|
||||
</template>
|
||||
<text v-else class="cs-text-name">{{ item.name }}</text>
|
||||
<template v-else>
|
||||
<text class="cs-text-name">{{ item.name }}</text>
|
||||
<view class="cs-text-line" v-if="item.id === currentId"></view>
|
||||
</template>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
@@ -37,7 +42,7 @@ const props = withDefaults(defineProps<{
|
||||
defineEmits(['change'])
|
||||
|
||||
const intoView = computed(() =>
|
||||
props.currentId != null ? `cs-${props.currentId}` : ''
|
||||
props.currentId != null ? 'cs-' + props.currentId : ''
|
||||
)
|
||||
</script>
|
||||
|
||||
@@ -45,49 +50,84 @@ const intoView = computed(() =>
|
||||
.cate-scroller {
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
background: #ffffff;
|
||||
border-bottom: 1rpx solid #f2f3f5;
|
||||
box-sizing: border-box;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.cs-item {
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 120rpx;
|
||||
padding: 16rpx 0 10rpx;
|
||||
justify-content: center;
|
||||
width: 130rpx;
|
||||
padding: 16rpx 6rpx 14rpx;
|
||||
vertical-align: top;
|
||||
box-sizing: border-box;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
.cs-icon-box {
|
||||
width: 92rpx;
|
||||
height: 92rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 3rpx solid transparent;
|
||||
box-sizing: border-box;
|
||||
background: #ffffff;
|
||||
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
||||
}
|
||||
.cs-item.active .cs-icon-box {
|
||||
border-color: $light-color;
|
||||
box-shadow: 0 4rpx 12rpx rgba(255, 102, 0, 0.15);
|
||||
}
|
||||
.cs-icon {
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50%;
|
||||
overflow: hidden;
|
||||
border: 2rpx solid transparent;
|
||||
}
|
||||
.cs-item.active .cs-icon {
|
||||
border-color: $light-color;
|
||||
background: #f6f7f9;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.cs-name {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: #333;
|
||||
max-width: 110rpx;
|
||||
margin-top: 10rpx;
|
||||
font-size: 24rpx;
|
||||
color: #555;
|
||||
max-width: 120rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
line-height: 1.2;
|
||||
}
|
||||
.cs-item.active .cs-name {
|
||||
color: $light-color;
|
||||
font-weight: bold;
|
||||
font-weight: 600;
|
||||
}
|
||||
.cs-item--text {
|
||||
width: auto;
|
||||
padding: 18rpx 24rpx;
|
||||
padding: 18rpx 28rpx;
|
||||
position: relative;
|
||||
}
|
||||
.cs-text-name {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
color: #666;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
.cs-item--text.active .cs-text-name {
|
||||
color: $light-color;
|
||||
font-weight: bold;
|
||||
font-weight: 600;
|
||||
}
|
||||
.cs-text-line {
|
||||
position: absolute;
|
||||
bottom: 6rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 32rpx;
|
||||
height: 4rpx;
|
||||
border-radius: 2rpx;
|
||||
background: $light-color;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
:class="{ active: item.id === currentId }"
|
||||
@click="$emit('change', item)"
|
||||
>
|
||||
{{ item.name }}
|
||||
<view class="active-indicator" v-if="item.id === currentId"></view>
|
||||
<text class="side-item-text">{{ item.name }}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
@@ -26,26 +27,49 @@ defineEmits(['change'])
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.side-list {
|
||||
width: 160rpx;
|
||||
width: 176rpx;
|
||||
flex-shrink: 0;
|
||||
height: 100%;
|
||||
background-color: #f7f7f7;
|
||||
background-color: #f6f7f9;
|
||||
border-right: 1rpx solid #ebebeb;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.side-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
min-height: 90rpx;
|
||||
padding: 10rpx 8rpx;
|
||||
min-height: 96rpx;
|
||||
padding: 16rpx 14rpx;
|
||||
box-sizing: border-box;
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&.active {
|
||||
font-weight: bold;
|
||||
font-weight: 600;
|
||||
color: $light-color;
|
||||
background: #fff;
|
||||
background: #ffffff;
|
||||
}
|
||||
}
|
||||
.side-item-text {
|
||||
line-height: 1.35;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.active-indicator {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 6rpx;
|
||||
height: 36rpx;
|
||||
border-radius: 0 4rpx 4rpx 0;
|
||||
background: $light-color;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -5,31 +5,31 @@
|
||||
:class="{ active: sort === 'releaseTime' }"
|
||||
@click="onClick('releaseTime')"
|
||||
>
|
||||
综合
|
||||
<text class="sort-label">综合</text>
|
||||
</view>
|
||||
<view
|
||||
class="sort-item"
|
||||
:class="{ active: sort === 'buyCount' }"
|
||||
@click="onClick('buyCount')"
|
||||
>
|
||||
销量
|
||||
<text class="sort-label">销量</text>
|
||||
</view>
|
||||
<view
|
||||
class="sort-item"
|
||||
:class="{ active: sort === 'price' }"
|
||||
@click="onClick('price')"
|
||||
>
|
||||
<text>价格</text>
|
||||
<text class="sort-label">价格</text>
|
||||
<view class="arrows">
|
||||
<u-icon
|
||||
name="arrow-up"
|
||||
size="10"
|
||||
:color="sort === 'price' && order === 'asc' ? '#ff6700' : '#c5c5c5'"
|
||||
name="arrow-up-fill"
|
||||
size="7"
|
||||
:color="sort === 'price' && order === 'asc' ? '#ff6700' : '#bbbbbb'"
|
||||
></u-icon>
|
||||
<u-icon
|
||||
name="arrow-down"
|
||||
size="10"
|
||||
:color="sort === 'price' && order === 'desc' ? '#ff6700' : '#c5c5c5'"
|
||||
name="arrow-down-fill"
|
||||
size="7"
|
||||
:color="sort === 'price' && order === 'desc' ? '#ff6700' : '#bbbbbb'"
|
||||
></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
@@ -60,24 +60,35 @@ function onClick(type: string) {
|
||||
.sort-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 72rpx;
|
||||
background: #fff;
|
||||
height: 68rpx;
|
||||
background: #ffffff;
|
||||
padding: 0 20rpx;
|
||||
border-bottom: 1rpx solid #f6f6f6;
|
||||
box-sizing: border-box;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.sort-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 40rpx;
|
||||
margin-right: 44rpx;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
color: #666;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
transition: color 0.2s ease;
|
||||
|
||||
&.active {
|
||||
color: $light-color;
|
||||
font-weight: bold;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
.sort-label {
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.arrows {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 6rpx;
|
||||
margin-left: 8rpx;
|
||||
gap: 2rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -27,7 +27,7 @@ const props = withDefaults(defineProps<{
|
||||
defineEmits(['change'])
|
||||
|
||||
const intoView = computed(() =>
|
||||
props.currentId != null ? `tb-${props.currentId}` : ''
|
||||
props.currentId != null ? 'tb-' + props.currentId : ''
|
||||
)
|
||||
</script>
|
||||
|
||||
@@ -35,21 +35,27 @@ const intoView = computed(() =>
|
||||
.tag-bar {
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
padding: 8rpx 0;
|
||||
background: #ffffff;
|
||||
padding: 12rpx 16rpx 10rpx;
|
||||
border-bottom: 1rpx solid #f6f6f6;
|
||||
box-sizing: border-box;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.tag-item {
|
||||
display: inline-block;
|
||||
padding: 8rpx 24rpx;
|
||||
padding: 6rpx 22rpx;
|
||||
margin-right: 12rpx;
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
background: #f5f5f5;
|
||||
color: #666;
|
||||
background: #f5f6f8;
|
||||
border-radius: 24rpx;
|
||||
line-height: 1.35;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&.active {
|
||||
color: #fff;
|
||||
color: #ffffff;
|
||||
background: $light-color;
|
||||
font-weight: bold;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -8,13 +8,6 @@
|
||||
mode="icon"
|
||||
@change="onL1Change"
|
||||
/>
|
||||
<!-- 模板2:三级分类标签横滑 -->
|
||||
<sub-tag-bar
|
||||
v-if="template === 2 && l3List.length"
|
||||
:list="l3List"
|
||||
:current-id="currentL3 && currentL3.id"
|
||||
@change="onL3Change"
|
||||
/>
|
||||
<view class="tpl-main">
|
||||
<!-- 左侧:模板2/3 为二级分类,模板4 为一级分类 -->
|
||||
<category-side-list
|
||||
@@ -23,6 +16,13 @@
|
||||
@change="onSideChange"
|
||||
/>
|
||||
<view class="tpl-right">
|
||||
<!-- 模板2:三级分类标签横滑 (置于右栏顶部) -->
|
||||
<sub-tag-bar
|
||||
v-if="template === 2 && l3List.length"
|
||||
:list="l3List"
|
||||
:current-id="currentL3 && currentL3.id"
|
||||
@change="onL3Change"
|
||||
/>
|
||||
<!-- 模板4:右上二级分类文字横滑(起点为当前一级名称,作为"全部"入口) -->
|
||||
<category-scroller
|
||||
v-if="template === 4"
|
||||
@@ -39,15 +39,24 @@
|
||||
type="oneColumns"
|
||||
:show-fields="setting.showFields"
|
||||
:tab-bar-gap="false"
|
||||
:store-name="false"
|
||||
@add-cart="onAddCart"
|
||||
/>
|
||||
<view v-else-if="!loading" class="empty">
|
||||
<text>{{ failed ? '加载失败,请点击重试' : '暂无商品' }}</text>
|
||||
<view v-if="failed" class="retry" @click="loadGoods(true)">重试</view>
|
||||
<view v-else-if="!loading" class="empty-state">
|
||||
<u-empty
|
||||
:text="failed ? '加载失败,请重试' : '暂无相关商品'"
|
||||
mode="data"
|
||||
icon="http://cdn.uviewui.com/uview/empty/data.png"
|
||||
margin-top="100"
|
||||
>
|
||||
<view v-if="failed" class="retry" @click="loadGoods(true)">重试</view>
|
||||
</u-empty>
|
||||
</view>
|
||||
<uni-load-more
|
||||
v-if="goodsList.length"
|
||||
v-if="showLoadMore"
|
||||
:status="loading ? 'loading' : hasMore ? 'more' : 'noMore'"
|
||||
:color="'#bfbfbf'"
|
||||
:content-text="loadMoreText"
|
||||
></uni-load-more>
|
||||
</scroll-view>
|
||||
</view>
|
||||
@@ -64,6 +73,13 @@ import SubTagBar from './sub-tag-bar.vue'
|
||||
import SortBar from './sort-bar.vue'
|
||||
import MGoodsList from '@/components/m-goods-list/list.vue'
|
||||
|
||||
defineOptions({
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
},
|
||||
})
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
categoryList?: any[]
|
||||
setting?: any
|
||||
@@ -86,6 +102,20 @@ const hasMore = ref(true)
|
||||
const loading = ref(false)
|
||||
const failed = ref(false)
|
||||
|
||||
const loadMoreText = {
|
||||
contentdown: '上拉加载更多',
|
||||
contentrefresh: '正在加载...',
|
||||
contentnomore: '—— 到底啦 ——',
|
||||
}
|
||||
|
||||
// 仅在正在加载、或者有下一页、或者商品总数达到 6 件以上触底时才展示底线,避免少量商品(如1~2件)时在空白区域突兀展示
|
||||
const showLoadMore = computed(() => {
|
||||
if (!goodsList.value.length) return false
|
||||
if (loading.value) return true
|
||||
if (hasMore.value) return true
|
||||
return goodsList.value.length >= 6
|
||||
})
|
||||
|
||||
// 模板2/3:左侧为当前一级的二级分类;模板4:左侧为一级分类
|
||||
const sideList = computed(() =>
|
||||
props.template === 4
|
||||
@@ -212,7 +242,7 @@ function loadMore() {
|
||||
|
||||
function onAddCart(item: any) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,
|
||||
url: '/pages/product/goods?id=' + item.id + '&goodsId=' + item.goodsId,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -221,40 +251,47 @@ function onAddCart(item: any) {
|
||||
.tpl-goods {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
background: #ffffff;
|
||||
overflow: hidden;
|
||||
}
|
||||
.tpl-main {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: 0;
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
}
|
||||
.tpl-right {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
background: #ffffff;
|
||||
}
|
||||
.goods-scroll {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: 0;
|
||||
}
|
||||
.empty {
|
||||
padding: 120rpx 0;
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
color: #999;
|
||||
font-size: 26rpx;
|
||||
justify-content: center;
|
||||
padding: 60rpx 0 100rpx;
|
||||
}
|
||||
.retry {
|
||||
margin-top: 20rpx;
|
||||
padding: 10rpx 48rpx;
|
||||
margin-top: 24rpx;
|
||||
padding: 12rpx 50rpx;
|
||||
border: 1rpx solid $light-color;
|
||||
color: $light-color;
|
||||
border-radius: 32rpx;
|
||||
border-radius: 36rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -27,18 +27,7 @@
|
||||
</view>
|
||||
<!-- 正常商品的价格 -->
|
||||
<view v-else>
|
||||
<!-- 批发阶梯价(E_COUPON 仅零售价) -->
|
||||
<div class="price-row flex" v-if="goodsDetail.salesModel === 'WHOLESALE' && !isECoupon(goodsDetail.goodsType)">
|
||||
<div class="goods-price" v-for="(item, index) in wholesaleList" :key="index">
|
||||
<span>
|
||||
¥
|
||||
<span class="goods-price-bigshow">{{ goodsFormatPrice(item.price)[0] }}</span>
|
||||
.{{ goodsFormatPrice(item.price)[1] }}
|
||||
</span>
|
||||
<span class="wholesale-item">{{ item.num }}{{ goodsDetail.goodsUnit }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="goods-price" v-else>
|
||||
<div class="goods-price">
|
||||
<span>
|
||||
¥
|
||||
<span class="goods-price-bigshow">{{ goodsFormatPrice(goodsDetail.price)[0] }}</span>
|
||||
@@ -135,7 +124,6 @@ import {
|
||||
} from '@/utils/goodsType.js'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
wholesaleList?: any[] | boolean
|
||||
buyMask?: boolean
|
||||
isGroup?: boolean
|
||||
goodsDetail?: any
|
||||
@@ -144,7 +132,6 @@ const props = withDefaults(defineProps<{
|
||||
addr?: any | null
|
||||
pointDetail?: any | null
|
||||
}>(), {
|
||||
wholesaleList: false,
|
||||
buyMask: false,
|
||||
isGroup: false,
|
||||
goodsDetail: () => ({}),
|
||||
@@ -156,7 +143,7 @@ const props = withDefaults(defineProps<{
|
||||
|
||||
const emit = defineEmits(['closeBuy', 'changed', 'handleClickSku', 'queryCart'])
|
||||
|
||||
const num = ref(props.wholesaleList && Array.isArray(props.wholesaleList) && props.wholesaleList.length > 0 ? props.wholesaleList[0].num : 1)
|
||||
const num = ref(1)
|
||||
|
||||
const selectName = ref('')
|
||||
const selectSkuList = ref<any>('')
|
||||
@@ -231,18 +218,7 @@ watch(
|
||||
}
|
||||
)
|
||||
|
||||
const numCheck = (val: number) => {
|
||||
if (Array.isArray(props.wholesaleList) && props.wholesaleList.length > 0) {
|
||||
if (num.value <= props.wholesaleList[0].num) {
|
||||
uni.showToast({
|
||||
title: '批发商品购买数量不能小于起批数量!',
|
||||
duration: 2000,
|
||||
icon: 'none'
|
||||
})
|
||||
num.value = props.wholesaleList[0].num
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const closeMask = () => {
|
||||
emit('closeBuy', false)
|
||||
@@ -541,13 +517,6 @@ defineExpose({
|
||||
}
|
||||
}
|
||||
|
||||
.wholesale-item {
|
||||
color: #999 !important;
|
||||
font-size: 24rpx;
|
||||
margin: 0 20rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.goods-header {
|
||||
height: 200rpx;
|
||||
|
||||
@@ -82,9 +82,6 @@
|
||||
</div>
|
||||
</view>
|
||||
<div class="promotion" @click="navigateToDetailPage(item)">
|
||||
<div v-if="item.salesModel == 'WHOLESALE'">
|
||||
<span>批</span>
|
||||
</div>
|
||||
<div
|
||||
v-for="(promotionItem, promotionIndex) in getPromotion(item)"
|
||||
:key="promotionIndex"
|
||||
|
||||
@@ -21,9 +21,6 @@
|
||||
</div>
|
||||
</view>
|
||||
<div class="promotion" @click="navigateToDetailPage(item)">
|
||||
<div v-if="item.salesModel == 'WHOLESALE'">
|
||||
<span class="promotion-tag">批</span>
|
||||
</div>
|
||||
<div v-for="(promotionItem,promotionIndex) in getPromotion(item)" :key="promotionIndex">
|
||||
<span class="promotion-tag" v-if="promotionItem.indexOf('COUPON') != -1">劵</span>
|
||||
<span class="promotion-tag" v-if="promotionItem.indexOf('FULL_DISCOUNT') != -1">满减</span>
|
||||
@@ -46,18 +43,32 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 一行一列商品展示 -->
|
||||
<div v-if="type == 'oneColumns'" class="goods-one-row">
|
||||
<div v-if="type == 'oneColumns'" class="goods-one-row" :class="{ 'goods-one-row--embedded': !tabBarGap }">
|
||||
<div v-for="(item, index) in res" :key="index" class="goods-row">
|
||||
<div class="flex goods-col">
|
||||
<div class="goods-img" @click="navigateToDetailPage(item)">
|
||||
<u-image width="230rpx" mode="aspectFit" border-radius='16' height="230rpx" :src="item.thumbnail">
|
||||
<u-image :width="!tabBarGap ? '170rpx' : '230rpx'" mode="aspectFit" :border-radius="!tabBarGap ? '12' : '16'" :height="!tabBarGap ? '170rpx' : '230rpx'" :src="item.thumbnail">
|
||||
<template #loading><u-loading-icon></u-loading-icon></template>
|
||||
</u-image>
|
||||
</div>
|
||||
<div class="goods-detail">
|
||||
<div class="title clamp3" @click="navigateToDetailPage(item)">{{ item.goodsName }}</div>
|
||||
<div class="title clamp2" @click="navigateToDetailPage(item)">
|
||||
<text class="self-tag" v-if="(!storeName || flag('selfTag')) && item.selfOperated">自营</text>
|
||||
{{ item.goodsName }}
|
||||
</div>
|
||||
<div class="selling-point" v-if="extra('subTitle') && item.sellingPoint">{{ item.sellingPoint }}</div>
|
||||
<div class="spec-summary" v-if="extra('spec') && specSummary(item)">{{ specSummary(item) }}</div>
|
||||
<div class="promotion" v-if="flag('tags')" @click="navigateToDetailPage(item)">
|
||||
<div v-for="(promotionItem,promotionIndex) in getPromotion(item)" :key="promotionIndex">
|
||||
<span class="promotion-tag" v-if="promotionItem.indexOf('COUPON') != -1">劵</span>
|
||||
<span class="promotion-tag" v-if="promotionItem.indexOf('FULL_DISCOUNT') != -1">满减</span>
|
||||
<span class="promotion-tag" v-if="promotionItem.indexOf('SECKILL') != -1">秒杀</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style="overflow: hidden" v-if="flag('sales')" @click="navigateToDetailPage(item)" class="count-config">
|
||||
<span style="float: left; font-size: 22rpx">已售 {{ item.buyCount || '0' }}</span>
|
||||
<span style="float: right; font-size: 22rpx" v-if="item.commentNum">{{ item.commentNum }}条评论</span>
|
||||
</div>
|
||||
<view class="price-box" @click="navigateToDetailPage(item)">
|
||||
<div class="price" v-if="flag('price') && item.price!=undefined">
|
||||
¥<span class="price-int">{{ goodsFormatPrice(item.price )[0] }} </span>.{{
|
||||
@@ -66,25 +77,11 @@
|
||||
</div>
|
||||
<div class="market-price" v-if="extra('linePrice') && hasMarketPrice(item)">¥{{ item.marketPrice }}</div>
|
||||
<div class="cart-btn" v-if="extra('cart')" @click.stop="emit('addCart', item)">
|
||||
<u-icon name="shopping-cart" size="20" color="#fff"></u-icon>
|
||||
<u-icon name="shopping-cart" size="16" :color="mainColor"></u-icon>
|
||||
</div>
|
||||
</view>
|
||||
<div class="promotion" v-if="flag('tags')" @click="navigateToDetailPage(item)">
|
||||
<div v-if="item.salesModel == 'WHOLESALE'">
|
||||
<span class="promotion-tag">批</span>
|
||||
</div>
|
||||
<div v-for="(promotionItem,promotionIndex) in getPromotion(item)" :key="promotionIndex">
|
||||
<span class="promotion-tag" v-if="promotionItem.indexOf('COUPON') != -1">劵</span>
|
||||
<span class="promotion-tag" v-if="promotionItem.indexOf('FULL_DISCOUNT') != -1">满减</span>
|
||||
<span class="promotion-tag" v-if="promotionItem.indexOf('SECKILL') != -1">秒杀</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style="overflow: hidden" v-if="flag('sales')" @click="navigateToDetailPage(item)" class="count-config">
|
||||
<span style="float: left; font-size: 22rpx">已售 {{ item.buyCount || '0' }}</span>
|
||||
<span style="float: right; font-size: 22rpx">{{ item.commentNum || '0' }}条评论</span>
|
||||
</div>
|
||||
<div class="store-seller-name" @click="navigateToStoreDetailPage(item)">
|
||||
<view class="store-name-row" v-if="storeName">
|
||||
<div class="store-seller-name" v-if="storeName" @click="navigateToStoreDetailPage(item)">
|
||||
<view class="store-name-row">
|
||||
<text class="self-tag" v-if="item.selfOperated && flag('selfTag')">自营</text>
|
||||
<text class="store-name-text">{{ item.storeName }}</text>
|
||||
<text class="to-store">进店</text>
|
||||
@@ -93,18 +90,20 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { watch } from 'vue'
|
||||
import { computed, watch } from 'vue'
|
||||
import { useStore } from '@/store'
|
||||
import { useGoodsListCommon } from './common'
|
||||
import { goodsFormatPrice } from '@/utils/filters.js'
|
||||
|
||||
const store = useStore()
|
||||
const mainColor = computed(() => (store && store.getters && store.getters.mainColor) || '#ff3c2a')
|
||||
|
||||
const { lightSearchStr, getPromotion, navigateToDetailPage, navigateToStoreDetailPage } = useGoodsListCommon()
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
@@ -238,6 +237,128 @@ watch(() => props.keyword, (val) => {
|
||||
}
|
||||
}
|
||||
|
||||
.goods-one-row--embedded {
|
||||
.goods-row {
|
||||
padding: 20rpx 16rpx;
|
||||
border-bottom: 1rpx solid #f6f6f6;
|
||||
background: #ffffff;
|
||||
|
||||
>.goods-col {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
|
||||
>.goods-img {
|
||||
flex: 0 0 170rpx;
|
||||
width: 170rpx;
|
||||
height: 170rpx;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
>.goods-detail {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin: 0 0 0 16rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
>.title {
|
||||
font-size: 26rpx;
|
||||
color: #222;
|
||||
line-height: 1.4;
|
||||
max-height: 74rpx;
|
||||
padding: 0;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
.self-tag {
|
||||
display: inline-block;
|
||||
margin-right: 8rpx;
|
||||
padding: 1rpx 8rpx;
|
||||
border-radius: 6rpx;
|
||||
background: $main-color;
|
||||
color: #fff;
|
||||
font-size: 20rpx;
|
||||
line-height: 1.4;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.selling-point {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
line-height: 1.3;
|
||||
margin-top: 4rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.spec-summary {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
line-height: 1.3;
|
||||
margin-top: 2rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.count-config {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
|
||||
.price-box {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
margin-top: auto;
|
||||
padding-top: 8rpx;
|
||||
|
||||
.price {
|
||||
font-size: 22rpx;
|
||||
color: $main-color;
|
||||
font-weight: 500;
|
||||
line-height: 1;
|
||||
|
||||
.price-int {
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.market-price {
|
||||
font-size: 22rpx;
|
||||
color: #bbb;
|
||||
text-decoration: line-through;
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
.cart-btn {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
border-radius: 50%;
|
||||
background: #ffffff;
|
||||
border: 2rpx solid $main-color;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 2rpx 8rpx rgba(255, 60, 42, 0.12);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.goods-row {
|
||||
background: #fff;
|
||||
padding: 16rpx;
|
||||
@@ -299,14 +420,17 @@ watch(() => props.keyword, (val) => {
|
||||
}
|
||||
|
||||
.cart-btn {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
border-radius: 50%;
|
||||
background: $main-color;
|
||||
background: #ffffff;
|
||||
border: 2rpx solid $main-color;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 2rpx 8rpx rgba(255, 60, 42, 0.12);
|
||||
}
|
||||
|
||||
.promotion {
|
||||
|
||||
Reference in New Issue
Block a user