|
|
|
@ -28,7 +28,7 @@ |
|
|
|
|
<view class="item" @click="tabFilter(2,5)" :class="filterIndex==2?'item-on':''">销量</view> |
|
|
|
|
<view class="item" @click="tabFilter(3,7)" :class="filterIndex==3?'item-on':''">综合</view> |
|
|
|
|
</view> |
|
|
|
|
<scroll-view scroll-y class="l"> |
|
|
|
|
<scroll-view scroll-y class="l" @scrolltolower="lowerthreshold" > |
|
|
|
|
<view class="item" v-for="(item,index) in list" v-if="list.length>0" :key="index" |
|
|
|
|
@click="goodsDetail(item.goods_id)" :isLoading="isLoading"> |
|
|
|
|
<image :src="item.goods_image"></image> |
|
|
|
@ -43,7 +43,8 @@ |
|
|
|
|
{{item.goods_sales}}+条评论 {{item.remaizhishu}}%好评率 |
|
|
|
|
</view> --> |
|
|
|
|
</view> |
|
|
|
|
<u-empty text="暂无数据显示哦~" v-else mode="list"></u-empty> |
|
|
|
|
<u-empty text="暂无数据显示哦~" v-else mode="list"></u-empty> |
|
|
|
|
<u-divider v-if="list.length == total && total>=1">没有更多了</u-divider> |
|
|
|
|
</scroll-view> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
@ -58,7 +59,9 @@ |
|
|
|
|
backgroundBg: { |
|
|
|
|
"background": "transparent", |
|
|
|
|
"overflow": "auto" |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
page: 1, |
|
|
|
|
total: 0, |
|
|
|
|
// 正在加载 |
|
|
|
|
isLoading: true, |
|
|
|
|
tabIndex1: 0, |
|
|
|
@ -84,7 +87,14 @@ |
|
|
|
|
this.getCarouselList() |
|
|
|
|
this.getCategoryList() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
methods: { |
|
|
|
|
lowerthreshold() { |
|
|
|
|
if(this.list.length <= this.total){ |
|
|
|
|
this.page ++ |
|
|
|
|
console.log("g") |
|
|
|
|
this.getBrandList(this.category_id) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 获取背景图 |
|
|
|
|
getCarouselList() { |
|
|
|
|
const app = this; |
|
|
|
@ -101,9 +111,14 @@ |
|
|
|
|
const app = this; |
|
|
|
|
Api.category({is_in_store:this.type==1?1:0}) |
|
|
|
|
.then(result => { |
|
|
|
|
app.categoryList = result.data.list; |
|
|
|
|
app.categoryChildren = result.data.list[0].children; |
|
|
|
|
this.getBrandList(result.data.list[0].category_id) |
|
|
|
|
app.categoryList = result.data.list; |
|
|
|
|
if(result.data.list && result.data.list.length > 0){ |
|
|
|
|
app.categoryChildren = result.data.list[0].children; |
|
|
|
|
app.category_id = result.data.list[0].category_id |
|
|
|
|
app.getBrandList(result.data.list[0].category_id) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
.finally(() => app.isLoading = false) |
|
|
|
|
}, |
|
|
|
@ -112,7 +127,7 @@ |
|
|
|
|
const app = this; |
|
|
|
|
let pamars = { |
|
|
|
|
// store_id: 10001, |
|
|
|
|
page: 1, |
|
|
|
|
page: this.page, |
|
|
|
|
is_brand:this.type==1?'':1, |
|
|
|
|
is_new: '', |
|
|
|
|
categoryId: categoryId, |
|
|
|
@ -122,20 +137,36 @@ |
|
|
|
|
Api.brandList(pamars) |
|
|
|
|
.then(result => { |
|
|
|
|
let arr = result.data.data; |
|
|
|
|
app.list = arr |
|
|
|
|
app.list = app.arrayUnique([...app.list,...arr],'goods_id') |
|
|
|
|
app.total = result.data.total |
|
|
|
|
}) |
|
|
|
|
.finally(() => app.isLoading = false) |
|
|
|
|
}, |
|
|
|
|
//数组对象去重 |
|
|
|
|
arrayUnique(arr, name) { |
|
|
|
|
var hash = {}; |
|
|
|
|
return arr.reduce(function (item, next) { |
|
|
|
|
hash[next[name]] |
|
|
|
|
? "" |
|
|
|
|
: (hash[next[name]] = true && item.push(next)); |
|
|
|
|
return item; |
|
|
|
|
}, []); |
|
|
|
|
}, |
|
|
|
|
tabItem(index, item) { |
|
|
|
|
this.tabIndex = index; |
|
|
|
|
this.page = 1; |
|
|
|
|
this.list = []; |
|
|
|
|
this.category_id = item.category_id |
|
|
|
|
this.getBrandList(item.category_id) |
|
|
|
|
}, |
|
|
|
|
tabItem1(item, index) { |
|
|
|
|
this.tabIndex1 = index; |
|
|
|
|
let app = this; |
|
|
|
|
this.page = 1; |
|
|
|
|
app.categoryChildren = []; |
|
|
|
|
app.categoryChildren = item.children; |
|
|
|
|
app.list = []; |
|
|
|
|
app.list = []; |
|
|
|
|
app.category_id = item.category_id |
|
|
|
|
this.getBrandList(item.category_id) |
|
|
|
|
}, |
|
|
|
|
tabFilter(index, stuts) { |
|
|
|
@ -152,7 +183,10 @@ |
|
|
|
|
if (index == 3) { |
|
|
|
|
this.orderSort = stuts == 7 ? 8 : 7 |
|
|
|
|
} |
|
|
|
|
console.log(this.orderSort) |
|
|
|
|
console.log(this.orderSort) |
|
|
|
|
this.page = 1 |
|
|
|
|
this.list = []; |
|
|
|
|
this.category_id = this.categoryChildren[0].category_id |
|
|
|
|
this.getBrandList(this.categoryChildren[0].category_id) |
|
|
|
|
}, |
|
|
|
|
goodsDetail(orderId) { |
|
|
|
|