作者 郭文星

1231

  1 +<?php
  2 +
  3 +namespace app\admin\controller;
  4 +
  5 +use app\admin\model\User;
  6 +use app\api\controller\v1\WxxcxPush;
  7 +use app\common\controller\Backend;
  8 +use think\Db;
  9 +use app\api\controller\Index;
  10 +use think\exception\DbException;
  11 +use think\exception\PDOException;
  12 +use think\exception\ValidateException;
  13 +
  14 +/**
  15 + * 订单管理
  16 + *
  17 + * @icon fa fa-circle-o
  18 + */
  19 +class Dispatch extends Backend
  20 +{
  21 +
  22 + /**
  23 + * Order模型对象
  24 + * @var \app\admin\model\Order
  25 + */
  26 + protected $model = null;
  27 +
  28 + public function _initialize()
  29 + {
  30 + parent::_initialize();
  31 + $this->model = new \app\admin\model\Order;
  32 + $this->view->assign("isPayList", $this->model->getIsPayList());
  33 + $this->view->assign("typeList", $this->model->gettypeList());
  34 + }
  35 +
  36 +
  37 +
  38 + /**
  39 + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
  40 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
  41 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
  42 + */
  43 +
  44 +
  45 + /**
  46 + * 查看
  47 + */
  48 + public function index()
  49 + {
  50 + //当前是否为关联查询
  51 + $this->relationSearch = true;
  52 + //设置过滤方法
  53 + $this->request->filter(['strip_tags', 'trim']);
  54 + if ($this->request->isAjax()) {
  55 + //如果发送的来源是Selectpage,则转发到Selectpage
  56 + if ($this->request->request('keyField')) {
  57 + return $this->selectpage();
  58 + }
  59 + list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  60 +
  61 + $list = $this->model
  62 + ->with(['driver', 'car', 'user'])
  63 + ->where($where)
  64 + ->where("order.driver_id",null)
  65 + ->where("order.is_pay",1)
  66 + ->order($sort, $order)
  67 + ->paginate($limit);
  68 + $res=$this->model->where("id",">",0)->update(["is_check"=>1]);
  69 + foreach ($list as $row) {
  70 + $row->visible(['id', 'order_no','phone', 'type','intended_driver_id', 'pay_type', 'price', 'is_pay', 'user_name', 'driver_name', 'pay_time', 'refund_time','reservation_time', 'create_time']);
  71 + if(!$row['driver_name']){
  72 + $row['driver_name']="未选择司机";
  73 + }
  74 + $row->visible(['driver']);
  75 + $row->getRelation('driver')->visible(['name']);
  76 + $row->visible(['car']);
  77 + $row->getRelation('car')->visible(['license_plate']);
  78 + $row->visible(['user']);
  79 + $row->getRelation('user')->visible(['username']);
  80 + }
  81 +
  82 + $result = array("total" => $list->total(), "rows" => $list->items());
  83 +
  84 + return json($result);
  85 + }
  86 + return $this->view->fetch();
  87 + }
  88 +
  89 + /**
  90 + * 查看
  91 + */
  92 + public function dispatch()
  93 + {
  94 + //当前是否为关联查询
  95 + $this->relationSearch = true;
  96 + //设置过滤方法
  97 + $this->request->filter(['strip_tags', 'trim']);
  98 + if ($this->request->isAjax()) {
  99 + //如果发送的来源是Selectpage,则转发到Selectpage
  100 + if ($this->request->request('keyField')) {
  101 + return $this->selectpage();
  102 + }
  103 + list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  104 +
  105 + $list = $this->model
  106 + ->with(['driver', 'car', 'user'])
  107 + ->where($where)
  108 + ->order($sort, $order)
  109 + ->paginate($limit);
  110 + $res=$this->model->where("id",">",0)->update(["is_check"=>1]);
  111 + foreach ($list as $row) {
  112 + $row->visible(['id', 'order_no','phone', 'type','intended_driver_id', 'pay_type', 'price', 'is_pay', 'user_name', 'driver_name', 'pay_time', 'refund_time','reservation_time', 'create_time']);
  113 + if(!$row['driver_name']){
  114 + $row['driver_name']="未选择司机";
  115 + }
  116 + $row->visible(['driver']);
  117 + $row->getRelation('driver')->visible(['name']);
  118 + $row->visible(['car']);
  119 + $row->getRelation('car')->visible(['license_plate']);
  120 + $row->visible(['user']);
  121 + $row->getRelation('user')->visible(['username']);
  122 + }
  123 +
  124 + $result = array("total" => $list->total(), "rows" => $list->items());
  125 +
  126 + return json($result);
  127 + }
  128 + return $this->view->fetch('order/dispatch');
  129 + }
  130 +
  131 + public function refund($id)
  132 + {
  133 +
  134 + //查询订单
  135 + $order = Db::name("order")->where("id", $id)->find();
  136 + if ($order['is_pay'] != 1) {
  137 + $this->error("该订单无法退款");
  138 + }
  139 + if($order['pay_type']=="offlinepay" || $order['pay_type']=="background"){
  140 + $relogs['update_time'] = time();
  141 + $relogs['is_pay'] = 3;
  142 + $relogs['refund_time'] = time();
  143 + $rs2 = Db::name('order')
  144 + ->where(['id' => $order['id']])
  145 + ->update($relogs);
  146 + if($order['pay_type']="offlinepay"){
  147 + $index=new Index();
  148 + $index->refundToDriverUser($order['id']);
  149 + $this->refundSendMessage($id);//发送订阅消息
  150 + }
  151 + $this->success("退款成功");
  152 + }
  153 +
  154 + //拼接退款参数
  155 + $pay_fee = $order['price'];
  156 + $refund_fee = $pay_fee;
  157 + $order_sn = $order['order_no'];
  158 + $pay_type = 'wechat';
  159 + $reason = '订单退款';
  160 + $notifyurl = 'https://wyc.tenyes.cn/api/index/refundNotifyx';//退款回调地址
  161 + //直接调用退款方法传参即可
  162 + $response = \addons\epay\library\Service::submitRefund($pay_fee, $refund_fee, $order_sn, getRefundSn($order['user_id']), $pay_type, $reason, $notifyurl, '', 'miniapp');
  163 + $response = json_encode($response);
  164 + $response = json_decode($response, true);
  165 + file_put_contents("pcl_repay_v2.log", date("Y-m-d H:i:s") . "::" . json_encode($response, JSON_UNESCAPED_UNICODE) . PHP_EOL, FILE_APPEND);
  166 + if (!empty($response['return_code'] == 'SUCCESS')) {
  167 + //退款成功,更新退款记录
  168 + $relogs['update_time'] = time();
  169 + $relogs['is_pay'] = 3;
  170 + $relogs['out_refund_no'] = $response['out_refund_no'];
  171 + $relogs['refund_time'] = time();
  172 + $rs2 = Db::name('order')
  173 + ->where(['id' => $order['id']])
  174 + ->update($relogs);
  175 + } else {
  176 + $this->error('退款失败');
  177 + }
  178 + $index=new Index();
  179 + $index->refundToDriverUser($id);
  180 + $this->refundSendMessage($id);//发送订阅消息
  181 +
  182 + $this->success("退款成功");
  183 + }
  184 +
  185 +
  186 + /**
  187 + * 编辑
  188 + *
  189 + * @param $ids
  190 + * @return string
  191 + * @throws DbException
  192 + * @throws \think\Exception
  193 + */
  194 + public function edit($ids = null)
  195 + {
  196 + $row = $this->model->get($ids);
  197 + if (!$row) {
  198 + $this->error(__('No Results were found'));
  199 + }
  200 + $adminIds = $this->getDataLimitAdminIds();
  201 + if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
  202 + $this->error(__('You have no permission'));
  203 + }
  204 + if (false === $this->request->isPost()) {
  205 + $car=Db::name("car")
  206 + ->alias("a")
  207 + ->join("driver b","a.driver_id=b.id")
  208 + ->where("a.route_id",$row['route_id'])
  209 + ->field("b.id,car_model,name,license_plate")
  210 + ->select();
  211 + $this->view->assign('row', $car);
  212 + return $this->view->fetch();
  213 + }
  214 + $params = $this->request->post('row/a');
  215 + if (empty($params)) {
  216 + $this->error(__('Parameter %s can not be empty', ''));
  217 + }
  218 + $params = $this->preExcludeFields($params);
  219 + $result = false;
  220 + Db::startTrans();
  221 + try {
  222 + //是否采用模型验证
  223 + if ($this->modelValidate) {
  224 + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
  225 + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
  226 + $row->validateFailException()->validate($validate);
  227 + }
  228 + $driver = Db::name("driver")->where("id", $ids)->find();
  229 + $car = Db::name("car")->where("driver_id", $driver['id'])->find();
  230 + $carmodel = Db::name("carmodel")->where("id", $car['carmodel_id'])->find();
  231 + $route = Db::name("route")->where("id", $car['route_id'])->find();
  232 +//判断总表
  233 + $time = strtotime(date("Y-m-d", time()));
  234 + $order_review = Db::name("order_review")
  235 + ->where("car_id", $car["id"])
  236 + ->where("route_id", $route['id'])
  237 + ->where("driver_id", $driver['id'])
  238 + ->where("createtime", ">", $time)
  239 + ->find();
  240 +
  241 + if (!$order_review) {
  242 + $order_review_id = Db::name("order_review")
  243 + ->insertGetId([
  244 + "car_id" => $car["id"],
  245 + "route_id" => $route['id'],
  246 + "driver_id" => $driver['id'],
  247 + "type" => 2,
  248 + "order_status" => 3,
  249 + "createtime" => time()
  250 + ]);
  251 + } else {
  252 + $order_review_id = $order_review['id'];
  253 + }
  254 + $params["order_review_id"]=$order_review_id;
  255 + $result = $row->allowField(true)->save($params);
  256 + Db::commit();
  257 + } catch (ValidateException|PDOException|Exception $e) {
  258 + Db::rollback();
  259 + $this->error($e->getMessage());
  260 + }
  261 + if (false === $result) {
  262 + $this->error(__('No rows were updated'));
  263 + }
  264 + $this->success();
  265 + }
  266 +
  267 + public function orderinfo($ids){
  268 + $row = Db::name("order")->field("id,passengers,driver_id,starting_point,end_point,order_no,pay_type,price,route_id,is_pay,phone,type")->find(['id' => $ids]);
  269 + $res=Db::name("passenger")->where("id","in",$row['passengers'])->select();
  270 + $row['passenger']="";
  271 + foreach ($res as $k=>$v) {
  272 + $row['passenger']=$row['passenger']."姓名:".$res[$k]['name']." 身份证:".$res[$k]['IDcard']." 手机号:".$res[$k]['phone'];
  273 + }
  274 + unset($row['passengers']);
  275 + if($row['is_pay']==1){
  276 + $row['is_pay']="已支付";
  277 + }elseif($row['is_pay']==2){
  278 + $row['is_pay']="未支付";
  279 + }elseif($row['is_pay']==3){
  280 + $row['is_pay']="已退款";
  281 + }elseif($row['is_pay']==4){
  282 + $row['is_pay']="已取消";
  283 + }
  284 + if($row['type']==1){
  285 + $row['type']="计票";
  286 + }elseif($row['type']==2){
  287 + $row['type']="城际";
  288 + }elseif($row['type']==3){
  289 + $row['type']="包车";
  290 + }
  291 + if($row['pay_type']=="wxpay"){
  292 + $row['pay_type']="微信";
  293 + }elseif($row['pay_type']=="offlinepay"){
  294 + $row['pay_type']="线下";
  295 + }elseif($row['pay_type']=="background"){
  296 + $row['pay_type']="后台下单";
  297 + }
  298 + $driver=Db::name("driver")->find($row['driver_id']);
  299 + $car=Db::name("car")->where("driver_id",$row['driver_id'])->find();
  300 + $row['license_plate']=$car['license_plate'];
  301 + $row['driver_name']=$driver['name'];
  302 + $route=Db::name("route")->find($row['route_id']);
  303 + $row['route_name']=$route['name'];
  304 + unset($row['driver_id']);
  305 + unset($row['route_id']);
  306 + if (!$row) {
  307 + $this->error(__('No Results were found'));
  308 + }
  309 + $this->view->assign("row", $row);
  310 + return $this->view->fetch();
  311 + }
  312 + public function chackorder(){
  313 + $newadditionorder= \app\admin\model\Order::where("is_check",0)->count();
  314 + return $newadditionorder;
  315 + }
  316 + public function notselectedorder(){
  317 + $newadditionorder= \app\admin\model\Order::where("driver_id",null)->count();
  318 + return $newadditionorder;
  319 + }
  320 + /**
  321 + * 发送模板消息
  322 + * @return void
  323 + * @throws \think\db\exception\DataNotFoundException
  324 + * @throws \think\db\exception\ModelNotFoundException
  325 + * @throws \think\exception\DbException
  326 + */
  327 + function refundSendMessage($order_id){
  328 + $order=\think\Db::name("order")->find($order_id);
  329 + $wxxcxpush=new WxxcxPush();
  330 + $user=new User();
  331 + $user=$user->find($order['user_id']);
  332 + $res=$wxxcxpush->refundMessage($user['wx_xcx_openid'],$order_id);
  333 + if ($res !== false) {
  334 + return $res;
  335 + }
  336 + }
  337 +
  338 + /**
  339 + * 检查是否有新订单
  340 + * @return void
  341 + */
  342 + public function chackordershow(){
  343 + $res=Db::name("order")->where("is_pay",1)->where("driver_id",null)->count();
  344 + return $res;
  345 + }
  346 + /**
  347 + * 添加
  348 + *
  349 + * @return string
  350 + * @throws \think\Exception
  351 + */
  352 + public function add()
  353 + {
  354 + if (false === $this->request->isPost()) {
  355 + return $this->view->fetch();
  356 + }
  357 + $params = $this->request->post('row/a');
  358 + if (empty($params)) {
  359 + $this->error(__('Parameter %s can not be empty', ''));
  360 + }
  361 + $params = $this->preExcludeFields($params);
  362 + $params['pay_type']="background";
  363 + $params['is_pay']=1;
  364 + $driver=Db::name("driver")->where("id",$params['driver_id'])->find();
  365 + $params['driver_name']=$driver['name'];
  366 + $params['order_no']=$this->getOrderSn();
  367 + if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
  368 + $params[$this->dataLimitField] = $this->auth->id;
  369 + }
  370 + $result = false;
  371 + Db::startTrans();
  372 + try {
  373 + //是否采用模型验证
  374 + if ($this->modelValidate) {
  375 + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
  376 + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
  377 + $this->model->validateFailException()->validate($validate);
  378 + }
  379 +
  380 + $passenger=Db::name("passenger")->insertGetId(['name'=>$params['user_name'],'IDcard'=>$params['IDcard'],'phone'=>$params['phone']]);
  381 + $params['passengers']=$passenger;
  382 + //判断总表
  383 + $time = strtotime(date("Y-m-d", time()));
  384 + $order_review = Db::name("order_review")
  385 + ->where("car_id", $params['car_id'])
  386 + ->where("route_id", $params['route_id'])
  387 + ->where("driver_id", $params['driver_id'])
  388 + ->where("createtime", ">", $time)
  389 + ->find();
  390 +
  391 + if (!$order_review) {
  392 + $order_review_id = Db::name("order_review")
  393 + ->insertGetId([
  394 + "car_id" => $params['car_id'],
  395 + "route_id" => $params['route_id'],
  396 + "driver_id" => $params['driver_id'],
  397 + "type" => 1,
  398 + "order_status" => 1,
  399 + "createtime" => time()
  400 + ]);
  401 + } else {
  402 + $order_review_id = $order_review['id'];
  403 + }
  404 + $params['order_review_id']=$order_review_id;
  405 + $result = $this->model->allowField(true)->save($params);
  406 + Db::commit();
  407 + } catch (ValidateException|PDOException|Exception $e) {
  408 + Db::rollback();
  409 + $this->error($e->getMessage());
  410 + }
  411 + if ($result === false) {
  412 + $this->error(__('No rows were inserted'));
  413 + }
  414 + $this->success();
  415 + }
  416 + function getOrderSn()
  417 + {
  418 + $orderid = date("YmdHis") . mt_rand(1000, 999999);
  419 + $odcks = \think\Db::name('order')
  420 + ->where(['order_no' => $orderid])
  421 + ->find();
  422 + while (!empty($odcks)) {
  423 + $orderid = date("YmdHis") . mt_rand(1000, 999999);
  424 + }
  425 + return $orderid;
  426 + }
  427 +}
  1 +<?php
  2 +
  3 +return [
  4 + 'Id' => 'ID',
  5 + 'Order_no' => '订单编号',
  6 + 'Price' => '价格',
  7 + 'Is_pay' => '是否支付',
  8 + 'Is_pay 1' => '已支付',
  9 + 'Is_pay 2' => '未支付',
  10 + 'Is_pay 3' => '已退款',
  11 + 'Is_pay 4' => '已取消',
  12 + 'Type' => '订单类型',
  13 + 'Type 1' => '计票',
  14 + 'Type 2' => '城际',
  15 + 'Type 3' => '包车',
  16 + 'Pay_type' => '支付类型',
  17 + 'passenger' => '乘车人信息',
  18 + 'Pay_type wxpay' => '微信支付',
  19 + 'Pay_type offlinepay' => '线下支付',
  20 + 'Pay_type background' => '后台下单',
  21 + 'Type 3' => '包车',
  22 + 'Starting_point' => '出发位置',
  23 + 'End_point' => '到达位置',
  24 + 'Car_id' => '订单车辆',
  25 + 'User_id' => '乘车人',
  26 + 'User_name' => '乘车人姓名',
  27 + 'Route_id' => '选择线路',
  28 + 'Driver_id' => '司机名称',
  29 + //'Driver_name' => '运行路线名称',
  30 + 'phone' => '联系电话',
  31 + 'route_name' => '线路名称',
  32 + 'Pay_time' => '支付时间',
  33 + 'Refund_time' => '退款时间',
  34 + 'Reservation_time' => '预约时间',
  35 + 'Create_time' => '创建时间',
  36 + 'driver_name' => '司机名称',
  37 + 'license_plate' => '车牌号',
  38 + 'IDcard' => '身份证',
  39 + 'Driver.name' => '司机名称',
  40 + 'Car.license_plate' => '车牌号',
  41 + 'Starting_point' => '出发位置',
  42 + 'end_point' => '结束位置',
  43 + 'User.username' => '用户名'
  44 +];
  1 +<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
  2 +
  3 + <div class="form-group">
  4 + <label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
  5 + <div class="col-xs-12 col-sm-8">
  6 + <input id="c-price" class="form-control" step="0.01" name="row[price]" type="number">
  7 + </div>
  8 + </div>
  9 +
  10 + <div class="form-group">
  11 + <label class="control-label col-xs-12 col-sm-2">{:__('Car_id')}:</label>
  12 + <div class="col-xs-12 col-sm-8">
  13 + <input id="c-car_id" data-rule="required" data-source="car/index" class="form-control selectpage" data-field="license_plate" name="row[car_id]" type="text" value="">
  14 + </div>
  15 + </div>
  16 + <div class="form-group">
  17 + <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
  18 + <div class="col-xs-12 col-sm-8">
  19 + <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
  20 + </div>
  21 + </div>
  22 + <div class="form-group">
  23 + <label class="control-label col-xs-12 col-sm-2">{:__('User_name')}:</label>
  24 + <div class="col-xs-12 col-sm-8">
  25 + <input id="c-user_name" class="form-control" name="row[user_name]" type="text">
  26 + </div>
  27 + </div>
  28 + <div class="form-group">
  29 + <label class="control-label col-xs-12 col-sm-2">{:__('Phone')}:</label>
  30 + <div class="col-xs-12 col-sm-8">
  31 + <input id="c-phone" class="form-control" name="row[phone]" type="text">
  32 + </div>
  33 + </div>
  34 + <div class="form-group">
  35 + <label class="control-label col-xs-12 col-sm-2">{:__('IDcard')}:</label>
  36 + <div class="col-xs-12 col-sm-8">
  37 + <input id="c-IDcard" class="form-control" name="row[IDcard]" type="text">
  38 + </div>
  39 + </div>
  40 + <div class="form-group">
  41 + <label class="control-label col-xs-12 col-sm-2">{:__('Driver_id')}:</label>
  42 + <div class="col-xs-12 col-sm-8">
  43 + <input id="c-driver_id" data-rule="required" data-source="driver/index" class="form-control selectpage" name="row[driver_id]" type="text" value="">
  44 + </div>
  45 + </div>
  46 + <div class="form-group">
  47 + <label class="control-label col-xs-12 col-sm-2">{:__('Route_id')}:</label>
  48 + <div class="col-xs-12 col-sm-8">
  49 + <input id="c-route_id" data-rule="required" data-source="route/index" class="form-control selectpage" name="row[route_id]" type="text" value="">
  50 + </div>
  51 + </div>
  52 + <div class="form-group">
  53 + <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
  54 + <div class="col-xs-12 col-sm-8">
  55 +
  56 + <select id="c-type" class="form-control selectpicker" name="row[type]">
  57 + {foreach name="typeList" item="vo"}
  58 + <option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
  59 + {/foreach}
  60 + </select>
  61 +
  62 + </div>
  63 + </div>
  64 + <div class="form-group">
  65 + <label class="control-label col-xs-12 col-sm-2">{:__('Starting_point')}:</label>
  66 + <div class="col-xs-12 col-sm-8">
  67 + <input id="c-starting_point" class="form-control" name="row[starting_point]" type="text">
  68 + </div>
  69 + </div>
  70 + <div class="form-group">
  71 + <label class="control-label col-xs-12 col-sm-2">{:__('End_point')}:</label>
  72 + <div class="col-xs-12 col-sm-8">
  73 + <input id="c-end_point" class="form-control" name="row[end_point]" type="text">
  74 + </div>
  75 + </div>
  76 + <div class="form-group">
  77 + <label class="control-label col-xs-12 col-sm-2">{:__('Pay_time')}:</label>
  78 + <div class="col-xs-12 col-sm-8">
  79 + <input id="c-pay_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[pay_time]" type="text" value="{:date('Y-m-d H:i:s')}">
  80 + </div>
  81 + </div>
  82 +
  83 + <div class="form-group">
  84 + <label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
  85 + <div class="col-xs-12 col-sm-8">
  86 + <input id="c-create_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:date('Y-m-d H:i:s')}">
  87 + </div>
  88 + </div>
  89 +
  90 + <div class="form-group layer-footer">
  91 + <label class="control-label col-xs-12 col-sm-2"></label>
  92 + <div class="col-xs-12 col-sm-8">
  93 + <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
  94 + </div>
  95 + </div>
  96 +</form>
  1 +<table class="table table-striped">
  2 + <thead>
  3 + <tr>
  4 + <th>{:__('Title')}</th>
  5 + <th>{:__('Content')}</th>
  6 + </tr>
  7 + </thead>
  8 + <tbody>
  9 + {volist name="row" id="vo" }
  10 + <tr>
  11 + <td>{$key}</td>
  12 + <td style="word-break: break-all;">{$vo|htmlentities}</td>
  13 + </tr>
  14 + {/volist}
  15 + {if $Think.get.dialog}
  16 + <tr>
  17 + <td>回传数据</td>
  18 + <td>
  19 + <div class="input-group">
  20 + <input name="callback" class="form-control" value="test" />
  21 + <span class="input-group-btn"><a href="javascript:;" class="btn btn-success btn-callback" >回传数据</a></span>
  22 + </div>
  23 + </td>
  24 + </tr>
  25 + {/if}
  26 + </tbody>
  27 +</table>
  28 +<div class="form-group layer-footer">
  29 + <label class="control-label col-xs-12 col-sm-2"></label>
  30 + <div class="col-xs-12 col-sm-8">
  31 + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
  32 + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
  33 + </div>
  34 +</div>
  1 +<div class="panel panel-default panel-intro">
  2 + {:build_heading()}
  3 + <div class="panel-body">
  4 + <div id="myTabContent" class="tab-content">
  5 + <div class="tab-pane fade active in" id="one">
  6 + <div class="widget-body no-padding">
  7 + <div id="toolbar" class="toolbar">
  8 + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
  9 + <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('order/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
  10 + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('order/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
  11 + <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('order/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
  12 + </div>
  13 + <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
  14 + data-operate-edit="{:$auth->check('order/edit')}"
  15 + data-operate-del="{:$auth->check('order/del')}"
  16 + width="100%">
  17 + </table>
  18 + </div>
  19 + </div>
  20 +
  21 + </div>
  22 + </div>
  23 +</div>
  1 +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
  2 +
  3 +
  4 + <div class="form-group">
  5 + <label class="control-label col-xs-12 col-sm-2">选择司机:</label>
  6 + <div class="col-xs-12 col-sm-8">
  7 + <select id="c-intended_driver_id" class="form-control selectpicker" name="row[intended_driver_id]">
  8 + {foreach name="row" item="vo"}
  9 + <option value="{$vo.id}" {in name="key" value="$vo.id"}selected{/in}>{$vo.name}-{$vo.license_plate}</option>
  10 + {/foreach}
  11 + </select>
  12 +
  13 + </div>
  14 + </div>
  15 +
  16 + <div class="form-group layer-footer">
  17 + <label class="control-label col-xs-12 col-sm-2"></label>
  18 + <div class="col-xs-12 col-sm-8">
  19 + <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
  20 + </div>
  21 + </div>
  22 +</form>
  1 +<div class="panel panel-default panel-intro">
  2 + {:build_heading()}
  3 +
  4 + <div class="panel-body">
  5 + <div id="myTabContent" class="tab-content">
  6 + <div class="tab-pane fade active in" id="one">
  7 + <div class="widget-body no-padding">
  8 + <div id="toolbar" class="toolbar">
  9 + <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
  10 + <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('order/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
  11 + <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('order/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
  12 + <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('order/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
  13 +
  14 +
  15 +
  16 +
  17 +
  18 + </div>
  19 + <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
  20 + data-operate-edit="{:$auth->check('order/edit')}"
  21 + data-operate-del="{:$auth->check('order/del')}"
  22 + width="100%">
  23 + </table>
  24 + </div>
  25 + </div>
  26 +
  27 + </div>
  28 + </div>
  29 +</div>
  1 +<style>
  2 + .table-adminlog tr td {
  3 + word-break: break-all;
  4 + }
  5 +</style>
  6 +<table class="table table-striped table-adminlog">
  7 + <thead>
  8 + <tr>
  9 + <th width="100">{:__('Title')}</th>
  10 + <th>{:__('Content')}</th>
  11 + </tr>
  12 + </thead>
  13 + <tbody>
  14 + {volist name="row" id="vo" }
  15 + <tr>
  16 + <td>{:__($key)}</td>
  17 + <td>{if $key=='createtime'}{$vo|datetime}{else/}{$vo|htmlentities}{/if}</td>
  18 + </tr>
  19 + {/volist}
  20 + </tbody>
  21 +</table>
  22 +<div class="hide layer-footer">
  23 + <label class="control-label col-xs-12 col-sm-2"></label>
  24 + <div class="col-xs-12 col-sm-8">
  25 + <button type="reset" class="btn btn-primary btn-embossed btn-close" onclick="Layer.closeAll();">{:__('Close')}</button>
  26 + </div>
  27 +</div>
  1 +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
  2 +
  3 +
  4 + <div class="form-group">
  5 + <label class="control-label col-xs-12 col-sm-2">选择司机:</label>
  6 + <div class="col-xs-12 col-sm-8">
  7 + <select id="c-intended_driver_id" class="form-control selectpicker" name="row[intended_driver_id]">
  8 + {foreach name="row" item="vo"}
  9 + <option value="{$vo.id}" {in name="key" value="$vo.id"}selected{/in}>{$vo.name}-{$vo.license_plate}</option>
  10 + {/foreach}
  11 + </select>
  12 +
  13 + </div>
  14 + </div>
  15 +
  16 + <div class="form-group layer-footer">
  17 + <label class="control-label col-xs-12 col-sm-2"></label>
  18 + <div class="col-xs-12 col-sm-8">
  19 + <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
  20 + </div>
  21 + </div>
  22 +</form>
@@ -5,13 +5,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function @@ -5,13 +5,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
5 // 初始化表格参数配置 5 // 初始化表格参数配置
6 Table.api.init({ 6 Table.api.init({
7 extend: { 7 extend: {
8 - index_url: 'order/dispatch' + location.search,  
9 - add_url: 'order/add',  
10 - edit_url: 'order/edit',  
11 - del_url: 'order/del',  
12 - multi_url: 'order/multi',  
13 - import_url: 'order/import',  
14 - table: 'order', 8 + index_url: 'dispatch/index' + location.search,
  9 + dispatch_url: 'dispatch/dispatch' + location.search,
  10 + add_url: 'dispatch/add',
  11 + edit_url: 'dispatch/edit',
  12 + del_url: 'dispatch/del',
  13 + multi_url: 'dispatch/multi',
  14 + import_url: 'dispatch/import',
  15 + table: 'dispatch',
15 } 16 }
16 }); 17 });
17 18
@@ -6,6 +6,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function @@ -6,6 +6,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
6 Table.api.init({ 6 Table.api.init({
7 extend: { 7 extend: {
8 index_url: 'order/index' + location.search, 8 index_url: 'order/index' + location.search,
  9 + dispatch_url: 'order/dispatch' + location.search,
9 add_url: 'order/add', 10 add_url: 'order/add',
10 edit_url: 'order/edit', 11 edit_url: 'order/edit',
11 del_url: 'order/del', 12 del_url: 'order/del',