feat: 自定义底部导航栏及订单、分类、商品等页面更新

这个提交包含在:
wikiboss
2026-11-20 09:05:07 +08:00
父节点 9d2488a631
当前提交 096e31448c
共有 26 个文件被更改,包括 1083 次插入 和 254 次删除

查看文件

@@ -1,12 +1,12 @@
<template>
<view class="content_box">
<view class="u-flex u-col-center wrapper-box">
<view class="scroll-box" style="background-color: #F6F6F6;">
<scroll-view class="left u-flex-col u-col-center" enable-flex enable-back-to-top scroll-y>
<view class="type-list u-ellipsis-1" :class="[{ 'list-active': listId == index }]"
<view class="scroll-box left-scroll-box" style="background-color: #F6F6F6;">
<scroll-view class="left" enable-back-to-top scroll-y>
<view class="type-list" :class="[{ 'list-active': listId == index }]"
v-for="(item, index) in categoryData" :key="index" @tap="onType(index)">
<view class="line" :class="[{ 'line-active': listId == index }]"></view>
{{ item.name }}
<text class="type-name">{{ item.name }}</text>
</view>
<view class="hack-tabbar"></view>
</scroll-view>
@@ -189,10 +189,14 @@
background: #fff;
}
.left-scroll-box {
flex: none;
width: 220rpx;
}
.left {
width: 200upx;
width: 220rpx;
height: 100%;
flex: 1;
.list-active {
background: #fff;
@@ -205,22 +209,37 @@
}
.type-list {
height: 110upx;
flex-shrink: 0;
min-height: 88rpx;
position: relative;
width: 200rpx;
padding-left: 16rpx;
line-height: 110rpx;
width: 220rpx;
padding: 16rpx 12rpx 16rpx 16rpx;
box-sizing: border-box;
display: flex;
align-items: center;
font-size: 28upx;
font-weight: 400;
color: rgba(102, 102, 102, 1);
.type-name {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
word-break: break-all;
white-space: normal;
line-height: 1.4;
width: 100%;
}
.line {
width: 10upx;
height: 40rpx;
position: absolute;
left: 0;
border-radius: 5rpx;
top:35rpx;
top: 50%;
transform: translateY(-50%);
}
}
}

查看文件

@@ -2,9 +2,9 @@
<view class="catgory-wrap">
<view class="u-flex wrapper-box">
<!-- 左侧分类列表 -->
<scroll-view enable-flex scroll-y scroll-with-animation class="u-tab-view menu-scroll-view"
<scroll-view scroll-y scroll-with-animation class="u-tab-view menu-scroll-view"
:scroll-top="scrollLeftTop">
<view v-for="(item, index) in tabbarList" :key="index" class="u-tab-item u-ellipsis-1"
<view v-for="(item, index) in tabbarList" :key="index" class="u-tab-item"
:class="[currentTab == index ? 'u-tab-item-active' : '']" :data-current="index"
@tap.stop="swichMenu(index)">
<text class="menu-name">{{ item.name }}</text>
@@ -37,7 +37,7 @@
</view>
<view class="goods-subtitle u-p-x-20 u-m-b-10 u-ellipsis-1">{{ item.subtitle }}</view>
<!-- 满减,满折 -->
<view class="u-p-x-20" v-if="item.activity_discounts_tags.length">
<view class="u-p-x-20" v-if="item.activity_discounts_tags && item.activity_discounts_tags.length">
<view class="tag-box u-m-b-10 u-m-r-10"
v-for="(tag, index1) in item.activity_discounts_tags" :key="index1">{{ tag }}</view>
</view>
@@ -448,24 +448,39 @@
// 左侧menu
.u-tab-view {
width: 200rpx;
flex-shrink: 0;
width: 220rpx;
height: 100%;
.u-tab-item {
height: 84rpx;
flex-shrink: 0;
min-height: 84rpx;
background: #f6f6f6;
width: 200rpx;
padding-left: 16rpx;
width: 220rpx;
padding: 16rpx 12rpx 16rpx 16rpx;
font-size: 26rpx;
color: #444;
font-weight: 400;
line-height: 84rpx;
line-height: 1.4;
box-sizing: border-box;
display: flex;
align-items: center;
.menu-name {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
word-break: break-all;
white-space: normal;
width: 100%;
}
}
.u-tab-item-active {
position: relative;
color: #000;
font-size: 30rpx;
font-size: 28rpx;
font-weight: bold;
background: #fff;
}
@@ -476,7 +491,8 @@
border-left: 4px solid #4C7AF3;
height: 32rpx;
left: 0;
top: 26rpx;
top: 50%;
transform: translateY(-50%);
}
}
}

查看文件

@@ -1,11 +1,11 @@
<template>
<view class="content_box">
<view class="u-flex u-col-center wrapper-box">
<view class="scroll-box" style="background-color: #F6F6F6;">
<scroll-view class="left u-flex-col u-col-center" enable-flex enable-back-to-top scroll-y>
<view class="type-list u-ellipsis-1" :class="[{ 'list-active': listId == index }]" v-for="(item, index) in categoryData" :key="index" @tap="onType(index)">
<view class="scroll-box left-scroll-box" style="background-color: #F6F6F6;">
<scroll-view class="left" enable-back-to-top scroll-y>
<view class="type-list" :class="[{ 'list-active': listId == index }]" v-for="(item, index) in categoryData" :key="index" @tap="onType(index)">
<view class="line" :class="[{ 'line-active': listId == index }]"></view>
{{ item.name }}
<text class="type-name">{{ item.name }}</text>
</view>
<view class="hack-tabbar"></view>
</scroll-view>
@@ -24,8 +24,10 @@
</view>
</view>
<view class="item-box u-flex">
<view class="u-flex-col goods-item" @tap="jump('/pages/goods/list', { id: mlist.id })" v-for="(mlist, index2) in list.children" :key="index2">
<image class="item-img" lazy-load :src="mlist.image" mode="aspectFill"></image>
<view class="u-flex-col u-col-center goods-item" @tap="jump('/pages/goods/list', { id: mlist.id })" v-for="(mlist, index2) in list.children" :key="index2">
<view class="item-img-wrap">
<image class="item-img" lazy-load :src="mlist.image" mode="aspectFill"></image>
</view>
<view class="item-title u-ellipsis-1 ">{{ mlist.name }}</view>
</view>
</view>
@@ -115,10 +117,14 @@ export default {
background: #fff;
}
.left-scroll-box {
flex: none;
width: 220rpx;
}
.left {
width: 200upx;
width: 220rpx;
height: 100%;
flex: 1;
.list-active {
background: #fff;
@@ -131,20 +137,37 @@ export default {
}
.type-list {
height: 84upx;
flex-shrink: 0;
min-height: 84rpx;
position: relative;
width: 200rpx;
padding-left: 16rpx;
line-height: 84rpx;
width: 220rpx;
padding: 16rpx 12rpx 16rpx 16rpx;
box-sizing: border-box;
display: flex;
align-items: center;
font-size: 28upx;
font-weight: 400;
color: rgba(102, 102, 102, 1);
.type-name {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
word-break: break-all;
white-space: normal;
line-height: 1.4;
width: 100%;
}
.line {
width: 10upx;
height: 100%;
height: 40rpx;
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
border-radius: 5rpx;
}
}
}
@@ -179,27 +202,42 @@ export default {
.item-box {
flex-wrap: wrap;
width: 100%;
align-items: flex-start;
.goods-item {
width: calc((100% - 40rpx) / 3);
margin-right: 20rpx;
margin-bottom: 20rpx;
box-sizing: border-box;
&:nth-child(3n) {
margin-right: 0;
}
.item-img {
width: 150rpx;
height: 150rpx;
background: #f5f5f5;
.item-img-wrap {
width: 100%;
height: 0;
padding-bottom: 100%;
position: relative;
border-radius: 6rpx;
overflow: hidden;
background: #f5f5f5;
}
.item-img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.item-title {
font-size: 24rpx;
line-height: 24rpx;
margin-top: 10rpx;
width: 150rpx;
width: 100%;
text-align: center;
}
}

查看文件

@@ -1,239 +1,514 @@
<template>
<view class="content_box">
<view class="u-flex u-col-center wrapper-box">
<view class="scroll-box" style="background-color: #F6F6F6;">
<scroll-view class="left u-flex-col u-col-center" enable-flex enable-back-to-top scroll-y>
<view class="scroll-box left-scroll-box" style="background-color: #F6F6F6;">
<scroll-view class="left" enable-back-to-top scroll-y>
<view class="type-list u-flex u-col-center" :class="[{ 'list-active': listId == index }]"
v-for="(item, index) in categoryData" :key="index" @tap="onType(index)">
<view class="u-ellipsis-1 list-item" :class="[{ 'line-active': listId == index }]">
{{ item.name }}
<view class="list-item" :class="[{ 'line-active': listId == index }]">
<text class="type-name">{{ item.name }}</text>
</view>
</view>
<view class="hack-tabbar"></view>
</scroll-view>
</view>
<view style="height: 100%;width: 100%;">
<scroll-view scroll-y class="scroll-box" enable-back-to-top scroll-with-animation>
<view class="right" v-if="categoryData.length">
<image class="type-img" v-if="categoryData[listId].image" :src="categoryData[listId].image"
lazy-load mode="aspectFill"></image>
<view class="type-box u-flex u-col-center u-row-center">
<view class="u-iconfont uicon-minus" style="color: #d3d3d3;font-size: 28rpx;"></view>
<text class="type-title">{{ categoryData[listId].name }}</text>
<view class="u-iconfont uicon-minus" style="color: #d3d3d3;font-size: 28rpx;"></view>
</view>
<view class="item-list">
<view class="item-box u-flex">
<view class="u-flex-col u-col-center goods-item"
@tap="jump('/pages/goods/list', { id: list.id })"
v-for="(list, index1) in categoryData[listId].children" :key="index1">
<image class="item-img" lazy-load :src="list.image" mode="aspectFill"></image>
<view class="item-title u-ellipsis-1 ">{{ list.name }}</view>
<view class="item-img-wrap">
<image class="item-img" lazy-load :src="list.image" mode="aspectFill"></image>
</view>
<view class="item-title u-ellipsis-1">{{ list.name }}</view>
</view>
</view>
<!-- 缺省页 -->
<shopro-empty v-show="!categoryData[listId].children.length"
:image="$IMG_URL + '/imgs/empty/empty_goods.png'" marginTop="200rpx"
tipText="暂无该商品,还有更多好货等着你噢~"></shopro-empty>
<view class="hack-tabbar"></view>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</template>
<script>
import {
mapMutations,
mapActions,
mapState,
mapGetters
} from 'vuex';
export default {
components: {},
data() {
return {
listId: 0,
categoryData: {}
};
},
computed: {},
props: {
categoryStyleId: {
type: Number,
default: 0
},
oldCategoryType: {
type: Number,
default: 0
},
categoryIndex: {
type: Number,
default: -1
}
},
created() {
this.getCategory();
},
methods: {
getCategory() {
this.$http('category.detail', {
id: this.categoryStyleId
}).then(res => {
if (res.code === 1) {
this.categoryData = res.data.children;
this.listId = this.categoryIndex < 0 ? 0 : this.categoryIndex;
// 如果oldCategoryType = 3并且分类下没有子分类则显示商品
if (this.oldCategoryType == 3 && !this.categoryData[this.listId].children.length) {
this.handleCategoryChange(2, this.listId);
}
}
});
},
onType(id) {
this.listId = id;
// 如果oldCategoryType = 3并且点击的分类下没有子分类则显示商品
if (this.oldCategoryType == 3 && !this.categoryData[id].children.length) {
this.handleCategoryChange(2, id);
}
},
// 分类类型切换
handleCategoryChange(categoryType, categoryIndex) {
this.$emit('categoryChange', {
type: categoryType,
index: categoryIndex
});
},
// 路由跳转
jump(path, parmas) {
this.$Router.push({
path: path,
query: parmas
});
}
}
};
</script>
<style lang="scss">
.hack-tabbar {
height: calc(100rpx + env(safe-area-inset-bottom) / 2);
width: 100%;
}
.content_box {
display: flex;
flex-direction: column;
overflow: hidden;
height: 100%;
}
.wrapper-box {
flex: 1;
margin-top: 1upx;
height: 100%;
}
.scroll-box {
height: 100%;
flex: 1;
background: #fff;
}
.left-scroll-box {
flex: none;
width: 220rpx;
}
.left {
width: 200upx;
width: 220rpx;
height: 100%;
flex: 1;
.list-active {
background: #fff;
color: #ffff !important;
}
.list-item {
width: 180rpx;
height: 64rpx;
line-height: 64rpx;
padding-left: 14rpx;
width: 200rpx;
min-height: 64rpx;
padding: 12rpx 14rpx;
box-sizing: border-box;
display: flex;
align-items: center;
font-size: 28upx;
font-weight: 400;
color: rgba(102, 102, 102, 1);
}
.line-active {
width: 180rpx;
height: 64rpx;
background: #4C7AF3;
border-radius: 0rpx 32rpx 32rpx 0rpx;
color: #fff;
.type-name {
color: #fff;
}
}
.type-list {
height: 100rpx;
min-height: 100rpx;
position: relative;
width: 200rpx;
font-size: 28upx;
font-weight: 400;
color: rgba(102, 102, 102, 1);
width: 220rpx;
padding: 8rpx 0;
box-sizing: border-box;
}
.type-name {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
word-break: break-all;
white-space: normal;
line-height: 1.4;
width: 100%;
}
}
.right {
padding: 0 30upx;
flex: 1;
height: 100%;
.type-img {
width: 505rpx;
height: 150rpx;
background: #ccc;
margin-top: 30rpx;
border-radius: 10rpx;
}
.type-box {
height: 84rpx;
.type-title {
font-size: 28rpx;
font-weight: bold;
padding: 0 16rpx;
}
.more {
font-size: 26rpx;
color: #999;
}
}
.item-list {
.item-box {
flex-wrap: wrap;
width: 100%;
align-items: flex-start;
.goods-item {
width: calc((100% - 40rpx) / 3);
margin-right: 20rpx;
margin-bottom: 20rpx;
box-sizing: border-box;
&:nth-child(3n) {
margin-right: 0;
}
.item-img {
width: 150rpx;
height: 150rpx;
.item-img-wrap {
width: 100%;
height: 0;
padding-bottom: 100%;
position: relative;
border-radius: 6rpx;
overflow: hidden;
background: #f5f5f5;
}
.item-title {
font-size: 24rpx;
margin-top: 10rpx;
width: 150rpx;
text-align: center;
.item-img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.item-title {
font-size: 24rpx;
margin-top: 10rpx;
width: 100%;
text-align: center;
}
}
}
}
}
</style>
</style>