Jelajahi Sumber

Merge branch 'raccount' of 39.97.239.116:gyfl/xyzshop into raccount

stanley-king 2 tahun lalu
induk
melakukan
ebd27a888a
2 mengubah file dengan 56 tambahan dan 1 penghapusan
  1. 49 0
      admin/control/retail.php
  2. 7 1
      admin/templates/default/retail.list.php

+ 49 - 0
admin/control/retail.php

@@ -31,4 +31,53 @@ class retailControl extends SystemControl
         $retail_mod->dispose_commit($cond);
         showMessage('操作成功','index.php?act=retail&op=index');
     }
+
+    public function retail_exportOp()
+    {
+        $retail_mod = Model('retail');
+        $cond['state'] = retailModel::state_init;
+        $retail_list = $retail_mod->getList($cond, 1000, '*', 'create_time asc');
+        $this->createExcel($retail_list);
+    }
+
+    private function createExcel($data)
+    {
+        Language::read('export');
+        import('libraries.excel');
+        $excel_obj = new Excel();
+        $excel_data = array();
+        //设置样式
+        $excel_obj->setStyle(array('id' => 's_title', 'Font' => array('FontName' => '宋体', 'Size' => '12', 'Bold' => '1')));
+        //header
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '序号');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '单号');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '渠道');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '省份');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '城市');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '区域');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '详细地址');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '联系人');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '联系电话');
+        $excel_data[0][] = array('styleid' => 's_title', 'data' => '身份证号码');
+
+        //data
+        foreach ($data as $k => $v) {
+            $tmp = array();
+            $tmp[] = array('data' => $k+1);
+            $tmp[] = array('data' => $v['retail_sn']);
+            $tmp[] = array('data' => $v['channel_code']);
+            $tmp[] = array('data' => $v['province']);
+            $tmp[] = array('data' => $v['city']);
+            $tmp[] = array('data' => $v['area']);
+            $tmp[] = array('data' => $v['address']);
+            $tmp[] = array('data' => $v['applicant_name']);
+            $tmp[] = array('data' => $v['contact_phone']);
+            $tmp[] = array('data' => $v['id_card']);
+            $excel_data[] = $tmp;
+        }
+        $excel_data = $excel_obj->charset($excel_data, CHARSET);
+        $excel_obj->addArray($excel_data);
+        $excel_obj->addWorksheet($excel_obj->charset(L('exp_od_order'), CHARSET));
+        $excel_obj->generateXML('retail');
+    }
 }

+ 7 - 1
admin/templates/default/retail.list.php

@@ -89,6 +89,9 @@
                     <a href="#" class="btns"  id="dispose">
                         <span><i class="icon-edit"></i>批量标记为已提交</span>
                     </a>
+                    <a href="#" class="btns"  id="export">
+                        <span><i class="icon-edit"></i>导出未提交数据</span>
+                    </a>
                 </td>
             </tr>
         </table>
@@ -214,7 +217,6 @@
             return arr.join(",")
         }
 
-        //批量失败
         $('#dispose').click(function () {
             layer.confirm('您确定要批量处理为已提交吗', {
                 btn: ['确定', '取消'],
@@ -227,6 +229,10 @@
             });
         })
 
+        $('#export').click(function () {
+            window.location.href = `index.php?act=retail&op=retail_export`
+        })
+
         // 表格hover时背景
         $('.trFlex').each(function () {
             let data_color = $(this).attr('data-timeout_State');