Accept Merge Request #214: (feature/hant -> develop)
Merge Request: 派单重复问题 Created By: @todayswind Accepted By: @todayswind URL: https://g-bcrc3009.coding.net/p/allocatr/d/allocatr/git/merge/214?initial=true
This commit is contained in:
commit
0a3b6b2b01
|
|
@ -116,6 +116,7 @@ class Dispatch extends Backend
|
|||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
// dd(1);
|
||||
$params = $this->request->post('row/a');
|
||||
// $this->success();
|
||||
if (empty($params)) {
|
||||
|
|
@ -149,7 +150,6 @@ class Dispatch extends Backend
|
|||
if($existDispatch > 0){
|
||||
$this->error('该订单已经派单,不可重复操作');
|
||||
}
|
||||
sleep(2);
|
||||
|
||||
$insert = [
|
||||
'admin_id' => $this->auth->id,
|
||||
|
|
@ -202,6 +202,7 @@ class Dispatch extends Backend
|
|||
Db::rollback();
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
sleep(2);
|
||||
if ($result === false) {
|
||||
$this->error(__('No rows were inserted'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -403,8 +403,6 @@ WHERE distance < 50000
|
|||
ORDER BY distance;",[$order->lng,$order->lat]);
|
||||
|
||||
$worker_ids = array_column($worker_distance,'id');
|
||||
|
||||
|
||||
$ids = $this->getParentIdsFromArray($order->item_id,$this->items);
|
||||
$ids [] = $order->item_id;
|
||||
$worker_items_ids = (new WorkerItem())
|
||||
|
|
|
|||
|
|
@ -196,20 +196,24 @@
|
|||
}
|
||||
|
||||
function assignOrder(worker_id) {
|
||||
// 可发起请求
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const order_id = params.get('order_id');
|
||||
|
||||
const loadingIndex = layer.load(1, {shade: [0.1, '#fff']}); // 显示 loading
|
||||
|
||||
$.ajax({
|
||||
url: '/admin/orders/dispatch/add',
|
||||
method: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({ worker_id, order_id }),
|
||||
success: function (res) {
|
||||
layer.close(loadingIndex); // 关闭 loading
|
||||
Toastr.info('派单成功');
|
||||
close()
|
||||
close();
|
||||
},
|
||||
error: function () {
|
||||
Toastr.info('派单失败,请重试。');
|
||||
layer.close(loadingIndex); // 关闭 loading
|
||||
Toastr.error('派单失败,请重试。');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -247,7 +251,15 @@
|
|||
// 委托方式绑定事件:监听 .assign-btn 点击
|
||||
$(document).on('click', '.assign-btn', function () {
|
||||
const worker_id = $(this).data('id');
|
||||
const worker_name = $(this).data('name');
|
||||
|
||||
layer.confirm(
|
||||
'确定要将订单派给 "' + worker_name + '" 吗?',
|
||||
{icon: 3, title: '确认派单'},
|
||||
function (index) {
|
||||
assignOrder(worker_id);
|
||||
}
|
||||
);
|
||||
});
|
||||
// 事件委托,绑定点击工人卡片的事件
|
||||
$(document).on('click', '.worker-card', function (e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user