更新订单统计及列表
This commit is contained in:
parent
6dcfc634ef
commit
cca62dcb43
@ -99,30 +99,22 @@ class StoreOrderDao extends BaseDao
|
|||||||
// 12表示信用购
|
// 12表示信用购
|
||||||
switch ($where['status']) {
|
switch ($where['status']) {
|
||||||
case 0 :
|
case 0 :
|
||||||
$query->where('StoreOrder.paid', 1)->whereIn('StoreOrder.status', [0, 9]);
|
$query->whereIn('StoreOrder.status', [0, 9]);
|
||||||
break;
|
break;
|
||||||
case 1 :
|
|
||||||
$query->where('paid', 1)->where('StoreOrder.status', 1);
|
|
||||||
break;
|
|
||||||
case 2 :
|
|
||||||
$query->where('StoreOrder.paid', 1)->where('StoreOrder.status', 2)->where('pay_type', '<>', StoreGroupOrder::PAY_TYPE_CREDIT_BUY);
|
|
||||||
break;
|
|
||||||
case 3 :
|
|
||||||
$query->where('paid', 1)->where('StoreOrder.status', 1);
|
|
||||||
break;
|
|
||||||
case -1 :
|
|
||||||
$query->where('paid', 0)->whereIn('StoreOrder.status', [0, 9, 12]);
|
|
||||||
case -2 :
|
case -2 :
|
||||||
$query->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;
|
||||||
|
case 2 :
|
||||||
|
$query->where('StoreOrder.paid', 1)->where('StoreOrder.status', $where['status'])->where('pay_type', '<>', StoreGroupOrder::PAY_TYPE_CREDIT_BUY);
|
||||||
break;
|
break;
|
||||||
case 20 :
|
case 20 :
|
||||||
$query->where('paid', 1)->whereIn('StoreOrder.status', [2, 3]);
|
$query->where('StoreOrder.paid', 1)->whereIn('StoreOrder.status', [2, 3]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$query->where('paid', 1)->where('StoreOrder.status', $where['status']);
|
$query->where('StoreOrder.status', $where['status']);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -585,14 +585,13 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
if ($product_type == 98) {
|
if ($product_type == 98) {
|
||||||
$isUser = 0;
|
$isUser = 0;
|
||||||
}
|
}
|
||||||
$noPay = $this->dao->search(['uid' => $uid, 'status' => -1, 'is_user' => $isUser])->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))->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
|
||||||
$noPostage = $this->dao->search(['uid' => $uid, 'status' => 0, 'is_user' => $isUser])->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, 'status' => 1, 'is_user' => $isUser])->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, 'status' => 2, 'is_user' => $isUser])->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();
|
||||||
$done = $this->dao->search(['uid' => $uid, 'status' => 3, 'is_user' => $isUser])->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
|
$done = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(5))->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
|
||||||
$refund = StoreRefundOrder::alias('t1')->join('store_order t2', 't1.order_id=t2.order_id')->where('t1.uid', $uid)->where('t1.status', 3)->where('t2.activity_type', $product_type)->count();
|
$refund = StoreRefundOrder::alias('t1')->join('store_order t2', 't1.order_id=t2.order_id')->where('t1.uid', $uid)->where('t1.status', 3)->where('t2.activity_type', $product_type)->count();
|
||||||
//$all = $this->dao->search(['uid' => $uid, 'status' => -2,'is_user' => 1])->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->count();
|
$orderPrice = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where($this->getOrderType(8))->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->sum('pay_price');
|
||||||
$orderPrice = $this->dao->search(['uid' => $uid, 'paid' => 1, 'is_user' => $isUser])->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->sum('pay_price');
|
|
||||||
$orderCount = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
|
$orderCount = $this->dao->search(['uid' => $uid, 'is_user' => $isUser])->where('activity_type', $product_type)->where('StoreOrder.is_del', 0)->fetchSql(false)->count();
|
||||||
return compact('noComment', 'done', 'refund', 'noDeliver', 'noPay', 'noPostage', 'orderPrice', 'orderCount');
|
return compact('noComment', 'done', 'refund', 'noDeliver', 'noPay', 'noPostage', 'orderPrice', 'orderCount');
|
||||||
}
|
}
|
||||||
@ -824,7 +823,7 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
if ($orderType === 0) $where['order_type'] = 0; //普通订单
|
if ($orderType === 0) $where['order_type'] = 0; //普通订单
|
||||||
if ($orderType === 1) $where['take_order'] = 1; //已核销订单
|
if ($orderType === 1) $where['take_order'] = 1; //已核销订单
|
||||||
if ($product_type!=0) $where['product_type'] = $product_type; //商品属性
|
if ($product_type!=0) $where['product_type'] = $product_type; //商品属性
|
||||||
//1: 未支付 2: 未发货 3: 待收货 4: 待评价 5: 交易完成 6: 已退款 7: 已删除
|
//1: 未支付 2: 未发货 3: 待收货 4: 待评价 5: 交易完成 6: 已退款 7: 已删除 8: 已支付
|
||||||
$all = $this->dao->search($where, $sysDel)->where($this->getOrderType(0))->count();
|
$all = $this->dao->search($where, $sysDel)->where($this->getOrderType(0))->count();
|
||||||
$statusAll = $all;
|
$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 or (StoreOrder.paid=1 and StoreOrder.pay_type=8 and StoreOrder.status=2)")->count();
|
||||||
@ -874,6 +873,7 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
$param['StoreOrder.is_del'] = 0;
|
$param['StoreOrder.is_del'] = 0;
|
||||||
switch ($status) {
|
switch ($status) {
|
||||||
case 1:
|
case 1:
|
||||||
|
$param['StoreOrder.paid'] = 0;
|
||||||
break; // 未支付
|
break; // 未支付
|
||||||
case 2:
|
case 2:
|
||||||
$param['StoreOrder.paid'] = 1;
|
$param['StoreOrder.paid'] = 1;
|
||||||
@ -893,8 +893,10 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
break; // 已退款
|
break; // 已退款
|
||||||
case 7:
|
case 7:
|
||||||
$param['StoreOrder.is_del'] = 1;
|
$param['StoreOrder.is_del'] = 1;
|
||||||
break; // 待核销
|
break; // 待核销 已删除
|
||||||
break; // 已删除
|
case 8:
|
||||||
|
$param['StoreOrder.paid'] = 1;
|
||||||
|
break; // 已支付
|
||||||
default:
|
default:
|
||||||
unset($param['StoreOrder.is_del']);
|
unset($param['StoreOrder.is_del']);
|
||||||
break; //全部
|
break; //全部
|
||||||
@ -1699,7 +1701,9 @@ class StoreOrderRepository extends BaseRepository
|
|||||||
*/
|
*/
|
||||||
public function getList(array $where, $page, $limit)
|
public function getList(array $where, $page, $limit)
|
||||||
{
|
{
|
||||||
$query = $this->dao->search($where)->where('StoreOrder.is_del', 0);
|
$status = $where['status'] ?? '';
|
||||||
|
unset($where['status']);
|
||||||
|
$query = $this->dao->search($where)->where($this->getOrderType($status))->where('StoreOrder.is_del', 0);
|
||||||
$count = $query->count();
|
$count = $query->count();
|
||||||
$list = $query->with([
|
$list = $query->with([
|
||||||
'orderProduct',
|
'orderProduct',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user