feat: 业务团队交易数据统计
parent
39afee861d
commit
a14bd86005
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
namespace app\admin\controller;
|
namespace app\admin\controller;
|
||||||
|
|
||||||
|
use app\admin\logic\user\BusinessTeamLogic;
|
||||||
use app\common\basics\AdminBase;
|
use app\common\basics\AdminBase;
|
||||||
use app\common\server\JsonServer;
|
use app\common\server\JsonServer;
|
||||||
use app\admin\logic\StatisticsLogic;
|
use app\admin\logic\StatisticsLogic;
|
||||||
|
@ -51,7 +52,8 @@ class Statistics extends AdminBase
|
||||||
$res = StatisticsLogic::trading($post);
|
$res = StatisticsLogic::trading($post);
|
||||||
return JsonServer::success('',$res);
|
return JsonServer::success('',$res);
|
||||||
}
|
}
|
||||||
return view();
|
|
||||||
|
return view('', ['teamList' => BusinessTeamLogic::getBusinessTeamList()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -157,10 +157,18 @@ class StatisticsLogic extends Logic
|
||||||
$start_time = strtotime($post['start_time']);
|
$start_time = strtotime($post['start_time']);
|
||||||
$end_time = strtotime($post['end_time']);
|
$end_time = strtotime($post['end_time']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$where = [];
|
||||||
|
if (isset($post['team_id']) && $post['team_id'] != '') {
|
||||||
|
$where[] = ['team_id', '=', $post['team_id']];
|
||||||
|
}
|
||||||
|
|
||||||
$order_num = Db::name('order')
|
$order_num = Db::name('order')
|
||||||
|
->where($where)
|
||||||
->where([['create_time', 'between', [$start_time, $end_time]], ['pay_status', '>', PayEnum::UNPAID]])
|
->where([['create_time', 'between', [$start_time, $end_time]], ['pay_status', '>', PayEnum::UNPAID]])
|
||||||
->count('id');
|
->count('id');
|
||||||
$order_amount = Db::name('order')
|
$order_amount = Db::name('order')
|
||||||
|
->where($where)
|
||||||
->where([['create_time', 'between', [$start_time, $end_time]], ['pay_status', '>', PayEnum::UNPAID]])
|
->where([['create_time', 'between', [$start_time, $end_time]], ['pay_status', '>', PayEnum::UNPAID]])
|
||||||
->sum('order_amount');
|
->sum('order_amount');
|
||||||
|
|
||||||
|
@ -177,9 +185,11 @@ class StatisticsLogic extends Logic
|
||||||
$start_now = strtotime(date('Y-m-d', $where_start));
|
$start_now = strtotime(date('Y-m-d', $where_start));
|
||||||
$end_now = strtotime(date('Y-m-d 23:59:59', $where_start));
|
$end_now = strtotime(date('Y-m-d 23:59:59', $where_start));
|
||||||
$order_num_add = Db::name('order')
|
$order_num_add = Db::name('order')
|
||||||
|
->where($where)
|
||||||
->where([['create_time', 'between', [$start_now, $end_now]], ['pay_status', '>', PayEnum::UNPAID]])
|
->where([['create_time', 'between', [$start_now, $end_now]], ['pay_status', '>', PayEnum::UNPAID]])
|
||||||
->count('id');
|
->count('id');
|
||||||
$order_amount_add = Db::name('order')
|
$order_amount_add = Db::name('order')
|
||||||
|
->where($where)
|
||||||
->where([['create_time', 'between', [$start_now, $end_now]], ['pay_status', '>', PayEnum::UNPAID]])
|
->where([['create_time', 'between', [$start_now, $end_now]], ['pay_status', '>', PayEnum::UNPAID]])
|
||||||
->sum('order_amount');
|
->sum('order_amount');
|
||||||
|
|
||||||
|
|
|
@ -70,17 +70,12 @@ class BusinessTeamLogic extends Logic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getBusinessTeamList($selected = [])
|
public static function getBusinessTeamList()
|
||||||
{
|
{
|
||||||
$levelArr = BusinessTeam::field('id,name,phone')
|
$levelArr = BusinessTeam::field('id,name,phone')
|
||||||
->order('id desc')
|
->order('id desc')
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
foreach ($levelArr as &$item) {
|
|
||||||
if (in_array($item['id'], $selected)) {
|
|
||||||
$item['selected'] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $levelArr;
|
return $levelArr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,17 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-inline">
|
||||||
|
<label class="layui-form-label">业务团队:</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<select name="team_id" id="team_id">
|
||||||
|
<option value="">全部</option>
|
||||||
|
{foreach $teamList as $team}
|
||||||
|
<option value="{$team.id}">{$team.name}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="layui-inline">
|
<div class="layui-inline">
|
||||||
<button class="layui-btn layui-btn-sm layuiadmin-btn-ad {$view_theme_color}" lay-submit
|
<button class="layui-btn layui-btn-sm layuiadmin-btn-ad {$view_theme_color}" lay-submit
|
||||||
lay-filter="menber-search">查询
|
lay-filter="menber-search">查询
|
||||||
|
@ -138,9 +149,10 @@
|
||||||
function graphData(){
|
function graphData(){
|
||||||
var start_time = $('#start_time').val();
|
var start_time = $('#start_time').val();
|
||||||
var end_time = $('#end_time').val();
|
var end_time = $('#end_time').val();
|
||||||
|
var team_id = $('#team_id').val();
|
||||||
like.ajax({
|
like.ajax({
|
||||||
url:'{:url("statistics/trading")}',
|
url:'{:url("statistics/trading")}',
|
||||||
data: {'start_time':start_time,'end_time':end_time},
|
data: {'start_time':start_time,'end_time':end_time, 'team_id': team_id},
|
||||||
type: "post",
|
type: "post",
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
$('#order_num').text(res.data.order_num);
|
$('#order_num').text(res.data.order_num);
|
||||||
|
|
Loading…
Reference in New Issue