生成取货码和修改核销码判断

This commit is contained in:
mkm 2023-11-23 10:48:04 +08:00
parent ecf559d4bc
commit 797090de46
3 changed files with 27 additions and 11 deletions

View File

@ -1998,8 +1998,11 @@ class StoreOrderRepository extends BaseRepository
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['verify_code']!=$data['verify_code']){
throw new ValidateException('核销码不正确');
}
if (!$order->paid) throw new ValidateException('订单未支付');
if ($order['status']) throw new ValidateException('订单已全部核销,请勿重复操作');
foreach ($data['data'] as $v) {

View File

@ -147,8 +147,7 @@ class Order extends BaseController
$split = $this->request->params(['is_split', ['split', []]]);
if (!$this->repository->merDeliveryExists($id, $this->request->merId()))
return app('json')->fail('订单信息或状态错误');
switch ($type)
{
switch ($type) {
case 3: //虚拟发货
$data = $this->request->params([
'delivery_type',
@ -170,7 +169,8 @@ class Order extends BaseController
'temp_id',
'remark',
]);
if (!$data['from_name'] ||
if (
!$data['from_name'] ||
!$data['delivery_name'] ||
!$data['from_tel'] ||
!$data['from_addr'] ||
@ -349,6 +349,16 @@ class Order extends BaseController
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
* @return mixed

View File

@ -109,6 +109,9 @@ Route::group(function () {
Route::get('children/:id', 'Order/childrenList')->name('merchantStoreOrderChildrenList')->option([
'_alias' => '关联订单',
]);
Route::get('logistics_code/:id', 'Order/logisticsCode')->name('merchantStoreOrderLogisticsCode')->option([
'_alias' => '生成取货码',
]);
})->prefix('merchant.store.order.')->option([
'_path' => '/order/list',
'_auth' => true,