2021-11-07 开源测试版 2.4.0

This commit is contained in:
2021-11-07 15:43:36 +08:00
parent a9e17b5af7
commit 672cc966db
24 changed files with 922 additions and 1396 deletions
@@ -3,12 +3,13 @@
use DB;
use Request;
use Auth;
use Gdoo\Index\Services\InfoService;
use Gdoo\Index\Controllers\DefaultController;
class WidgetController extends DefaultController
{
public $permission = ['index', 'goods'];
public $permission = ['index', 'goods', 'orderCount'];
public function index()
{
@@ -229,4 +230,48 @@ class WidgetController extends DefaultController
}
return $this->render();
}
/**
* 订单数量
*/
public function orderCount()
{
$config = InfoService::getInfo('customer_order');
$model = DB::table('customer_order')
->leftJoin('customer_order_data','customer_order_data.order_id', '=', 'customer_order.id')
->whereRaw('('.$config['sql'].')');
$model2 = DB::table('customer_order')
->leftJoin('customer_order_data','customer_order_data.order_id', '=', 'customer_order.id')
->whereRaw('('.$config['sql2'].')');
$region = regionCustomer();
if ($region['authorise']) {
foreach ($region['whereIn'] as $key => $where) {
$model->whereIn($key, $where);
$model2->whereIn($key, $where);
}
}
$count = $model->sum('customer_order_data.money');
$count2 = $model2->sum('customer_order_data.money');
$rate = 0;
if ($count2 > 0) {
$rate = ($count - $count2) / $count2 * 100;
$rate = number_format($rate, 2);
}
$res = [
'count' => $count,
'count2' => $count2,
'rate' => $rate,
];
return $this->render([
'dates' => $config['dates'],
'info' => $config['info'],
'res' => $res,
]);
}
}
+6
View File
@@ -40,6 +40,12 @@ return [
'url' => 'order/widget/goods',
'more_url' => 'order/order/delivery',
],
'info_order_count' => [
'name' => '销售订单(元)',
'type' => 2,
'url' => 'order/widget/orderCount',
'more_url' => 'order/order/index',
],
],
"controllers" => [
"order" => [
@@ -0,0 +1,15 @@
<div class="panel panel-shadow info-skin1">
<div class="info-l hidden-xs" style="background-color:{{$info['color']}}">
<i class="fa fa-2x {{$info['icon']}}"></i>
</div>
<div class="info-c">
<div class="info-name">{{$info['name']}}</div>
<a href="javascript:;" data-toggle="addtab" data-url="{{$info['more_url']}}" data-id="{{str_replace(['/', '?', '='], ['_', '_', '_'], $info['more_url'])}}" data-name="{{$info['name']}}">
<div class="text-info info-item" data-id="{{$info['id']}}" data-more_url="{{$info['more_url']}}">{{$res['count']}}</div>
</a>
</div>
<div class="info-r">
<div>比{{$dates[$info['params']['date']]}}</div>
<div class="rate @if($res['rate'] > 100) red @endif">{{$res['rate']}}%</div>
</div>
</div>