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

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

View File

@@ -707,11 +707,21 @@
title: '登录成功', title: '登录成功',
duration: 2000 duration: 2000
}); });
// 跳转底部导航
setTimeout(() => { setTimeout(() => {
// uni.switchTab({
// url: "/pages/home/home"
// });
uni.switchTab({ uni.switchTab({
url: "/pages/home/home"                 url: "/pages/home/home",
});                 success: function () {
}, 2000);                   let page = getCurrentPages()[0];                  
          page.$vm.requestAll();
                },
              });
}, 1000);
} else { } else {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
@@ -767,10 +777,17 @@
duration: 2000 duration: 2000
}); });
setTimeout(() => { setTimeout(() => {
// uni.switchTab({
// url: "/pages/home/home"
// });
uni.switchTab({ uni.switchTab({
url: "/pages/home/home"                 url: "/pages/home/home",
});                 success: function () {
}, 2000);                   let page = getCurrentPages()[0];                  
                  page.$vm.requestAll();
                },
              });
}, 1000);
} else { } else {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',