Merge remote-tracking branch 'origin/feature/hant' into feature/hant

This commit is contained in:
hant 2025-06-21 19:47:43 +08:00
commit 370f9ec304
34 changed files with 16044 additions and 268 deletions

View File

@ -6,6 +6,7 @@ namespace app\admin\controller;
use app\admin\controller\orders\DispatchLogic;
use app\admin\model\Admin;
use app\admin\model\Message;
use app\admin\model\OrderDispatch;
use app\admin\model\Worker;
use think\Hook;
@ -24,6 +25,21 @@ class AutoDispatchLogic
$worker_id = (new DispatchLogic())->getMaxScoreWorker($order);
// dd($worker_id);
if (!$worker_id) {
$area_id = substr($order->area_id, 0, 4);
$res = Admin::where('area_ids', 'like', '%' . $area_id . '%')
->column('id');
$insert = [];
foreach ($res as $re) {
$insert [] = [
'to_id' => $re,
'type' => 1,
'title' => '派单通知',
'content' => '【派单通知】您有一条订单号为' . $order->order_no . '的新订单,请立即派单!'
];
}
$build = new Message();
$build->saveAll($insert);
$order->dispatch_type = 1;
$order->save();
return false;
@ -59,9 +75,9 @@ class AutoDispatchLogic
$hookparams['role'] = 1;
$hookparams['auth'] = null;
$hookparams['remark'] = '自动完成派单';//. $worker->name.'('.$worker->tel.')';
if ($isRetry) {
/*if ($isRetry) {
$hookparams['remark'] = '订单重派:工程师【'.$worker->name.'】超时不接单,系统自动转派订单';
}
}*/
Hook::listen('order_change', $hookparams);
//日志

View File

@ -157,6 +157,7 @@ class Order extends Backend
$filter = (array)json_decode(input()['filter'] ?? '', true);
$admin_filter = $filter['user.nickname'] ?? false;
$area_id = $filter['area_id'] ?? false;
$item_id = $filter['item_id'] ?? false;
$is_timeout = $filter['is_timeout'] ?? null;
// dd($create_time,$filter);
if ($admin_filter) {
@ -166,6 +167,11 @@ class Order extends Backend
if ($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_timeout == 1){
$build->where('status', '>=', \app\admin\model\Order::STATUS_DISPATCHING)
@ -290,8 +296,9 @@ class Order extends Backend
$result = $this->model->allowField(true)->save($params);
$auth = clone $this->auth;
$order = \app\admin\model\Order::get($this->model->id);
//日志
$hookparams['order'] = \app\admin\model\Order::get($this->model->id);
$hookparams['order'] = $order;
$hookparams['role'] = 1;
$hookparams['auth'] = $auth;
$hookparams['remark'] = '录入订单';
@ -816,29 +823,11 @@ class Order extends Backend
$this->request->get([config('paginate.var_page') => $page]);
$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']);
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 : [];
$where = [];
$alias = [];

View File

@ -123,6 +123,11 @@ class Aftersale extends Backend
if(empty($order)){
$this->error('订单不存在');
}
if($order->aftersale_id > 0){
$this->error('订单已存在售后信息,不可重复创建');
}
$this->assign('order',$order);
}
@ -253,6 +258,15 @@ class Aftersale extends Backend
$result = $row->allowField(true)->save($params);
if($params['status'] != 3){ //非退款售后
$order = Order::get($row->order_id);
if(empty($order)){
$this->error('订单不存在');
}
$order->status = Order::STATUS_FINISHED;
$order->save();
}
/*if($params['handle_type'] == 1 && $params['status'] == 2){ //处理完成,重新计算利润
$row->refund_status = 3;

View File

@ -12,6 +12,7 @@ use think\Db;
use think\exception\DbException;
use think\exception\PDOException;
use think\exception\ValidateException;
use think\Loader;
/**
* 待退款列表
@ -69,11 +70,29 @@ class Aftersale2 extends Backend
}
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
->whereIn('fa_aftersale.status',[3,4])
->with(['order'])
->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){
//$builder->where('refund_amount','>',0);
//$builder->where('status','<>',-1);
@ -102,6 +121,200 @@ class Aftersale2 extends Backend
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];
}
/**
* 添加
*
@ -225,7 +438,7 @@ class Aftersale2 extends Backend
return $this->view->fetch();
}
if($row->status != 3 || $row->handle_type!= 1){
if($row->status != 3){
$this->error('售后状态不是待退款,不可编辑');
}
$params = $this->request->post('row/a');

View File

@ -161,6 +161,7 @@ class Dispatch extends Backend
$order->dispatch_time = date('Y-m-d H:i:s');
$order->dispatch_admin_id = $this->auth->id;
$order->worker_id = $worker->id;
$order->dispatch_admin_user = $this->auth->nickname;
$order->save();
$auth = clone $this->auth;

View File

@ -125,8 +125,8 @@ class Dispatchrecord extends Backend
$params['notice_time'] = date('Y-m-d', $timestamp) . ' 09:00:00'; // 拼接为明天的 9 点
//$dispatch->work_progress = $params['rate'];
$params['need_notice'] = 0;
$params['status'] = 1;
$params['need_notice'] = 1;
//$params['status'] = 1;
/* if(!empty($params['rate'])){ //修改任务的状态
if($dispatch->status != $params['rate']){
$dispatch->status = $params['rate'];
@ -142,6 +142,9 @@ class Dispatchrecord extends Backend
$dispatch->admin_user = $groupName.''. $this->auth->nickname;
$dispatch->record_images = $params['images'];
$dispatch->from_record = 1;
$dispatch->status = OrderDispatch::STATUS_GOTIT;
$hookParams = [
'dispatch' => $dispatch,
'remark' => '跟进订单,跟进内容:'.$params['remark'],

View File

@ -151,7 +151,9 @@ class CustomDetail extends Backend
return json($result);
}
$this->assignconfig("manage", $this->auth->check('salary/custom_detail/edit'));
$this->assignconfig("edit", $this->auth->check('salary/custom_detail/edit'));
$this->assignconfig("copy", $this->auth->check('salary/custom_detail/copy'));
$this->assignconfig("settle", $this->auth->check('salary/custom_detail/settle'));
$this->view->assign("month", $month);
$this->view->assign("salaryitem", json_encode($salaryItem));
return $this->view->fetch();
@ -416,7 +418,7 @@ class CustomDetail extends Backend
Db::name('salary_status')
->where('salary_month', $month)
->where('target_admin_id', $targetAdminId)
->save([
->update([
'settle_status' => 1,
]);
$this->success();

View File

@ -50,18 +50,12 @@ class Aftersale extends Backend
return $this->fetch('index');
}
public function list()
{
$build = new Order();
}
public function dispatch()
{
$build = new Admin();
$build->alias('a')
->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);
@ -101,6 +95,7 @@ class Aftersale extends Backend
'a.mobile',
'count(b.id) order_total',
'count(c.id) after_total',
'sum(c.refund_amount) refund_amount',
]
);
@ -157,6 +152,7 @@ class Aftersale extends Backend
'a.area_id',
'count(a.id) order_total',
'count(c.id) after_total',
'sum(c.refund_amount) refund_amount',
]
)->with([
'area' => function ($q) {
@ -205,7 +201,7 @@ class Aftersale extends Backend
}
$build->where('audit_time', '>=', $start);
$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(
[
'a.item_id',
'a.item_title',
'count(a.id) order_total',
'count(c.id) after_total',
'sum(c.refund_amount) refund_amount',
]
);
@ -253,20 +251,13 @@ class Aftersale extends Backend
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()
{
$build = new \app\admin\model\Worker();
$build->alias('a')
->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);
@ -306,6 +297,7 @@ class Aftersale extends Backend
'a.tel',
'count(b.id) order_total',
'count(c.id) after_total',
'sum(c.refund_amount) refund_amount',
]
);

View File

@ -6,6 +6,7 @@ use app\admin\model\Area;
use app\admin\model\AuthGroup;
use app\admin\model\Item;
use app\admin\model\Order;
use app\admin\model\OrderDispatch;
use app\admin\model\WorkerItem;
use app\common\controller\Backend;
use fast\Tree;
@ -21,6 +22,7 @@ use think\exception\ValidateException;
class Worker extends Backend
{
protected $noNeedRight = ['dispatchList','dispatchMapList'];
/**
* Worker模型对象
* @var \app\admin\model\Worker
@ -282,6 +284,7 @@ class Worker extends Backend
$build = model('worker')
->where('status', 1)
->where('type',2)
->with(['area'])
->withCount(['myorder' => function ($query) {
$query->where('status', Order::STATUS_FINISHED);
@ -319,7 +322,7 @@ class Worker extends Backend
$order_id = request()->get('order_id');
$search = request()->get('search');
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$order = (new Order())->where('id',$order_id)->field(['id','lng','lat'])->select();
$order = (new Order())->where('id',$order_id)->field(['id','lng','lat','item_id'])->select();
if (!empty($order)) {
$order = $order[0];
@ -332,16 +335,28 @@ SELECT id,
point(lng, lat),
point(?, ?)
) AS distance
FROM fa_worker where status = 1
FROM fa_worker where status = 1 and type = 2
) AS t
WHERE distance < 50000
ORDER BY distance;",[$order->lng,$order->lat]);
$worker_ids = array_column($worker_distance,'id');
$worker_items_ids = (new WorkerItem())
->where('item_id', $order->item_id)
->whereIn('worker_id', $worker_ids)
->column('worker_id');
// $out_worker = OrderDispatch::where('order_id',$order->id)
// ->where('status',-30)->column('worker_id');
$out_worker_ids = array_intersect($worker_ids, $worker_items_ids);
// $out_worker_ids = array_values(array_diff($out_worker_ids, $out_worker));
$build = model('worker')
->where('status', 1)
->whereIn('id', $worker_ids);
->whereIn('id', $out_worker_ids);
if ($search){

View File

@ -164,19 +164,21 @@
<!--
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Star')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-star" data-rule="required" min="1" max="5" step="1" class="form-control" name="row[star]" type="number" value="{$row.star|htmlentities}">
</div>
</div>
-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
<div class="radio" data-rule="required">
<label for="row[status]-4">
<input id="row[status]-4" data-rule="required" name="row[status]" type="radio" value="4"/> 确认退款
</label>

View File

@ -24,7 +24,7 @@
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('aftersales/aftersale/edit')}"
data-operate-edit="{:$auth->check('aftersales/aftersale2/edit')}"
data-operate-del="{:$auth->check('aftersales/aftersale/del')}"
width="100%">
</table>
@ -34,3 +34,12 @@
</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>

View File

@ -41,7 +41,7 @@
</div>
</div>
</div>
<link rel="stylesheet" href="/assets/css/select.css">
<style>
/* 派单按钮 */
.button-dispatch {
@ -123,15 +123,25 @@
.text-my_dispatch{
color: #0011ff;
}
</style>
<script>
var items = {:json_encode($items); };
</script>
<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" value="LIKE%" />
<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>
</script>

View File

@ -45,6 +45,22 @@
<div class="col-md-12" style="margin-bottom: 10px">
<div style="display: flex">
<div class="col-md-3">
<div class="order-count-plan" style="color: #55d2fe">
<div class="order-count-title">
<div class="todo-plan-title-text text-left" style="flex: 1">
<span class="fa fa-clock-o"></span> 进行中的订单
</div>
</div>
<div class="order-count-num text-left">
0 / 0 / 0 / 0
</div>
<div class="order-count-num-sub text-left">
待派单 / 待接单 / 待上门 / 服务中
</div>
</div>
</div>
<!-- 卡片 1: 总用户数 -->
<div class="col-md-3">
<div class="myplan">
@ -100,12 +116,10 @@
</div>
<div class="col-md-12" style="margin-top: 10px;margin-bottom: 10px">
<div class="col-md-2">
<div class="todo-plan" style="color: #55d2fe">
<div class="todo-plan" style="color: #434343">
<div class="todo-plan-title">
<div style="font-size: 32px" class="fa fa-warning"></div>
<div class="todo-plan-title-text" style="flex: 1">
<p>报错</p>
<p>单位/笔</p>
</div>
<div>
<a onclick="Backend.api.addtabs('/admin/orders/abnormal','报错订单')" href="">详情></a>
@ -118,12 +132,10 @@
</div>
<div class="col-md-2">
<div class="todo-plan" style="color: #86a7ff">
<div class="todo-plan" style="color: #434343">
<div class="todo-plan-title">
<div style="font-size: 32px" class="fa fa-gear"></div>
<div class="todo-plan-title-text" style="flex: 1">
<p>待配置</p>
<p>单位/笔</p>
</div>
<div>
<a onclick="Backend.api.addtabs('/admin/orders/configorder','待配置')" href="#">详情></a>
@ -136,12 +148,10 @@
</div>
<div class="col-md-2">
<div class="todo-plan" style="color: #4de171">
<div class="todo-plan" style="color: #434343">
<div class="todo-plan-title">
<div style="font-size: 32px" class="fa fa-envelope-open"></div>
<div class="todo-plan-title-text" style="flex: 1">
<p>待审核</p>
<p>单位/笔</p>
</div>
<div>
<a onclick="Backend.api.addtabs('/admin/orders/auditorder','待审核')" href="#">详情></a>
@ -154,12 +164,10 @@
</div>
<div class="col-md-2">
<div class="todo-plan" style="color: #b896ff">
<div class="todo-plan" style="color: #434343">
<div class="todo-plan-title">
<div style="font-size: 32px" class="fa fa-pencil"></div>
<div class="todo-plan-title-text" style="flex: 1">
<p>待回访</p>
<p>单位/笔</p>
</div>
<div>
<a onclick="Backend.api.addtabs('/admin/orders/revisitorder','待回访')" href="#">详情></a>
@ -172,12 +180,10 @@
</div>
<div class="col-md-2">
<div class="todo-plan" style="color: #f8bf18">
<div class="todo-plan" style="color: #434343">
<div class="todo-plan-title">
<div style="font-size: 32px" class="fa fa-leaf"></div>
<div class="todo-plan-title-text" style="flex: 1">
<p>待售后</p>
<p>单位/笔</p>
</div>
<div>
<a onclick="Backend.api.addtabs('/admin/aftersales/aftersale','待售后')" href="#">详情></a>
@ -190,12 +196,10 @@
</div>
<div class="col-md-2">
<div class="todo-plan" style="color: #f58164">
<div class="todo-plan" style="color: #434343">
<div class="todo-plan-title">
<div style="font-size: 32px" class="fa fa-file-text-o"></div>
<div class="todo-plan-title-text" style="flex: 1">
<p>开票</p>
<p>单位/笔</p>
</div>
<div>
<a onclick="Backend.api.addtabs('/admin/orders/abnormal','开票')" href="#">详情></a>
@ -246,24 +250,6 @@
</div>
</div>
<div class="tab-pane fade" id="second">
<div class="col-md-12">
<div class="col-md-3">
<div class="order-count-plan" style="color: #55d2fe">
<div class="order-count-title">
<div class="todo-plan-title-text text-left" style="flex: 1">
<span class="fa fa-clock-o"></span> 进行中的订单
</div>
</div>
<div class="order-count-num text-left">
0 / 0 / 0 / 0
</div>
<div class="order-count-num-sub text-left">
待派单 / 待接单 / 待上门 / 服务中
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6">
<div class="col-md-12">订单数据</div>
@ -682,10 +668,11 @@
.order-count-title {
background-color: #c389f6;
color: #7b38b7;
color: #FFFFFF;
padding: 5px;
border-radius: 20px;
font-size: 14px;
font-weight: bold;
}
.order-count-plan {
@ -699,12 +686,12 @@
.order-count-num {
font-size: 20px;
margin: 10px 0;
color: #292e39;
color: rgba(0, 0, 0, 0.9);
}
.order-count-num-sub {
font-size: 12px;
color: #C9C5C5;
color: rgba(0, 0, 0, 0.5);
}
.static-plan{
display: flex;
@ -732,9 +719,11 @@
}
.static-text-num{
font-size: 16px;
font-weight: bold;
color: rgba(0, 0, 0, 0.9);
}
.static-text-sub{
color: #C9C5C5;
color: rgba(0, 0, 0, 0.5);
font-size: 12px;
}
.rank-plan{
@ -800,7 +789,11 @@
flex: 1;
}
.service-content-sub{
color: #ccc;
color: rgba(0, 0, 0, 0.5);
font-size: 12px;
}
.service-content-title {
color: rgba(0, 0, 0, 0.9);
}
</style>

View File

@ -263,6 +263,15 @@
</div>
-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('预计利润')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-performance" readonly class="form-control" type="number" value="{$row.performance|htmlentities}">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">

View File

@ -53,7 +53,7 @@
{notempty name ='action'}
<input name="row[action]" type="hidden" value="{$action|htmlentities}">
<input id="c-action" name="row[action]" type="hidden" value="{$action|htmlentities}">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('当前师傅')}:</label>
@ -82,19 +82,14 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('线上预付')}:</label>
<div class="col-xs-12 col-sm-8">
<input readonly type="text" class="form-control" value="{$order.online_amount|htmlentities}">
</div>
</div>
{if $row['is_receipt']==0 }
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('线上收款')}:</label>
<div class="col-xs-12 col-sm-8">
<input readonly type="text" class="form-control" value="{$order.online_amount|htmlentities}">
<input id="order-online-amount" readonly type="text" class="form-control" value="{$order.online_amount|htmlentities}">
</div>
</div>
@ -109,10 +104,17 @@
{if $row['is_receipt']==1 }
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('线上预付')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="order-online-amount" readonly type="text" class="form-control" value="{$order.online_amount|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('线上尾款')}:</label>
<div class="col-xs-12 col-sm-8">
<input name="row[online_total]" data-rule="required" type="number" min="0" placeholder="请输入线上尾款金额" class="form-control" value="{$row.online_total|htmlentities}">
<input id="c-online_total" name="row[online_total]" data-rule="required" type="number" min="0" placeholder="请输入线上尾款金额" class="form-control" value="{$row.online_total|htmlentities}">
</div>
</div>
@ -154,7 +156,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('材料成本(¥)')}:</label>
<div class="col-xs-12 col-sm-8">
<input name="order[material_cost]" min="1" step="0.01" type="number" class="form-control" value="{$order.material_cost}">
<input id="order-material_cost" data-rule="required" name="order[material_cost]" min="1" step="0.01" type="number" class="form-control" value="{$order.material_cost}">
</div>
</div>
@ -209,7 +211,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('师傅提成(¥)')}:</label>
<div class="col-xs-12 col-sm-8">
<input data-rule="required" name="order[cost]" type="number" min="0" max="100" step="1" class="form-control" value="">
<input id="order-cost" data-rule="required" name="order[cost]" type="number" min="0" max="100" step="1" class="form-control" value="">
</div>
</div>
<div class="form-group">
@ -219,6 +221,14 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('预计利润')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-performance" readonly class="form-control" type="number" value="{$row.performance|htmlentities}">
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">

View File

@ -50,6 +50,7 @@ class NoticeLogic
if(empty($ttsCode)){
$log->status = -1;
$log->content = 'TTSID为空';
$log->mobile = $dispatch->worker_tel;
$log->save();
return;
}
@ -62,15 +63,18 @@ class NoticeLogic
if($reponse->statusCode == 200 && $reponse->body->code == 'OK'){
$log->status = 1;
$log->callId = $reponse->body->callId;
$log->mobile = $dispatch->worker_tel;
$log->save();
}else{
$log->status = -1;
$log->mobile = $dispatch->worker_tel;
$log->content = $reponse->body->message;
$log->save();
}
}else{
$log->status = -1;
$log->content = 'TTSID为空';
$log->mobile = $dispatch->worker_tel;
$log->save();
//throw new Exception('语音通知服务未开启');
}

View File

@ -100,12 +100,12 @@ class OrderLogic
* 师傅超时未接单的处理逻辑
* @return void
*/
public function noWorkerCanGetIt(OrderDispatch $dispatch,$remark = null)
public function noWorkerCanGetIt(OrderDispatch $dispatch,$remark = null,$isOverTime=false)
{//超过三次,直接取消
Db::startTrans();
try {
if (is_null($remark)){
$remark = '工程师('.$dispatch->worker_name.')超时未接,任务取消';
if ($isOverTime){
$remark = '工程师('.$dispatch->worker_name.')超时未接,系统自动转派订单';
}
$this->cancelOrderDispatch($dispatch,null,$remark);
Db::commit();

View File

@ -49,7 +49,7 @@ class CheckOrderDispatchGotCommand extends Command
foreach ($list as $item) {
try {
//取消旧单
$OrderLogic->noWorkerCanGetIt($item);
$OrderLogic->noWorkerCanGetIt($item,null,true);
//自动重派新单
$order = Order::get($item->order_id);
AutoDispatchLogic::autoDispatch($order,null,true);
@ -85,7 +85,7 @@ class CheckOrderDispatchGotCommand extends Command
foreach ($list as $item) {
try {
//取消旧单
$OrderLogic->noWorkerCanGetIt($item);
$OrderLogic->noWorkerCanGetIt($item,null,true);
//自动重派新单
$order = Order::get($item->order_id);
AutoDispatchLogic::autoDispatch($order,null,true);

View File

@ -43,6 +43,7 @@ class CheckTTSOverTimeCommand extends Command
$logs[] = [
'dispatch_id' => $item->id,
'order_id'=>$item->order_id,
'mobile' => $item->worker_tel,
'type' => 3,
'outid' => md5(time().rand(1000,9999).rand(1000,9999)),
'create_time' => date('Y-m-d H:i:s'),

View File

@ -44,6 +44,7 @@ class CheckTTSPlantCommand extends Command
$logs[] = [
'dispatch_id' => $item->id,
'order_id'=>$item->order_id,
'mobile' => $item->worker_tel,
'type' => 2,
'outid' => md5(time().rand(1000,9999).rand(1000,9999)),
'create_time' => date('Y-m-d H:i:s'),

View File

@ -723,4 +723,11 @@ class Backend extends Controller
// 重新索引数组
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);
}
}

44
deploy-if-new-tag.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/bash
set -e
SITE_FILE="application/extra/site.php"
# 获取本地当前 tag假设是当前 HEAD 所在 tag
current_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")
# 拉取最新 tags
git fetch --tags
# 获取远程最新 tag
latest_tag=$(git tag --sort=-v:refname | head -n 1)
echo "当前 tag: ${current_tag}"
echo "远程最新 tag: ${latest_tag}"
# 函数:将 tag 转换成整数用于比较
version_to_int() {
local IFS=.
read -r major minor patch <<< "$1"
printf "%03d%03d%03d" "$major" "$minor" "$patch"
}
if [ "$(version_to_int "$latest_tag")" -gt "$(version_to_int "$current_tag")" ]; then
echo "🚀 检测到新版本,准备更新为 $latest_tag"
# 拉取代码并 checkout 到该 tag注意如果是部署环境建议 --force
git checkout -f "tags/$latest_tag"
# 更新 site.php 文件中的版本号
if [ -f "$SITE_FILE" ]; then
sed -i.bak "s/'version' => '.*'/'version' => '${latest_tag}'/" "$SITE_FILE"
rm "$SITE_FILE.bak"
echo "✅ 已更新 $SITE_FILE 为版本 $latest_tag"
else
echo "⚠️ 找不到 $SITE_FILE,未更新版本号"
fi
echo "✅ 部署完成,新版本:$latest_tag"
else
echo "🟢 当前已是最新版本,无需更新"
fi

View File

@ -57,9 +57,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'admin_user', title: __('Admin_user'), operate: '='},
//{field: 'handle_admin_id', title: __('Handle_admin_id')},
{field: 'handle_admin_user', title: __('Handle_admin_user'), operate: '='},
{field: 'worker_name', title: '师傅', operate: 'like'},
{field: 'star', title: __('Star'),operate: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: '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,
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);
},

View File

@ -435,7 +435,8 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
timeOut:"30000",
onclick:function(){
//window.location.href='/admin/message/index';
Backend.api.addtabs('/admin/message/index','消息列表')
//Backend.api.addtabs('/admin/message/index','消息列表')
Fast.api.open('/admin/message/index','消息列表');
}
});
}

View File

@ -217,6 +217,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
return '无';
}, visible: false
},
{field: 'item_id', title: '服务项目', searchList: function (column) {
return Template('items_picker', {});
}, formatter: function (value, row, index) {
return '无';
}, visible: false
},
{
field: 'operate',
@ -409,7 +415,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
url: 'aftersales/aftersale/add',
dropdown: "更多",
visible: function (row) {
if (row.status !== -10 && row.status !== 70) {
if (row.status !== -10 && row.status !== 70 && row.aftersale_id <= 0) {
return true;
}
return false;
@ -463,6 +469,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function
});
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 () {
$("#mybuttom").on("click", function () {

View File

@ -113,6 +113,34 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
edit: function () {
Controller.api.bindevent();
// 浮点数转两位小数(避免精度问题)
function toFixedNum(num) {
return (Math.round((num + Number.EPSILON) * 100) / 100).toFixed(2);
}
// 利润计算函数
function calcProfit() {
var online = parseFloat($('#c-online_amount').val()) || 0;
var online2 = parseFloat($('#c-online_amount_last').val()) || 0;
var offline = parseFloat($('#c-offline_amount').val()) || 0;
var cost = parseFloat($('#c-cost').val()) || 0;
var material = parseFloat($('#c-material_cost').val()) || 0;
var profit = online + online2 + offline - cost - material;
$('#c-performance').val(toFixedNum(profit));
}
// 监听字段变化,实时计算利润
$('#c-online_amount_last, #c-offline_amount, #c-cost, #c-material_cost').on('input', function () {
calcProfit();
});
// 页面加载时自动计算一次利润,避免空白
calcProfit();
},
api: {
bindevent: function () {

View File

@ -76,7 +76,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
}
},
//{field: 'order_id', title: __('Order_id')},
{field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"10":__('Status 10'),"20":__('Status 20'),"25":__('Status 25'),"30":__('Status 30'),"60":__('Status 60'),"-10":__('Status -10'),
//"-20":__('Status -20'),
@ -84,9 +83,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
formatter: Table.api.formatter.status,
custom:{25:"red"}
},
//{field: 'follow', title: __('跟进状态'), searchList: {"0":__('待跟进'),"1":__('已跟进'),"2":__('已结束')}, formatter: Table.api.formatter.normal},
// {field: 'worker_id', title: __('Worker_id')},
{field: 'worker_name', title: __('Worker_name'), operate: 'LIKE'},
{field: 'worker_tel', title: __('Worker_tel'), operate: 'LIKE'},
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('自动')}, formatter: Table.api.formatter.normal
@ -135,20 +132,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
{field: 'arrive_time', title: __('上门时间'), operate:false, addclass:'datetimerange', autocomplete:false},
{field: 'arrive_image', title: __('上门照片'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
// {field: 'estimated_finish_time', title: __('预估完成时间'), operate:false, addclass:'datetimerange', autocomplete:false},
//
// {field: 'is_finish_today', title: __('预估时间能否完成'), operate:false,formatter: function(value, row, index) {
// if (value === 1) {
// return '<span style="color:green;">能</span>';
// } else {
// return '<span style="color:red;">不能</span>';
// }
// }},
//
// {field: 'work_progress', title: __('进度'), operate:false},
// {field: 'is_notice', title: __('Is_notice'), searchList: {"0":__('Is_notice 0'),"1":__('Is_notice 1')}, formatter: Table.api.formatter.normal},
// {field: 'admin_id', title: __('Admin_id')},
{field: 'admin_user', title: __('Admin_user'), operate: 'LIKE'},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
//{field: 'update_time', title: __('Update_time'), operate:false, addclass:'datetimerange', autocomplete:false},
@ -167,21 +150,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
align:'left',
buttons: [
/* {
name: 'edit',
text:"修改",
title:"",
icon: 'fa fa-pencil',
//title: __('Edit'),
extend: 'data-toggle="tooltip" data-container="body"',
classname: 'btn btn-xs btn-info btn-editone',
visible:function(row){
if(row.btn_edit){
return true;
}
return false;
}
},*/
{
name: 'dispatchlog',
text:"查看轨迹图",
@ -196,24 +165,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
return true;
}
},
// {
// name: "dispatch",
// text: "派单",
// title: "派单",
// extend: 'data-toggle="tooltip" data-container="body"',
// classname: 'btn btn-xs btn-info btn-dialog',
// icon: 'fa fa-add',
// url: function (row) {
// return 'orders/dispatch/add?order_id=' + row.order_id;
// },
// visible: function (row) {
// if (row.type == 2) {
// return true;
// }
// return false;
// },
// refresh: true,
// },
{
name: 'addrecord',
text:"跟进",
@ -462,6 +414,40 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
},
finish: function () {
Controller.api.bindevent();
console.log("sb:init...");
// 判断 #c-action 是否存在且有值
const $action = $("#c-action");
if ($action.length && $action.val()) {
function calculatePerformance() {
//console.log("sb:计算利润...");
const orderOnlineAmount = parseFloat($("#order-online-amount").val()) || 0;
//console.log("sb:计算利润:预收款..."+orderOnlineAmount);
const onlineAmountLast = parseFloat($("#c-online_total").val()) || 0; //线上尾款
//console.log("sb:计算利润:线上尾款..."+onlineAmountLast);
const offlineAmount = parseFloat($("#c-total").val()) || 0; //线下尾款
//console.log("sb:计算利润:线下尾款..."+offlineAmount);
const cost = parseFloat($("#order-cost").val()) || 0; //成本
//console.log("sb:计算利润:师傅成本..."+cost);
const materialCost = parseFloat($("#order-material_cost").val()) || 0;//材料
//console.log("sb:计算利润:材料成本..."+materialCost);
const performance = (orderOnlineAmount + onlineAmountLast + offlineAmount) - (cost + materialCost);
$("#c-performance").val(performance.toFixed(2));
}
/* ["c-online_total", "c-total", "order-cost", "order-material_cost"].forEach(function(id) {
$("#" + id).on("input", calculatePerformance);
});*/
$('#c-online_total, #c-total, #order-cost, #order-material_cost').on('input', function () {
//calcProfit();
calculatePerformance();
});
// 页面加载时先算一次
calculatePerformance();
}
},
addrecord: function () {
Controller.api.bindevent();

View File

@ -56,7 +56,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
extend: 'data-area=\'["800px", "600px"]\'',
visible:function(row){
if (!Config.manage) {
if (!Config.edit) {
return false;
}
return true;
@ -74,22 +74,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
extend: 'data-area=\'["800px", "600px"]\'',
visible:function(row){
if (!Config.manage) {
if (!Config.copy) {
return false;
}
return true;
}
},
{
name: 'complete',
text:"结算",
title:"结算",
name: 'settle',
text: '结算',
title: '结算',
extend: 'data-toggle="tooltip" data-container="body"',
classname: 'btn btn-xs btn-success btn-magic btn-ajax',
icon: 'fa fa-cny',
url: function (row) {
// 注意这里拼接 admin_id 和 month
return 'salary/detail/settle?target_admin_id=' + row.target_admin_id + '&month=' + row.month;
return 'salary/custom_detail/settle?target_admin_id=' + row.target_admin_id + '&month=' + row.month;
},
confirm: '确认结算?',
refresh: true,
@ -102,7 +102,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return false;
},
visible: function (row) {
if (!Config.manage) {
if (!Config.settle) {
return false;
}
//返回true时按钮显示,返回false隐藏

View File

@ -4,14 +4,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs'
var Controller = {
index: function () {
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
var $targetPanel = $($(this).attr("href"));
var tabVal = $(this).data('val');
if (tabVal === 'first') {
Controller.api.first();
}else if (tabVal === 'second') {
console.log(3333);
Controller.api.second();
}else if (tabVal === 'third'){
Controller.api.third();
@ -19,16 +17,84 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs'
Controller.api.fourth();
}
});
Table.api.init();
Controller.api.first();
Controller.api.datepicker();
Controller.api.enevt();
},
api: {
bindevent: function () {
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 (){
Table.api.init();
// 表格2
var table = $("#table1");
table.bootstrapTable({
@ -46,35 +112,36 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs'
{field: 'nickname', title: '名称', operate: false},
{field: 'mobile', title: '电话', operate: false},
{field: 'order_total', title: '订单总数', operate: false},
{field: 'refund_amount', title: '退款金额', operate: false},
{field: 'after_total', 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绑定事件
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 (){
Table.api.init();
// 表格2
var table = $("#table2");
table.bootstrapTable({
@ -92,7 +159,26 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs'
{field: 'area.merge_name', title: '城市', operate: false},
{field: 'order_total', title: '订单总数', operate: false},
{field: 'after_total', title: '退款订单数', operate: false},
{field: 'refund_amount', 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绑定事件
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();
},
third: function (){
Table.api.init();
// 表格2
var table = $("#table3");
table.bootstrapTable({
@ -139,35 +207,37 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs'
[
{field: 'item_title', title: '服务项目', operate: false},
{field: 'order_total', title: '订单总数', operate: false},
{field: 'refund_amount', title: '退款金额', operate: false},
{field: 'after_total', 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绑定事件
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();
},
fourth: function (){
Table.api.init();
// 表格2
var table = $("#table4");
table.bootstrapTable({
@ -185,31 +255,33 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'addtabs'
{field: 'name', title: '名称', operate: false},
{field: 'tel', title: '电话', operate: false},
{field: 'order_total', title: '订单总数', operate: false},
{field: 'refund_amount', title: '退款金额', operate: false},
{field: 'after_total', 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绑定事件
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 () {

View File

@ -40,7 +40,8 @@
// 重置搜索
form.on("click", "button[type=reset]", function (event) {
form[0].reset();
form.find('#select_area_id').val('');
form.find('#select_item_id').val('');
setTimeout(function () {
that.onCommonSearch();
}, 1);

View File

@ -10641,6 +10641,7 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'],
}
});
}
console.log(multipleList,params);
//调用Ajax请求方法
Fast.api.ajax({
type: type,
@ -10768,7 +10769,8 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'],
// 重置搜索
form.on("click", "button[type=reset]", function (event) {
form[0].reset();
form.find('#select_area_id').val('');
form.find('#select_item_id').val('');
setTimeout(function () {
that.onCommonSearch();
}, 1);
@ -12515,10 +12517,12 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
});
return html.join(' ');
},
content: function (value, row, index) {
var width = this.width != undefined ? (this.width.toString().match(/^\d+$/) ? this.width + "px" : this.width) : "250px";
var hover = this.hover != undefined && this.hover ? "autocontent-hover" : "";
return "<div class='autocontent-item " + hover + "' style='white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:" + width + ";'>" + value + "</div>";
return "<div class='autocontent-item " + hover + "' style='white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:" + width + ";'>" + (value||'') + "</div>";
},
status: function (value, row, index) {
var custom = {normal: 'success', hidden: 'gray', deleted: 'danger', locked: 'info'};
@ -12754,7 +12758,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
$.each(dropdowns, function (i, j) {
dropdownHtml.push('<div class="btn-group"><button type="button" class="btn btn-primary dropdown-toggle btn-xs" data-toggle="dropdown">' + i + '</button><button type="button" class="btn btn-primary dropdown-toggle btn-xs" data-toggle="dropdown"><span class="caret"></span></button><ul class="dropdown-menu dropdown-menu-right"><li>' + j.join('</li><li>') + '</li></ul></div>');
});
html.unshift(dropdownHtml.join(' '));
html.push(dropdownHtml.join(' '));
}
return html.join(' ');
},

15347
public/assets/js/require-frontend.min.js vendored Executable file → Normal file

File diff suppressed because one or more lines are too long

View File

@ -768,10 +768,12 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
});
return html.join(' ');
},
content: function (value, row, index) {
var width = this.width != undefined ? (this.width.toString().match(/^\d+$/) ? this.width + "px" : this.width) : "250px";
var hover = this.hover != undefined && this.hover ? "autocontent-hover" : "";
return "<div class='autocontent-item " + hover + "' style='white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:" + width + ";'>" + (value??'') + "</div>";
return "<div class='autocontent-item " + hover + "' style='white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-width:" + width + ";'>" + (value||'') + "</div>";
},
status: function (value, row, index) {
var custom = {normal: 'success', hidden: 'gray', deleted: 'danger', locked: 'info'};

0
public/assets/js/require.min.js vendored Executable file → Normal file
View File