|
|
|
@ -21,11 +21,32 @@ class OrderGoodsActivityMarketChart extends Donut |
|
|
|
protected $GoodsActivityReport = null; |
|
|
|
protected $color = ['#33b2df', '#546E7A', '#d4526e', '#13d8aa', '#A5978B', '#2b908f', '#f9a3a4', '#90ee7e', '#f48024', '#69d2e7']; |
|
|
|
|
|
|
|
public function __construct($data = []) |
|
|
|
public function __construct($params = []) |
|
|
|
{ |
|
|
|
$this->GoodsActivityReport = new GoodsActivityReport($data); |
|
|
|
|
|
|
|
parent::__construct(); |
|
|
|
|
|
|
|
// $params = $this->parameters($params);
|
|
|
|
|
|
|
|
$data = $params['list'] ?? []; |
|
|
|
$market = $params['markets'] ?? []; |
|
|
|
|
|
|
|
if(!empty($data) && is_array($data)){ |
|
|
|
$total = 0; |
|
|
|
foreach($data as $key => $value){ |
|
|
|
$this->data[] = (int)$value['total']; |
|
|
|
$this->labels[] = $market[$value['market_id']]??'未知'; |
|
|
|
$this->colors[] = $this->color[$key]; |
|
|
|
$total += $value['total']; |
|
|
|
} |
|
|
|
$this->total['number_total'] = $total; |
|
|
|
} |
|
|
|
|
|
|
|
$this->chartLabels($this->labels); |
|
|
|
$this->chartColors($this->colors); |
|
|
|
// 数据查询逻辑
|
|
|
|
$data = $this->data; |
|
|
|
$this->withContent($data); |
|
|
|
$this->withChart($data); |
|
|
|
} |
|
|
|
|
|
|
|
protected function init() |
|
|
|
@ -36,11 +57,6 @@ class OrderGoodsActivityMarketChart extends Donut |
|
|
|
$this->subTitle('各市场销售量的占比图'); |
|
|
|
$this->chartHeight(170); |
|
|
|
$this->chartMarginTop(20); |
|
|
|
// 设置下拉菜单
|
|
|
|
// $this->dropdown([]);
|
|
|
|
|
|
|
|
$this->chartLabels($this->labels); |
|
|
|
$this->chartColors($this->colors); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -50,8 +66,16 @@ class OrderGoodsActivityMarketChart extends Donut |
|
|
|
* @param Request $request |
|
|
|
* @return mixed|void |
|
|
|
*/ |
|
|
|
public function handle(Request $request) |
|
|
|
public function handleBar(Request $request) |
|
|
|
{ |
|
|
|
// $this->GoodsActivityReport = new GoodsActivityReport($params);
|
|
|
|
// 分页的时候不重复查询数据
|
|
|
|
// $currentPage = $params['page'] ?? 1;
|
|
|
|
// if($currentPage == 1){
|
|
|
|
// $data = $this->GoodsActivityReport->getMarketData($params);
|
|
|
|
// $market = MarketModel::getMarketArray();
|
|
|
|
// }else{
|
|
|
|
// }
|
|
|
|
// 分页的时候不重复查询数据
|
|
|
|
$currentPage = $request->get('page'); |
|
|
|
if($currentPage == 1){ |
|
|
|
@ -82,7 +106,7 @@ class OrderGoodsActivityMarketChart extends Donut |
|
|
|
* |
|
|
|
* @return array |
|
|
|
*/ |
|
|
|
public function parameters(): array |
|
|
|
public function parameters($data = []): array |
|
|
|
{ |
|
|
|
$this->marketId = Auth::getMarket(); |
|
|
|
return [ |
|
|
|
@ -92,6 +116,7 @@ class OrderGoodsActivityMarketChart extends Donut |
|
|
|
'store_id' => request()->input('store_id',0), |
|
|
|
'start_time' => request()->input('start_time',''), |
|
|
|
'end_time' => request()->input('end_time',''), |
|
|
|
'data' => $data |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
|