添加搜索以及退款信息
This commit is contained in:
parent
91f3266094
commit
7fa8e964c9
|
|
@ -157,6 +157,7 @@ class Order extends Backend
|
||||||
$filter = (array)json_decode(input()['filter'] ?? '', true);
|
$filter = (array)json_decode(input()['filter'] ?? '', true);
|
||||||
$admin_filter = $filter['user.nickname'] ?? false;
|
$admin_filter = $filter['user.nickname'] ?? false;
|
||||||
$area_id = $filter['area_id'] ?? false;
|
$area_id = $filter['area_id'] ?? false;
|
||||||
|
$item_id = $filter['item_id'] ?? false;
|
||||||
$is_timeout = $filter['is_timeout'] ?? null;
|
$is_timeout = $filter['is_timeout'] ?? null;
|
||||||
// dd($create_time,$filter);
|
// dd($create_time,$filter);
|
||||||
if ($admin_filter) {
|
if ($admin_filter) {
|
||||||
|
|
@ -166,6 +167,11 @@ class Order extends Backend
|
||||||
if ($area_id) {
|
if ($area_id) {
|
||||||
$build->where('area_id', 'like', $this->getSelectAreaCode($area_id) . '%');
|
$build->where('area_id', 'like', $this->getSelectAreaCode($area_id) . '%');
|
||||||
}
|
}
|
||||||
|
if ($item_id) {
|
||||||
|
$item_ids = $this->getItemsById($item_id);
|
||||||
|
$item_ids [] = $item_id;
|
||||||
|
$build->whereIn('item_id', $item_ids);
|
||||||
|
}
|
||||||
if (!is_null($is_timeout)) {
|
if (!is_null($is_timeout)) {
|
||||||
if ($is_timeout == 1){
|
if ($is_timeout == 1){
|
||||||
$build->where('status', '>=', \app\admin\model\Order::STATUS_DISPATCHING)
|
$build->where('status', '>=', \app\admin\model\Order::STATUS_DISPATCHING)
|
||||||
|
|
@ -817,29 +823,11 @@ class Order extends Backend
|
||||||
$this->request->get([config('paginate.var_page') => $page]);
|
$this->request->get([config('paginate.var_page') => $page]);
|
||||||
$filter = (array)json_decode($filter, true);
|
$filter = (array)json_decode($filter, true);
|
||||||
|
|
||||||
|
unset($filter['item_id']);
|
||||||
|
|
||||||
|
|
||||||
$province_id = $filter['province_id']??null;
|
|
||||||
$city_id = $filter['city_id']??null;
|
|
||||||
$area_id = $filter['city_id']??null;
|
|
||||||
unset($filter['city_id']);
|
|
||||||
unset($filter['province_id']);
|
|
||||||
unset($filter['area_id']);
|
unset($filter['area_id']);
|
||||||
|
|
||||||
if(!empty($area_id)){
|
|
||||||
$filter['area_id'] = $area_id;
|
|
||||||
}else{
|
|
||||||
if(!empty($city_id)){
|
|
||||||
$filter['area_id'] = $city_id;
|
|
||||||
}else{
|
|
||||||
if(!empty($province_id)){
|
|
||||||
$filter['area_id'] = $province_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$op = (array)json_decode($op, true);
|
|
||||||
$op['area_id'] = 'LIKE%';
|
|
||||||
$filter = $filter ? $filter : [];
|
$filter = $filter ? $filter : [];
|
||||||
$where = [];
|
$where = [];
|
||||||
$alias = [];
|
$alias = [];
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ use think\Db;
|
||||||
use think\exception\DbException;
|
use think\exception\DbException;
|
||||||
use think\exception\PDOException;
|
use think\exception\PDOException;
|
||||||
use think\exception\ValidateException;
|
use think\exception\ValidateException;
|
||||||
|
use think\Loader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 待退款列表
|
* 待退款列表
|
||||||
|
|
@ -69,11 +70,29 @@ class Aftersale2 extends Backend
|
||||||
}
|
}
|
||||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||||
|
|
||||||
|
|
||||||
|
$filter = (array)json_decode(input()['filter'] ?? '', true);
|
||||||
|
|
||||||
|
$area_id = $filter['area_id'] ?? request()->get('area_id') ?? false;
|
||||||
|
$item_id = $filter['item_id'] ?? request()->get('item_id') ?? false;
|
||||||
|
|
||||||
$builder = $this->model
|
$builder = $this->model
|
||||||
->whereIn('fa_aftersale.status',[3,4])
|
->whereIn('fa_aftersale.status',[3,4])
|
||||||
->with(['order'])
|
->with(['order'])
|
||||||
->where($where);
|
->where($where);
|
||||||
|
|
||||||
|
|
||||||
|
if ($area_id) {
|
||||||
|
$builder->where('area_id', 'like', $this->getSelectAreaCode($area_id) . '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($item_id) {
|
||||||
|
$item_ids = $this->getItemsById($item_id);
|
||||||
|
$item_ids [] = $item_id;
|
||||||
|
$builder->whereIn('item_id', $item_ids);
|
||||||
|
}
|
||||||
|
|
||||||
if($from == 2){
|
if($from == 2){
|
||||||
//$builder->where('refund_amount','>',0);
|
//$builder->where('refund_amount','>',0);
|
||||||
//$builder->where('status','<>',-1);
|
//$builder->where('status','<>',-1);
|
||||||
|
|
@ -102,6 +121,200 @@ class Aftersale2 extends Backend
|
||||||
return $this->view->fetch();
|
return $this->view->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function buildparams($searchfields = null, $relationSearch = null)
|
||||||
|
{
|
||||||
|
$searchfields = is_null($searchfields) ? $this->searchFields : $searchfields;
|
||||||
|
$relationSearch = is_null($relationSearch) ? $this->relationSearch : $relationSearch;
|
||||||
|
$search = $this->request->get("search", '');
|
||||||
|
$filter = $this->request->get("filter", '');
|
||||||
|
$op = $this->request->get("op", '', 'trim');
|
||||||
|
$sort = $this->request->get("sort", !empty($this->model) && $this->model->getPk() ? $this->model->getPk() : 'id');
|
||||||
|
$order = $this->request->get("order", "DESC");
|
||||||
|
$offset = max(0, $this->request->get("offset/d", 0));
|
||||||
|
$limit = max(0, $this->request->get("limit/d", 0));
|
||||||
|
$limit = $limit ?: 999999;
|
||||||
|
//新增自动计算页码
|
||||||
|
$page = $limit ? intval($offset / $limit) + 1 : 1;
|
||||||
|
if ($this->request->has("page")) {
|
||||||
|
$page = max(0, $this->request->get("page/d", 1));
|
||||||
|
}
|
||||||
|
$this->request->get([config('paginate.var_page') => $page]);
|
||||||
|
$filter = (array)json_decode($filter, true);
|
||||||
|
|
||||||
|
|
||||||
|
unset($filter['area_id']);
|
||||||
|
unset($filter['item_id']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$op = (array)json_decode($op, true);
|
||||||
|
$filter = $filter ? $filter : [];
|
||||||
|
$where = [];
|
||||||
|
$alias = [];
|
||||||
|
$bind = [];
|
||||||
|
$name = '';
|
||||||
|
$aliasName = '';
|
||||||
|
if (!empty($this->model) && $relationSearch) {
|
||||||
|
$name = $this->model->getTable();
|
||||||
|
$alias[$name] = Loader::parseName(basename(str_replace('\\', '/', get_class($this->model))));
|
||||||
|
$aliasName = $alias[$name] . '.';
|
||||||
|
}
|
||||||
|
$sortArr = explode(',', $sort);
|
||||||
|
foreach ($sortArr as $index => & $item) {
|
||||||
|
$item = stripos($item, ".") === false ? $aliasName . trim($item) : $item;
|
||||||
|
}
|
||||||
|
unset($item);
|
||||||
|
$sort = implode(',', $sortArr);
|
||||||
|
$adminIds = $this->getDataLimitAdminIds();
|
||||||
|
if (is_array($adminIds)) {
|
||||||
|
$where[] = [$aliasName . $this->dataLimitField, 'in', $adminIds];
|
||||||
|
}
|
||||||
|
if ($search) {
|
||||||
|
$searcharr = is_array($searchfields) ? $searchfields : explode(',', $searchfields);
|
||||||
|
foreach ($searcharr as $k => &$v) {
|
||||||
|
$v = stripos($v, ".") === false ? $aliasName . $v : $v;
|
||||||
|
}
|
||||||
|
unset($v);
|
||||||
|
$where[] = [implode("|", $searcharr), "LIKE", "%{$search}%"];
|
||||||
|
}
|
||||||
|
$index = 0;
|
||||||
|
foreach ($filter as $k => $v) {
|
||||||
|
if (!preg_match('/^[a-zA-Z0-9_\-\.]+$/', $k)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$sym = $op[$k] ?? '=';
|
||||||
|
if (stripos($k, ".") === false) {
|
||||||
|
$k = $aliasName . $k;
|
||||||
|
}
|
||||||
|
$v = !is_array($v) ? trim($v) : $v;
|
||||||
|
$sym = strtoupper($op[$k] ?? $sym);
|
||||||
|
//null和空字符串特殊处理
|
||||||
|
if (!is_array($v)) {
|
||||||
|
if (in_array(strtoupper($v), ['NULL', 'NOT NULL'])) {
|
||||||
|
$sym = strtoupper($v);
|
||||||
|
}
|
||||||
|
if (in_array($v, ['""', "''"])) {
|
||||||
|
$v = '';
|
||||||
|
$sym = '=';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($sym) {
|
||||||
|
case '=':
|
||||||
|
case '<>':
|
||||||
|
$where[] = [$k, $sym, (string)$v];
|
||||||
|
break;
|
||||||
|
case 'LIKE':
|
||||||
|
case 'NOT LIKE':
|
||||||
|
case 'LIKE %...%':
|
||||||
|
case 'NOT LIKE %...%':
|
||||||
|
$where[] = [$k, trim(str_replace('%...%', '', $sym)), "%{$v}%"];
|
||||||
|
break;
|
||||||
|
// ✅ 新增:右匹配(like%)
|
||||||
|
case 'LIKE%':
|
||||||
|
$where[] = [$k, 'LIKE', "{$v}%"];
|
||||||
|
break;
|
||||||
|
|
||||||
|
// ✅ 新增:左匹配(%like)
|
||||||
|
case '%LIKE':
|
||||||
|
$where[] = [$k, 'LIKE', "%{$v}"];
|
||||||
|
break;
|
||||||
|
case '>':
|
||||||
|
case '>=':
|
||||||
|
case '<':
|
||||||
|
case '<=':
|
||||||
|
$where[] = [$k, $sym, intval($v)];
|
||||||
|
break;
|
||||||
|
case 'FINDIN':
|
||||||
|
case 'FINDINSET':
|
||||||
|
case 'FIND_IN_SET':
|
||||||
|
$v = is_array($v) ? $v : explode(',', str_replace(' ', ',', $v));
|
||||||
|
$findArr = array_values($v);
|
||||||
|
foreach ($findArr as $idx => $item) {
|
||||||
|
$bindName = "item_" . $index . "_" . $idx;
|
||||||
|
$bind[$bindName] = $item;
|
||||||
|
$where[] = "FIND_IN_SET(:{$bindName}, `" . str_replace('.', '`.`', $k) . "`)";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'IN':
|
||||||
|
case 'IN(...)':
|
||||||
|
case 'NOT IN':
|
||||||
|
case 'NOT IN(...)':
|
||||||
|
$where[] = [$k, str_replace('(...)', '', $sym), is_array($v) ? $v : explode(',', $v)];
|
||||||
|
break;
|
||||||
|
case 'BETWEEN':
|
||||||
|
case 'NOT BETWEEN':
|
||||||
|
$arr = array_slice(explode(',', $v), 0, 2);
|
||||||
|
if (stripos($v, ',') === false || !array_filter($arr, function ($v) {
|
||||||
|
return $v != '' && $v !== false && $v !== null;
|
||||||
|
})) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
//当出现一边为空时改变操作符
|
||||||
|
if ($arr[0] === '') {
|
||||||
|
$sym = $sym == 'BETWEEN' ? '<=' : '>';
|
||||||
|
$arr = $arr[1];
|
||||||
|
} elseif ($arr[1] === '') {
|
||||||
|
$sym = $sym == 'BETWEEN' ? '>=' : '<';
|
||||||
|
$arr = $arr[0];
|
||||||
|
}
|
||||||
|
$where[] = [$k, $sym, $arr];
|
||||||
|
break;
|
||||||
|
case 'RANGE':
|
||||||
|
case 'NOT RANGE':
|
||||||
|
$v = str_replace(' - ', ',', $v);
|
||||||
|
$arr = array_slice(explode(',', $v), 0, 2);
|
||||||
|
if (stripos($v, ',') === false || !array_filter($arr)) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
|
//当出现一边为空时改变操作符
|
||||||
|
if ($arr[0] === '') {
|
||||||
|
$sym = $sym == 'RANGE' ? '<=' : '>';
|
||||||
|
$arr = $arr[1];
|
||||||
|
} elseif ($arr[1] === '') {
|
||||||
|
$sym = $sym == 'RANGE' ? '>=' : '<';
|
||||||
|
$arr = $arr[0];
|
||||||
|
}
|
||||||
|
$tableArr = explode('.', $k);
|
||||||
|
if (count($tableArr) > 1 && $tableArr[0] != $name && !in_array($tableArr[0], $alias)
|
||||||
|
&& !empty($this->model) && $this->relationSearch) {
|
||||||
|
//修复关联模型下时间无法搜索的BUG
|
||||||
|
$relation = Loader::parseName($tableArr[0], 1, false);
|
||||||
|
$alias[$this->model->$relation()->getTable()] = $tableArr[0];
|
||||||
|
}
|
||||||
|
$where[] = [$k, str_replace('RANGE', 'BETWEEN', $sym) . ' TIME', $arr];
|
||||||
|
break;
|
||||||
|
case 'NULL':
|
||||||
|
case 'IS NULL':
|
||||||
|
case 'NOT NULL':
|
||||||
|
case 'IS NOT NULL':
|
||||||
|
$where[] = [$k, strtolower(str_replace('IS ', '', $sym))];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$index++;
|
||||||
|
}
|
||||||
|
if (!empty($this->model)) {
|
||||||
|
$this->model->alias($alias);
|
||||||
|
}
|
||||||
|
$model = $this->model;
|
||||||
|
$where = function ($query) use ($where, $alias, $bind, &$model) {
|
||||||
|
if (!empty($model)) {
|
||||||
|
$model->alias($alias);
|
||||||
|
$model->bind($bind);
|
||||||
|
}
|
||||||
|
foreach ($where as $k => $v) {
|
||||||
|
if (is_array($v)) {
|
||||||
|
call_user_func_array([$query, 'where'], $v);
|
||||||
|
} else {
|
||||||
|
$query->where($v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return [$where, $sort, $order, $offset, $limit, $page, $alias, $bind];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加
|
* 添加
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -50,18 +50,12 @@ class Aftersale extends Backend
|
||||||
return $this->fetch('index');
|
return $this->fetch('index');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function list()
|
|
||||||
{
|
|
||||||
$build = new Order();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function dispatch()
|
public function dispatch()
|
||||||
{
|
{
|
||||||
$build = new Admin();
|
$build = new Admin();
|
||||||
$build->alias('a')
|
$build->alias('a')
|
||||||
->join('order b', 'a.id = b.admin_id', 'right')
|
->join('order b', 'a.id = b.admin_id', 'right')
|
||||||
->join('aftersale c', 'b.id = c.admin_id', 'left')
|
->join('aftersale c', 'a.id = c.refund_admin_id', 'left')
|
||||||
->where('b.status', Order::STATUS_FINISHED);
|
->where('b.status', Order::STATUS_FINISHED);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -101,6 +95,7 @@ class Aftersale extends Backend
|
||||||
'a.mobile',
|
'a.mobile',
|
||||||
'count(b.id) order_total',
|
'count(b.id) order_total',
|
||||||
'count(c.id) after_total',
|
'count(c.id) after_total',
|
||||||
|
'sum(c.refund_amount) refund_amount',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -157,6 +152,7 @@ class Aftersale extends Backend
|
||||||
'a.area_id',
|
'a.area_id',
|
||||||
'count(a.id) order_total',
|
'count(a.id) order_total',
|
||||||
'count(c.id) after_total',
|
'count(c.id) after_total',
|
||||||
|
'sum(c.refund_amount) refund_amount',
|
||||||
]
|
]
|
||||||
)->with([
|
)->with([
|
||||||
'area' => function ($q) {
|
'area' => function ($q) {
|
||||||
|
|
@ -205,7 +201,7 @@ class Aftersale extends Backend
|
||||||
}
|
}
|
||||||
$build->where('audit_time', '>=', $start);
|
$build->where('audit_time', '>=', $start);
|
||||||
$build->where('audit_time', '<=', $end_at);
|
$build->where('audit_time', '<=', $end_at);
|
||||||
$build->group('a.item_title');
|
$build->group('a.item_id,a.item_title');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -217,9 +213,11 @@ class Aftersale extends Backend
|
||||||
|
|
||||||
$build->field(
|
$build->field(
|
||||||
[
|
[
|
||||||
|
'a.item_id',
|
||||||
'a.item_title',
|
'a.item_title',
|
||||||
'count(a.id) order_total',
|
'count(a.id) order_total',
|
||||||
'count(c.id) after_total',
|
'count(c.id) after_total',
|
||||||
|
'sum(c.refund_amount) refund_amount',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -253,20 +251,13 @@ class Aftersale extends Backend
|
||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getItemsById(mixed $item_id)
|
|
||||||
{
|
|
||||||
$build = new \app\admin\model\Item();
|
|
||||||
$data = $build->getAllData();
|
|
||||||
return \app\admin\model\Item::getAllChildIds($data,$item_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function worker()
|
public function worker()
|
||||||
{
|
{
|
||||||
$build = new \app\admin\model\Worker();
|
$build = new \app\admin\model\Worker();
|
||||||
$build->alias('a')
|
$build->alias('a')
|
||||||
->join('order b', 'a.id = b.worker_id', 'right')
|
->join('order b', 'a.id = b.worker_id', 'right')
|
||||||
->join('aftersale c', 'b.id = c.admin_id', 'left')
|
->join('aftersale c', 'a.id = c.worker_id', 'left')
|
||||||
->where('b.status', Order::STATUS_FINISHED);
|
->where('b.status', Order::STATUS_FINISHED);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -306,6 +297,7 @@ class Aftersale extends Backend
|
||||||
'a.tel',
|
'a.tel',
|
||||||
'count(b.id) order_total',
|
'count(b.id) order_total',
|
||||||
'count(c.id) after_total',
|
'count(c.id) after_total',
|
||||||
|
'sum(c.refund_amount) refund_amount',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,3 +34,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script id="categorytpl" type="text/html">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<input id="select_city" class="form-control" data-toggle="city-picker" type="text" />
|
||||||
|
<input id="select_area_id" type="hidden" class="operate" name="area_id" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<link rel="stylesheet" href="/assets/css/select.css">
|
||||||
<style>
|
<style>
|
||||||
/* 派单按钮 */
|
/* 派单按钮 */
|
||||||
.button-dispatch {
|
.button-dispatch {
|
||||||
|
|
@ -123,15 +123,25 @@
|
||||||
.text-my_dispatch{
|
.text-my_dispatch{
|
||||||
color: #0011ff;
|
color: #0011ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
<script>
|
||||||
|
var items = {:json_encode($items); };
|
||||||
|
</script>
|
||||||
|
|
||||||
<script id="categorytpl" type="text/html">
|
<script id="categorytpl" type="text/html">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<input id="select_city" class="form-control" data-toggle="city-picker" type="text" />
|
<input id="select_city" class="form-control" data-toggle="city-picker" type="text" />
|
||||||
<input id="select_area_id" type="hidden" class="operate" name="area_id" />
|
<input id="select_area_id" type="hidden" name="area_id" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script id="items_picker" type="text/html">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<input id="select_item" class="form-control" type="text" />
|
||||||
|
<input id="select_item_id" type="hidden" name="item_id" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -723,4 +723,11 @@ class Backend extends Controller
|
||||||
// 重新索引数组
|
// 重新索引数组
|
||||||
return array_values($filtered_codes);
|
return array_values($filtered_codes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getItemsById(mixed $item_id)
|
||||||
|
{
|
||||||
|
$build = new \app\admin\model\Item();
|
||||||
|
$data = $build->getAllData();
|
||||||
|
return \app\admin\model\Item::getAllChildIds($data,$item_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
{field: 'admin_user', title: __('Admin_user'), operate: '='},
|
{field: 'admin_user', title: __('Admin_user'), operate: '='},
|
||||||
//{field: 'handle_admin_id', title: __('Handle_admin_id')},
|
//{field: 'handle_admin_id', title: __('Handle_admin_id')},
|
||||||
{field: 'handle_admin_user', title: __('Handle_admin_user'), operate: '='},
|
{field: 'handle_admin_user', title: __('Handle_admin_user'), operate: '='},
|
||||||
|
{field: 'worker_name', title: '师傅', operate: 'like'},
|
||||||
{field: 'star', title: __('Star'),operate:false},
|
{field: 'star', title: __('Star'),operate:false},
|
||||||
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||||
{field: 'update_time', title: __('Update_time'), operate:false, addclass:'datetimerange', autocomplete:false},
|
{field: 'update_time', title: __('Update_time'), operate:false, addclass:'datetimerange', autocomplete:false},
|
||||||
|
{field: 'area_id', title: __('地区'), searchList: function (column) {
|
||||||
|
return Template('categorytpl', {});
|
||||||
|
}, formatter: function (value, row, index) {
|
||||||
|
return '无';
|
||||||
|
}, visible: false
|
||||||
|
},
|
||||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
|
|
@ -82,7 +89,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
$("#select_city").on("cp:updated", function () {
|
||||||
|
var citypicker = $(this).data("citypicker");
|
||||||
|
var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
|
||||||
|
$("#select_area_id").val(code);
|
||||||
|
});
|
||||||
// 为表格绑定事件
|
// 为表格绑定事件
|
||||||
Table.api.bindevent(table);
|
Table.api.bindevent(table);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
return '无';
|
return '无';
|
||||||
}, visible: false
|
}, visible: false
|
||||||
},
|
},
|
||||||
|
{field: 'item_id', title: '服务项目', searchList: function (column) {
|
||||||
|
return Template('items_picker', {});
|
||||||
|
}, formatter: function (value, row, index) {
|
||||||
|
return '无';
|
||||||
|
}, visible: false
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'operate',
|
field: 'operate',
|
||||||
|
|
@ -463,6 +469,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
|
||||||
});
|
});
|
||||||
resetIdleTimer();
|
resetIdleTimer();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var _data = items;
|
||||||
|
$('#select_item').zdCascader({
|
||||||
|
data: _data,
|
||||||
|
onChange: function ($this, data, allPathData) {
|
||||||
|
// console.log(data,allPathData);
|
||||||
|
$('#select_item_id').val(data.value);
|
||||||
|
},
|
||||||
|
clear:true,
|
||||||
|
clickParent: true
|
||||||
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
add: function () {
|
add: function () {
|
||||||
$("#mybuttom").on("click", function () {
|
$("#mybuttom").on("click", function () {
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs'
|
||||||
var Controller = {
|
var Controller = {
|
||||||
|
|
||||||
index: function () {
|
index: function () {
|
||||||
|
|
||||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||||
var $targetPanel = $($(this).attr("href"));
|
var $targetPanel = $($(this).attr("href"));
|
||||||
var tabVal = $(this).data('val');
|
var tabVal = $(this).data('val');
|
||||||
if (tabVal === 'first') {
|
if (tabVal === 'first') {
|
||||||
Controller.api.first();
|
Controller.api.first();
|
||||||
}else if (tabVal === 'second') {
|
}else if (tabVal === 'second') {
|
||||||
console.log(3333);
|
|
||||||
Controller.api.second();
|
Controller.api.second();
|
||||||
}else if (tabVal === 'third'){
|
}else if (tabVal === 'third'){
|
||||||
Controller.api.third();
|
Controller.api.third();
|
||||||
|
|
@ -19,16 +17,84 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs'
|
||||||
Controller.api.fourth();
|
Controller.api.fourth();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Table.api.init();
|
||||||
Controller.api.first();
|
Controller.api.first();
|
||||||
Controller.api.datepicker();
|
Controller.api.datepicker();
|
||||||
|
Controller.api.enevt();
|
||||||
},
|
},
|
||||||
|
|
||||||
api: {
|
api: {
|
||||||
bindevent: function () {
|
bindevent: function () {
|
||||||
Form.api.bindevent($("form[role=form]"));
|
Form.api.bindevent($("form[role=form]"));
|
||||||
},
|
},
|
||||||
|
enevt:function (){
|
||||||
|
$('#first-search').on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const range = $('#daterange-table').val();
|
||||||
|
const keyword = $('#keyword').val();
|
||||||
|
let data = '';
|
||||||
|
if (range !== ''){
|
||||||
|
data += 'range=' + range;
|
||||||
|
}
|
||||||
|
if (keyword !== ''){
|
||||||
|
data += '&keyword=' + keyword;
|
||||||
|
}
|
||||||
|
// data = encodeURIComponent(data);
|
||||||
|
$("#table1").bootstrapTable('refresh',{
|
||||||
|
url:'statistics/aftersale/dispatch?' + data,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$('#first-search2').on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const range = $('#daterange-table2').val();
|
||||||
|
const area_id = $('#area_id').val();
|
||||||
|
let data = '';
|
||||||
|
if (range !== ''){
|
||||||
|
data += 'range=' + range;
|
||||||
|
}
|
||||||
|
if (area_id !== ''){
|
||||||
|
data += 'area_id=' + area_id;
|
||||||
|
}
|
||||||
|
// data = encodeURIComponent(data);
|
||||||
|
$("#table2").bootstrapTable('refresh',{
|
||||||
|
url:'statistics/aftersale/city?' + data,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#first-search3').on('click', function () {
|
||||||
|
|
||||||
|
const range = $('#daterange-table3').val();
|
||||||
|
const item_id = $('#item_id_value').val();
|
||||||
|
let data = '';
|
||||||
|
if (range !== ''){
|
||||||
|
data += 'range=' + range;
|
||||||
|
}
|
||||||
|
if (item_id !== ''){
|
||||||
|
data += '&item_id=' + item_id;
|
||||||
|
}
|
||||||
|
// data = encodeURIComponent(data);
|
||||||
|
$("#table3").bootstrapTable('refresh',{
|
||||||
|
url:'statistics/aftersale/item?' + data,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$('#first-search4').on('click', function () {
|
||||||
|
|
||||||
|
const range = $('#daterange-table4').val();
|
||||||
|
const keyword = $('#keyword4').val();
|
||||||
|
let data = '';
|
||||||
|
if (range !== ''){
|
||||||
|
data += 'range=' + range;
|
||||||
|
}
|
||||||
|
if (keyword !== ''){
|
||||||
|
data += '&keyword=' + keyword;
|
||||||
|
}
|
||||||
|
// data = encodeURIComponent(data);
|
||||||
|
$("#table4").bootstrapTable('refresh',{
|
||||||
|
url:'statistics/aftersale/worker?' + data,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
first: function (){
|
first: function (){
|
||||||
Table.api.init();
|
|
||||||
// 表格2
|
// 表格2
|
||||||
var table = $("#table1");
|
var table = $("#table1");
|
||||||
table.bootstrapTable({
|
table.bootstrapTable({
|
||||||
|
|
@ -46,35 +112,36 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs'
|
||||||
{field: 'nickname', title: '名称', operate: false},
|
{field: 'nickname', title: '名称', operate: false},
|
||||||
{field: 'mobile', title: '电话', operate: false},
|
{field: 'mobile', title: '电话', operate: false},
|
||||||
{field: 'order_total', title: '订单总数', operate: false},
|
{field: 'order_total', title: '订单总数', operate: false},
|
||||||
|
{field: 'refund_amount', title: '退款金额', operate: false},
|
||||||
{field: 'after_total', title: '退款订单数', operate: false},
|
{field: 'after_total', title: '退款订单数', operate: false},
|
||||||
{field: 'rate', title: '退款率', operate: false},
|
{field: 'rate', title: '退款率', operate: false},
|
||||||
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
name: 'aftersales',
|
||||||
|
text:"退款订单",
|
||||||
|
title:"退款订单",
|
||||||
|
icon: 'fa fa-list',
|
||||||
|
url: function(row){
|
||||||
|
return 'aftersales/aftersale2/?dispatch_admin_user='+row.nickname;
|
||||||
|
},
|
||||||
|
extend: 'data-toggle="tooltip" data-container="body"',
|
||||||
|
classname: 'btn btn-xs btn-default btn-dialog',
|
||||||
|
visible:function(row){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
// 为表格2绑定事件
|
// 为表格2绑定事件
|
||||||
Table.api.bindevent(table);
|
Table.api.bindevent(table);
|
||||||
|
|
||||||
$('#first-search').on('click', function () {
|
|
||||||
|
|
||||||
const range = $('#daterange-table').val();
|
|
||||||
const keyword = $('#keyword').val();
|
|
||||||
let data = '';
|
|
||||||
if (range !== ''){
|
|
||||||
data += 'range=' + range;
|
|
||||||
}
|
|
||||||
if (keyword !== ''){
|
|
||||||
data += '&keyword=' + keyword;
|
|
||||||
}
|
|
||||||
// data = encodeURIComponent(data);
|
|
||||||
$("#table1").bootstrapTable('refresh',{
|
|
||||||
url:'statistics/aftersale/dispatch?' + data,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
second: function (){
|
second: function (){
|
||||||
Table.api.init();
|
|
||||||
// 表格2
|
// 表格2
|
||||||
var table = $("#table2");
|
var table = $("#table2");
|
||||||
table.bootstrapTable({
|
table.bootstrapTable({
|
||||||
|
|
@ -92,7 +159,26 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs'
|
||||||
{field: 'area.merge_name', title: '城市', operate: false},
|
{field: 'area.merge_name', title: '城市', operate: false},
|
||||||
{field: 'order_total', title: '订单总数', operate: false},
|
{field: 'order_total', title: '订单总数', operate: false},
|
||||||
{field: 'after_total', title: '退款订单数', operate: false},
|
{field: 'after_total', title: '退款订单数', operate: false},
|
||||||
|
{field: 'refund_amount', title: '退款金额', operate: false},
|
||||||
{field: 'rate', title: '退款率', operate: false},
|
{field: 'rate', title: '退款率', operate: false},
|
||||||
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
name: 'aftersales',
|
||||||
|
text:"退款订单",
|
||||||
|
title:"退款订单",
|
||||||
|
icon: 'fa fa-list',
|
||||||
|
url: function(row){
|
||||||
|
return 'aftersales/aftersale2/?area_id='+row.area.area_code;
|
||||||
|
},
|
||||||
|
extend: 'data-toggle="tooltip" data-container="body"',
|
||||||
|
classname: 'btn btn-xs btn-default btn-dialog',
|
||||||
|
visible:function(row){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
@ -100,29 +186,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs'
|
||||||
// 为表格2绑定事件
|
// 为表格2绑定事件
|
||||||
Table.api.bindevent(table);
|
Table.api.bindevent(table);
|
||||||
|
|
||||||
$('#first-search2').on('click', function () {
|
|
||||||
|
|
||||||
const range = $('#daterange-table2').val();
|
|
||||||
const area_id = $('#area_id').val();
|
|
||||||
let data = '';
|
|
||||||
if (range !== ''){
|
|
||||||
data += 'range=' + range;
|
|
||||||
}
|
|
||||||
if (area_id !== ''){
|
|
||||||
data += 'area_id=' + area_id;
|
|
||||||
}
|
|
||||||
// data = encodeURIComponent(data);
|
|
||||||
$("#table2").bootstrapTable('refresh',{
|
|
||||||
url:'statistics/aftersale/city?' + data,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Controller.api.areapicker();
|
Controller.api.areapicker();
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
third: function (){
|
third: function (){
|
||||||
Table.api.init();
|
|
||||||
// 表格2
|
// 表格2
|
||||||
var table = $("#table3");
|
var table = $("#table3");
|
||||||
table.bootstrapTable({
|
table.bootstrapTable({
|
||||||
|
|
@ -139,35 +207,37 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs'
|
||||||
[
|
[
|
||||||
{field: 'item_title', title: '服务项目', operate: false},
|
{field: 'item_title', title: '服务项目', operate: false},
|
||||||
{field: 'order_total', title: '订单总数', operate: false},
|
{field: 'order_total', title: '订单总数', operate: false},
|
||||||
|
{field: 'refund_amount', title: '退款金额', operate: false},
|
||||||
{field: 'after_total', title: '退款订单数', operate: false},
|
{field: 'after_total', title: '退款订单数', operate: false},
|
||||||
{field: 'rate', title: '退款率', operate: false},
|
{field: 'rate', title: '退款率', operate: false},
|
||||||
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
name: 'aftersales',
|
||||||
|
text:"退款订单",
|
||||||
|
title:"退款订单",
|
||||||
|
icon: 'fa fa-list',
|
||||||
|
url: function(row){
|
||||||
|
return 'aftersales/aftersale2/?item_id='+row.item_id;
|
||||||
|
},
|
||||||
|
extend: 'data-toggle="tooltip" data-container="body"',
|
||||||
|
classname: 'btn btn-xs btn-default btn-dialog',
|
||||||
|
visible:function(row){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
// 为表格2绑定事件
|
// 为表格2绑定事件
|
||||||
Table.api.bindevent(table);
|
Table.api.bindevent(table);
|
||||||
|
|
||||||
$('#first-search3').on('click', function () {
|
|
||||||
|
|
||||||
const range = $('#daterange-table3').val();
|
|
||||||
const item_id = $('#item_id_value').val();
|
|
||||||
let data = '';
|
|
||||||
if (range !== ''){
|
|
||||||
data += 'range=' + range;
|
|
||||||
}
|
|
||||||
if (item_id !== ''){
|
|
||||||
data += 'item_id=' + item_id;
|
|
||||||
}
|
|
||||||
// data = encodeURIComponent(data);
|
|
||||||
$("#table3").bootstrapTable('refresh',{
|
|
||||||
url:'statistics/aftersale/item?' + data,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Controller.api.itemspicker();
|
Controller.api.itemspicker();
|
||||||
},
|
},
|
||||||
|
|
||||||
fourth: function (){
|
fourth: function (){
|
||||||
Table.api.init();
|
|
||||||
// 表格2
|
// 表格2
|
||||||
var table = $("#table4");
|
var table = $("#table4");
|
||||||
table.bootstrapTable({
|
table.bootstrapTable({
|
||||||
|
|
@ -185,31 +255,33 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs'
|
||||||
{field: 'name', title: '名称', operate: false},
|
{field: 'name', title: '名称', operate: false},
|
||||||
{field: 'tel', title: '电话', operate: false},
|
{field: 'tel', title: '电话', operate: false},
|
||||||
{field: 'order_total', title: '订单总数', operate: false},
|
{field: 'order_total', title: '订单总数', operate: false},
|
||||||
|
{field: 'refund_amount', title: '退款金额', operate: false},
|
||||||
{field: 'after_total', title: '退款订单数', operate: false},
|
{field: 'after_total', title: '退款订单数', operate: false},
|
||||||
{field: 'rate', title: '退款率', operate: false},
|
{field: 'rate', title: '退款率', operate: false},
|
||||||
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
name: 'aftersales',
|
||||||
|
text:"退款订单",
|
||||||
|
title:"退款订单",
|
||||||
|
icon: 'fa fa-list',
|
||||||
|
url: function(row){
|
||||||
|
return 'aftersales/aftersale2/?worker_name='+row.name;
|
||||||
|
},
|
||||||
|
extend: 'data-toggle="tooltip" data-container="body"',
|
||||||
|
classname: 'btn btn-xs btn-default btn-dialog',
|
||||||
|
visible:function(row){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
// 为表格2绑定事件
|
// 为表格2绑定事件
|
||||||
Table.api.bindevent(table);
|
Table.api.bindevent(table);
|
||||||
|
|
||||||
$('#first-search4').on('click', function () {
|
|
||||||
|
|
||||||
const range = $('#daterange-table4').val();
|
|
||||||
const keyword = $('#keyword4').val();
|
|
||||||
let data = '';
|
|
||||||
if (range !== ''){
|
|
||||||
data += 'range=' + range;
|
|
||||||
}
|
|
||||||
if (keyword !== ''){
|
|
||||||
data += '&keyword=' + keyword;
|
|
||||||
}
|
|
||||||
// data = encodeURIComponent(data);
|
|
||||||
$("#table4").bootstrapTable('refresh',{
|
|
||||||
url:'statistics/aftersale/worker?' + data,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
datepicker: function () {
|
datepicker: function () {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@
|
||||||
// 重置搜索
|
// 重置搜索
|
||||||
form.on("click", "button[type=reset]", function (event) {
|
form.on("click", "button[type=reset]", function (event) {
|
||||||
form[0].reset();
|
form[0].reset();
|
||||||
|
form.find('#select_area_id').val('');
|
||||||
|
form.find('#select_item_id').val('');
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
that.onCommonSearch();
|
that.onCommonSearch();
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user