feat: 添加了商品统计、用户统计和交易统计的相关API
This commit is contained in:
parent
34cad62c8e
commit
3808cfd401
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,282 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\system_store;
|
||||
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\admin\lists\system_store\SystemStoreLists;
|
||||
use app\admin\lists\system_store\SystemStoreSourceLists;
|
||||
use app\admin\logic\store_product\StoreProductLogic;
|
||||
use app\admin\logic\system_store\SystemStoreLogic;
|
||||
use app\admin\validate\system_store\SystemStoreValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 门店统计
|
||||
* Class SystemStoreController
|
||||
* @package app\admin\controller\system_store
|
||||
*/
|
||||
class SystemStoreStatisticsController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取门店统计头部
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/05/31 17=>45
|
||||
*/
|
||||
public function header()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'card_count' => 0,
|
||||
'cashier_order_price' => 28762.69,
|
||||
'recharge_price' => 2004402.08,
|
||||
'store_income' => 34974.53,
|
||||
'store_order_price' => 1681.30,
|
||||
'store_pay_user_count' => 48,
|
||||
'store_use_yue' => 6734.52,
|
||||
'store_user_count' => 76,
|
||||
'store_writeoff_order_price' => 4530.54,
|
||||
'vip_price' => 1000.00,
|
||||
];
|
||||
return $this->data($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 交易/类型数据
|
||||
*/
|
||||
public function orderChart()
|
||||
{
|
||||
$order_list = [
|
||||
[
|
||||
"id" => 11127,
|
||||
"order_id" => "wx529263627312562176",
|
||||
"uid" => 0,
|
||||
"pay_price" => "257.20",
|
||||
"pay_time" => 1717472682,
|
||||
"avatar" => null,
|
||||
"nickname" => null,
|
||||
"phone" => null,
|
||||
"now_money" => null,
|
||||
"integral" => null,
|
||||
"delete_time" => null,
|
||||
"refund" => []
|
||||
],
|
||||
[
|
||||
"id" => 11120,
|
||||
"order_id" => "wx529242351697133568",
|
||||
"uid" => 0,
|
||||
"pay_price" => "4.48",
|
||||
"pay_time" => 1717467609,
|
||||
"avatar" => null,
|
||||
"nickname" => null,
|
||||
"phone" => null,
|
||||
"now_money" => null,
|
||||
"integral" => null,
|
||||
"delete_time" => null,
|
||||
"refund" => []
|
||||
]
|
||||
];
|
||||
$bing_xdata = [
|
||||
"收银订单",
|
||||
"充值订单",
|
||||
"分配订单",
|
||||
"核销订单",
|
||||
"付费会员订单"
|
||||
];
|
||||
$bing_data = [
|
||||
[
|
||||
"name" => "收银订单",
|
||||
"value" => 29019.89,
|
||||
"itemStyle" => [
|
||||
"color" => "#2EC479"
|
||||
]
|
||||
],
|
||||
[
|
||||
"name" => "充值订单",
|
||||
"value" => 2004402.08,
|
||||
"itemStyle" => [
|
||||
"color" => "#7F7AE5"
|
||||
]
|
||||
],
|
||||
[
|
||||
"name" => "分配订单",
|
||||
"value" => 1681.3,
|
||||
"itemStyle" => [
|
||||
"color" => "#FFA21B"
|
||||
]
|
||||
],
|
||||
|
||||
[
|
||||
"name" => "核销订单",
|
||||
"value" => 4530.54,
|
||||
"itemStyle" => [
|
||||
"color" => "#46A3FF"
|
||||
]
|
||||
],
|
||||
[
|
||||
"name" => "付费会员订单",
|
||||
"value" => 1000,
|
||||
"itemStyle" => [
|
||||
"color" => "#FF6046"
|
||||
]
|
||||
]
|
||||
];
|
||||
$data = [
|
||||
'order_list' => $order_list,
|
||||
'bing_xdata' => $bing_xdata,
|
||||
'bing_data' => $bing_data,
|
||||
];
|
||||
return $this->data($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 营业趋势
|
||||
*/
|
||||
public function operate(){
|
||||
$xAxis=[
|
||||
"05-06",
|
||||
"05-07",
|
||||
"05-08",
|
||||
"05-09",
|
||||
"05-10",
|
||||
"05-11",
|
||||
"05-12",
|
||||
"05-13",
|
||||
"05-14",
|
||||
"05-15",
|
||||
"05-16",
|
||||
"05-17",
|
||||
"05-18",
|
||||
"05-19",
|
||||
"05-20",
|
||||
"05-21",
|
||||
"05-22",
|
||||
"05-23",
|
||||
"05-24",
|
||||
"05-25",
|
||||
"05-26",
|
||||
"05-27",
|
||||
"05-28",
|
||||
"05-29",
|
||||
"05-30",
|
||||
"05-31",
|
||||
"06-01",
|
||||
"06-02",
|
||||
"06-03",
|
||||
"06-04"
|
||||
];
|
||||
$series=[
|
||||
[
|
||||
"name"=> "门店收款",
|
||||
"data"=> [
|
||||
171.29,
|
||||
167.46,
|
||||
1455.65,
|
||||
45.47,
|
||||
542.69,
|
||||
216.58,
|
||||
228.82,
|
||||
34.24,
|
||||
8249.85,
|
||||
664.23,
|
||||
8586.24,
|
||||
10.19,
|
||||
90.19,
|
||||
105.4,
|
||||
62.59,
|
||||
1051.34,
|
||||
160.84,
|
||||
2437.68,
|
||||
111374.41,
|
||||
12161.05,
|
||||
189,
|
||||
4831.65,
|
||||
1276.31,
|
||||
582.4,
|
||||
906.02,
|
||||
597,
|
||||
0.08,
|
||||
771.16,
|
||||
10262.64,
|
||||
261.68
|
||||
],
|
||||
"type"=> "line",
|
||||
"smooth"=> "true",
|
||||
"yAxisIndex"=> 1
|
||||
],
|
||||
[
|
||||
"name"=> "新增用户数",
|
||||
"data"=> [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"type"=> "line",
|
||||
"smooth"=> "true",
|
||||
"yAxisIndex"=> 1
|
||||
]
|
||||
];
|
||||
$data = [
|
||||
'xAxis' => $xAxis,
|
||||
'series' => $series,
|
||||
];
|
||||
return $this->data($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 门店业绩
|
||||
*/
|
||||
public function store(){
|
||||
$data=[
|
||||
[
|
||||
"id"=> 46,
|
||||
"name"=> "王多鱼的商超",
|
||||
"image"=> "https=>//multi-store.crmeb.net/uploads/attach/2024/05/20240527/f9b8b3c3cd5f1113bd7d374dc55d320a.jpg",
|
||||
"store_price"=> 797.88,
|
||||
"store_product_count"=> 18,
|
||||
"store_order_price"=> 1275.16,
|
||||
"store_user_count"=> 6
|
||||
],
|
||||
[
|
||||
"id"=> 43,
|
||||
"name"=> "这是直营店",
|
||||
"image"=> "https=>//multi-store.crmeb.net/uploads/attach/2024/05/20240524/9066528e73e2db60d31a704d321ba4a5.jpeg",
|
||||
"store_price"=> 203.11,
|
||||
"store_product_count"=> 10,
|
||||
"store_order_price"=> 579.01,
|
||||
"store_user_count"=> 8
|
||||
],
|
||||
];
|
||||
return $this->data($data);
|
||||
}
|
||||
}
|
64
app/admin/lists/system_store/SystemStoreStatisticsLists.php
Normal file
64
app/admin/lists/system_store/SystemStoreStatisticsLists.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\lists\system_store;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* 门店统计列表
|
||||
* Class SystemStoreStatisticsLists
|
||||
*/
|
||||
class SystemStoreStatisticsLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author admin
|
||||
* @date 2024/05/31 17:45
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['name', 'phone'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取门店列表列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author admin
|
||||
* @date 2024/05/31 17:45
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return SystemStore::where($this->searchWhere)
|
||||
->field(['id', 'name', 'phone', 'detailed_address', 'image', 'is_show'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取门店列表数量
|
||||
* @return int
|
||||
* @author admin
|
||||
* @date 2024/05/31 17:45
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return SystemStore::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user