|
@@ -19,11 +19,13 @@ class OrderController extends AdminBaseController |
|
@@ -19,11 +19,13 @@ class OrderController extends AdminBaseController |
19
|
protected $order_model;
|
19
|
protected $order_model;
|
20
|
protected $option_table;
|
20
|
protected $option_table;
|
21
|
protected $sort_model;
|
21
|
protected $sort_model;
|
|
|
22
|
+ protected $order_sort_table;
|
22
|
public function _initialize()
|
23
|
public function _initialize()
|
23
|
{
|
24
|
{
|
24
|
$this->table = 'Order';
|
25
|
$this->table = 'Order';
|
25
|
$this->order_model = new OrderModel();
|
26
|
$this->order_model = new OrderModel();
|
26
|
$this->option_table = 'OrderOption';
|
27
|
$this->option_table = 'OrderOption';
|
|
|
28
|
+ $this->order_sort_table = 'OrderSort';
|
27
|
|
29
|
|
28
|
// 订单字段类型定义
|
30
|
// 订单字段类型定义
|
29
|
$this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}">
|
31
|
$this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}">
|
|
@@ -83,6 +85,7 @@ class OrderController extends AdminBaseController |
|
@@ -83,6 +85,7 @@ class OrderController extends AdminBaseController |
83
|
</div>';
|
85
|
</div>';
|
84
|
}
|
86
|
}
|
85
|
|
87
|
|
|
|
88
|
+
|
86
|
/**
|
89
|
/**
|
87
|
* 电子订单列表
|
90
|
* 电子订单列表
|
88
|
* @adminMenu(
|
91
|
* @adminMenu(
|
|
@@ -134,7 +137,7 @@ class OrderController extends AdminBaseController |
|
@@ -134,7 +137,7 @@ class OrderController extends AdminBaseController |
134
|
$where['create_time'] = ['<= time', $endTime];
|
137
|
$where['create_time'] = ['<= time', $endTime];
|
135
|
}
|
138
|
}
|
136
|
}
|
139
|
}
|
137
|
- $list = Db::name('order_view')->where($where)->paginate(10);
|
140
|
+ $list = $this->singleData('order_view',$where,2,[],10);
|
138
|
$list->appends($param);
|
141
|
$list->appends($param);
|
139
|
$this->assign('list',$list->items());
|
142
|
$this->assign('list',$list->items());
|
140
|
$this->assign('page',$list->render());
|
143
|
$this->assign('page',$list->render());
|
|
@@ -146,7 +149,7 @@ class OrderController extends AdminBaseController |
|
@@ -146,7 +149,7 @@ class OrderController extends AdminBaseController |
146
|
$this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
|
149
|
$this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
|
147
|
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
|
150
|
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
|
148
|
// 订单类型查询
|
151
|
// 订单类型查询
|
149
|
- $sortList = Db::name('OrderSort')->where(['delete_time'=>0])->select()->toArray();
|
152
|
+ $sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
|
150
|
$this->assign('sortList',$sortList);
|
153
|
$this->assign('sortList',$sortList);
|
151
|
return $this->fetch();
|
154
|
return $this->fetch();
|
152
|
}
|
155
|
}
|
|
@@ -199,7 +202,7 @@ class OrderController extends AdminBaseController |
|
@@ -199,7 +202,7 @@ class OrderController extends AdminBaseController |
199
|
$where['create_time'] = ['<= time', $endTime];
|
202
|
$where['create_time'] = ['<= time', $endTime];
|
200
|
}
|
203
|
}
|
201
|
}
|
204
|
}
|
202
|
- $list = Db::name('order_view')->where($where)->paginate(10);
|
205
|
+ $list = $this->singleData('order_view',$where,2,[],10);
|
203
|
$list->appends($param);
|
206
|
$list->appends($param);
|
204
|
$this->assign('list',$list->items());
|
207
|
$this->assign('list',$list->items());
|
205
|
$this->assign('page',$list->render());
|
208
|
$this->assign('page',$list->render());
|
|
@@ -211,7 +214,7 @@ class OrderController extends AdminBaseController |
|
@@ -211,7 +214,7 @@ class OrderController extends AdminBaseController |
211
|
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
|
214
|
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
|
212
|
$this->assign('sort_id',$param['sort_id']);
|
215
|
$this->assign('sort_id',$param['sort_id']);
|
213
|
// 订单类型
|
216
|
// 订单类型
|
214
|
- $sortList = Db::name('OrderSort')->where(['delete_time'=>0])->select()->toArray();
|
217
|
+ $sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
|
215
|
$this->assign('sortList',$sortList);
|
218
|
$this->assign('sortList',$sortList);
|
216
|
return $this->fetch();
|
219
|
return $this->fetch();
|
217
|
}
|
220
|
}
|
|
@@ -270,7 +273,7 @@ class OrderController extends AdminBaseController |
|
@@ -270,7 +273,7 @@ class OrderController extends AdminBaseController |
270
|
$where['create_time'] = ['<= time', $endTime];
|
273
|
$where['create_time'] = ['<= time', $endTime];
|
271
|
}
|
274
|
}
|
272
|
}
|
275
|
}
|
273
|
- $list = Db::name('order_view')->where($where)->paginate(10);
|
276
|
+ $list = $this->singleData('order_view',$where,2,[],10);
|
274
|
$list->appends($param);
|
277
|
$list->appends($param);
|
275
|
$this->assign('list',$list->items());
|
278
|
$this->assign('list',$list->items());
|
276
|
$this->assign('page',$list->render());
|
279
|
$this->assign('page',$list->render());
|
|
@@ -283,7 +286,7 @@ class OrderController extends AdminBaseController |
|
@@ -283,7 +286,7 @@ class OrderController extends AdminBaseController |
283
|
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
|
286
|
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
|
284
|
$this->assign('user_id',$param['user_id']);
|
287
|
$this->assign('user_id',$param['user_id']);
|
285
|
// 订单类型
|
288
|
// 订单类型
|
286
|
- $sortList = Db::name('OrderSort')->where(['delete_time'=>0])->select()->toArray();
|
289
|
+ $sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
|
287
|
$this->assign('sortList',$sortList);
|
290
|
$this->assign('sortList',$sortList);
|
288
|
return $this->fetch();
|
291
|
return $this->fetch();
|
289
|
}
|
292
|
}
|
|
@@ -344,14 +347,13 @@ class OrderController extends AdminBaseController |
|
@@ -344,14 +347,13 @@ class OrderController extends AdminBaseController |
344
|
}
|
347
|
}
|
345
|
}
|
348
|
}
|
346
|
// 查询数据并导出
|
349
|
// 查询数据并导出
|
347
|
- $list = Db::name('order_view')->where($where)->select()->toArray();
|
350
|
+ $list = $this->singleData('order_view',$where,1);
|
348
|
$this->expList($list);
|
351
|
$this->expList($list);
|
349
|
}
|
352
|
}
|
350
|
|
353
|
|
351
|
// 数据导出
|
354
|
// 数据导出
|
352
|
private function expList($array)
|
355
|
private function expList($array)
|
353
|
{
|
356
|
{
|
354
|
-
|
|
|
355
|
//导出Excel
|
357
|
//导出Excel
|
356
|
$objPHPExcel = new \PHPExcel();
|
358
|
$objPHPExcel = new \PHPExcel();
|
357
|
|
359
|
|
|
@@ -397,6 +399,7 @@ class OrderController extends AdminBaseController |
|
@@ -397,6 +399,7 @@ class OrderController extends AdminBaseController |
397
|
$objPHPExcel->getActiveSheet()->getColumnDimension('AN')->setWidth(20);
|
399
|
$objPHPExcel->getActiveSheet()->getColumnDimension('AN')->setWidth(20);
|
398
|
$objPHPExcel->getActiveSheet()->getColumnDimension('AO')->setWidth(20);
|
400
|
$objPHPExcel->getActiveSheet()->getColumnDimension('AO')->setWidth(20);
|
399
|
$objPHPExcel->getActiveSheet()->getColumnDimension('AP')->setWidth(20);
|
401
|
$objPHPExcel->getActiveSheet()->getColumnDimension('AP')->setWidth(20);
|
|
|
402
|
+ $objPHPExcel->getActiveSheet()->getColumnDimension('AQ')->setWidth(20);
|
400
|
// 设置水平居中
|
403
|
// 设置水平居中
|
401
|
$objPHPExcel->getDefaultStyle()->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
404
|
$objPHPExcel->getDefaultStyle()->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
402
|
// 设置垂直居中
|
405
|
// 设置垂直居中
|
|
@@ -444,7 +447,8 @@ class OrderController extends AdminBaseController |
|
@@ -444,7 +447,8 @@ class OrderController extends AdminBaseController |
444
|
->setCellValue('AM1', '不适龄备注')
|
447
|
->setCellValue('AM1', '不适龄备注')
|
445
|
->setCellValue('AN1', '图片')
|
448
|
->setCellValue('AN1', '图片')
|
446
|
->setCellValue('AO1', '月龄版升级年份')
|
449
|
->setCellValue('AO1', '月龄版升级年份')
|
447
|
- ->setCellValue('AP1', '备注');
|
450
|
+ ->setCellValue('AP1', '备注')
|
|
|
451
|
+ ->setCellValue('AQ1', '客户编号');
|
448
|
|
452
|
|
449
|
$i = 2;
|
453
|
$i = 2;
|
450
|
|
454
|
|
|
@@ -475,6 +479,7 @@ class OrderController extends AdminBaseController |
|
@@ -475,6 +479,7 @@ class OrderController extends AdminBaseController |
475
|
'id' => $vs['id']
|
479
|
'id' => $vs['id']
|
476
|
];
|
480
|
];
|
477
|
$vs['cell'] = Db::name('OrderOption')->where($where)->value('cell');
|
481
|
$vs['cell'] = Db::name('OrderOption')->where($where)->value('cell');
|
|
|
482
|
+ if(!empty($vs['cell'])) {
|
478
|
if($vs['type'] == 3) {
|
483
|
if($vs['type'] == 3) {
|
479
|
// 纯数字字段转化为字符串格式,防止以科学计数法进行显示
|
484
|
// 纯数字字段转化为字符串格式,防止以科学计数法进行显示
|
480
|
$objPHPExcel->setActiveSheetIndex(0)
|
485
|
$objPHPExcel->setActiveSheetIndex(0)
|
|
@@ -508,6 +513,7 @@ class OrderController extends AdminBaseController |
|
@@ -508,6 +513,7 @@ class OrderController extends AdminBaseController |
508
|
->setCellValue($vs['cell'] . $i, $vs['user_choose']);
|
513
|
->setCellValue($vs['cell'] . $i, $vs['user_choose']);
|
509
|
}
|
514
|
}
|
510
|
}
|
515
|
}
|
|
|
516
|
+ }
|
511
|
$i++;
|
517
|
$i++;
|
512
|
Db::name('Order')->where(['order_sn'=>$v['order_sn']])->update(['is_excel'=>1,'excel_time'=>time()]);
|
518
|
Db::name('Order')->where(['order_sn'=>$v['order_sn']])->update(['is_excel'=>1,'excel_time'=>time()]);
|
513
|
}
|
519
|
}
|