|
@@ -223,13 +223,6 @@ class ordersendlistControl extends SystemControl
|
|
|
|
|
|
$base_cond['refill_order.inner_status'] = 0;
|
|
|
|
|
|
- if (in_array($_GET['order_state'], ['0', '10', '20', '30', '40'])) {
|
|
|
- $base_cond['vr_order.order_state'] = intval($_GET['order_state']);
|
|
|
- }
|
|
|
- else {
|
|
|
- $base_cond['vr_order.order_state'] = ['in', [ORDER_STATE_CANCEL, ORDER_STATE_SEND]];
|
|
|
- }
|
|
|
-
|
|
|
$all_mchids = $this->getAllTransferMchid();
|
|
|
if (!empty($_GET['mchid'])) {
|
|
|
$base_cond['refill_order.mchid'] = $_GET['mchid'];
|
|
@@ -282,8 +275,22 @@ class ordersendlistControl extends SystemControl
|
|
|
$buyback_list = $mod_buyback->getAllBuybackOrder($buyback_cond, 'distinct refill_order.mch_order');
|
|
|
$buyback_mch_orders = array_column($buyback_list, 'mch_order');
|
|
|
|
|
|
- if (!empty($buyback_mch_orders)) {
|
|
|
- $base_cond['refill_order.mch_order'] = ['not in', $buyback_mch_orders];
|
|
|
+ $order_state = $_GET['order_state'];
|
|
|
+ if ($order_state === '-2' && !empty($buyback_mch_orders))
|
|
|
+ {
|
|
|
+ $base_cond['refill_order.mch_order'] = ['in', $buyback_mch_orders];
|
|
|
+ }
|
|
|
+ else if (in_array($_GET['order_state'], ['0', '30', '40']))
|
|
|
+ {
|
|
|
+ $base_cond['vr_order.order_state'] = intval($_GET['order_state']);
|
|
|
+ }
|
|
|
+ else if (empty($order_state))
|
|
|
+ { //没选择订单状态,默认只显示充值中和已取消(未返销)
|
|
|
+ $base_cond['vr_order.order_state'] = ['in', [ORDER_STATE_CANCEL, ORDER_STATE_SEND]];
|
|
|
+
|
|
|
+ if (!empty($buyback_mch_orders)) {
|
|
|
+ $base_cond['refill_order.mch_order'] = ['not in', $buyback_mch_orders];
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (!empty($_GET['export'])) {
|
|
@@ -291,22 +298,38 @@ class ordersendlistControl extends SystemControl
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- $cur_time = time();
|
|
|
- $order_by = 'refill_order.order_time desc';
|
|
|
- $order_list = Model('')->table('refill_order,vr_order,merchant')
|
|
|
- ->join('inner,inner')
|
|
|
- ->on('refill_order.order_id=vr_order.order_id,refill_order.mchid=merchant.mchid')
|
|
|
- ->field("refill_order.*,vr_order.order_state,({$cur_time} - refill_order.order_time - merchant.time_out) as mtime_out")
|
|
|
- ->where($base_cond)
|
|
|
- ->order($order_by)
|
|
|
- ->select();
|
|
|
-
|
|
|
- $merchant_list = $merchants_getter($all_mchids);
|
|
|
- if(!empty($order_list))
|
|
|
+ if ($order_state === '-2' && empty($buyback_mch_orders))
|
|
|
+ { //仅查询返销,不存在返销数据
|
|
|
+ $order_list = [];
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- $order_list = $this->orderFormat($order_list, $merchant_list);
|
|
|
+ $cur_time = time();
|
|
|
+ $order_by = 'refill_order.order_time desc';
|
|
|
+ $order_list = Model('')->table('refill_order,vr_order,merchant')
|
|
|
+ ->join('inner,inner')
|
|
|
+ ->on('refill_order.order_id=vr_order.order_id,refill_order.mchid=merchant.mchid')
|
|
|
+ ->field("refill_order.*,vr_order.order_state,({$cur_time} - refill_order.order_time - merchant.time_out) as mtime_out")
|
|
|
+ ->where($base_cond)
|
|
|
+ ->order($order_by)
|
|
|
+ ->select();
|
|
|
+
|
|
|
+ $merchant_list = $merchants_getter($all_mchids);
|
|
|
+ if(!empty($order_list))
|
|
|
+ {
|
|
|
+ $order_list = $this->orderFormat($order_list, $merchant_list);
|
|
|
+ foreach ($order_list as $key => $item)
|
|
|
+ {
|
|
|
+ if (in_array($item['mch_order'], $buyback_mch_orders)) {
|
|
|
+ $order_list[$key]['buyback'] = true;
|
|
|
+ } else {
|
|
|
+ $order_list[$key]['buyback'] = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
Tpl::output('order_list', $order_list);
|
|
|
Tpl::output('merchant_list', $merchant_list);
|
|
|
Tpl::output('except_stat', $this->except_stat());
|