Merge branch 'develop'
This commit is contained in:
commit
efcb34c40a
@ -97,10 +97,10 @@ class StoreOrderDao extends BaseDao
|
|||||||
$query->whereIn('StoreOrder.status', [0, 9]);
|
$query->whereIn('StoreOrder.status', [0, 9]);
|
||||||
break;
|
break;
|
||||||
case -2 :
|
case -2 :
|
||||||
$query->where('paid', 1)->whereNotIn('StoreOrder.status', [10, 11]);
|
$query->where('StoreOrder.paid', 1)->whereNotIn('StoreOrder.status', [10, 11]);
|
||||||
break;
|
break;
|
||||||
case 10 :
|
case 10 :
|
||||||
$query->where('paid', 1)->whereIn('StoreOrder.status', [10, 11]);
|
$query->where('StoreOrder.paid', 1)->whereIn('StoreOrder.status', [10, 11]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$query->where('StoreOrder.status', $where['status']);
|
$query->where('StoreOrder.status', $where['status']);
|
||||||
@ -108,7 +108,7 @@ class StoreOrderDao extends BaseDao
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) {
|
->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) {
|
||||||
$query->where('uid', $where['uid']);
|
$query->where('StoreOrder.uid', $where['uid']);
|
||||||
})
|
})
|
||||||
//待核销订单
|
//待核销订单
|
||||||
->when(isset($where['is_verify']) && $where['is_verify'], function ($query) use ($where) {
|
->when(isset($where['is_verify']) && $where['is_verify'], function ($query) use ($where) {
|
||||||
@ -178,7 +178,8 @@ class StoreOrderDao extends BaseDao
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
->when(isset($where['group_order_sn']) && $where['group_order_sn'] !== '', function ($query) use ($where) {
|
->when(isset($where['group_order_sn']) && $where['group_order_sn'] !== '', function ($query) use ($where) {
|
||||||
$query->join('StoreGroupOrder GO','StoreOrder.group_order_id = GO.group_order_id')->where('group_order_sn',$where['group_order_sn']);
|
$query->join('StoreGroupOrder GO','StoreOrder.group_order_id = GO.group_order_id')
|
||||||
|
->where('group_order_sn',$where['group_order_sn']);
|
||||||
})
|
})
|
||||||
->when(isset($where['keywords']) && $where['keywords'] !== '', function ($query) use ($where) {
|
->when(isset($where['keywords']) && $where['keywords'] !== '', function ($query) use ($where) {
|
||||||
$query->where(function ($query) use ($where) {
|
$query->where(function ($query) use ($where) {
|
||||||
|
@ -55,10 +55,14 @@ class StoreGroupOrderRepository extends BaseRepository
|
|||||||
* @author xaboy
|
* @author xaboy
|
||||||
* @day 2020/6/10
|
* @day 2020/6/10
|
||||||
*/
|
*/
|
||||||
public function getList(array $where, $page, $limit)
|
public function getList(array $where, $page, $limit, $source = 2)
|
||||||
{
|
{
|
||||||
$query = $this->search($where);
|
$query = $this->search($where);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
|
|
||||||
|
// 增加订单类型筛选 1 小组采购 2 普通商品
|
||||||
|
$query->where('source', $source);
|
||||||
|
|
||||||
$list = $query->with(['orderList' => function (Relation $query) {
|
$list = $query->with(['orderList' => function (Relation $query) {
|
||||||
$query->field('order_id,group_order_id,activity_type,pay_price')->with(['orderProduct','presellOrder']);
|
$query->field('order_id,group_order_id,activity_type,pay_price')->with(['orderProduct','presellOrder']);
|
||||||
}])->page($page, $limit)->order('create_time DESC')->select();
|
}])->page($page, $limit)->order('create_time DESC')->select();
|
||||||
|
@ -895,9 +895,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
) + ['allow_address' => !$allow_no_address, 'order_delivery_status' => $orderDeliveryStatus];
|
) + ['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;
|
$uid = $user->uid;
|
||||||
$orderInfo = $this->v2CartIdByOrderInfo($user, $cartId, $takes, $useCoupon, $useIntegral, $addressId, true);
|
$orderInfo = $this->v2CartIdByOrderInfo($user, $cartId, $takes, $useCoupon, $useIntegral, $addressId, true);
|
||||||
$order_model = $orderInfo['order_model'];
|
$order_model = $orderInfo['order_model'];
|
||||||
@ -978,6 +977,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
$total_extension_two = 0;
|
$total_extension_two = 0;
|
||||||
//计算佣金和赠送的优惠券
|
//计算佣金和赠送的优惠券
|
||||||
foreach ($merchantCart['list'] as &$cart) {
|
foreach ($merchantCart['list'] as &$cart) {
|
||||||
|
|
||||||
$cartIds[] = $cart['cart_id'];
|
$cartIds[] = $cart['cart_id'];
|
||||||
$giveCouponIds = array_merge($giveCouponIds, $cart['product']['give_coupon_ids'] ?: []);
|
$giveCouponIds = array_merge($giveCouponIds, $cart['product']['give_coupon_ids'] ?: []);
|
||||||
$cart['cost'] = $cart['productAttr']['cost'];
|
$cart['cost'] = $cart['productAttr']['cost'];
|
||||||
@ -1045,6 +1045,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
$cart['extension_two'] = $extension_two;
|
$cart['extension_two'] = $extension_two;
|
||||||
$total_extension_one = bcadd($total_extension_one, bcmul($extension_one, $cart['cart_num'], 2), 2);
|
$total_extension_one = bcadd($total_extension_one, bcmul($extension_one, $cart['cart_num'], 2), 2);
|
||||||
$total_extension_two = bcadd($total_extension_two, bcmul($extension_two, $cart['cart_num'], 2), 2);
|
$total_extension_two = bcadd($total_extension_two, bcmul($extension_two, $cart['cart_num'], 2), 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
unset($cart);
|
unset($cart);
|
||||||
|
|
||||||
@ -1089,7 +1090,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
'mark' => $mark[$merchantCart['mer_id']] ?? '',
|
'mark' => $mark[$merchantCart['mer_id']] ?? '',
|
||||||
'coupon_price' => bcadd($merchantCart['order']['coupon_price'], $merchantCart['order']['platform_coupon_price'], 2),
|
'coupon_price' => bcadd($merchantCart['order']['coupon_price'], $merchantCart['order']['platform_coupon_price'], 2),
|
||||||
'platform_coupon_price' => $merchantCart['order']['platform_coupon_price'],
|
'platform_coupon_price' => $merchantCart['order']['platform_coupon_price'],
|
||||||
'pay_type' => $pay_type
|
'pay_type' => $pay_type,
|
||||||
];
|
];
|
||||||
$allUseCoupon = array_merge($allUseCoupon, $merchantCart['order']['useCouponIds']);
|
$allUseCoupon = array_merge($allUseCoupon, $merchantCart['order']['useCouponIds']);
|
||||||
$orderList[] = $_order;
|
$orderList[] = $_order;
|
||||||
@ -1116,6 +1117,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
'integral' => $orderInfo['order_total_integral'],
|
'integral' => $orderInfo['order_total_integral'],
|
||||||
'integral_price' => $orderInfo['order_total_integral_price'],
|
'integral_price' => $orderInfo['order_total_integral_price'],
|
||||||
'give_integral' => $orderInfo['order_total_give_integral'],
|
'give_integral' => $orderInfo['order_total_give_integral'],
|
||||||
|
'source' => $source, // 增加订单来源 1 小组采购 2 普同商品
|
||||||
];
|
];
|
||||||
event('order.create.before', compact('groupOrder', 'orderList'));
|
event('order.create.before', compact('groupOrder', 'orderList'));
|
||||||
$group = Db::transaction(function () use ($ex, $user, $topUid, $spreadUid, $uid, $receipt_data, $cartIds, $allUseCoupon, $groupOrder, $orderList, $orderInfo) {
|
$group = Db::transaction(function () use ($ex, $user, $topUid, $spreadUid, $uid, $receipt_data, $cartIds, $allUseCoupon, $groupOrder, $orderList, $orderInfo) {
|
||||||
@ -1183,6 +1185,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
\think\facade\Log::record($groupOrder);
|
||||||
|
|
||||||
//创建订单
|
//创建订单
|
||||||
$groupOrder = $storeGroupOrderRepository->create($groupOrder);
|
$groupOrder = $storeGroupOrderRepository->create($groupOrder);
|
||||||
$bills = [];
|
$bills = [];
|
||||||
|
@ -1575,10 +1575,17 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
* @author xaboy
|
* @author xaboy
|
||||||
* @day 2020/6/10
|
* @day 2020/6/10
|
||||||
*/
|
*/
|
||||||
public function getList(array $where, $page, $limit)
|
public function getList(array $where, $page, $limit, $source = 2)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// $query->where('source', $source);
|
||||||
|
|
||||||
$query = $this->dao->search($where)->where('StoreOrder.is_del', 0);
|
$query = $this->dao->search($where)->where('StoreOrder.is_del', 0);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
|
|
||||||
|
// 增加订单类型筛选 1 小组采购 2 普通商品
|
||||||
|
$query->hasWhere('groupOrder', ['source' => $source]);
|
||||||
|
|
||||||
$list = $query->with([
|
$list = $query->with([
|
||||||
'orderProduct',
|
'orderProduct',
|
||||||
'presellOrder',
|
'presellOrder',
|
||||||
|
@ -86,9 +86,13 @@ class EnterCompany extends BaseController
|
|||||||
->where('is_fail', '=', 0)
|
->where('is_fail', '=', 0)
|
||||||
->where('is_del', '=', 0)
|
->where('is_del', '=', 0)
|
||||||
->column('cart_id');
|
->column('cart_id');
|
||||||
|
|
||||||
$cart_id_str = implode('|',$cart_id);
|
$cart_id_str = implode('|',$cart_id);
|
||||||
|
|
||||||
$list = app()->make(StoreOrderRepository::class)->getList2($where,$page,$limit,$cart_id_str);
|
$list = app()->make(StoreOrderRepository::class)->getList2($where,$page,$limit,$cart_id_str);
|
||||||
|
|
||||||
$data = app()->make(StoreOrderRepository::class)->userOrderNumber2($uid,$cart_id_str);
|
$data = app()->make(StoreOrderRepository::class)->userOrderNumber2($uid,$cart_id_str);
|
||||||
|
|
||||||
$list['all'] = $data['all'];
|
$list['all'] = $data['all'];
|
||||||
$list['orderPrice'] = $data['orderPrice'];
|
$list['orderPrice'] = $data['orderPrice'];
|
||||||
return app('json')->success($list);
|
return app('json')->success($list);
|
||||||
|
@ -88,7 +88,8 @@ class StoreOrder extends BaseController
|
|||||||
$payType = $this->request->param('pay_type');
|
$payType = $this->request->param('pay_type');
|
||||||
$post = (array)$this->request->param('post');
|
$post = (array)$this->request->param('post');
|
||||||
$is_dg = $this->request->param('is_dg',0);
|
$is_dg = $this->request->param('is_dg',0);
|
||||||
$source = (int)$this->request->param('source'); // 1 小组服务 2 普通来源
|
$source = $this->request->param('source'); // 1 小组服务 2 普通来源
|
||||||
|
$source = !isset($source)?2:$source; // 默认来源为2 普通商品订单
|
||||||
$isPc = $payType === 'pc';
|
$isPc = $payType === 'pc';
|
||||||
if ($isPc) {
|
if ($isPc) {
|
||||||
$payType = 'balance';
|
$payType = 'balance';
|
||||||
@ -147,9 +148,13 @@ class StoreOrder extends BaseController
|
|||||||
[$page, $limit] = $this->getPage();
|
[$page, $limit] = $this->getPage();
|
||||||
$where['status'] = $this->request->param('status');
|
$where['status'] = $this->request->param('status');
|
||||||
$where['search'] = $this->request->param('store_name');
|
$where['search'] = $this->request->param('store_name');
|
||||||
|
$source = $this->request->param('source');
|
||||||
|
$source = !isset($source)?2:$source; // 默认来源为2 普通商品订单
|
||||||
$where['uid'] = $this->request->uid();
|
$where['uid'] = $this->request->uid();
|
||||||
$where['paid'] = 1;
|
$where['paid'] = 1;
|
||||||
return app('json')->success($this->repository->getList($where, $page, $limit));
|
$where['source'] = $source;
|
||||||
|
|
||||||
|
return app('json')->success($this->repository->getList($where, $page, $limit, $source));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -188,7 +193,10 @@ class StoreOrder extends BaseController
|
|||||||
public function groupOrderList(StoreGroupOrderRepository $groupOrderRepository)
|
public function groupOrderList(StoreGroupOrderRepository $groupOrderRepository)
|
||||||
{
|
{
|
||||||
[$page, $limit] = $this->getPage();
|
[$page, $limit] = $this->getPage();
|
||||||
$list = $groupOrderRepository->getList(['uid' => $this->request->uid(), 'paid' => 0], $page, $limit);
|
$source = $this->request->param('source');
|
||||||
|
$source = !isset($source)?2:$source; // 默认来源为2 普通商品订单
|
||||||
|
|
||||||
|
$list = $groupOrderRepository->getList(['uid' => $this->request->uid(), 'paid' => 0], $page, $limit,$source);
|
||||||
return app('json')->success($list);
|
return app('json')->success($list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user