tts
This commit is contained in:
parent
b28deda70e
commit
67fa2b7697
|
|
@ -10,6 +10,7 @@ use app\admin\model\OrderReview;
|
||||||
use app\common\controller\Backend;
|
use app\common\controller\Backend;
|
||||||
use PDOStatement;
|
use PDOStatement;
|
||||||
use think\Collection;
|
use think\Collection;
|
||||||
|
use think\Db;
|
||||||
use think\Exception;
|
use think\Exception;
|
||||||
use think\exception\DbException;
|
use think\exception\DbException;
|
||||||
use think\Loader;
|
use think\Loader;
|
||||||
|
|
@ -33,6 +34,29 @@ class Item extends Backend
|
||||||
public function _initialize()
|
public function _initialize()
|
||||||
{
|
{
|
||||||
parent::_initialize();
|
parent::_initialize();
|
||||||
|
|
||||||
|
$sources = Db::name('source')
|
||||||
|
->where('status', 1)
|
||||||
|
->field(['id', 'title', 'key_word', 'pid'])
|
||||||
|
->order('pid', 'asc')
|
||||||
|
->order('sort', 'desc')
|
||||||
|
->select();
|
||||||
|
$filtered = array_filter($sources, function ($item) {
|
||||||
|
return $item['pid'] == 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
$pid_map = array_column($filtered, null, 'id');
|
||||||
|
$res = [];
|
||||||
|
foreach ($sources as $item) {
|
||||||
|
if ($item['pid'] != 0 && isset($pid_map[$item['pid']])) {
|
||||||
|
$res [] = [
|
||||||
|
...$item, 'ptitle' => $pid_map[$item['pid']]['title']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->view->assign("sources", $res);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
|
|
@ -139,6 +163,8 @@ class Item extends Backend
|
||||||
|
|
||||||
$filter ['daterange'] = request()->post('daterange');
|
$filter ['daterange'] = request()->post('daterange');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!empty($filter['daterange'])) {
|
if (!empty($filter['daterange'])) {
|
||||||
$arr = explode(' - ', $filter['daterange']);
|
$arr = explode(' - ', $filter['daterange']);
|
||||||
if (trim($arr[0])) {
|
if (trim($arr[0])) {
|
||||||
|
|
@ -149,9 +175,15 @@ class Item extends Backend
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = $build
|
$build = $build
|
||||||
->whereBetween('create_time', [$start, $end_at])
|
->whereBetween('create_time', [$start, $end_at]);
|
||||||
->field([
|
|
||||||
|
if(!empty(request()->post('source',null))){
|
||||||
|
$build->where('source',request()->post('source'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$res = $build->field([
|
||||||
'item_title name', // 类型
|
'item_title name', // 类型
|
||||||
'sum(total) total', // 营业额
|
'sum(total) total', // 营业额
|
||||||
'count(id) count', // 单量
|
'count(id) count', // 单量
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,14 @@
|
||||||
<input type="text" class="form-control datetimerange" value = "{$default_daterange}" data-locale='{"format":"YYYY-MM-DD"}' placeholder="指定日期" name="filter[daterange]" id="daterange" autocomplete="off" style="width: 200px;">
|
<input type="text" class="form-control datetimerange" value = "{$default_daterange}" data-locale='{"format":"YYYY-MM-DD"}' placeholder="指定日期" name="filter[daterange]" id="daterange" autocomplete="off" style="width: 200px;">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group" style="margin-left: 15px;">
|
||||||
|
<select id="source" data-live-search="true" title="选择订单渠道" name="filter[source]" class="form-control selectpicker show-tick">
|
||||||
|
{foreach $sources as $item}
|
||||||
|
<option value="{$item['id']}">【{$item['ptitle']}】{$item['title']}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 查询按钮 -->
|
<!-- 查询按钮 -->
|
||||||
<button class="btn btn-default" id="filter-btn" style="margin-left: 15px;">查询</button>
|
<button class="btn btn-default" id="filter-btn" style="margin-left: 15px;">查询</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -187,10 +187,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'echarts', 'echarts-t
|
||||||
getChartData: function () {
|
getChartData: function () {
|
||||||
// 获取日期范围值
|
// 获取日期范围值
|
||||||
var daterange = $('#daterange').val();
|
var daterange = $('#daterange').val();
|
||||||
|
var source = $('#source').val();
|
||||||
|
|
||||||
// 构建查询参数
|
// 构建查询参数
|
||||||
var params = {
|
var params = {
|
||||||
'daterange': daterange,
|
'daterange': daterange,
|
||||||
|
'source': source
|
||||||
};
|
};
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user