作者 郭文星

123

... ... @@ -270,7 +270,7 @@ class Api extends Controller
$orderlog['content'] = '订单已支付';
$orderlog['user_id'] = $cks['user_id'];
$orderlog['createtime'] = time();
Db::name('order_log')->insertGetId($orderlog);
Db::name('order_log')->insert($orderlog);
}
}
... ...
... ... @@ -22,7 +22,7 @@ class Route extends Backend
{
parent::_initialize();
$this->model = new \app\admin\model\Route;
$this->view->assign("typeList", $this->model->getTypeList());
}
... ...
... ... @@ -5,6 +5,9 @@ return [
'Name' => '线路名称',
'Start_address' => '开始地址',
'End_address' => '结束地址',
'Type' => '线路类型',
'Type 1' => '城际',
'Type 2' => '计票',
'Price' => '价格',
'Create_time' => '创建时间'
];
... ...
... ... @@ -25,12 +25,24 @@ class Route extends Model
// 追加属性
protected $append = [
'type_text',
'create_time_text'
];
public function getTypeList()
{
return ['1' => __('Type 1'), '2' => __('Type 2')];
}
public function getTypeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['type']) ? $data['type'] : '');
$list = $this->getTypeList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getCreateTimeTextAttr($value, $data)
... ...
... ... @@ -19,6 +19,18 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-type" class="form-control selectpicker" name="row[type]">
{foreach name="typeList" item="vo"}
<option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" class="form-control" step="0.01" name="row[price]" type="number">
... ...
... ... @@ -19,6 +19,18 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-type" class="form-control selectpicker" name="row[type]">
{foreach name="typeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.type"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<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
$phone = $this->request->param("phone");//联系手机号码
$user_name = $this->request->param("user_name");//联系人
$position = $this->request->param("position");//上车地址
$seat_no = $this->request->param("seat_no");//经度
$lat = $this->request->param("lat");//经度
$lng = $this->request->param("lng");//维度
$remarks = $this->request->param("remarks");//备注
... ... @@ -128,6 +129,9 @@ class Car extends Base
}else{
$order_review_id=$order_review['id'];
}
//计算价格
$data=[
"order_no"=>getOrderSn(),
"price"=>bcmul($route['price'],$number,2),
... ... @@ -325,7 +329,29 @@ class Car extends Base
public function selectroutebyname(){
$start_address=$this->request->param("start_address");
$end_address=$this->request->param("end_address");
$route=Db::name("route")->where("end_address",$end_address)->where("start_address",$start_address)->find();
$route=Db::name("route")
->where("end_address",$end_address)
->where("type",2)
->where("start_address",$start_address)
->find();
return $this->success("请求成功",$route);
}
/**
* 通过位置查询线路
* @return void
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function selectintercityroutebyname(){
$start_address=$this->request->param("start_address");
$end_address=$this->request->param("end_address");
$route=Db::name("route")
->where("end_address",$end_address)
->where("type",1)
->where("start_address",$start_address)
->find();
return $this->success("请求成功",$route);
}
... ...
... ... @@ -29,6 +29,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'start_address', title: __('Start_address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'end_address', title: __('End_address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
{field: 'price', title: __('Price'), operate:'BETWEEN'},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
... ...