|
@@ -6,7 +6,7 @@
|
|
</view>
|
|
</view>
|
|
<!-- 商品 -->
|
|
<!-- 商品 -->
|
|
<view class="goods">
|
|
<view class="goods">
|
|
- <view v-for="(item,index) in goodsList" :key="item.type.id" v-if="goodsList.length&&item.list.length">
|
|
|
|
|
|
+ <view v-for="(item,index) in goodsList" :key="index" v-if="goodsList.length&&item.list.length">
|
|
<u-section :title="item.type.name" font-size="35" line-color="#01c9b2" sub-title="更多" @click="toGoods(item.type)"></u-section>
|
|
<u-section :title="item.type.name" font-size="35" line-color="#01c9b2" sub-title="更多" @click="toGoods(item.type)"></u-section>
|
|
<view class="goods-list">
|
|
<view class="goods-list">
|
|
<uni-coods :list="item.list"></uni-coods>
|
|
<uni-coods :list="item.list"></uni-coods>
|
|
@@ -38,23 +38,34 @@
|
|
goodsType:[], // 商品分类
|
|
goodsType:[], // 商品分类
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- onShow() {
|
|
|
|
- this.getbannerList()
|
|
|
|
- this.goodsList = []
|
|
|
|
- getGoodsClass({}).then(res => {
|
|
|
|
- console.log(res)
|
|
|
|
- if(res.status == 200){
|
|
|
|
- this.goodsType = res.data
|
|
|
|
- this.goodsType.map((item,index) => {
|
|
|
|
- this.getGoods(item,index)
|
|
|
|
- })
|
|
|
|
- }else{
|
|
|
|
- this.goodsList = []
|
|
|
|
- this.noDataText = '暂无商品'
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ onLoad() {
|
|
|
|
+ this.pageInit()
|
|
|
|
+ },
|
|
|
|
+ // 下拉刷新
|
|
|
|
+ onPullDownRefresh() {
|
|
|
|
+ console.log('refresh')
|
|
|
|
+ this.pageInit()
|
|
|
|
+ setTimeout(function () {
|
|
|
|
+ uni.stopPullDownRefresh()
|
|
|
|
+ }, 200)
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ pageInit(){
|
|
|
|
+ this.getbannerList()
|
|
|
|
+ this.goodsList = []
|
|
|
|
+ getGoodsClass({}).then(res => {
|
|
|
|
+ console.log(res)
|
|
|
|
+ if(res.status == 200){
|
|
|
|
+ this.goodsType = res.data
|
|
|
|
+ this.goodsType.map((item,index) => {
|
|
|
|
+ this.getGoods(item,index)
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ this.goodsList = []
|
|
|
|
+ this.noDataText = '暂无商品'
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
// 点击banner
|
|
// 点击banner
|
|
clickBanner(index){
|
|
clickBanner(index){
|
|
let row = this.imageTopList[index]
|
|
let row = this.imageTopList[index]
|
|
@@ -83,7 +94,7 @@
|
|
// 更多商品
|
|
// 更多商品
|
|
toGoods(item){
|
|
toGoods(item){
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
- url:"/pages/goods/goods?goodsTypeNo="+ item.goodsTypeNo + "&goldLimit="+ item.goldLimit
|
|
|
|
|
|
+ url:"/pages/goods/goods?goodsTypeNo="+ item.goodsTypeNo + "&goldLimit="+ item.goldLimit + "&name=" + item.name
|
|
})
|
|
})
|
|
},
|
|
},
|
|
// 查询商品
|
|
// 查询商品
|
|
@@ -91,10 +102,10 @@
|
|
getGoodsList({pageNo:1,pageSize:item.popularizeGoodsLimit,goodsTypeNo:item.goodsTypeNo}).then(res => {
|
|
getGoodsList({pageNo:1,pageSize:item.popularizeGoodsLimit,goodsTypeNo:item.goodsTypeNo}).then(res => {
|
|
console.log(res,'goodsList')
|
|
console.log(res,'goodsList')
|
|
if(res.status == 200&&res.data.list&&res.data.list.length){
|
|
if(res.status == 200&&res.data.list&&res.data.list.length){
|
|
- this.goodsList.push({
|
|
|
|
|
|
+ this.goodsList[index] = {
|
|
type: item,
|
|
type: item,
|
|
list: res.data.list
|
|
list: res.data.list
|
|
- })
|
|
|
|
|
|
+ }
|
|
this.goodsList.splice()
|
|
this.goodsList.splice()
|
|
}
|
|
}
|
|
})
|
|
})
|