生成取货码和修改核销码判断
This commit is contained in:
parent
ecf559d4bc
commit
797090de46
@ -1998,8 +1998,11 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
|
|
||||||
public function verifyOrder(int $id, int $merId, array $data, $serviceId = 0)
|
public function verifyOrder(int $id, int $merId, array $data, $serviceId = 0)
|
||||||
{
|
{
|
||||||
$order = $this->dao->getWhere(['order_id' => $id, 'mer_id' => $merId, 'verify_code' => $data['verify_code'], 'order_type' => 1], '*', ['orderProduct']);
|
$order = $this->dao->getWhere(['order_id' => $id, 'mer_id' => $merId, 'order_type' => 1], '*', ['orderProduct']);
|
||||||
if (!$order) throw new ValidateException('订单不存在');
|
if (!$order) throw new ValidateException('订单不存在');
|
||||||
|
if($order['verify_code']!=$data['verify_code']){
|
||||||
|
throw new ValidateException('核销码不正确');
|
||||||
|
}
|
||||||
if (!$order->paid) throw new ValidateException('订单未支付');
|
if (!$order->paid) throw new ValidateException('订单未支付');
|
||||||
if ($order['status']) throw new ValidateException('订单已全部核销,请勿重复操作');
|
if ($order['status']) throw new ValidateException('订单已全部核销,请勿重复操作');
|
||||||
foreach ($data['data'] as $v) {
|
foreach ($data['data'] as $v) {
|
||||||
|
@ -144,11 +144,10 @@ class Order extends BaseController
|
|||||||
public function delivery($id)
|
public function delivery($id)
|
||||||
{
|
{
|
||||||
$type = $this->request->param('delivery_type');
|
$type = $this->request->param('delivery_type');
|
||||||
$split = $this->request->params(['is_split',['split',[]]]);
|
$split = $this->request->params(['is_split', ['split', []]]);
|
||||||
if (!$this->repository->merDeliveryExists($id, $this->request->merId()))
|
if (!$this->repository->merDeliveryExists($id, $this->request->merId()))
|
||||||
return app('json')->fail('订单信息或状态错误');
|
return app('json')->fail('订单信息或状态错误');
|
||||||
switch ($type)
|
switch ($type) {
|
||||||
{
|
|
||||||
case 3: //虚拟发货
|
case 3: //虚拟发货
|
||||||
$data = $this->request->params([
|
$data = $this->request->params([
|
||||||
'delivery_type',
|
'delivery_type',
|
||||||
@ -170,7 +169,8 @@ class Order extends BaseController
|
|||||||
'temp_id',
|
'temp_id',
|
||||||
'remark',
|
'remark',
|
||||||
]);
|
]);
|
||||||
if (!$data['from_name'] ||
|
if (
|
||||||
|
!$data['from_name'] ||
|
||||||
!$data['delivery_name'] ||
|
!$data['delivery_name'] ||
|
||||||
!$data['from_tel'] ||
|
!$data['from_tel'] ||
|
||||||
!$data['from_addr'] ||
|
!$data['from_addr'] ||
|
||||||
@ -186,7 +186,7 @@ class Order extends BaseController
|
|||||||
'delivery_type',
|
'delivery_type',
|
||||||
'station_id',
|
'station_id',
|
||||||
'mark',
|
'mark',
|
||||||
['cargo_weight',0],
|
['cargo_weight', 0],
|
||||||
'remark',
|
'remark',
|
||||||
]);
|
]);
|
||||||
if ($data['cargo_weight'] < 0) return app('json')->fail('包裹重量能为负数');
|
if ($data['cargo_weight'] < 0) return app('json')->fail('包裹重量能为负数');
|
||||||
@ -206,7 +206,7 @@ class Order extends BaseController
|
|||||||
$method = 'delivery';
|
$method = 'delivery';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$this->repository->runDelivery($id,$this->request->merId(), $data, $split, $method);
|
$this->repository->runDelivery($id, $this->request->merId(), $data, $split, $method);
|
||||||
return app('json')->success('发货成功');
|
return app('json')->success('发货成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ class Order extends BaseController
|
|||||||
public function status($id)
|
public function status($id)
|
||||||
{
|
{
|
||||||
[$page, $limit] = $this->getPage();
|
[$page, $limit] = $this->getPage();
|
||||||
$where = $this->request->params(['date','user_type']);
|
$where = $this->request->params(['date', 'user_type']);
|
||||||
$where['id'] = $id;
|
$where['id'] = $id;
|
||||||
if (!$this->repository->getOne($id, $this->request->merId()))
|
if (!$this->repository->getOne($id, $this->request->merId()))
|
||||||
return app('json')->fail('数据不存在');
|
return app('json')->fail('数据不存在');
|
||||||
@ -337,7 +337,7 @@ class Order extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function verify($id)
|
public function verify($id)
|
||||||
{
|
{
|
||||||
$data = $this->request->params(['data','verify_code']);
|
$data = $this->request->params(['data', 'verify_code']);
|
||||||
$this->repository->verifyOrder($id, $this->request->merId(), $data);
|
$this->repository->verifyOrder($id, $this->request->merId(), $data);
|
||||||
return app('json')->success('订单核销成功');
|
return app('json')->success('订单核销成功');
|
||||||
}
|
}
|
||||||
@ -349,6 +349,16 @@ class Order extends BaseController
|
|||||||
return app('json')->success($order);
|
return app('json')->success($order);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成取货码
|
||||||
|
*/
|
||||||
|
public function logisticsCode($id)
|
||||||
|
{
|
||||||
|
$order = $this->repository->getWhere(['order_id' => $id, 'mer_id' => $this->request->merId(), 'is_del' => 0]);
|
||||||
|
if (!$order)
|
||||||
|
return app('json')->fail('订单状态有误');
|
||||||
|
return app('json')->success(['qrcode' => $this->repository->logisticsQrcode($id, $order->order_sn)]);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @param $id
|
* @param $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
@ -424,7 +434,7 @@ class Order extends BaseController
|
|||||||
unset($where['order_type']);
|
unset($where['order_type']);
|
||||||
}
|
}
|
||||||
$where['mer_id'] = $this->request->merId();
|
$where['mer_id'] = $this->request->merId();
|
||||||
$data = app()->make(ExcelService::class)->order($where,$page,$limit);
|
$data = app()->make(ExcelService::class)->order($where, $page, $limit);
|
||||||
return app('json')->success($data);
|
return app('json')->success($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,7 +472,7 @@ class Order extends BaseController
|
|||||||
if (!$count) return app('json')->fail('没有可导出数据');
|
if (!$count) return app('json')->fail('没有可导出数据');
|
||||||
|
|
||||||
[$page, $limit] = $this->getPage();
|
[$page, $limit] = $this->getPage();
|
||||||
$data = app()->make(ExcelService::class)->delivery($where,$page,$limit);
|
$data = app()->make(ExcelService::class)->delivery($where, $page, $limit);
|
||||||
return app('json')->success($data);
|
return app('json')->success($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,9 @@ Route::group(function () {
|
|||||||
Route::get('children/:id', 'Order/childrenList')->name('merchantStoreOrderChildrenList')->option([
|
Route::get('children/:id', 'Order/childrenList')->name('merchantStoreOrderChildrenList')->option([
|
||||||
'_alias' => '关联订单',
|
'_alias' => '关联订单',
|
||||||
]);
|
]);
|
||||||
|
Route::get('logistics_code/:id', 'Order/logisticsCode')->name('merchantStoreOrderLogisticsCode')->option([
|
||||||
|
'_alias' => '生成取货码',
|
||||||
|
]);
|
||||||
})->prefix('merchant.store.order.')->option([
|
})->prefix('merchant.store.order.')->option([
|
||||||
'_path' => '/order/list',
|
'_path' => '/order/list',
|
||||||
'_auth' => true,
|
'_auth' => true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user