Accept Merge Request #206: (feature/hant -> develop)
Merge Request: Merge remote-tracking branch 'origin/develop' into feature/hant Created By: @todayswind Accepted By: @todayswind URL: https://g-bcrc3009.coding.net/p/allocatr/d/allocatr/git/merge/206?initial=true
This commit is contained in:
commit
31e3de648f
|
|
@ -150,6 +150,7 @@ class Order extends Backend
|
||||||
|
|
||||||
|
|
||||||
if (false === $this->request->isAjax()) {
|
if (false === $this->request->isAjax()) {
|
||||||
|
|
||||||
return $this->view->fetch();
|
return $this->view->fetch();
|
||||||
}
|
}
|
||||||
//如果发送的来源是 Selectpage,则转发到 Selectpage
|
//如果发送的来源是 Selectpage,则转发到 Selectpage
|
||||||
|
|
|
||||||
|
|
@ -65,20 +65,29 @@ class Auditorder extends Backend
|
||||||
$list = $this->model
|
$list = $this->model
|
||||||
->scope('tab',Order::TAB_AUDIT)
|
->scope('tab',Order::TAB_AUDIT)
|
||||||
->alias('order')
|
->alias('order')
|
||||||
->with(['auditadmin','workerman'])
|
->with(['auditadmin','workerman', 'source' => [
|
||||||
|
'parent' => function ($q) {
|
||||||
|
$q->field('id,title');
|
||||||
|
}
|
||||||
|
]])
|
||||||
->where($where)
|
->where($where)
|
||||||
->order($sort, $order)
|
->order($sort, $order)
|
||||||
->paginate($limit);
|
->paginate($limit);
|
||||||
|
|
||||||
foreach ($list as $row) {
|
foreach ($list as $item) {
|
||||||
|
if (isset($item->getRelation('source')->parent->title)){
|
||||||
|
$item->source_total_name = '【' . $item->getRelation('source')->parent->title . '】' . ($item->getRelation('source')->title??'');
|
||||||
|
}else{
|
||||||
|
$item->source_total_name = ($item->getRelation('source')->title??'');
|
||||||
|
}
|
||||||
|
unset($item->source);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||||
|
|
||||||
return json($result);
|
return json($result);
|
||||||
}
|
}
|
||||||
|
$res = $this->getSource();
|
||||||
|
$this->view->assign("sources", $res);
|
||||||
return $this->view->fetch();
|
return $this->view->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ use think\exception\DbException;
|
||||||
use think\exception\PDOException;
|
use think\exception\PDOException;
|
||||||
use think\exception\ValidateException;
|
use think\exception\ValidateException;
|
||||||
use think\Hook;
|
use think\Hook;
|
||||||
|
use think\Loader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单列管理
|
* 订单列管理
|
||||||
|
|
@ -64,22 +65,34 @@ class Configorder extends Backend
|
||||||
->tab(Order::TAB_SETTING)
|
->tab(Order::TAB_SETTING)
|
||||||
->dispatcherauth($this->auth,'dispatch_admin_id')
|
->dispatcherauth($this->auth,'dispatch_admin_id')
|
||||||
//->areaauth($this->auth)
|
//->areaauth($this->auth)
|
||||||
->with(['dispatchadmin'])
|
->with(['dispatchadmin', 'source' => [
|
||||||
|
'parent' => function ($q) {
|
||||||
|
$q->field('id,title');
|
||||||
|
}
|
||||||
|
]])
|
||||||
->where($where);
|
->where($where);
|
||||||
|
|
||||||
|
|
||||||
$list = $list->order($sort, $order)
|
$list = $list->order($sort, $order)
|
||||||
->paginate($limit);
|
->paginate($limit);
|
||||||
|
|
||||||
foreach ($list as $row)
|
foreach ($list as $item) {
|
||||||
{
|
if (isset($item->getRelation('source')->parent->title)){
|
||||||
|
$item->source_total_name = '【' . $item->getRelation('source')->parent->title . '】' . ($item->getRelation('source')->title??'');
|
||||||
|
}else{
|
||||||
|
$item->source_total_name = ($item->getRelation('source')->title??'');
|
||||||
|
}
|
||||||
|
unset($item->source);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||||
|
|
||||||
return json($result);
|
return json($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$res = $this->getSource();
|
||||||
|
$this->view->assign("sources", $res);
|
||||||
|
|
||||||
return $this->view->fetch();
|
return $this->view->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,4 +196,216 @@ class Configorder extends Backend
|
||||||
return json($adminUsers);
|
return json($adminUsers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成查询所需要的条件,排序方式
|
||||||
|
* @param mixed $searchfields 快速查询的字段
|
||||||
|
* @param boolean $relationSearch 是否关联查询
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
|
||||||
|
$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']);
|
||||||
|
|
||||||
|
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);
|
||||||
|
$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];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,28 @@ class Dispatch2 extends Backend
|
||||||
$this->view->assign("typeList", $this->model->getTypeList());
|
$this->view->assign("typeList", $this->model->getTypeList());
|
||||||
$this->view->assign("statusList", $this->model->getStatusList());
|
$this->view->assign("statusList", $this->model->getStatusList());
|
||||||
$this->view->assign("offlineTotalTypeList", $this->model->getOfflineTotalTypeList());
|
$this->view->assign("offlineTotalTypeList", $this->model->getOfflineTotalTypeList());
|
||||||
|
|
||||||
|
|
||||||
|
$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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -70,6 +92,7 @@ class Dispatch2 extends Backend
|
||||||
}
|
}
|
||||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||||
|
|
||||||
|
|
||||||
$list = $this->model
|
$list = $this->model
|
||||||
->with(['orderb','lastRecord'])
|
->with(['orderb','lastRecord'])
|
||||||
//->auth($this->auth)
|
//->auth($this->auth)
|
||||||
|
|
@ -99,38 +122,6 @@ class Dispatch2 extends Backend
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*if($row->follow == 0 ){
|
|
||||||
$row->btn_record = true;
|
|
||||||
}else{
|
|
||||||
$row->btn_record = false;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// if($row->type == 2)
|
|
||||||
// {
|
|
||||||
// $row->btn_record = false;
|
|
||||||
// $now = date('Y-m-d H:i:s');
|
|
||||||
// //未上门
|
|
||||||
// if($row->status == OrderDispatch::STATUS_PLANIT){ //待上门
|
|
||||||
// if(empty($row->arrive_time))
|
|
||||||
// {
|
|
||||||
// if($row->plan_time < $now)
|
|
||||||
// {
|
|
||||||
// $row->btn_record = true;
|
|
||||||
// }
|
|
||||||
// }else{
|
|
||||||
// //已上门 完成时间超了
|
|
||||||
// if($row->estimated_finish_time < $now)
|
|
||||||
// { //预估完成时间过了
|
|
||||||
// $row->btn_record = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $row->btn_income = (in_array($row->status, $this->model->btnActiveStatusList('btn_income')) && in_array($row->order->status, $orderModel->incomeBtnStatus())) ? true : false;
|
|
||||||
|
|
||||||
if($row->status == -10){ //拒绝
|
if($row->status == -10){ //拒绝
|
||||||
$row->remark = $row->reject_reason;
|
$row->remark = $row->reject_reason;
|
||||||
}
|
}
|
||||||
|
|
@ -529,15 +520,21 @@ class Dispatch2 extends Backend
|
||||||
$filter = (array)json_decode($filter, true);
|
$filter = (array)json_decode($filter, true);
|
||||||
|
|
||||||
$area_id = $filter['area_id']??null;
|
$area_id = $filter['area_id']??null;
|
||||||
|
$source = $filter['source']??null;
|
||||||
|
|
||||||
unset($filter['city_id']);
|
unset($filter['city_id']);
|
||||||
unset($filter['province_id']);
|
unset($filter['province_id']);
|
||||||
unset($filter['area_id']);
|
unset($filter['area_id']);
|
||||||
|
unset($filter['source']);
|
||||||
if(!empty($area_id)){
|
if(!empty($area_id)){
|
||||||
$filter['orderb.area_id'] = $this->getSelectAreaCode($area_id);
|
$filter['orderb.area_id'] = $this->getSelectAreaCode($area_id);
|
||||||
}
|
}
|
||||||
|
if(!empty($source)){
|
||||||
|
$filter['orderb.source'] = $source;
|
||||||
|
}
|
||||||
$op = (array)json_decode($op, true);
|
$op = (array)json_decode($op, true);
|
||||||
$op['orderb.area_id'] = 'like%';
|
$op['orderb.area_id'] = 'like%';
|
||||||
|
$op['orderb.source'] = '=';
|
||||||
$filter = $filter ? $filter : [];
|
$filter = $filter ? $filter : [];
|
||||||
$where = [];
|
$where = [];
|
||||||
$alias = [];
|
$alias = [];
|
||||||
|
|
|
||||||
|
|
@ -202,5 +202,4 @@ class OrderDispatch extends Model
|
||||||
public function lastRecord(){
|
public function lastRecord(){
|
||||||
return $this->hasOne(OrderDispatchRecord::class,'dispatch_id','id')->order('id','desc')->limit(1);
|
return $this->hasOne(OrderDispatchRecord::class,'dispatch_id','id')->order('id','desc')->limit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,3 +153,16 @@
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script id="source" type="text/html">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<select id="c-source" title="请选择订单渠道" name="source" class="form-control">
|
||||||
|
<option value="">全部来源</option>
|
||||||
|
{foreach $sources as $item}
|
||||||
|
<option value="{$item['id']}">【{$item['ptitle']}】{$item['title']}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,3 +47,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script id="source" type="text/html">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<select id="c-source" title="请选择订单渠道" name="source" class="form-control">
|
||||||
|
<option value="">全部来源</option>
|
||||||
|
{foreach $sources as $item}
|
||||||
|
<option value="{$item['id']}">【{$item['ptitle']}】{$item['title']}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -43,3 +43,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script id="source" type="text/html">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<select id="c-source" title="请选择订单渠道" name="source" class="form-control">
|
||||||
|
<option value="">全部来源</option>
|
||||||
|
{foreach $sources as $item}
|
||||||
|
<option value="{$item['id']}">【{$item['ptitle']}】{$item['title']}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -65,5 +65,22 @@
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script id="source" type="text/html">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<select id="c-source" title="请选择订单渠道" name="source" class="form-control">
|
||||||
|
<option value="">全部来源</option>
|
||||||
|
{foreach $sources as $item}
|
||||||
|
<option value="{$item['id']}">【{$item['ptitle']}】{$item['title']}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var source = {:json_encode($sources); };
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ namespace app\common\controller;
|
||||||
use app\admin\library\Auth;
|
use app\admin\library\Auth;
|
||||||
use think\Config;
|
use think\Config;
|
||||||
use think\Controller;
|
use think\Controller;
|
||||||
|
use think\Db;
|
||||||
|
use think\exception\DbException;
|
||||||
use think\Hook;
|
use think\Hook;
|
||||||
use think\Lang;
|
use think\Lang;
|
||||||
use think\Loader;
|
use think\Loader;
|
||||||
|
|
@ -730,4 +732,34 @@ class Backend extends Controller
|
||||||
$data = $build->getAllData();
|
$data = $build->getAllData();
|
||||||
return \app\admin\model\Item::getAllChildIds($data,$item_id);
|
return \app\admin\model\Item::getAllChildIds($data,$item_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
* @throws DbException
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
*/
|
||||||
|
protected function getSource(): array
|
||||||
|
{
|
||||||
|
$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']
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,8 @@ ${data.receive_type == 1 ? '已收定金' : '已收全款'}
|
||||||
},
|
},
|
||||||
|
|
||||||
// {field: 'worker_id', title: __('Worker_id')},
|
// {field: 'worker_id', title: __('Worker_id')},
|
||||||
{field: 'source_shop', title: __('Source')},
|
{field: 'source_total_name', title: __('Source'), operate: false,},
|
||||||
|
|
||||||
// {field: 'source_uid', title: __('Source_uid'), operate: 'LIKE'},
|
// {field: 'source_uid', title: __('Source_uid'), operate: 'LIKE'},
|
||||||
{
|
{
|
||||||
field: 'detail',
|
field: 'detail',
|
||||||
|
|
@ -256,6 +257,13 @@ ${data.receive_type == 1 ? '已收定金' : '已收全款'}
|
||||||
return '无';
|
return '无';
|
||||||
}, visible: false
|
}, visible: false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'source', title: '订单渠道', searchList: function (column) {
|
||||||
|
return Template('source', {});
|
||||||
|
}, formatter: function (value, row, index) {
|
||||||
|
return '无';
|
||||||
|
}, visible: false
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'operate',
|
field: 'operate',
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
// {field: 'lng', title: __('Lng'), operate:'BETWEEN'},
|
// {field: 'lng', title: __('Lng'), operate:'BETWEEN'},
|
||||||
// {field: 'lat', title: __('Lat'), operate:'BETWEEN'},
|
// {field: 'lat', title: __('Lat'), operate:'BETWEEN'},
|
||||||
//{field: 'work_tel_id', title: __('Work_tel_id')},
|
//{field: 'work_tel_id', title: __('Work_tel_id')},
|
||||||
{field: 'source_shop', title: __('Source_shop'), operate: '='},
|
{field: 'source_total_name', title: __('Source_shop'), operate: false},
|
||||||
|
{
|
||||||
|
field: 'source', title: '订单渠道', searchList: function (column) {
|
||||||
|
return Template('source', {});
|
||||||
|
}, formatter: function (value, row, index) {
|
||||||
|
return '无';
|
||||||
|
}, visible: false
|
||||||
|
},
|
||||||
// {field: 'source', title: __('Source'), operate: 'like'},
|
// {field: 'source', title: __('Source'), operate: 'like'},
|
||||||
// {field: 'source_uid', title: __('Source_uid'), operate: '='},
|
// {field: 'source_uid', title: __('Source_uid'), operate: '='},
|
||||||
// {field: 'item_id', title: __('Item_id')},
|
// {field: 'item_id', title: __('Item_id')},
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
|
|
||||||
// {field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
// {field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||||
|
|
||||||
{field: 'source_shop', title: __('Source_shop'), operate: '='},
|
{field: 'source_total_name', title: __('Source_shop'), operate: false},
|
||||||
// {field: 'source', title: __('Source')},
|
// {field: 'source', title: __('Source')},
|
||||||
// {field: 'source_uid', title: __('Source_uid'), operate: 'LIKE'},
|
// {field: 'source_uid', title: __('Source_uid'), operate: 'LIKE'},
|
||||||
{field: 'item_title', title: __('Item_title'), operate: false},
|
{field: 'item_title', title: __('Item_title'), operate: false},
|
||||||
|
|
@ -57,7 +57,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
{field: 'offline_amount', title: __('Offline_amount'), operate:false},
|
{field: 'offline_amount', title: __('Offline_amount'), operate:false},
|
||||||
|
|
||||||
{field: 'offline_amount_type_text', title: __('Offline_amount_type'), operate:false},
|
{field: 'offline_amount_type_text', title: __('Offline_amount_type'), operate:false},
|
||||||
|
{
|
||||||
|
field: 'source', title: '订单渠道', searchList: function (column) {
|
||||||
|
return Template('source', {});
|
||||||
|
}, formatter: function (value, row, index) {
|
||||||
|
return '无';
|
||||||
|
}, visible: false
|
||||||
|
},
|
||||||
{field: 'refund_amount', title: __('Refund_amount'), operate:false},
|
{field: 'refund_amount', title: __('Refund_amount'), operate:false},
|
||||||
{field: 'real_amount', title: __('Real_amount'), operate:false},
|
{field: 'real_amount', title: __('Real_amount'), operate:false},
|
||||||
{field: 'cost', title: __('Cost'), operate:false},
|
{field: 'cost', title: __('Cost'), operate:false},
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
|
||||||
|
|
||||||
{field: 'orderb.order_no', title: __('Order.order_no'), operate: '='},
|
{field: 'orderb.order_no', title: __('Order.order_no'), operate: '='},
|
||||||
|
|
||||||
{field: 'orderb.source_shop', title: __('来源'), operate: false},
|
{field: 'orderb.source', title: __('来源'), operate: false, formatter:function (value) {
|
||||||
|
return getDisplayById(value);
|
||||||
|
}},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'follow',
|
field: 'follow',
|
||||||
|
|
@ -85,8 +87,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
|
||||||
formatter: Table.api.formatter.status,
|
formatter: Table.api.formatter.status,
|
||||||
custom:{25:"red"}
|
custom:{25:"red"}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'source', title: '订单渠道', searchList: function (column) {
|
||||||
|
return Template('source', {});
|
||||||
|
}, formatter: function (value, row, index) {
|
||||||
|
return '无';
|
||||||
|
}, visible: false
|
||||||
|
},
|
||||||
{field: 'orderb.customer', title: __('Order.customer'), operate: 'like'},
|
{field: 'orderb.customer', title: __('Order.customer'), operate: 'like'},
|
||||||
{field: 'orderb.source_shop', title: __('Order.source_shop'), operate: 'like'},
|
|
||||||
{field: 'orderb.tel', title: __('Order.tel'), operate: 'like'},
|
{field: 'orderb.tel', title: __('Order.tel'), operate: 'like'},
|
||||||
|
|
||||||
{field: 'worker_name', title: __('Worker_name'), operate: 'LIKE'},
|
{field: 'worker_name', title: __('Worker_name'), operate: 'LIKE'},
|
||||||
|
|
@ -294,7 +303,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
|
||||||
var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
|
var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
|
||||||
$("#select_area_id").val(code);
|
$("#select_area_id").val(code);
|
||||||
});
|
});
|
||||||
|
function getDisplayById(id) {
|
||||||
|
const item = source.find(d => d.id === id);
|
||||||
|
return item ? `【${item.ptitle}】${item.title}` : '';
|
||||||
|
}
|
||||||
// 获取选中项
|
// 获取选中项
|
||||||
$(document).on("click", ".btn-cancel-selected", function () {
|
$(document).on("click", ".btn-cancel-selected", function () {
|
||||||
//Layer.alert(JSON.stringify(Table.api.selecteddata(table)));
|
//Layer.alert(JSON.stringify(Table.api.selecteddata(table)));
|
||||||
|
|
@ -367,7 +379,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
console.log(source);
|
||||||
|
|
||||||
// 获取选中项
|
// 获取选中项
|
||||||
$(document).on("click", ".btn-add-normal", function () {
|
$(document).on("click", ".btn-add-normal", function () {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user