获取待付款订单增加来源

This commit is contained in:
monanxiao 2023-03-10 14:41:26 +08:00
parent 2b936eab29
commit 4d95c182a6
3 changed files with 12 additions and 5 deletions

View File

@ -55,10 +55,14 @@ class StoreGroupOrderRepository extends BaseRepository
* @author xaboy
* @day 2020/6/10
*/
public function getList(array $where, $page, $limit)
public function getList(array $where, $page, $limit, $source = 2)
{
$query = $this->search($where);
$count = $query->count();
// 增加订单类型筛选 1 小组采购 2 普通商品
$query->where('source', $source);
$list = $query->with(['orderList' => function (Relation $query) {
$query->field('order_id,group_order_id,activity_type,pay_price')->with(['orderProduct','presellOrder']);
}])->page($page, $limit)->order('create_time DESC')->select();

View File

@ -895,9 +895,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
) + ['allow_address' => !$allow_no_address, 'order_delivery_status' => $orderDeliveryStatus];
}
public function v2CreateOrder(int $pay_type, $user, array $cartId, array $extend, array $mark, array $receipt_data, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, array $post, int $source)
public function v2CreateOrder(int $pay_type, $user, array $cartId, array $extend, array $mark, array $receipt_data, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, array $post, $source)
{
$uid = $user->uid;
$orderInfo = $this->v2CartIdByOrderInfo($user, $cartId, $takes, $useCoupon, $useIntegral, $addressId, true);
$order_model = $orderInfo['order_model'];
@ -1089,7 +1088,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
'mark' => $mark[$merchantCart['mer_id']] ?? '',
'coupon_price' => bcadd($merchantCart['order']['coupon_price'], $merchantCart['order']['platform_coupon_price'], 2),
'platform_coupon_price' => $merchantCart['order']['platform_coupon_price'],
'pay_type' => $pay_type
'pay_type' => $pay_type,
];
$allUseCoupon = array_merge($allUseCoupon, $merchantCart['order']['useCouponIds']);
$orderList[] = $_order;
@ -1116,6 +1115,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
'integral' => $orderInfo['order_total_integral'],
'integral_price' => $orderInfo['order_total_integral_price'],
'give_integral' => $orderInfo['order_total_give_integral'],
'source' => $source, // 增加订单来源 1 小组采购 2 普同商品
];
event('order.create.before', compact('groupOrder', 'orderList'));
$group = Db::transaction(function () use ($ex, $user, $topUid, $spreadUid, $uid, $receipt_data, $cartIds, $allUseCoupon, $groupOrder, $orderList, $orderInfo) {
@ -1183,6 +1183,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
]);
}
\think\facade\Log::record($groupOrder);
//创建订单
$groupOrder = $storeGroupOrderRepository->create($groupOrder);
$bills = [];

View File

@ -188,7 +188,8 @@ class StoreOrder extends BaseController
public function groupOrderList(StoreGroupOrderRepository $groupOrderRepository)
{
[$page, $limit] = $this->getPage();
$list = $groupOrderRepository->getList(['uid' => $this->request->uid(), 'paid' => 0], $page, $limit);
$source = $this->request->param('source');
$list = $groupOrderRepository->getList(['uid' => $this->request->uid(), 'paid' => 0], $page, $limit,$source);
return app('json')->success($list);
}