|
@@ -73,19 +73,8 @@ var myGoods = new Vue({
|
|
|
let page = data.productPage;
|
|
|
_this.featuredNum = data.featuredNum;
|
|
|
_this.isForbid = data.listingFee === 1
|
|
|
- _this.productsList = page.results.map(function(el){
|
|
|
- el.isAddFeatured = false;
|
|
|
- el.isDelFeatured = false;
|
|
|
- if(_this.featuredNum<4){
|
|
|
- if(el.validFlag === 2 && el.featuredFlag === 0 ){
|
|
|
- el.isAddFeatured = true;
|
|
|
- }
|
|
|
- if (el.validFlag === 2 && el.featuredFlag === 1) {
|
|
|
- el.isDelFeatured = true;
|
|
|
- }
|
|
|
- }
|
|
|
- return el
|
|
|
- })
|
|
|
+ _this.productsList = _this.handleResults(page.results,_this.featuredNum)
|
|
|
+ console.log('productsList',_this.productsList)
|
|
|
_this.total = page.totalRecord;
|
|
|
_this.listLoading = false
|
|
|
}else{
|
|
@@ -94,6 +83,24 @@ var myGoods = new Vue({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ //处理
|
|
|
+ handleResults(list,featuredNum){
|
|
|
+ return list.map(function(el){
|
|
|
+ el.isAddFeatured = false;
|
|
|
+ el.isDelFeatured = false;
|
|
|
+ if(featuredNum<4){
|
|
|
+ if(el.validFlag === 2 && el.featuredFlag === 0 ){
|
|
|
+ el.isAddFeatured = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(featuredNum>0){
|
|
|
+ if (el.validFlag === 2 && el.featuredFlag === 1) {
|
|
|
+ el.isDelFeatured = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return el
|
|
|
+ })
|
|
|
+ },
|
|
|
handleCommodityType(event){//选择商品属性
|
|
|
console.log('event',event)
|
|
|
console.log('event',this.listQuery.commodityType)
|