新品首付与人气推荐的价格排序与销量排序搜索导致的商品重复出现的bug修改

This commit is contained in:
chenbo 2021-05-14 17:17:22 +08:00
parent ddbc1afd93
commit 18778a7374
2 changed files with 23 additions and 11 deletions

View File

@ -15,6 +15,7 @@ Page({
currentSortType: 'default', currentSortType: 'default',
currentSort: 'browse', currentSort: 'browse',
currentSortOrder: 'desc', currentSortOrder: 'desc',
isSearch: true,
page: 1, page: 1,
size: 10, size: 10,
totalPages: 1 totalPages: 1
@ -47,9 +48,10 @@ Page({
.then(function(res) { .then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
goodsList: that.data.goodsList.concat(res.data.goodsList), goodsList: that.data.isSearch ? res.data.goodsList : that.data.goodsList.concat(res.data.goodsList),
filterCategory: res.data.filterCategoryList, filterCategory: res.data.filterCategoryList,
totalPages: res.data.totalPages totalPages: res.data.totalPages,
isSearch: false
}); });
} }
}); });
@ -83,7 +85,8 @@ Page({
categoryFilter: !this.data.categoryFilter, categoryFilter: !this.data.categoryFilter,
currentSortType: 'category', currentSortType: 'category',
currentSort: 'add_time', currentSort: 'add_time',
currentSortOrder: 'desc' currentSortOrder: 'desc',
isSearch: true
}); });
break; break;
case 'priceSort': case 'priceSort':
@ -94,7 +97,8 @@ Page({
currentSortType: 'price', currentSortType: 'price',
currentSort: 'retail_price', currentSort: 'retail_price',
currentSortOrder: tmpSortOrder, currentSortOrder: tmpSortOrder,
categoryFilter: false categoryFilter: false,
isSearch: true
}); });
this.getGoodsList(); this.getGoodsList();
@ -107,7 +111,8 @@ Page({
currentSortType: 'sales', currentSortType: 'sales',
currentSort: 'sales', currentSort: 'sales',
currentSortOrder: tmpSortOrder, currentSortOrder: tmpSortOrder,
categoryFilter: false categoryFilter: false,
isSearch: true
}); });
this.getGoodsList(); this.getGoodsList();
break; break;
@ -118,6 +123,7 @@ Page({
currentSort: 'add_time', currentSort: 'add_time',
currentSortOrder: 'desc', currentSortOrder: 'desc',
categoryFilter: false, categoryFilter: false,
isSearch: true,
categoryId: 0, categoryId: 0,
}); });
this.getGoodsList(); this.getGoodsList();

View File

@ -15,6 +15,7 @@ Page({
currentSortType: 'default', currentSortType: 'default',
currentSort: 'add_time', currentSort: 'add_time',
currentSortOrder: 'desc', currentSortOrder: 'desc',
isSearch: true,
page: 1, page: 1,
size: 10, size: 10,
totalPages: 1 totalPages: 1
@ -33,9 +34,10 @@ Page({
.then(function(res) { .then(function(res) {
if (res.errno === 0) { if (res.errno === 0) {
that.setData({ that.setData({
goodsList: that.data.goodsList.concat(res.data.goodsList), goodsList: that.data.isSearch ? res.data.goodsList : that.data.goodsList.concat(res.data.goodsList),
filterCategory: res.data.filterCategoryList, filterCategory: res.data.filterCategoryList,
totalPages: res.data.totalPages totalPages: res.data.totalPages,
isSearch: false
}); });
} }
}); });
@ -68,7 +70,8 @@ Page({
categoryFilter: !this.data.categoryFilter, categoryFilter: !this.data.categoryFilter,
currentSortType: 'category', currentSortType: 'category',
currentSort: 'add_time', currentSort: 'add_time',
currentSortOrder: 'desc' currentSortOrder: 'desc',
isSearch: true
}); });
break; break;
case 'priceSort': case 'priceSort':
@ -79,7 +82,8 @@ Page({
currentSortType: 'price', currentSortType: 'price',
currentSort: 'retail_price', currentSort: 'retail_price',
currentSortOrder: tmpSortOrder, currentSortOrder: tmpSortOrder,
categoryFilter: false categoryFilter: false,
isSearch: true
}); });
this.getGoodsList(); this.getGoodsList();
@ -92,7 +96,8 @@ Page({
currentSortType: 'sales', currentSortType: 'sales',
currentSort: 'sales', currentSort: 'sales',
currentSortOrder: tmpSortOrder, currentSortOrder: tmpSortOrder,
categoryFilter: false categoryFilter: false,
isSearch: true
}); });
this.getGoodsList(); this.getGoodsList();
break; break;
@ -103,7 +108,8 @@ Page({
currentSort: 'add_time', currentSort: 'add_time',
currentSortOrder: 'desc', currentSortOrder: 'desc',
categoryFilter: false, categoryFilter: false,
categoryId: 0 categoryId: 0,
isSearch: true
}); });
this.getGoodsList(); this.getGoodsList();
} }