Kaynağa Gözat

免发货流程

shish 6 yıl önce
ebeveyn
işleme
0cdc725348

+ 10 - 2
app/business/controllers/OrderController.php

@@ -6,6 +6,8 @@ use biz\merchant\services\MerchantAssetService;
 use biz\merchant\services\MerchantExtendService;
 use biz\merchant\services\MerchantService;
 use biz\merchant\services\ShopService;
+use biz\order\classes\OrderClass;
+use biz\order\classes\OrderSendClass;
 use biz\order\services\OrderService;
 use biz\saas\services\RegionService;
 use biz\user\services\UserService;
@@ -123,6 +125,12 @@ class OrderController extends BaseController
 	public function actionWithoutSend()
 	{
 		$id = Yii::$app->request->get('id');
+		$order = OrderService::getById($id);
+		OrderService::valid($order, $this->merchantId);
+		//配送流程变更
+		OrderSendClass::withoutSend($id);
+		//订单状态变更
+		OrderClass::complete($id);
 		util::complete('操作成功');
 	}
 	
@@ -150,7 +158,7 @@ class OrderController extends BaseController
 		$out = ['freight' => $freight, 'shop' => $shop, 'region' => $regionTree, 'txMapKey' => $mapKey, 'merchant' => $this->merchant];
 		util::success($out);
 	}
-
+	
 	//配送单 shish 2020.2.29
 	public function actionDeliver()
 	{
@@ -174,5 +182,5 @@ class OrderController extends BaseController
 		];
 		util::success($data);
 	}
-
+	
 }

+ 20 - 1
biz/order/classes/OrderClass.php

@@ -13,6 +13,19 @@ class OrderClass extends BaseClass
 	
 	public static $baseFile = '\biz\order\models\Order';
 	
+	//完成
+	const ORDER_STATUS_COMPLETE = 5;
+	//已取消
+	const ORDER_STATUS_CANCEL = 4;
+	//待通知
+	const ORDER_STATUS_UN_NOTICE = 3;
+	//配送中
+	const ORDER_STATUS_SENDING = 2;
+	//待配送
+	const ORDER_STATUS_UN_SEND = 1;
+	//待付款
+	const ORDER_STATUS_UN_PAY = 0;
+
 	//添加订单 shish 2019.12.5
 	public static function addOrder($data)
 	{
@@ -71,7 +84,7 @@ class OrderClass extends BaseClass
 		$order['goodsInfoList'] = OrderGoodsClass::getGoodsListById($id);
 		return $order;
 	}
-
+	
 	//返回随机优惠金额 shish 2019.9.12
 	public static function getRandDiscount($amount)
 	{
@@ -98,4 +111,10 @@ class OrderClass extends BaseClass
 		return $rand / 10;
 	}
 
+	//订单完成 shish 2020.3.12
+	public static function complete($id)
+	{
+		self::updateById($id, ['status' => self::ORDER_STATUS_COMPLETE]);
+	}
+
 }

+ 14 - 2
biz/order/classes/OrderSendClass.php

@@ -45,12 +45,24 @@ class OrderSendClass extends BaseClass
 	//当前待执行的动作 shish 2019.12.16
 	public static function toDoActionId($id)
 	{
-		$action = self::getByCondition(['orderId'=>$id],false,'inTurn DESC');
+		$action = self::getByCondition(['orderId' => $id], false, 'inTurn DESC');
 		$actionId = 0;
 		if (empty($action['finishTime'])) {
 			$actionId = $action['actionId'];
 		}
 		return $actionId;
 	}
-
+	
+	//免发货流程的处理 shish 2020.3.12
+	public static function withoutSend($id)
+	{
+		$actionList = self::$action;
+		$time = time();
+		foreach ($actionList as $actionId => $action) {
+			$inTurn = $action['inTurn'];
+			$data = ['actionId' => $actionId, 'orderId' => $id, 'finishTime' => $time, 'addTime' => $time, 'inTurn' => $inTurn];
+			self::add($data);
+		}
+	}
+	
 }

+ 1 - 1
biz/order/services/OrderService.php

@@ -98,7 +98,7 @@ class OrderService extends BaseService
 			util::fail('订单无效');
 		}
 		if ($order['merchantId'] != $merchantId) {
-			util::fail('您没有权限操作');
+			util::fail('不是您的客户订单');
 		}
 	}