作者 郭文星

123

@@ -270,7 +270,7 @@ class Api extends Controller @@ -270,7 +270,7 @@ class Api extends Controller
270 $orderlog['content'] = '订单已支付'; 270 $orderlog['content'] = '订单已支付';
271 $orderlog['user_id'] = $cks['user_id']; 271 $orderlog['user_id'] = $cks['user_id'];
272 $orderlog['createtime'] = time(); 272 $orderlog['createtime'] = time();
273 - Db::name('order_log')->insertGetId($orderlog); 273 + Db::name('order_log')->insert($orderlog);
274 274
275 } 275 }
276 } 276 }
@@ -22,7 +22,7 @@ class Route extends Backend @@ -22,7 +22,7 @@ class Route extends Backend
22 { 22 {
23 parent::_initialize(); 23 parent::_initialize();
24 $this->model = new \app\admin\model\Route; 24 $this->model = new \app\admin\model\Route;
25 - 25 + $this->view->assign("typeList", $this->model->getTypeList());
26 } 26 }
27 27
28 28
@@ -5,6 +5,9 @@ return [ @@ -5,6 +5,9 @@ return [
5 'Name' => '线路名称', 5 'Name' => '线路名称',
6 'Start_address' => '开始地址', 6 'Start_address' => '开始地址',
7 'End_address' => '结束地址', 7 'End_address' => '结束地址',
  8 + 'Type' => '线路类型',
  9 + 'Type 1' => '城际',
  10 + 'Type 2' => '计票',
8 'Price' => '价格', 11 'Price' => '价格',
9 'Create_time' => '创建时间' 12 'Create_time' => '创建时间'
10 ]; 13 ];
@@ -25,12 +25,24 @@ class Route extends Model @@ -25,12 +25,24 @@ class Route extends Model
25 25
26 // 追加属性 26 // 追加属性
27 protected $append = [ 27 protected $append = [
  28 + 'type_text',
28 'create_time_text' 29 'create_time_text'
29 ]; 30 ];
30 31
31 32
32 33
  34 + public function getTypeList()
  35 + {
  36 + return ['1' => __('Type 1'), '2' => __('Type 2')];
  37 + }
  38 +
33 39
  40 + public function getTypeTextAttr($value, $data)
  41 + {
  42 + $value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
  43 + $list = $this->getTypeList();
  44 + return isset($list[$value]) ? $list[$value] : '';
  45 + }
34 46
35 47
36 public function getCreateTimeTextAttr($value, $data) 48 public function getCreateTimeTextAttr($value, $data)
@@ -19,6 +19,18 @@ @@ -19,6 +19,18 @@
19 </div> 19 </div>
20 </div> 20 </div>
21 <div class="form-group"> 21 <div class="form-group">
  22 + <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
  23 + <div class="col-xs-12 col-sm-8">
  24 +
  25 + <select id="c-type" class="form-control selectpicker" name="row[type]">
  26 + {foreach name="typeList" item="vo"}
  27 + <option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
  28 + {/foreach}
  29 + </select>
  30 +
  31 + </div>
  32 + </div>
  33 + <div class="form-group">
22 <label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label> 34 <label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
23 <div class="col-xs-12 col-sm-8"> 35 <div class="col-xs-12 col-sm-8">
24 <input id="c-price" class="form-control" step="0.01" name="row[price]" type="number"> 36 <input id="c-price" class="form-control" step="0.01" name="row[price]" type="number">
@@ -19,6 +19,18 @@ @@ -19,6 +19,18 @@
19 </div> 19 </div>
20 </div> 20 </div>
21 <div class="form-group"> 21 <div class="form-group">
  22 + <label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
  23 + <div class="col-xs-12 col-sm-8">
  24 +
  25 + <select id="c-type" class="form-control selectpicker" name="row[type]">
  26 + {foreach name="typeList" item="vo"}
  27 + <option value="{$key}" {in name="key" value="$row.type"}selected{/in}>{$vo}</option>
  28 + {/foreach}
  29 + </select>
  30 +
  31 + </div>
  32 + </div>
  33 + <div class="form-group">
22 <label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label> 34 <label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
23 <div class="col-xs-12 col-sm-8"> 35 <div class="col-xs-12 col-sm-8">
24 <input id="c-price" class="form-control" step="0.01" name="row[price]" type="number" value="{$row.price|htmlentities}"> 36 <input id="c-price" class="form-control" step="0.01" name="row[price]" type="number" value="{$row.price|htmlentities}">
@@ -88,6 +88,7 @@ class Car extends Base @@ -88,6 +88,7 @@ class Car extends Base
88 $phone = $this->request->param("phone");//联系手机号码 88 $phone = $this->request->param("phone");//联系手机号码
89 $user_name = $this->request->param("user_name");//联系人 89 $user_name = $this->request->param("user_name");//联系人
90 $position = $this->request->param("position");//上车地址 90 $position = $this->request->param("position");//上车地址
  91 + $seat_no = $this->request->param("seat_no");//经度
91 $lat = $this->request->param("lat");//经度 92 $lat = $this->request->param("lat");//经度
92 $lng = $this->request->param("lng");//维度 93 $lng = $this->request->param("lng");//维度
93 $remarks = $this->request->param("remarks");//备注 94 $remarks = $this->request->param("remarks");//备注
@@ -128,6 +129,9 @@ class Car extends Base @@ -128,6 +129,9 @@ class Car extends Base
128 }else{ 129 }else{
129 $order_review_id=$order_review['id']; 130 $order_review_id=$order_review['id'];
130 } 131 }
  132 +
  133 + //计算价格
  134 +
131 $data=[ 135 $data=[
132 "order_no"=>getOrderSn(), 136 "order_no"=>getOrderSn(),
133 "price"=>bcmul($route['price'],$number,2), 137 "price"=>bcmul($route['price'],$number,2),
@@ -325,7 +329,29 @@ class Car extends Base @@ -325,7 +329,29 @@ class Car extends Base
325 public function selectroutebyname(){ 329 public function selectroutebyname(){
326 $start_address=$this->request->param("start_address"); 330 $start_address=$this->request->param("start_address");
327 $end_address=$this->request->param("end_address"); 331 $end_address=$this->request->param("end_address");
328 - $route=Db::name("route")->where("end_address",$end_address)->where("start_address",$start_address)->find(); 332 + $route=Db::name("route")
  333 + ->where("end_address",$end_address)
  334 + ->where("type",2)
  335 + ->where("start_address",$start_address)
  336 + ->find();
  337 + return $this->success("请求成功",$route);
  338 + }
  339 +
  340 + /**
  341 + * 通过位置查询线路
  342 + * @return void
  343 + * @throws \think\db\exception\DataNotFoundException
  344 + * @throws \think\db\exception\ModelNotFoundException
  345 + * @throws \think\exception\DbException
  346 + */
  347 + public function selectintercityroutebyname(){
  348 + $start_address=$this->request->param("start_address");
  349 + $end_address=$this->request->param("end_address");
  350 + $route=Db::name("route")
  351 + ->where("end_address",$end_address)
  352 + ->where("type",1)
  353 + ->where("start_address",$start_address)
  354 + ->find();
329 return $this->success("请求成功",$route); 355 return $this->success("请求成功",$route);
330 } 356 }
331 357
@@ -29,6 +29,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -29,6 +29,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
29 {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, 29 {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
30 {field: 'start_address', title: __('Start_address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, 30 {field: 'start_address', title: __('Start_address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
31 {field: 'end_address', title: __('End_address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, 31 {field: 'end_address', title: __('End_address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
  32 + {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
32 {field: 'price', title: __('Price'), operate:'BETWEEN'}, 33 {field: 'price', title: __('Price'), operate:'BETWEEN'},
33 {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, 34 {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
34 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 35 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}