feat: 修改了StoreFinanceFlowLists和StoreFinanceFlowWeekLists类中的查询逻辑,并更新了SystemStoreStorageLists类。

This commit is contained in:
mkm 2024-06-07 16:51:14 +08:00
parent 454a0ea3ad
commit 33857f15df
3 changed files with 6 additions and 12 deletions

View File

@ -32,6 +32,7 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
{
return [
'=' => ['store_id', 'user_id', 'create_time', 'staff_id'],
'between_time'=>'create_time',
];
}
@ -48,15 +49,6 @@ class StoreFinanceFlowLists extends BaseAdminDataLists implements ListsSearchInt
public function lists(): array
{
return StoreFinanceFlow::where($this->searchWhere)
->when(!empty($this->params['start_time']), function ($query) {
$query->whereTime('create_time', '>=', $this->params['start_time']);
})
->when(!empty($this->params['end_time']), function ($query) {
if ($this->params['end_time'] == $this->params['start_time']) {
$this->params['end_time'] = strtotime($this->params['end_time']) + 86399;
}
$query->whereTime('create_time', '<=', $this->params['end_time']);
})
->when(!empty($this->request->adminInfo['store_id']), function ($query) {
$query->where('store_id', $this->request->adminInfo['store_id']);
})

View File

@ -45,7 +45,7 @@ class StoreFinanceFlowWeekLists extends BaseAdminDataLists implements ListsSearc
{
return StoreFinanceFlow::where($this->searchWhere)
->field('
CONCAT("", YEARweek(FROM_UNIXTIME(create_time, "%Y-%m-%d")), "周(", MONTH(FROM_UNIXTIME(create_time, "%Y-%m-%d")), "月)") as date,
CONCAT("", LPAD(YEAR(FROM_UNIXTIME(create_time, "%Y-%m-%d")), 4, "0"), "-", LPAD(WEEK(FROM_UNIXTIME(create_time, "%Y-%m-%d"), 3), 2, "0"), "周(", LPAD(MONTH(FROM_UNIXTIME(create_time, "%Y-%m-%d")), 2, "0"), "月)") as date,
SUM(CASE WHEN financial_pm = 1 THEN number ELSE 0 END) as income,
SUM(CASE WHEN financial_pm = 0 THEN number ELSE 0 END) as expenditure
')

View File

@ -46,7 +46,7 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI
public function lists(): array
{
return SystemStoreStorage::where($this->searchWhere)
->field(['id', 'store_id', 'admin_id', 'staff_id', 'product_id', 'nums', 'status'])
->field(['id', 'store_id', 'admin_id', 'staff_id', 'product_id', 'nums','mark', 'status'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($item){
@ -58,7 +58,9 @@ class SystemStoreStorageLists extends BaseAdminDataLists implements ListsSearchI
}else{
$item['staff_name']='无';
}
$item['store_name']=StoreProduct::where('id',$item['product_id'])->value('store_name');
$find=StoreProduct::where('id',$item['product_id'])->field('store_name,image')->find();
$item['store_name']=$find['store_name'];
$item['image']=$find['image'];
return $item;
})
->toArray();