sth
This commit is contained in:
parent
8c4ce33384
commit
d986cd7b69
292
application/admin/controller/orders/Dispatch2.php
Normal file
292
application/admin/controller/orders/Dispatch2.php
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\controller\orders;
|
||||
|
||||
use app\admin\model\Order;
|
||||
use app\admin\model\OrderDispatch;
|
||||
use app\common\controller\Backend;
|
||||
use think\Db;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\Exception;
|
||||
use think\exception\DbException;
|
||||
use think\exception\PDOException;
|
||||
use think\exception\ValidateException;
|
||||
use think\Hook;
|
||||
use think\Lang;
|
||||
use think\Loader;
|
||||
|
||||
/**
|
||||
* 派单列管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class Dispatch2 extends Backend
|
||||
{
|
||||
|
||||
/**
|
||||
* OrderDispatch模型对象
|
||||
* @var \app\admin\model\OrderDispatch
|
||||
*/
|
||||
protected $model = null;
|
||||
|
||||
protected $searchFields = 'order.order_no,order.tel,order.customer,worker_name,worker_tel';
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
|
||||
//加载当前控制器语言包
|
||||
$this->model = new \app\admin\model\OrderDispatch;
|
||||
$this->view->assign("typeList", $this->model->getTypeList());
|
||||
$this->view->assign("statusList", $this->model->getStatusList());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
//如果发送的来源是Selectpage,则转发到Selectpage
|
||||
if ($this->request->request('keyField')) {
|
||||
return $this->selectpage();
|
||||
}
|
||||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['order'])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
foreach ($list as &$row) {
|
||||
$row->btn_edit = (in_array($row->status, $this->model->btnActiveStatusList('btn_edit'))) ? true : false;
|
||||
$row->btn_cancel = (in_array($row->status, $this->model->btnActiveStatusList('btn_cancel'))) ? true : false;
|
||||
$row->btn_abnormal = (in_array($row->status, $this->model->btnActiveStatusList('btn_abnormal'))) ? true : false;
|
||||
// $row->btn_income = (in_array($row->status, $this->model->btnActiveStatusList('btn_income')) && in_array($row->order->status, $orderModel->incomeBtnStatus())) ? true : false;
|
||||
}
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
||||
return json($result);
|
||||
}
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @return string
|
||||
* @throws \think\Exception
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (false === $this->request->isPost()) {
|
||||
$id = $this->request->param('order_id');
|
||||
$order = model('order')->where('id', $id)->find();
|
||||
if (!$order) {
|
||||
$this->error(__('No results were found'));
|
||||
}
|
||||
|
||||
$items = Db::name('item')
|
||||
->where('status',1)
|
||||
->field(['id','title','key_word','pid'])
|
||||
->order('pid','asc')
|
||||
->order('sort','desc')
|
||||
->select();
|
||||
|
||||
$tree = $this->buildTree($items);
|
||||
$formattedTree = $this->formatTree($tree);
|
||||
|
||||
$area_name = model('area')->getNameByCode($order->area_id);
|
||||
$order->area_name = str_replace(',','/',$area_name);
|
||||
$this->view->assign('items', $formattedTree);
|
||||
$this->view->assign('row', $order);
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
$params = $this->request->post('row/a');
|
||||
if (empty($params)) {
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$params = $this->preExcludeFields($params);
|
||||
|
||||
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
|
||||
$params[$this->dataLimitField] = $this->auth->id;
|
||||
}
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
//是否采用模型验证
|
||||
if ($this->modelValidate) {
|
||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
|
||||
$this->model->validateFailException()->validate($validate);
|
||||
}
|
||||
$order = model('order')->where('id',$params['order_id'])->find();
|
||||
if (!$order){
|
||||
$this->error(__('No results were found'));
|
||||
}
|
||||
$insert = [
|
||||
'admin_id' => $this->auth->id,
|
||||
'admin_user' => $this->auth->nickname,
|
||||
'order_id' => $params['order_id'],
|
||||
'type' => 1,
|
||||
'worker_id' => $params['worker_id'],
|
||||
'plan_time' => $order['plan_time'],
|
||||
'is_receipt' => $order['receive_type'] == 1
|
||||
];
|
||||
|
||||
$worker = model('worker')->where('id',$params['worker_id'])->find();
|
||||
$insert ['worker_name'] = $worker->name;
|
||||
$insert ['worker_tel'] = $worker->tel;
|
||||
|
||||
$result = $this->model->allowField(true)->save($insert);
|
||||
$order->status = Order::STATUS_DISPATCHED;
|
||||
$order->save();
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param $ids
|
||||
* @return string
|
||||
* @throws DbException
|
||||
* @throws \think\Exception
|
||||
*/
|
||||
public function edit($ids = null)
|
||||
{
|
||||
$row = $this->model->get($ids);
|
||||
if (!$row) {
|
||||
$this->error(__('No Results were found'));
|
||||
}
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
|
||||
$this->error(__('You have no permission'));
|
||||
}
|
||||
if (false === $this->request->isPost()) {
|
||||
$this->view->assign('row', $row);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
$params = $this->request->post('row/a');
|
||||
if (empty($params)) {
|
||||
$this->error(__('Parameter %s can not be empty', ''));
|
||||
}
|
||||
$params = $this->preExcludeFields($params);
|
||||
$result = false;
|
||||
Db::startTrans();
|
||||
try {
|
||||
//是否采用模型验证
|
||||
if ($this->modelValidate) {
|
||||
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
|
||||
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
|
||||
$row->validateFailException()->validate($validate);
|
||||
}
|
||||
$result = $row->allowField(true)->save($params);
|
||||
Db::commit();
|
||||
} catch (ValidateException | PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if (false === $result) {
|
||||
$this->error(__('No rows were updated'));
|
||||
}
|
||||
$this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消派单
|
||||
*
|
||||
* @param $ids
|
||||
* @return void
|
||||
* @throws DbException
|
||||
* @throws DataNotFoundException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function del($ids = null)
|
||||
{
|
||||
if (false === $this->request->isPost()) {
|
||||
$this->error(__("Invalid parameters"));
|
||||
}
|
||||
$ids = $ids ?: $this->request->post("ids");
|
||||
if (empty($ids)) {
|
||||
$this->error(__('Parameter %s can not be empty', 'ids'));
|
||||
}
|
||||
$pk = $this->model->getPk();
|
||||
$adminIds = $this->getDataLimitAdminIds();
|
||||
if (is_array($adminIds)) {
|
||||
$this->model->where($this->dataLimitField, 'in', $adminIds);
|
||||
}
|
||||
$list = $this->model->where($pk, 'in', $ids)->whereIn('status', $this->model->deleteStatusList())->select();
|
||||
|
||||
$remark = $this->request->param('remark', '');
|
||||
|
||||
$count = 0;
|
||||
Db::startTrans();
|
||||
try {
|
||||
foreach ($list as $item) {
|
||||
//$count += $item->delete();
|
||||
$order = Order::where('id', $item->order_id)->where('status', Order::STATUS_DISPATCHED)->find();
|
||||
if (!$order) {
|
||||
$this->error('订单状态已变更,请刷新后操作');
|
||||
}
|
||||
//取消
|
||||
$item->save(['status' => OrderDispatch::STATUS_CANCEL, 'remark' => $remark]);
|
||||
//回退订单状态
|
||||
$order->allowField(true)->save(['status' => Order::STATUS_DISPATCHING]);
|
||||
|
||||
$params['order'] = $order->ref;
|
||||
$params['role'] = 1;
|
||||
$params['auth'] = $this->auth;
|
||||
$params['remark'] = '派单被取消[ID:' . $item->id . '],订单状态回退';
|
||||
if (!empty($remark)) {
|
||||
$params['remark'] .= ',操作备注:' . $remark;
|
||||
}
|
||||
Hook::listen('order_change', $params);
|
||||
}
|
||||
Db::commit();
|
||||
} catch (PDOException | Exception $e) {
|
||||
Db::rollback();
|
||||
throw $e;
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
/* if ($count) {
|
||||
$this->success();
|
||||
}*/
|
||||
$this->error(__('取消成功'));
|
||||
}
|
||||
|
||||
private function getWorkers($workers)
|
||||
{
|
||||
foreach ($workers as $worker){
|
||||
$worker->dist = '100m';
|
||||
}
|
||||
return $workers;
|
||||
}
|
||||
|
||||
}
|
||||
82
application/admin/lang/zh-cn/orders/dispatch2.php
Normal file
82
application/admin/lang/zh-cn/orders/dispatch2.php
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Id' => 'ID',
|
||||
'Order_id' => '订单ID',
|
||||
'Type' => '派单方式',
|
||||
'Type 1' => '手动',
|
||||
'Worker_id' => '师傅ID',
|
||||
'Worker_name' => '师傅姓名',
|
||||
'Worker_tel' => '师傅电话',
|
||||
'Status' => '进度',
|
||||
'Status 0' => '待接单',
|
||||
'Set status to 0' => '设为待接单',
|
||||
'Status 10' => '已接单',
|
||||
'Set status to 10' => '设为已接单',
|
||||
'Status 25' => '已开始',
|
||||
'Set status to 25' => '设为已开始',
|
||||
'Status 20' => '已预约',
|
||||
'Set status to 20' => '设为已预约',
|
||||
'Status 30' => '已打卡',
|
||||
'Set status to 30' => '设为已打卡',
|
||||
'Status 60' => '已完成',
|
||||
'Set status to 60' => '设为已完成',
|
||||
'Status -10' => '已拒接',
|
||||
'Set status to -10' => '设为已拒接',
|
||||
'Status -20' => '已移交',
|
||||
'Set status to -20' => '设为已移交',
|
||||
'Status -30' => '已取消',
|
||||
'Set status to -30' => '设为已取消',
|
||||
'Remark' => '备注',
|
||||
'Notice_num' => '通知次数',
|
||||
'Plan_time' => '预约时间',
|
||||
'Finish_time' => '完成时间',
|
||||
'Admin_id' => '派单人ID',
|
||||
'Admin_user' => '派单人',
|
||||
'Create_time' => '派单时间',
|
||||
'Update_time' => '编辑时间',
|
||||
'Order.id' => 'ID',
|
||||
'Order.order_no' => '订单号',
|
||||
'Order.customer' => '客户姓名',
|
||||
'Order.tel' => '客户电话',
|
||||
'Order.status' => '订单状态',
|
||||
'Order.status 10' => '未派单',
|
||||
'Order.status 20' => '已派单',
|
||||
'Order.status 30' => '进行中',
|
||||
'Order.status 40' => '待验收',
|
||||
'Order.status 41' => '审核驳回',
|
||||
'Order.status 50' => '待财务审核',
|
||||
'Order.status 60' => '已完成',
|
||||
'Order.status -10' => '取消',
|
||||
'Order.area_id' => '地域',
|
||||
'Order.address' => '详细地址',
|
||||
'Order.lng' => '经度',
|
||||
'Order.lat' => '纬度',
|
||||
'Order.work_tel_id' => '工作机',
|
||||
'Order.source_shop' => '来源店铺',
|
||||
'Order.source' => '订单来源',
|
||||
'Order.source_uid' => '来源UID',
|
||||
'Order.item_id' => '服务ID',
|
||||
'Order.item_title' => '服务名称',
|
||||
'Order.detail' => '订单详情',
|
||||
'Order.remark' => '订单备注',
|
||||
'Order.images' => '图片',
|
||||
'Order.plan_time' => '客户预约时间',
|
||||
'Order.admin_id' => '录单员ID',
|
||||
'Order.coupon_id' => '优惠码id',
|
||||
'Order.total' => '总收款',
|
||||
'Order.online_amount' => '线上收款',
|
||||
'Order.offline_amount' => '线下收款',
|
||||
'Order.discount_amount' => '优惠抵扣',
|
||||
'Order.refund_amount' => '总退款额',
|
||||
'Order.real_amount' => '实际收款',
|
||||
'Order.cost' => '师傅成本',
|
||||
'Order.performance' => '预计利润',
|
||||
'Order.cancel_reason_id' => '取消原因',
|
||||
'Order.cancel_detail' => '取消详情',
|
||||
'Order.audit_remark' => '审核备注',
|
||||
'Order.audit_admin_id' => '审核员',
|
||||
'Order.create_time' => '录单时间',
|
||||
'Order.update_time' => '更新时间',
|
||||
'Order.delete_time' => '删除时间'
|
||||
];
|
||||
110
application/admin/view/orders/dispatch2/add.html
Normal file
110
application/admin/view/orders/dispatch2/add.html
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<!-- 订单信息标题 -->
|
||||
<div class="row order-header">
|
||||
<div class="col-xs-12">
|
||||
<h2>订单详情</h2>
|
||||
<p><strong>订单编号:</strong> {$row.order_no}</p>
|
||||
<p><strong>顾客信息:</strong> {$row.customer} 电话:{$row.tel}</p>
|
||||
<p><strong>订单来源:</strong> {$row.source_shop} 单号:{$row.source_uid} </p>
|
||||
<p><strong>区域:</strong> {$row.area_name}</p>
|
||||
<p><strong>地址:</strong> {$row.address}</p>
|
||||
<p><strong>订单类型:</strong> {$row.item_title}</p>
|
||||
<p><strong>订单详情:</strong> {$row.detail}</p>
|
||||
<p><strong>订单备注:</strong> {$row.remark}</p>
|
||||
<!-- <p><strong>收款方式:</strong> {$row.receive_type == 1 ? '定金':'全款'}</p>-->
|
||||
<!-- <p><strong>线上收款:</strong> {$row.online_amount}</p>-->
|
||||
</div>
|
||||
<form id="add-form" class="form-horizontal col-xs-12" role="form" data-toggle="validator" method="POST" action="">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-4 text-left" style="text-align: left">师傅名称:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-worker_name" disabled data-rule="required" class="form-control" name="row[worker_name]" type="text">
|
||||
<input id="c-worker_id" class="form-control" style="display: none" name="row[worker_id]" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-4 text-left" style="text-align: left">{:__('Plan_time')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[plan_time]" type="text" value="{:date('Y-m-d H:i:s')}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group layer-footer">
|
||||
<label class="control-label col-xs-12 col-sm-4"></label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
<input style="display: none" class="form-control" name="row[order_id]" type="text" value="{$row->id}">
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="panel panel-default panel-intro">
|
||||
<div class="panel-body">
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="one">
|
||||
<div class="widget-body no-padding">
|
||||
<h3>师傅选择</h3>
|
||||
<!-- <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>-->
|
||||
|
||||
<form id="select-form" role="form" class="form-horizontal" data-toggle="validator" method="POST" action="">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-2" style="padding-left: 0px;text-align: left">区域:</label>
|
||||
<div style="display: inline-block;width: 300px;position: absolute">
|
||||
<input id="c-city-search" data-rule="required" class="form-control" data-toggle="city-picker" value="{$row.area_name}" type="text" />
|
||||
<input id="area_id" style="display: none" class="form-control" name="area_id" hidden type="text" value="{$row.area_id}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-2" style="text-align: left;padding-left: 0px;">工种:</label>
|
||||
<div style="width: 300px;display: inline-block;">
|
||||
<input type="text" id="item_id" name="item_id" data-value="{$row.item_title}" value="{$row.item_id}" class="zd-input__inner">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-xs-12 col-sm-2" style="padding-left: 0px;text-align: left">关键字:</label>
|
||||
<div style="display: inline-block;width: 300px;position: absolute">
|
||||
<input id="keyword" class="form-control" style="width: 100%;height: 32px" placeholder="名称或电话号码搜索" name="keyword" type="text" value="" />
|
||||
</div>
|
||||
</div>
|
||||
<p id="search_btn" class="btn btn-primary">搜索</p>
|
||||
<p id="reset_btn" class="btn btn-primary">清空</p>
|
||||
</form>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<link rel="stylesheet" href="/assets/css/select.css">
|
||||
<style>
|
||||
.dropdown-menu {
|
||||
position: absolute;
|
||||
z-index: 1000;
|
||||
width: 100%;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
|
||||
margin: 6px 12px;
|
||||
}
|
||||
#select-form .form-group{
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var items = {:json_encode($items); };
|
||||
</script>
|
||||
55
application/admin/view/orders/dispatch2/edit.html
Normal file
55
application/admin/view/orders/dispatch2/edit.html
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||
|
||||
<!-- <div class="form-group">-->
|
||||
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Order_id')}:</label>-->
|
||||
<!-- <div class="col-xs-12 col-sm-8">-->
|
||||
<!-- <input id="c-order_id" data-rule="required" data-field="order_no" data-source="order/index" class="form-control selectpage" name="row[order_id]" type="text" value="{$row.order_id|htmlentities}">-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Order_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-order_id" data-field="order_no" data-rule="required" data-source="order/index" class="form-control selectpage" name="row[order_id]" type="text" value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Worker_id')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-worker_id" data-rule="required" data-field="name" data-source="workers/worker/index" class="form-control selectpage" name="row[worker_id]" type="text" value="{$row.worker_id|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Worker_name')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-worker_name" data-rule="required" class="form-control" name="row[worker_name]" type="text" value="{$row.worker_name|htmlentities}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Worker_tel')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
<input id="c-worker_tel" data-rule="required" class="form-control" name="row[worker_tel]" type="text" value="{$row.worker_tel|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">
|
||||
{foreach name="statusList" item="vo"}
|
||||
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
</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">
|
||||
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
51
application/admin/view/orders/dispatch2/index.html
Normal file
51
application/admin/view/orders/dispatch2/index.html
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<div class="panel panel-default panel-intro">
|
||||
|
||||
<div class="panel-heading">
|
||||
{:build_heading(null,FALSE)}
|
||||
<ul class="nav nav-tabs" data-field="status">
|
||||
<li class="{:$Think.get.status === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
|
||||
{foreach name="statusList" item="vo"}
|
||||
<li class="{:$Think.get.status === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel-body">
|
||||
<div id="myTabContent" class="tab-content">
|
||||
<div class="tab-pane fade active in" id="one">
|
||||
<div class="widget-body no-padding">
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||
<!-- <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('orders/dispatch/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('orders/dispatch/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('orders/dispatch/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||
-->
|
||||
|
||||
<a href="javascript:;" class="btn btn-warning btn-add btn-disabled disabled {:$auth->check('orders/abnormal/add')}?'':'hide'}" title="{:__('创建异常')}" ><i class="fa fa-plus"></i> {:__('创建异常')}</a>
|
||||
|
||||
|
||||
|
||||
<div class="dropdown btn-group {:$auth->check('orders/dispatch/multi')?'':'hide'}">
|
||||
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
|
||||
<ul class="dropdown-menu text-left" role="menu">
|
||||
{foreach name="statusList" item="vo"}
|
||||
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:" data-params="status={$key}">{:__('Set status to ' . $key)}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||
data-operate-edit="{:$auth->check('orders/dispatch2/edit')}"
|
||||
data-operate-del="{:$auth->check('orders/dispatch2/del')}"
|
||||
data-operate-abnormal="{:$auth->check('orders/abnormal/add')}"
|
||||
width="100%">
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
164
public/assets/js/backend/orders/dispatch2.js
Normal file
164
public/assets/js/backend/orders/dispatch2.js
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
Table.api.init({
|
||||
extend: {
|
||||
index_url: 'orders/dispatch2/index' + location.search,
|
||||
//add_url: 'orders/dispatch/add',
|
||||
edit_url: 'orders/dispatch2/edit',
|
||||
del_url: 'orders/dispatc2h/del',
|
||||
multi_url: 'orders/dispatch2/multi',
|
||||
import_url: 'orders/dispatch2/import',
|
||||
table: 'order_dispatch',
|
||||
}
|
||||
});
|
||||
|
||||
var table = $("#table");
|
||||
|
||||
// 初始化表格
|
||||
table.bootstrapTable({
|
||||
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
||||
pk: 'id',
|
||||
sortName: 'id',
|
||||
fixedColumns: true,
|
||||
fixedRightNumber: 1,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
{field: 'id', title: __('Id')},
|
||||
//{field: 'order_id', title: __('Order_id')},
|
||||
|
||||
{field: 'order.order_no', title: __('Order.order_no'), operate: 'LIKE'},
|
||||
|
||||
{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'),"-30":__('Status -30')}, formatter: Table.api.formatter.status},
|
||||
|
||||
// {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')}, formatter: Table.api.formatter.normal},
|
||||
|
||||
{field: 'plan_time', title: __('Plan_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
|
||||
|
||||
{field: 'order.source_shop', title: __('Order.source_shop'), operate: 'LIKE'},
|
||||
{field: 'order.source', title: __('Order.source')},
|
||||
{field: 'order.customer', title: __('Order.customer'), operate: 'LIKE'},
|
||||
{field: 'order.tel', title: __('Order.tel'), operate: 'LIKE'},
|
||||
{field: 'order.address', title: __('Order.address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
|
||||
{field: 'order.item_title', title: __('Order.item_title'), operate: 'LIKE'},
|
||||
{field: 'order.detail', title: __('Order.detail'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
|
||||
{field: 'order.images', title: __('Order.images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
|
||||
|
||||
{field: 'remark', title: __('Remark'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
|
||||
|
||||
// {field: 'is_notice', title: __('Is_notice'), searchList: {"0":__('Is_notice 0'),"1":__('Is_notice 1')}, formatter: Table.api.formatter.normal},
|
||||
{field: 'finish_time', title: __('Finish_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
// {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:'RANGE', addclass:'datetimerange', autocomplete:false},
|
||||
|
||||
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
|
||||
|
||||
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-success btn-editone',
|
||||
visible:function(row){
|
||||
if(row.btn_edit){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'del',
|
||||
text:"取消",
|
||||
title:"取消",
|
||||
icon: 'fa fa-trash',
|
||||
//title: __('Del'),
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: 'btn btn-xs btn-danger btn-delone',
|
||||
click: function (data, row) {
|
||||
layer.prompt({
|
||||
formType: 2,
|
||||
value: '',
|
||||
title: '请输入备注',
|
||||
maxlength: 140,
|
||||
},function(value, index, elem) {
|
||||
var url = 'orders/dispatch2/del' + row.id;
|
||||
var options = {url: url, data: {remark: value}};
|
||||
Fast.api.ajax(options, function (data, ret) {
|
||||
// table.trigger("uncheckbox");
|
||||
table.bootstrapTable('refresh');
|
||||
})
|
||||
},function (data, ret) {
|
||||
var error = $(this).data("error") || $.noop;
|
||||
if (typeof error === 'function') {
|
||||
if (false === error.call(this, data, ret)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
layer.close(index);
|
||||
},
|
||||
visible:function(row){
|
||||
if(row.btn_cancel){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
},
|
||||
{
|
||||
name:"abnormal",
|
||||
text:"创建异常",
|
||||
title:"创建异常",
|
||||
classname:"btn-add btn-dialog",
|
||||
icon:'fa fa-add',
|
||||
url:function(row) {
|
||||
return "orders/abnormal/add?order_id="+row.order_id
|
||||
},
|
||||
dropdown:"更多",
|
||||
visible:function(row){
|
||||
if(row.btn_income){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
//refresh:true,
|
||||
}
|
||||
],
|
||||
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
|
||||
// 为表格绑定事件
|
||||
Table.api.bindevent(table);
|
||||
},
|
||||
add: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
edit: function () {
|
||||
Controller.api.bindevent();
|
||||
},
|
||||
api: {
|
||||
bindevent: function () {
|
||||
Form.api.bindevent($("form[role=form]"));
|
||||
}
|
||||
}
|
||||
};
|
||||
return Controller;
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user