north 7 rokov pred
rodič
commit
57df54d086

+ 13 - 3
www/protected/controllers/JRecordController.php

@@ -12,6 +12,7 @@ class JRecordController extends AdminController
     public function actionIndex()
     {
         $status = CommonFn::getComboboxData(JRecord::$status_options, 100, true, 100);
+        $type = CommonFn::getComboboxData(Gift::$type_options, 100, true, 100);
         $tmp = Business::model()->findAll();
 //        foreach ($tmp as $k) {
 //            $k->delete();
@@ -30,7 +31,8 @@ class JRecordController extends AdminController
 //        }
 
         $this->render('index',array(
-            'status' => $status
+            'status' => $status,
+            'type' => $type,
         ));
 
     }
@@ -124,9 +126,10 @@ class JRecordController extends AdminController
     {
         $start_time = Yii::app()->request->getParam('start_time','');
         $end_time = Yii::app()->request->getParam('end_time','');
+        $type = (int)Yii::app()->request->getParam('type','');
         $criteria = new EMongoCriteria();
-        $criteria->addCond('time','>=',strtotime(date('Y-m-d 00:00:00',strtotime($start_time))));
-        $criteria->addCond('time','<=',strtotime(date('Y-m-d 23:59:59',strtotime($start_time))));
+        $criteria->addCond('time','>=',strtotime(date('Y-m-d H:i:s',strtotime($start_time))));
+        $criteria->addCond('time','<=',strtotime(date('Y-m-d H:i:s',strtotime($end_time))));
         $cursor = JRecord::model()->findAll($criteria);
 
 
@@ -136,6 +139,13 @@ class JRecordController extends AdminController
             $item->status = 2;
             $item->save();
         }
+        if ($type != 100) {
+            foreach ($parsedRows as &$row) {
+                if ($row['type'] != $type) {
+                    unset($row);
+                }
+            }
+        }
 
         $res=Service::factory('JRecordService')->push($parsedRows);
     }

+ 1 - 0
www/protected/modules/j/models/JRecord.php

@@ -68,6 +68,7 @@ class JRecord extends MongoAr
         $newRow['pwd'] = $coupon->pwd;
         $newRow['gift_name'] = $gift->title;
         $newRow['gift_type'] = Gift::$type_options[$gift->type]['name'];
+        $newRow['type'] = $gift->type;
         $newRow['gift_id'] = $gift->gift_num;
         $newRow['address'] = CommonFn::get_val_if_isset($row,'address','');
         $newRow['user_id'] = CommonFn::get_val_if_isset($row,'user_id','');

+ 17 - 1
www/protected/views/jRecord/index.php

@@ -25,6 +25,13 @@
             <div style="margin: 3px 2px;padding:5px;border: 1px solid #95B8E7;">
                 开始 <input type="text" id="server_start_time" />
                 结束 <input type="text" id="server_end_time" />
+                <div class="tb_line">
+                    <span class="tb_label">类型: </span>
+                    <input id="filter_type" />
+                    <!--                <div class="left">-->
+                    <!--                    查询:<input id="ss" />-->
+                    <!--                </div>-->
+                </div>
                 <a href="#" class='easyui-linkbutton' iconCls="icon-add" plain="true" onclick="export_order();return false;">导出提货记录 </a>
 
             </div>
@@ -301,6 +308,7 @@
   var jq_dg_content = $('#dg_content');
   var jq_content_form = $('#content_form');
   var jq_filter_status = $('#filter_status');
+  var jq_filter_type = $('#filter_type');
   var module_router = site_root + '/index.php?r=JRecord';
   var jq_setStatus = $('#setStatus');
   var jq_setStatus_add = $('#setStatus_add');
@@ -310,6 +318,7 @@
   var jq_add_dialog = $('#add_dialog');
   var jq_add_form = $('#add_form');
   var status_data = <?php echo json_encode($status); ?>;
+  var type_data = <?php echo json_encode($type); ?>;
   var jq_set_precedence = $('#set_precedence');
   var jq_action_info = $('#action_info');
   var jq_acc = $('#acc_container');
@@ -371,6 +380,11 @@
         search_content();
       }
     });
+    jq_filter_type.combobox({
+      width: 100,
+      data: status_data,
+      editable: false
+    });
 
 
     var p_width = parseInt(w_width / 2);
@@ -657,9 +671,11 @@
     if (!start_time && !end_time) {
       alert('请选择时间');
     } else {
-      window.location.href = module_router+'/OutputExcel&start_time='+start_time+'&end_time='+end_time;
+      const type = jq_filter_type.combobox('getValue');
+      window.location.href = module_router+'/OutputExcel&start_time='+start_time+'&end_time='+end_time + '&type=' + type;
       $('#server_start_time').datebox('setValue','');
       $('#server_end_time').datebox('setValue','');
+      jq_filter_type.combobox('setValue',100);
     }
 
   }