正在显示
6 个修改的文件
包含
103 行增加
和
27 行删除
@@ -67,7 +67,7 @@ class Litestoreorder extends Backend | @@ -67,7 +67,7 @@ class Litestoreorder extends Backend | ||
67 | ->select(); | 67 | ->select(); |
68 | 68 | ||
69 | foreach ($list as $row) { | 69 | foreach ($list as $row) { |
70 | - $row->visible(['id','order_no','total_price','pay_price','pay_time','express_price','freight_time','receipt_time','order_status','updatetime']); | 70 | + $row->visible(['id','order_no','total_price','pay_price','pay_status','pay_time','express_price','freight_status','freight_time','receipt_time','order_status','updatetime']); |
71 | $row->visible(['address']); | 71 | $row->visible(['address']); |
72 | $row->getRelation('address')->visible(['name']); | 72 | $row->getRelation('address')->visible(['name']); |
73 | $row->visible(['rider']); | 73 | $row->visible(['rider']); |
@@ -107,4 +107,27 @@ class Litestoreorder extends Backend | @@ -107,4 +107,27 @@ class Litestoreorder extends Backend | ||
107 | $this->view->assign('vo', $row); | 107 | $this->view->assign('vo', $row); |
108 | return $this->view->fetch(); | 108 | return $this->view->fetch(); |
109 | } | 109 | } |
110 | + | ||
111 | + // 快捷匹配骑手 | ||
112 | + public function render(){ | ||
113 | + if($this->request->isPost()) | ||
114 | + { | ||
115 | + $id = input('get.ids'); | ||
116 | + $row = $this->model->get($id); | ||
117 | + $row['pay_status'] == '10' && $this->error('订单未支付,禁止分配骑手'); | ||
118 | + $row['freight_status'] = "20"; | ||
119 | + $row['freight_time'] = time(); | ||
120 | + $row['rider_user_id'] = input('post.virtual_name'); | ||
121 | + $row->save(); | ||
122 | + $param = [ | ||
123 | + 'order_id' => $row->id, | ||
124 | + 'user_id' => input('post.virtual_name'), | ||
125 | + 'address_id' => $row['address']['id'], | ||
126 | + 'price' => $row->express_price, | ||
127 | + ]; | ||
128 | + RiderOrder::create($param); | ||
129 | + $this->success(); | ||
130 | + } | ||
131 | + return $this->view->fetch(); | ||
132 | + } | ||
110 | } | 133 | } |
@@ -134,7 +134,7 @@ | @@ -134,7 +134,7 @@ | ||
134 | </fieldset> | 134 | </fieldset> |
135 | 135 | ||
136 | 136 | ||
137 | - {in name="$vo.freight_status" value="10"} | 137 | + {if condition="$vo.pay_status == '20' and $vo.freight_status == '10' and $vo.order_status == '10'"} |
138 | <fieldset> | 138 | <fieldset> |
139 | <legend><h4>发货信息</h4></legend> | 139 | <legend><h4>发货信息</h4></legend> |
140 | <div class="form-group"> | 140 | <div class="form-group"> |
@@ -158,6 +158,6 @@ | @@ -158,6 +158,6 @@ | ||
158 | <button type="button" id="send" data-type="send" class="btn btn-success btn-embossed">确认发货</button> | 158 | <button type="button" id="send" data-type="send" class="btn btn-success btn-embossed">确认发货</button> |
159 | </div> | 159 | </div> |
160 | </div> | 160 | </div> |
161 | - {/in} | 161 | + {/if} |
162 | 162 | ||
163 | </form> | 163 | </form> |
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">{:__('选择骑手')}:</label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <input id="c-virtual_name" data-rule="required" data-source="user/user/index" data-field="nickname" data-params='{"custom[rider]":2}' class="form-control selectpage form-control" name="virtual_name" type="text" value=""> | ||
7 | + </div> | ||
8 | + </div> | ||
9 | + <div class="form-group layer-footer"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
13 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
14 | + </div> | ||
15 | + </div> | ||
16 | +</form> |
@@ -7,6 +7,7 @@ namespace app\api\controller; | @@ -7,6 +7,7 @@ namespace app\api\controller; | ||
7 | use addons\epay\library\Service; | 7 | use addons\epay\library\Service; |
8 | use app\api\model\GoodsComment; | 8 | use app\api\model\GoodsComment; |
9 | use app\api\model\GoodsSpec; | 9 | use app\api\model\GoodsSpec; |
10 | +use app\api\model\RiderOrder; | ||
10 | use app\api\model\SpecValue; | 11 | use app\api\model\SpecValue; |
11 | use app\api\model\Third; | 12 | use app\api\model\Third; |
12 | use app\api\model\UserAddress; | 13 | use app\api\model\UserAddress; |
@@ -609,13 +610,24 @@ class Order extends Api | @@ -609,13 +610,24 @@ class Order extends Api | ||
609 | if (!is_numeric($order_id)) $this->error('参数不合法'); | 610 | if (!is_numeric($order_id)) $this->error('参数不合法'); |
610 | 611 | ||
611 | $model = new \app\api\model\Order(); | 612 | $model = new \app\api\model\Order(); |
612 | - $order = $model::get($order_id); | ||
613 | - if (!$order) $this->error('订单不存在'); | ||
614 | - if ($order['receipt_status'] == 20) $this->error('订单已收货,请勿重复提交'); | ||
615 | - if ($order['rider_status'] == 10) $this->error('骑手未送达,请稍后提交'); | ||
616 | - $order->receipt_status = '20'; | ||
617 | - $order->receipt_time = time(); | ||
618 | - $order->isUpdate()->save(); | 613 | + $order = $model->get($order_id); |
614 | + empty($order) && $this->error('订单不存在'); | ||
615 | + $order['receipt_status'] == '20' && $this->error('订单已收货,请勿重复提交'); | ||
616 | + $rider_order = RiderOrder::where('order_id',$order_id)->find(); | ||
617 | + empty($rider_order) && $this->error('骑手订单不存在'); | ||
618 | + | ||
619 | + // 修改订单信息 | ||
620 | + $order->rider_status = '20'; //送达状态:已送达 | ||
621 | + $order->receipt_status = '20'; //收货状态:已收货 | ||
622 | + $order->receipt_time = time(); //收货时间 | ||
623 | + $order->save(); | ||
624 | + // 修改配送单信息 | ||
625 | + $rider_order->status = '2'; //已送达 | ||
626 | + $rider_order->sendtime = time(); //送达时间 | ||
627 | + $rider_order->save(); | ||
628 | + // 发放订单运费 | ||
629 | + \app\common\model\User::money($order->express_price,$order->rider_user_id,'订单运费'); | ||
630 | + | ||
619 | $this->success('收货成功'); | 631 | $this->success('收货成功'); |
620 | } | 632 | } |
621 | 633 |
@@ -320,30 +320,26 @@ class Rider extends Api | @@ -320,30 +320,26 @@ class Rider extends Api | ||
320 | public function orderService() | 320 | public function orderService() |
321 | { | 321 | { |
322 | $id = $this->request->post('id'); | 322 | $id = $this->request->post('id'); |
323 | + | ||
323 | $rider_order = RiderOrder::get($id); | 324 | $rider_order = RiderOrder::get($id); |
324 | empty($rider_order) && $this->error('骑手订单不存在'); | 325 | empty($rider_order) && $this->error('骑手订单不存在'); |
325 | $ordermodel = new \app\api\model\Order(); | 326 | $ordermodel = new \app\api\model\Order(); |
326 | - $order = $ordermodel | ||
327 | - ->where('id',$rider_order['order_id']) | ||
328 | - ->find(); | 327 | + $order = $ordermodel->get($rider_order['order_id']); |
329 | empty($order) && $this->error('订单不存在'); | 328 | empty($order) && $this->error('订单不存在'); |
330 | if ($order['rider_status'] == 20) $this->error('该订单已送达'); | 329 | if ($order['rider_status'] == 20) $this->error('该订单已送达'); |
331 | - $order->rider_status = '20'; | 330 | + |
331 | + // 修改订单信息 | ||
332 | + $order->rider_status = '20'; //送达状态:已送达 | ||
333 | + $order->receipt_status = '20'; //收货状态:已收货 | ||
334 | + $order->receipt_time = time(); //收货时间 | ||
332 | $order->save(); | 335 | $order->save(); |
333 | - $rider_order->status = '2'; | ||
334 | - $rider_order->sendtime = time(); | 336 | + // 修改配送单信息 |
337 | + $rider_order->status = '2'; //已送达 | ||
338 | + $rider_order->sendtime = time(); //送达时间 | ||
335 | $rider_order->save(); | 339 | $rider_order->save(); |
336 | - $user = $this->auth->getUser(); | ||
337 | - $data = [ | ||
338 | - 'user_id' => $this->auth->id, | ||
339 | - 'money' => $order->express_price, | ||
340 | - 'before' => $user->money, | ||
341 | - 'after' => $order->express_price+$user->money, | ||
342 | - 'memo' => '订单运费', | ||
343 | - ]; | ||
344 | - $user->setInc('money',$order->express_price); | ||
345 | - $moneymodel = new UserMoneyLog(); | ||
346 | - $moneymodel->isUpdate(false)->save($data); | 340 | + // 发放订单运费 |
341 | + User::money($order->express_price,$order->rider_user_id,'订单运费'); | ||
342 | + | ||
347 | $this->success('送达成功',$order); | 343 | $this->success('送达成功',$order); |
348 | } | 344 | } |
349 | 345 |
@@ -39,6 +39,32 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -39,6 +39,32 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
39 | formatter: Controller.api.status_formatter}, | 39 | formatter: Controller.api.status_formatter}, |
40 | {field: 'updatetime', title: __('Updatetime'), operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime}, | 40 | {field: 'updatetime', title: __('Updatetime'), operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime}, |
41 | {field: 'address.name', title: __('Address.name'),operate: false}, | 41 | {field: 'address.name', title: __('Address.name'),operate: false}, |
42 | + { | ||
43 | + field: 'rider.nickname', | ||
44 | + title: __('选择配送骑手'), | ||
45 | + table: table, | ||
46 | + events: Table.api.events.operate, | ||
47 | + buttons: [ | ||
48 | + { | ||
49 | + name: 'detail', | ||
50 | + text: __('选择配送骑手'), | ||
51 | + title: __('选择配送骑手'), | ||
52 | + classname: 'btn btn-xs btn-primary btn-dialog', | ||
53 | + icon: 'fa fa-fighter-jet', | ||
54 | + url: 'litestore/litestoreorder/render?ids={ids}', | ||
55 | + callback: function (data) { | ||
56 | + Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"}); | ||
57 | + }, | ||
58 | + visible: function (row) { | ||
59 | + //返回true时按钮显示,返回false隐藏 | ||
60 | + if(row.pay_status == '20' && row.freight_status == '10' && row.order_status == '10'){ | ||
61 | + return true; | ||
62 | + } | ||
63 | + } | ||
64 | + } | ||
65 | + ], | ||
66 | + formatter: Table.api.formatter.buttons | ||
67 | + }, | ||
42 | {field: 'rider.nickname', title: __('骑手')}, | 68 | {field: 'rider.nickname', title: __('骑手')}, |
43 | {field: 'operate', title: __('Operate'), table: table, buttons: [ | 69 | {field: 'operate', title: __('Operate'), table: table, buttons: [ |
44 | {name: 'send', text: __('view'), icon: 'fa fa-eye', classname: 'btn btn-xs btn-warning btn-dialog chakan', url: 'litestore/litestoreorder/detail'}, | 70 | {name: 'send', text: __('view'), icon: 'fa fa-eye', classname: 'btn btn-xs btn-warning btn-dialog chakan', url: 'litestore/litestoreorder/detail'}, |
@@ -90,6 +116,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -90,6 +116,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
90 | }); | 116 | }); |
91 | Controller.api.bindevent(); | 117 | Controller.api.bindevent(); |
92 | }, | 118 | }, |
119 | + render: function () { | ||
120 | + Controller.api.bindevent(); | ||
121 | + }, | ||
93 | api: { | 122 | api: { |
94 | bindevent: function () { | 123 | bindevent: function () { |
95 | Form.api.bindevent($("form[role=form]")); | 124 | Form.api.bindevent($("form[role=form]")); |
-
请 注册 或 登录 后发表评论