diff --git a/app/common/model/store/product/Product.php b/app/common/model/store/product/Product.php index 2aa5b0e5..52dac139 100644 --- a/app/common/model/store/product/Product.php +++ b/app/common/model/store/product/Product.php @@ -40,6 +40,10 @@ class Product extends BaseModel const IS_SHOW = 1; //上架 const IS_NOT_SHOW = 0; //下架 + + const TYPE_NORMAL = 0; //普通商品 + const TYPE_PURCHASE = 98; //采购商品 + /** * @Author:Qinii * @Date: 2020/5/8 diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index 75c56efc..20962a0f 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -925,7 +925,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository $extend = []; } $orderType = $orderInfo['order_type']; - if ($orderType && (count($orderInfo['order']) > 1 || ($orderType != 10 && count($orderInfo['order'][0]['list']) > 1))) { + if (!in_array($orderType, [98, 0]) && (count($orderInfo['order']) > 1 || ($orderType != 10 && count($orderInfo['order'][0]['list']) > 1))) { throw new ValidateException('活动商品请单独购买'); } @@ -941,7 +941,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository if (isset($receipt_data[$merchantCart['mer_id']]) && !$merchantCart['openReceipt']) throw new ValidateException('该店铺不支持开发票'); if ($pay_type == StoreGroupOrder::PAY_TYPE_CREDIT_BUY && !$merchantCart['credit_buy']) { - throw new ValidateException('该店铺不支持先货后款'); + throw new ValidateException("{$merchantCart['mer_name']}不支持先货后款"); } foreach ($merchantCart['list'] as $cart) { diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index 5bc6ecd3..97a88513 100644 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -723,10 +723,12 @@ class StoreOrderRepository extends BaseRepository public function takeAfter(StoreOrder $order, ?User $user) { Db::transaction(function () use ($user, $order) { - if ($user) $this->computed($order, $user); + if ($user && $order->pay_type != StoreGroupOrder::PAY_TYPE_CREDIT_BUY) $this->computed($order, $user); Queue::push(SendSmsJob::class, ['tempId' => 'ORDER_TAKE_SUCCESS', 'id' => $order->order_id]); Queue::push(SendSmsJob::class, ['tempId' => 'ADMIN_TAKE_DELIVERY_CODE', 'id' => $order->order_id]); - app()->make(MerchantRepository::class)->computedLockMoney($order); + if ($order->pay_type != StoreGroupOrder::PAY_TYPE_CREDIT_BUY) { + app()->make(MerchantRepository::class)->computedLockMoney($order); + } $order->save(); }); } diff --git a/app/controller/api/store/order/StoreOrder.php b/app/controller/api/store/order/StoreOrder.php index ed028c15..fb441cca 100644 --- a/app/controller/api/store/order/StoreOrder.php +++ b/app/controller/api/store/order/StoreOrder.php @@ -106,7 +106,7 @@ class StoreOrder extends BaseController return $orderCreateRepository->v2CreateOrder(array_search($payType, StoreOrderRepository::PAY_TYPE), $this->request->userInfo(), $cartId, $extend, $mark, $receipt_data, $takes, $couponIds, $useIntegral, $addressId, $post); }); - if ($groupOrder['pay_price'] == 0 || $payType == StoreGroupOrder::PAY_TYPE_CREDIT_BUY) { + if ($groupOrder['pay_price'] == 0 || $groupOrder['pay_type'] == StoreGroupOrder::PAY_TYPE_CREDIT_BUY) { $this->repository->paySuccess($groupOrder); return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]); }