修改店员详情、配送员详情

This commit is contained in:
luofei 2024-06-06 17:02:53 +08:00
parent 4362d43795
commit 64f59e596e
4 changed files with 80 additions and 4 deletions

View File

@ -33,7 +33,7 @@ class StoreStaffLists extends BaseAdminDataLists implements ListsSearchInterface
*/
public function lists(): array
{
return SystemStoreStaff::field('id,staff_name,avatar,account,phone,is_admin,is_manager')
return SystemStoreStaff::field('id,staff_name,avatar,account,phone,is_admin,is_manager,status')
->when(!empty($this->request->adminInfo['store_id']), function ($query) {
$query->where('store_id', '=', $this->request->adminInfo['store_id']);
})

View File

@ -2,9 +2,9 @@
namespace app\common\logic;
use app\common\logic\store_order\StoreOrderLogic;
use app\common\model\system_store\DeliveryService;
use app\common\service\FileService;
use Webman\Config;
class DeliveryServiceLogic extends BaseLogic
{
@ -58,7 +58,37 @@ class DeliveryServiceLogic extends BaseLogic
if (empty($model)) {
throw new \Exception('数据不存在');
}
return $model->toArray();
$data = $model->toArray();
$orderLogic = new StoreOrderLogic();
$data['wait'] = $orderLogic->storeOrderCountByWhere([
'store_id' => $data['store_id'],
'delivery_id' => $data['phone'],
'status' => 0,
'paid' => 1,
'shipping_type' => 1,
]);
$data['finish'] = $orderLogic->storeOrderCountByWhere([
'store_id' => $data['store_id'],
'delivery_id' => $data['phone'],
'status' => [1, 2],
'paid' => 1,
'shipping_type' => 1,
]);
$data['wait_amount'] = $orderLogic->storeOrderSumByWhere([
'store_id' => $data['store_id'],
'delivery_id' => $data['phone'],
'status' => 0,
'paid' => 1,
'shipping_type' => 1,
]);
$data['finish_amount'] = $orderLogic->storeOrderSumByWhere([
'store_id' => $data['store_id'],
'delivery_id' => $data['phone'],
'status' => [1, 2],
'paid' => 1,
'shipping_type' => 1,
]);
return $data;
}
public function status($id)

View File

@ -2,6 +2,7 @@
namespace app\common\logic;
use app\common\logic\store_order\StoreOrderLogic;
use app\common\model\system_store\SystemStoreStaff;
use app\common\service\FileService;
use Webman\Config;
@ -69,7 +70,30 @@ class SystemStoreStaffLogic extends BaseLogic
if (empty($model)) {
throw new \Exception('数据不存在');
}
return $model->toArray();
$data = $model->toArray();
$orderLogic = new StoreOrderLogic();
$data['cashier_order'] = $orderLogic->storeOrderCountByWhere([
'store_id' => $data['store_id'],
'staff_id' => $data['id'],
'status' => [0, 1, 2],
'paid' => 1,
'shipping_type' => 3,
]);
$data['verify_order'] = $orderLogic->storeOrderCountByWhere([
'store_id' => $data['store_id'],
'delivery_id' => $data['phone'],
'status' => [1, 2],
'paid' => 1,
'shipping_type' => 2,
]);
$data['delivery_order'] = $orderLogic->storeOrderSumByWhere([
'store_id' => $data['store_id'],
'delivery_id' => $data['phone'],
'status' => 0,
'paid' => 1,
'shipping_type' => 1,
]);
return $data;
}
public function status($id)

View File

@ -143,4 +143,26 @@ class StoreOrderLogic extends BaseLogic
return StoreOrder::where(['store_id' => $storeId, 'status' => $status])->count();
}
/**
* 订单统计
* @param $where
* @return int|\think\db\Query
* @throws \think\db\exception\DbException
*/
public function storeOrderCountByWhere($where)
{
return StoreOrder::where($where)->count();
}
/**
* 订单统计
* @param $where
* @return int|\think\db\Query
* @throws \think\db\exception\DbException
*/
public function storeOrderSumByWhere($where)
{
return StoreOrder::where($where)->sum('pay_price');
}
}