采购订单允许多个商品
This commit is contained in:
parent
7115792191
commit
10d3db55ff
@ -40,6 +40,10 @@ class Product extends BaseModel
|
|||||||
|
|
||||||
const IS_SHOW = 1; //上架
|
const IS_SHOW = 1; //上架
|
||||||
const IS_NOT_SHOW = 0; //下架
|
const IS_NOT_SHOW = 0; //下架
|
||||||
|
|
||||||
|
const TYPE_NORMAL = 0; //普通商品
|
||||||
|
const TYPE_PURCHASE = 98; //采购商品
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:Qinii
|
* @Author:Qinii
|
||||||
* @Date: 2020/5/8
|
* @Date: 2020/5/8
|
||||||
|
@ -925,7 +925,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
$extend = [];
|
$extend = [];
|
||||||
}
|
}
|
||||||
$orderType = $orderInfo['order_type'];
|
$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('活动商品请单独购买');
|
throw new ValidateException('活动商品请单独购买');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -941,7 +941,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
if (isset($receipt_data[$merchantCart['mer_id']]) && !$merchantCart['openReceipt'])
|
if (isset($receipt_data[$merchantCart['mer_id']]) && !$merchantCart['openReceipt'])
|
||||||
throw new ValidateException('该店铺不支持开发票');
|
throw new ValidateException('该店铺不支持开发票');
|
||||||
if ($pay_type == StoreGroupOrder::PAY_TYPE_CREDIT_BUY && !$merchantCart['credit_buy']) {
|
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) {
|
foreach ($merchantCart['list'] as $cart) {
|
||||||
|
@ -723,10 +723,12 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
public function takeAfter(StoreOrder $order, ?User $user)
|
public function takeAfter(StoreOrder $order, ?User $user)
|
||||||
{
|
{
|
||||||
Db::transaction(function () use ($user, $order) {
|
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' => 'ORDER_TAKE_SUCCESS', 'id' => $order->order_id]);
|
||||||
Queue::push(SendSmsJob::class, ['tempId' => 'ADMIN_TAKE_DELIVERY_CODE', '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();
|
$order->save();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -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);
|
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);
|
$this->repository->paySuccess($groupOrder);
|
||||||
return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
return app('json')->status('success', '支付成功', ['order_id' => $groupOrder['group_order_id']]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user