0517
This commit is contained in:
@@ -129,20 +129,27 @@
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="head_line" style="background-color: #fff;">
|
||||
<!-- <view class="head_line" style="background-color: #fff;">
|
||||
<b></b>
|
||||
<text>新书上市</text>
|
||||
<!-- <i @click="onBookMore('New')">查看更多 ></i> -->
|
||||
</view>
|
||||
|
||||
<text>新书上市</text>
|
||||
</view> -->
|
||||
|
||||
<!-- 营销标签 -->
|
||||
<scroll-view class="scroll-view_H " scroll-x="true" scroll-left="0">
|
||||
<view class="ProTabs">
|
||||
<text v-for="(item,index) in yingxiaoTags" :key="item.id" :class="[yxCurIndex == index ? 'cur' :'']"
|
||||
@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 newBookList" :key="index">
|
||||
<view class="videoBox" @click="goDetail(item.productId)">
|
||||
<image v-if="item.productImages != ''" :src="item.productImages" mode="scaleToFill"></image>
|
||||
<view :class="['item']" v-for="(item,index) in YXBookList" :key="index">
|
||||
<view class="videoBox" @click="goDetail(item.product_id)">
|
||||
<image v-if="item.product_images != ''" :src="item.product_images" mode="scaleToFill"></image>
|
||||
<image v-else src="../../static/icon/wufeng.jpg" mode="scaleToFill"></image>
|
||||
</view>
|
||||
<text class="bookName">{{item.productName}}</text>
|
||||
<text class="bookName">{{item.product_name}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
@@ -232,22 +239,16 @@
|
||||
|
||||
<scroll-view class="scroll-view_H " scroll-x="true" scroll-left="0">
|
||||
<view class="ProTabs">
|
||||
<text v-for="item in tagList" :key="item.splId" :class="[tabsid == item.splId ? 'cur' :'']"
|
||||
@click="tabsChange(item)">{{item.labelName}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<scroll-view class="scroll-view_H " scroll-x="true" scroll-left="0" v-if="tabsid == 15">
|
||||
<view class="ProTabs">
|
||||
<text v-for="item in yxtaglist" :key="item.splId" :class="[wztabsid == item.splId ? 'cur' :'']"
|
||||
@click="wztabsChange(item)">{{item.labelName}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<scroll-view class="scroll-view_H " scroll-x="true" scroll-left="0" v-if="tabsid == 16">
|
||||
<view class="wzProTabs">
|
||||
<text v-for="item in wztaglist" :key="item.splId" :class="[wztabsid == item.splId ? 'cur' :'']"
|
||||
@click="wztabsChange(item)">{{item.labelName}}</text>
|
||||
<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="goods">
|
||||
<!-- 精选 -->
|
||||
@@ -255,17 +256,17 @@
|
||||
<view v-if="tjProList.length > 0">
|
||||
<view class="flexbox" style="flex-wrap: wrap;">
|
||||
<view class="goodsItem" v-for="(item,index) in tjProList" :key="index"
|
||||
@click="goDetail(item.productId)">
|
||||
<image :src="item.productImages" mode="" class="goodsImg"></image>
|
||||
@click="goDetail(item.product_id)">
|
||||
<image :src="item.product_images" mode="" class="goodsImg"></image>
|
||||
<view class="goodsContent">
|
||||
<view class="goodsName">
|
||||
{{item.productName}}
|
||||
{{item.product_name}}
|
||||
</view>
|
||||
<view class="goodsPrice">
|
||||
<span class="price"
|
||||
v-if="item.activityPrice && item.activityPrice > 0">¥{{item.activityPrice}}</span>
|
||||
v-if="item.activity_price && item.activity_price > 0">¥{{item.activityPrice}}</span>
|
||||
<span class="price" v-else>¥{{item.price}}</span>
|
||||
<span class="Salesnum">已售:{{item.sumSales}} 件</span>
|
||||
<span class="Salesnum">已售:{{item.sum_sales}} 件</span>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -328,6 +329,8 @@
|
||||
'../../static/icon/home_ban_2.jpg',
|
||||
'../../static/icon/home_ban_3.jpg',
|
||||
],
|
||||
yingxiaoTags:[ // 营销标签列表
|
||||
],
|
||||
xinsList: [],
|
||||
loadingNow: false,
|
||||
limiTist: [],
|
||||
@@ -338,13 +341,17 @@
|
||||
bgiStyle: {
|
||||
background: '#fff'
|
||||
},
|
||||
newBookList: [],
|
||||
YXBookList: [],
|
||||
catTagList:[ // 分类标签
|
||||
],
|
||||
curChildrenId:0,
|
||||
iconStyle: {
|
||||
fontSize: '40rpx',
|
||||
fontWeight: 'bold',
|
||||
color: '#54a966',
|
||||
},
|
||||
tagList: [], // 推荐标签列表
|
||||
childrenCatList:[], // 二级分类
|
||||
wztaglist: [{
|
||||
splId: "-1",
|
||||
labelName: "全部"
|
||||
@@ -387,6 +394,7 @@
|
||||
tjProList: [],
|
||||
status: 3,
|
||||
userMsg: {}, // 用户信息
|
||||
yxCurIndex:0, // 当前营销标签序号
|
||||
};
|
||||
},
|
||||
onPageScroll(e) {
|
||||
@@ -414,6 +422,7 @@
|
||||
this.getData();
|
||||
this.getTags()
|
||||
this.getUserInfo()
|
||||
this.getYXTgs()
|
||||
},
|
||||
// 页面加载完毕
|
||||
onReady() {
|
||||
@@ -426,22 +435,23 @@
|
||||
this.getData()
|
||||
this.getTags()
|
||||
this.getUserInfo()
|
||||
this.getYXTgs()
|
||||
// this.requestIapOrder()
|
||||
uni.stopPullDownRefresh()
|
||||
|
||||
},
|
||||
onReachBottom() {
|
||||
this.loadingNow = true
|
||||
console.log('到底了')
|
||||
if (this.page + 1 <= this.totalPage) {
|
||||
this.status = 0
|
||||
this.page++
|
||||
this.getJtData()
|
||||
} else {
|
||||
this.status = 1
|
||||
}
|
||||
// onReachBottom() {
|
||||
// this.loadingNow = true
|
||||
// console.log('到底了')
|
||||
// if (this.page + 1 <= this.totalPage) {
|
||||
// this.status = 0
|
||||
// this.page++
|
||||
// this.getJtData()
|
||||
// } else {
|
||||
// this.status = 1
|
||||
// }
|
||||
|
||||
},
|
||||
// },
|
||||
|
||||
filters: {
|
||||
// 控制字数
|
||||
@@ -465,7 +475,39 @@
|
||||
//方法
|
||||
methods: {
|
||||
...mapMutations(['setUserInfo']),
|
||||
// 获取营销标签列表
|
||||
getYXTgs(){
|
||||
this.$http
|
||||
.post('book/labelAndMarket/marketTree')
|
||||
.then(res => {
|
||||
console.log(res, '营销标签列表')
|
||||
if(res.result.length > 0){
|
||||
this.yingxiaoTags = res.result
|
||||
this.getYXproducts()
|
||||
}
|
||||
|
||||
// console.log(res)
|
||||
});
|
||||
},
|
||||
// ...mapMutations(['setLoadingShow']),
|
||||
// 获取对应营销商品列表
|
||||
getYXproducts(item){
|
||||
var tag_id = null
|
||||
if(!item){
|
||||
console.log('没有传参')
|
||||
tag_id = this.yingxiaoTags[0].id
|
||||
}else{
|
||||
tag_id = item.id
|
||||
}
|
||||
this.$http
|
||||
.post('book/labelAndMarket/getShopProductListByMarketId',{
|
||||
'marketId':tag_id
|
||||
})
|
||||
.then(res => {
|
||||
console.log(res.result, '营销商品列表')
|
||||
this.YXBookList = res.result
|
||||
});
|
||||
},
|
||||
// 获取用户详情
|
||||
getUserInfo() {
|
||||
// 用户详情
|
||||
@@ -478,34 +520,62 @@
|
||||
// }
|
||||
},
|
||||
// 获取商品标签
|
||||
getTags() {
|
||||
getTags() {
|
||||
this.loadingNow = false
|
||||
this.$http
|
||||
.post('book/label/getLabels')
|
||||
.post('book/labelAndMarket/labelTree')
|
||||
.then(res => {
|
||||
console.log(res, '标签列表')
|
||||
if (res.code == 0 && res.result.labels.length > 0) {
|
||||
this.tagList = res.result.labels
|
||||
this.tabsid = this.tagList[0].splId
|
||||
this.getJtData()
|
||||
// console.log(res, '标签列表')
|
||||
if (res.code == 0 && res.result.length > 0) {
|
||||
this.catTagList = res.result
|
||||
this.tabsid = this.catTagList[0].id
|
||||
if(this.catTagList[0].isLast == 1){
|
||||
this.getJtData(this.catTagList[0].id)
|
||||
}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')
|
||||
});
|
||||
},
|
||||
tabsChange(item) {
|
||||
// 二级分类点击
|
||||
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 = []
|
||||
this.tabsid = item.splId
|
||||
if (this.tabsid == 15) {
|
||||
this.wztabsid = '0'
|
||||
} else if (this.tabsid == 16) {
|
||||
this.wztabsid = '-1'
|
||||
} else {
|
||||
this.wztabsid = ''
|
||||
this.tabsid = item.id
|
||||
this.childrenCatList = []
|
||||
if(this.catTagList[cindex].isLast == 1){
|
||||
this.getJtData(this.catTagList[cindex].id)
|
||||
}else{
|
||||
this.childrenCatList = this.catTagList[cindex].children
|
||||
this.curChildrenId = this.childrenCatList[0].id
|
||||
this.getJtData(this.childrenCatList[0].id)
|
||||
|
||||
}
|
||||
this.page = 1
|
||||
// 获取推荐数据
|
||||
this.getJtData()
|
||||
// this.getJtData()
|
||||
// if (this.tabsid == 15) {
|
||||
// this.wztabsid = '0'
|
||||
// } else if (this.tabsid == 16) {
|
||||
// this.wztabsid = '-1'
|
||||
// } else {
|
||||
// this.wztabsid = ''
|
||||
// }
|
||||
// this.page = 1
|
||||
// // 获取推荐数据
|
||||
|
||||
},
|
||||
yxTabsChange(item,index) {
|
||||
// this.yxtaglist = []
|
||||
this.yxCurIndex = index
|
||||
this.getYXproducts(item)
|
||||
},
|
||||
wztabsChange(item) {
|
||||
this.tjProList = []
|
||||
@@ -514,28 +584,22 @@
|
||||
// 获取推荐数据
|
||||
this.getJtData()
|
||||
},
|
||||
getJtData() {
|
||||
getJtData(cid) {
|
||||
this.tjProList = []
|
||||
this.$http
|
||||
// .post('book/label/list',{
|
||||
.post('book/label/getProductsByLabel', {
|
||||
'splId': this.tabsid,
|
||||
'limit': this.pageSize,
|
||||
'page': this.page,
|
||||
'type': this.wztabsid
|
||||
.post('book/labelAndMarket/getShopProductListByLabelId', {
|
||||
'labelId': cid
|
||||
})
|
||||
.then(res => {
|
||||
|
||||
if (res.code == 0 && res.page.records.length > 0) {
|
||||
this.tjProList = this.tjProList.concat(res.page.records)
|
||||
this.totalPage = res.page.pages
|
||||
if (res.code == 0 && res.result.length > 0) {
|
||||
this.tjProList = res.result
|
||||
}
|
||||
else {
|
||||
this.status = 3
|
||||
console.log(this.tjProList, '按标签检索结果')
|
||||
} else {
|
||||
this.tjProList = []
|
||||
this.totalPage = 0
|
||||
}
|
||||
}).catch(e => {
|
||||
console.log(e, '标签检索报错')
|
||||
console.log(e, '商品分类列表报错')
|
||||
});
|
||||
},
|
||||
// 获取折扣图书
|
||||
@@ -554,19 +618,19 @@
|
||||
});
|
||||
},
|
||||
// 新书上市
|
||||
getNewBook() {
|
||||
this.$http
|
||||
.post('book/shopproduct/getNewBook', {
|
||||
'limit': 4,
|
||||
'page': 1
|
||||
})
|
||||
.then(res => {
|
||||
console.log(res, 'xinshu')
|
||||
this.newBookList = res.page.list
|
||||
}).catch(e => {
|
||||
console.log(e, '新书上市报错')
|
||||
});
|
||||
},
|
||||
// getNewBook() {
|
||||
// this.$http
|
||||
// .post('book/shopproduct/getNewBook', {
|
||||
// 'limit': 4,
|
||||
// 'page': 1
|
||||
// })
|
||||
// .then(res => {
|
||||
// console.log(res, 'xinshu')
|
||||
// this.YXBookList.page.list
|
||||
// }).catch(e => {
|
||||
// console.log(e, '新书上市报错')
|
||||
// });
|
||||
// },
|
||||
// 检测未完成订单
|
||||
requestIapOrder() {
|
||||
console.log('检测支付环境...')
|
||||
@@ -724,13 +788,7 @@
|
||||
},
|
||||
// 获取列表数据
|
||||
getData() {
|
||||
// this.$http
|
||||
// .post('book/book/bookIndex')
|
||||
// .then(res => {
|
||||
// // this.xinsList = res.bookIndex.newBookList
|
||||
// // this.limiTist = res.bookIndex.saleList
|
||||
// // this.jingList = res.bookIndex.topBookList
|
||||
// });
|
||||
|
||||
|
||||
// 获取限时秒杀
|
||||
// this.$http
|
||||
@@ -748,7 +806,7 @@
|
||||
// this.goodsList = res.page.list
|
||||
// })
|
||||
//this.getOffSale()
|
||||
this.getNewBook()
|
||||
// this.getNewBook()
|
||||
},
|
||||
|
||||
// 跳转
|
||||
@@ -824,7 +882,13 @@
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import '@/style/mixin.scss';
|
||||
|
||||
.children_cate{
|
||||
background-color: #fff; justify-items: normal;
|
||||
margin-bottom: 12rpx;
|
||||
padding: 0 10rpx;
|
||||
.item{padding: 10rpx; background-color: #eee;}
|
||||
.cur{ color:#55aa7f ;}
|
||||
}
|
||||
.fiveIcon {
|
||||
justify-content: space-between;
|
||||
text-align: center;
|
||||
|
||||
Reference in New Issue
Block a user