Просмотр исходного кода

商户后台-订单列表-增加手动确认收货关单功能

sunxbiao 1 год назад
Родитель
Сommit
0e1c6bd6c4

+ 5 - 2
app/common/repositories/store/order/StoreOrderRepository.php

@@ -5360,10 +5360,13 @@ class StoreOrderRepository extends BaseRepository
5360 5360
      */
5361 5361
     public function carryOrder($id, $merId, $serviceId, $order_id)
5362 5362
     {
5363
-        $order = $this->dao->getWhere(['order_id' => $order_id, 'status' => 1, 'mer_id' => $merId]);
5363
+        $order = $this->dao->getWhere(['order_id' => $order_id, 'mer_id' => $merId]);
5364 5364
         if (!$order)
5365 5365
             throw new ValidateException('订单不存在或已支付~');
5366
-        if ($order->verify_code != $id)
5366
+        if (!in_array($order->status, [0, 1])) {
5367
+            throw new ValidateException('订单状态错误');
5368
+        }
5369
+        if ($id != null && $order->verify_code != $id)
5367 5370
             throw new ValidateException('提货码错误~');
5368 5371
         if (!$order->paid)
5369 5372
             throw new ValidateException('订单未支付');

+ 4 - 5
app/controller/merchant/store/order/Order.php

@@ -264,17 +264,16 @@ class Order extends BaseController
264 264
 
265 265
     /**
266 266
      * 手动操作订单为 已自提 关单
267
-     * @param $id
268 267
      * @return mixed
269 268
      * @throws \think\db\exception\DataNotFoundException
270 269
      * @throws \think\db\exception\DbException
271 270
      * @throws \think\db\exception\ModelNotFoundException
272 271
      */
273
-    public function take()
272
+    public function carryByWithoutCode()
274 273
     {
275
-        $order_id= input('order_id');
276
-        $this->repository->takeOrder($order_id);
277
-        return app('json')->success('确认收货成功');
274
+        $order_id = input('order_id');
275
+        $this->repository->carryOrder(null, $this->request->merId(), 0, $order_id);
276
+        return app('json')->success('订单核销成功');
278 277
     }
279 278
 
280 279
     /**

+ 1 - 1
route/merchant.php

@@ -460,6 +460,7 @@ Route::group(config('admin.api_merchant_prefix') . '/', function () {
460 460
             Route::post('remark/:id', 'Order/remark')->name('merchantStoreOrderRemark');
461 461
             Route::post('verify/:code', 'Order/verify')->name('merchantStoreOrderVerify');
462 462
             Route::post('carry/:code', 'Order/carry')->name('merchantStoreOrderCarry');
463
+            Route::post('carryByWithoutCode', 'Order/carryByWithoutCode')->name('carryByWithoutCode');// 奖励统计-导出
463 464
             Route::post('delete/:id', 'Order/delete')->name('merchantStoreOrderDelete');
464 465
             Route::get('reconciliation/lst', 'Reconciliation/lst')->name('sysMerchantReconciliationLst');
465 466
             Route::get('reconciliation/mark/:id/form', 'Reconciliation/markForm')->name('merchantReconciliationMarkForm');
@@ -476,7 +477,6 @@ Route::group(config('admin.api_merchant_prefix') . '/', function () {
476 477
             Route::get('order_red_list', 'Order/order_red_list')->name('orderRedList');// 养老金打款凭证 列表
477 478
             Route::get('reward_list', 'Order/reward_list')->name('orderRedList');// 奖励统计
478 479
             Route::get('reward_excel', 'Order/reward_excel')->name('reward_excel');// 奖励统计-导出
479
-            Route::post('take', 'Order/take')->name('take');// 奖励统计-导出
480 480
         })->prefix('merchant.store.order.');
481 481
 
482 482
         //退款订单