|
@@ -26,6 +26,7 @@ class ShopGoodLists extends BaseWorkerDataLists implements ListsSearchInterface
|
|
|
|
|
|
|
|
public function lists(): array
|
|
public function lists(): array
|
|
|
{
|
|
{
|
|
|
|
|
+ record_sql();
|
|
|
$lists = ShopGoods::with(['goodSpecsInventory'=>function(Query $query){
|
|
$lists = ShopGoods::with(['goodSpecsInventory'=>function(Query $query){
|
|
|
$query->field(['id','shop_goods_id','remaining_inventory','service_fee','service_total']);
|
|
$query->field(['id','shop_goods_id','remaining_inventory','service_fee','service_total']);
|
|
|
}])
|
|
}])
|
|
@@ -41,6 +42,8 @@ class ShopGoodLists extends BaseWorkerDataLists implements ListsSearchInterface
|
|
|
->each(function($item){
|
|
->each(function($item){
|
|
|
$item['remaining_inventory'] =(int) $item->goodSpecsInventory()->sum('remaining_inventory');
|
|
$item['remaining_inventory'] =(int) $item->goodSpecsInventory()->sum('remaining_inventory');
|
|
|
$item['service_fee'] = $item->goodSpecsInventory()->min('service_fee');
|
|
$item['service_fee'] = $item->goodSpecsInventory()->min('service_fee');
|
|
|
|
|
+ $serviceItem = $item->goodSpecsInventory()->where('service_fee',$item['service_fee'])->find()->toArray();
|
|
|
|
|
+ $item['service_total'] = floatval($serviceItem['service_total'] ?? 0);
|
|
|
unset($item['goodSpecsInventory']);
|
|
unset($item['goodSpecsInventory']);
|
|
|
})
|
|
})
|
|
|
->toArray();
|
|
->toArray();
|