lowkeyman пре 1 месец
родитељ
комит
f994559918

+ 45 - 22
admin/control/ordersendlist.php

@@ -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());

+ 1 - 0
admin/language/zh_cn/core_lang_index.php

@@ -52,6 +52,7 @@ $lang['order_state_pay'] = '待发货';
 $lang['order_state_send'] = '待收货';
 $lang['order_state_success'] = '交易完成';
 $lang['order_state_eval'] = '已评价';
+$lang['order_state_buyback'] = '已返销';
 
 
 

+ 5 - 0
admin/templates/default/monitor_transfer.php

@@ -122,8 +122,11 @@
                 <td>
                     <select name="order_state" class="querySelect order_state">
                         <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                        <option value="-1" <?php if ($_GET['order_state'] == '-1') { ?>selected<?php } ?>><?php echo $lang['nc_all']; ?></option>
                         <option value="30" <?php if ($_GET['order_state'] == '30') { ?>selected<?php } ?>><?php echo $lang['order_state_send']; ?></option>
+                        <option value="40" <?php if ($_GET['order_state'] == '40') { ?>selected<?php } ?>><?php echo $lang['order_state_success']; ?></option>
                         <option value="0" <?php if ($_GET['order_state'] == '0') { ?>selected<?php } ?>><?php echo $lang['order_state_cancel']; ?></option>
+                        <option value="-2" <?php if ($_GET['order_state'] == '-2') { ?>selected<?php } ?>><?php echo $lang['order_state_buyback']; ?></option>
                     </select>
                 </td>
 
@@ -275,6 +278,7 @@
             <th class="align-center">当前耗时</th>
             <th class="align-center">总耗时</th>
             <th class="align-center">订单状态</th>
+            <th class="align-center">返销状态</th>
             <th class="align-center">通道质量</th>
             <th class="align-left">失败原因</th>
             <th class="align-left">商家单号</th>
@@ -342,6 +346,7 @@
                         <?php } ?>
                     </td>
                     <td class="align-center"><?php echo orderState($order); ?></td>
+                    <td class="align-center"><?php echo $order['buyback'] === true ? '已反销': '/';?></td>
                     <td class="align-center"><?php echo $order['quality_text']; ?></td>
                     <td class="align-left"><?php echo $order['err_msg']; ?></td>
                     <td class="align-left"><?php echo $order['mch_order']; ?></td>