feat: 修改商品列表API,增加'total_price'字段,修复'is_lack'判断逻辑
This commit is contained in:
parent
64396fe1b5
commit
21baf23272
@ -68,24 +68,16 @@ class BranchProductLists extends BaseApiDataLists implements ListsSearchInterfac
|
|||||||
// } else {
|
// } else {
|
||||||
// $order = [$field => $order];
|
// $order = [$field => $order];
|
||||||
// }
|
// }
|
||||||
$fields = 'id,top_cate_id,cate_id,store_name,cost,vip_price,purchase,price,bar_code,image,sales,store_info,unit,batch,two_cate_id,stock,is_lack';
|
$fields = 'id,top_cate_id,cate_id,store_name,cost,vip_price,purchase,price,bar_code,image,sales,store_info,unit,batch,two_cate_id,stock,total_price';
|
||||||
|
|
||||||
$tag = '';
|
$this->searchWhere[] = ['status', '=', 1];
|
||||||
|
|
||||||
$this->searchWhere[] = ['is_show', '=', 1];
|
|
||||||
$this->searchWhere[] = ['product_type', 'in', [0,4]];
|
$this->searchWhere[] = ['product_type', 'in', [0,4]];
|
||||||
return StoreBranchProduct::where($this->searchWhere)
|
return StoreBranchProduct::where($this->searchWhere)
|
||||||
->field($fields)
|
->field($fields)
|
||||||
->with(['className', 'unitName'])
|
->with(['className', 'unitName'])
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order($this->sortOrder)
|
->order($this->sortOrder)
|
||||||
->select()->each(function ($item) use ($tag) {
|
->select()
|
||||||
if($item['is_lack']==1){
|
|
||||||
$tag='缺货';
|
|
||||||
}
|
|
||||||
$item['tag'] = $tag;
|
|
||||||
return $item;
|
|
||||||
})
|
|
||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user