更新未支付订单数及列表

This commit is contained in:
yaooo 2023-08-23 17:18:28 +08:00
parent faa2e16f7a
commit 470740b8da

View File

@ -589,7 +589,7 @@ class StoreOrderRepository extends BaseRepository
if ($product_type == 98) {
$isUser = 0;
}
$noPay = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(1))->whereRaw("StoreOrder.paid=0 or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
$noPay = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(1))->whereRaw("(StoreOrder.paid=0 and StoreOrder.pay_type!=8) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
$noPostage = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(2))->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
$noDeliver = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(3))->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
$noComment = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(4))->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
@ -849,7 +849,7 @@ class StoreOrderRepository extends BaseRepository
//1: 未支付 2: 未发货 3: 待收货 4: 待评价 5: 交易完成 6: 已退款 7: 已删除 8: 已支付
$all = $this->dao->search($where, $sysDel)->where($this->getOrderType(0))->count();
$statusAll = $all;
$unpaid = $this->dao->search($where, $sysDel)->where($this->getOrderType(1))->whereRaw("StoreOrder.paid=0 or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->count();
$unpaid = $this->dao->search($where, $sysDel)->where($this->getOrderType(1))->whereRaw("(StoreOrder.paid=0 and StoreOrder.pay_type!=8) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->count();
$unshipped = $this->dao->search($where, $sysDel)->where($this->getOrderType(2))->count();
$untake = $this->dao->search($where, $sysDel)->where($this->getOrderType(3))->count();
$unevaluate = $this->dao->search($where, $sysDel)->where($this->getOrderType(4))->where('paid', 1)->where('pay_type', '<>', StoreGroupOrder::PAY_TYPE_CREDIT_BUY)->count();
@ -1545,7 +1545,7 @@ class StoreOrderRepository extends BaseRepository
$query->where('paid', 1)->where('pay_type', '<>', StoreGroupOrder::PAY_TYPE_CREDIT_BUY);
})
->when($status == 1, function ($query) {
$query->whereRaw("StoreOrder.paid=0 or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)");
$query->whereRaw("(StoreOrder.paid=0 and StoreOrder.pay_type!=8) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)");
})
->with([
'orderProduct',
@ -1726,7 +1726,13 @@ class StoreOrderRepository extends BaseRepository
{
$status = $where['status'] ?? '';
unset($where['status']);
$query = $this->dao->search($where)->where($this->getOrderType($status))->where('StoreOrder.is_del', 0);
// 未支付订单
if ($status == 1) {
$query = $this->dao->search($where)->where($this->getOrderType($status))->whereRaw("(StoreOrder.paid=0 and StoreOrder.pay_type!=8) or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->where('StoreOrder.is_del', 0);
} else {
$query = $this->dao->search($where)->where($this->getOrderType($status))->where('StoreOrder.is_del', 0);
}
$count = $query->count();
$list = $query->with([
'orderProduct',