This commit is contained in:
@fawn-nine
2024-05-21 16:29:23 +08:00
parent ed803b94bf
commit edf80bea28
2 changed files with 181 additions and 84 deletions

View File

@@ -133,7 +133,7 @@
<b></b>
<text>新书上市</text>
</view> -->
<!-- 营销标签 -->
<scroll-view class="scroll-view_H " scroll-x="true" scroll-left="0">
<view class="ProTabs">
@@ -141,7 +141,7 @@
@click="yxTabsChange(item,index)">{{item.title}}</text>
</view>
</scroll-view>
<view class="newBook">
<scroll-view class="scroll-view_H " scroll-x="true" scroll-left="10" style="margin-top: 0 !important;">
<view :class="['item']" v-for="(item,index) in YXBookList" :key="index">
@@ -237,18 +237,19 @@
</view>
<scroll-view class="scroll-view_H" scroll-x="true" scroll-left="0">
<view class="ProTabs">
<scroll-view class="ProTabsBox">
<view class="New_ProTabs flexbox">
<text v-for="(item,index) in catTagList" :key="item.splId" :class="[tabsid == item.id ? 'cur' :'']"
@click="tabsChange(item,index)">{{item.title}}</text>
</view>
</scroll-view>
<view class="children_cate flexbox" v-if="childrenCatList && childrenCatList.length > 0">
<view @click="childrenChange(item,index)" :class="['item',curChildrenId == item.id ? 'cur':'']" v-for="(item, index) in childrenCatList" :key="item.id">
<text>{{item.title}}</text>
</view>
</view>
<view class="children_cate flexbox" v-if="childrenCatList && childrenCatList.length > 0">
<view @click="childrenChange(item,index)" :class="['item',curChildrenId == item.id ? 'cur':'']"
v-for="(item, index) in childrenCatList" :key="item.id">
<text>{{item.title}}</text>
</view>
</view>
<!-- 商品展示 -->
<view class="goods">
<!-- 精选 -->
@@ -264,7 +265,7 @@
</view>
<view class="goodsPrice">
<span class="price"
v-if="item.activity_price && item.activity_price > 0">{{item.activityPrice}}</span>
v-if="item.activityPrice && item.activityPrice > 0">{{item.activityPrice}}</span>
<span class="price" v-else>{{item.price}}</span>
<span class="Salesnum">已售{{item.sum_sales}} </span>
</view>
@@ -329,7 +330,7 @@
'../../static/icon/home_ban_2.jpg',
'../../static/icon/home_ban_3.jpg',
],
yingxiaoTags:[ // 营销标签列表
yingxiaoTags: [ // 营销标签列表
],
xinsList: [],
loadingNow: false,
@@ -341,17 +342,17 @@
bgiStyle: {
background: '#fff'
},
YXBookList: [],
catTagList:[ // 分类标签
YXBookList: [],
catTagList: [ // 分类标签
],
curChildrenId:0,
curChildrenId: 0,
iconStyle: {
fontSize: '40rpx',
fontWeight: 'bold',
color: '#54a966',
},
tagList: [], // 推荐标签列表
childrenCatList:[], // 二级分类
childrenCatList: [], // 二级分类
wztaglist: [{
splId: "-1",
labelName: "全部"
@@ -394,7 +395,8 @@
tjProList: [],
status: 3,
userMsg: {}, // 用户信息
yxCurIndex:0, // 当前营销标签序号
yxCurIndex: 0, // 当前营销标签序号
SystemInfoSync: {}, // 屏幕尺寸
};
},
onPageScroll(e) {
@@ -409,7 +411,7 @@
},
onHide() {
this.page = 1
this.tjProList = []
// this.tjProList = []
// if(this.tagList.length > 0){
// this.tabsid = this.tagList[0].splId
// }
@@ -417,24 +419,32 @@
//页面显示
onShow() {
// 隐藏原生的tabbar
this.tjProList = []
uni.hideTabBar();
this.getData();
this.getTags()
this.getUserInfo()
this.getYXTgs()
// this.getUserInfo()
// this.tjProList = []
// uni.hideTabBar();
// this.getData();
// this.getTags()
// this.getYXTgs()
this.requestAll()
},
onTabItemTap() {
},
// 页面加载完毕
onReady() {
// this.requestIapOrder()
// console.log(uni.getSystemInfoSync(), '屏幕')
},
mounted() {
this.requestAll()
},
// 下拉刷新
onPullDownRefresh() {
this.page = 1
this.tjProList = []
this.getData()
this.getTags()
this.getUserInfo()
// this.getData()
this.getTags()
this.getYXTgs()
// this.requestIapOrder()
uni.stopPullDownRefresh()
@@ -475,37 +485,52 @@
//方法
methods: {
...mapMutations(['setUserInfo']),
requestAll() {
this.getUserInfo()
this.tjProList = []
uni.hideTabBar();
// this.getData();
this.getTags()
this.getYXTgs()
},
// 获取营销标签列表
getYXTgs(){
getYXTgs() {
this.$http
.post('book/labelAndMarket/marketTree')
.then(res => {
console.log(res, '营销标签列表')
if(res.result.length > 0){
// console.log(res, '营销标签列表')
if (res.result.length > 0) {
this.yingxiaoTags = res.result
this.getYXproducts()
}
}
// console.log(res)
});
},
// ...mapMutations(['setLoadingShow']),
// 获取对应营销商品列表
getYXproducts(item){
getYXproducts(item) {
var tag_id = null
if(!item){
console.log('没有传参')
if (!item) {
/// console.log('没有传参')
tag_id = this.yingxiaoTags[0].id
}else{
} else {
tag_id = item.id
}
}
this.$http
.post('book/labelAndMarket/getShopProductListByMarketId',{
'marketId':tag_id
.post('book/labelAndMarket/getShopProductListByMarketId', {
'marketId': tag_id
})
.then(res => {
console.log(res.result, '营销商品列表')
this.YXBookList = res.result
if (res.code == 0 && res.result.length > 0) {
this.YXBookList = res.result
}else{
this.YXBookList = []
}
// console.log(res.result, '营销商品列表')
}).catch( e =>{
this.YXBookList = []
});
},
// 获取用户详情
@@ -520,7 +545,7 @@
// }
},
// 获取商品标签
getTags() {
getTags() {
this.loadingNow = false
this.$http
.post('book/labelAndMarket/labelTree')
@@ -529,36 +554,36 @@
if (res.code == 0 && res.result.length > 0) {
this.catTagList = res.result
this.tabsid = this.catTagList[0].id
if(this.catTagList[0].isLast == 1){
if (this.catTagList[0].isLast == 1) {
this.getJtData(this.catTagList[0].id)
}else{
} else {
this.childrenCatList = this.catTagList[0].children
this.curChildrenId = this.childrenCatList[0].id
this.getJtData(this.childrenCatList[0].id)
}
}
}).catch(e => {
console.log(e, 'e')
});
},
// 二级分类点击
childrenChange(item,index){
childrenChange(item, index) {
// console.log(item,this.curChildrenId,'点击')
this.curChildrenId = this.childrenCatList[index].id
this.getJtData(this.childrenCatList[index].id)
},
tabsChange(item,cindex) {
this.tjProList = []
tabsChange(item, cindex) {
// this.tjProList = []
this.tabsid = item.id
this.childrenCatList = []
if(this.catTagList[cindex].isLast == 1){
this.childrenCatList = []
if (this.catTagList[cindex].isLast == 1) {
this.getJtData(this.catTagList[cindex].id)
}else{
} else {
this.childrenCatList = this.catTagList[cindex].children
this.curChildrenId = this.childrenCatList[0].id
this.getJtData(this.childrenCatList[0].id)
}
// this.getJtData()
// if (this.tabsid == 15) {
@@ -570,9 +595,9 @@
// }
// this.page = 1
// // 获取推荐数据
},
yxTabsChange(item,index) {
yxTabsChange(item, index) {
// this.yxtaglist = []
this.yxCurIndex = index
this.getYXproducts(item)
@@ -582,41 +607,42 @@
this.wztabsid = item.splId
this.page = 1
// 获取推荐数据
this.getJtData()
// this.getJtData()
},
getJtData(cid) {
this.tjProList = []
getJtData(cid) {
this.$http
// .post('book/label/list',{
.post('book/labelAndMarket/getShopProductListByLabelId', {
'labelId': cid
'labelId': cid
})
.then(res => {
if (res.code == 0 && res.result.length > 0) {
this.tjProList = res.result
}
else {
} else {
this.tjProList = []
this.status = 3
}
}).catch(e => {
this.tjProList = []
console.log(e, '商品分类列表报错')
});
},
// 获取折扣图书
getOffSale() {
this.$http
.post('book/shopproduct/listactivityprice?limit=10&page=1')
.then(res => {
console.log(res, '折扣')
if (res.code == 0 && res.page.list.length > 0) {
this.offSaleList = res.page.list
this.tabsNumber = 0
}
// getOffSale() {
// this.$http
// .post('book/shopproduct/listactivityprice?limit=10&page=1')
// .then(res => {
// console.log(res, '折扣')
// if (res.code == 0 && res.page.list.length > 0) {
// this.offSaleList = res.page.list
// this.tabsNumber = 0
// }
}).catch(e => {
console.log(e, 'e')
});
},
// }).catch(e => {
// console.log(e, 'e')
// });
// },
// 新书上市
// getNewBook() {
// this.$http
@@ -788,7 +814,7 @@
},
// 获取列表数据
getData() {
// 获取限时秒杀
// this.$http
@@ -882,13 +908,39 @@
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.children_cate{
background-color: #fff; justify-items: normal;
margin-bottom: 12rpx;
.children_cate {
justify-content: space-evenly;
padding: 0 10rpx;
.item{padding: 10rpx; background-color: #eee;}
.cur{ color:#55aa7f ;}
background-color: #fff;
display: flex;
justify-items: normal;
padding-top: 12rpx;
overflow: hidden;
padding-bottom: 10rpx;
.item {
width: 100%; text-align: center;
margin-right: 1px;
font-size: 32rpx;
padding: 10rpx;
color: #fff;
// background-color: #55aa7f;
background-color: #eee;
color: #333;
border-radius: 10rpx;
}
.item:last-child {
margin-right: 0;
}
.cur {
color: #55aa7f; font-weight: bold;
border-radius: 5rpx;
}
}
.fiveIcon {
justify-content: space-between;
text-align: center;
@@ -936,6 +988,7 @@
padding: 0 20rpx;
text {
padding: 8rpx 14rpx;
font-size: 32rpx;
display: inline-block;
@@ -952,6 +1005,32 @@
}
}
.New_ProTabs {
justify-content: space-between;
background-color: #fff;
padding-left: 5px; padding-right: 5px;
text {
// max-width: 12.5%;
// background-color: #56565633;
font-size: 32rpx;
padding: 5px 3px;
font-weight: bold;
display: block;
width: 100%;
border-radius: 10rpx;
overflow: hidden;
// background-color: #eee;
color: #333;
// white-space:wrap !important;
text-align: center;
}
text.cur {
background-color: #55aa7f;
color: #fff;
}
}
.wzProTabs {
display: flex;
justify-content: center;
@@ -1441,6 +1520,7 @@
width: 100%;
margin: 0 0 50rpx 0;
background-color: #fff;
margin-top: 10rpx;
.goodsItem {
display: inline-block;