...
|
...
|
@@ -19,11 +19,13 @@ class OrderController extends AdminBaseController |
|
|
protected $order_model;
|
|
|
protected $option_table;
|
|
|
protected $sort_model;
|
|
|
protected $order_sort_table;
|
|
|
public function _initialize()
|
|
|
{
|
|
|
$this->table = 'Order';
|
|
|
$this->order_model = new OrderModel();
|
|
|
$this->option_table = 'OrderOption';
|
|
|
$this->order_sort_table = 'OrderSort';
|
|
|
|
|
|
// 订单字段类型定义
|
|
|
$this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}">
|
...
|
...
|
@@ -83,6 +85,7 @@ class OrderController extends AdminBaseController |
|
|
</div>';
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 电子订单列表
|
|
|
* @adminMenu(
|
...
|
...
|
@@ -134,7 +137,7 @@ class OrderController extends AdminBaseController |
|
|
$where['create_time'] = ['<= time', $endTime];
|
|
|
}
|
|
|
}
|
|
|
$list = Db::name('order_view')->where($where)->paginate(10);
|
|
|
$list = $this->singleData('order_view',$where,2,[],10);
|
|
|
$list->appends($param);
|
|
|
$this->assign('list',$list->items());
|
|
|
$this->assign('page',$list->render());
|
...
|
...
|
@@ -146,7 +149,7 @@ class OrderController extends AdminBaseController |
|
|
$this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
|
|
|
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
|
|
|
// 订单类型查询
|
|
|
$sortList = Db::name('OrderSort')->where(['delete_time'=>0])->select()->toArray();
|
|
|
$sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
|
|
|
$this->assign('sortList',$sortList);
|
|
|
return $this->fetch();
|
|
|
}
|
...
|
...
|
@@ -199,7 +202,7 @@ class OrderController extends AdminBaseController |
|
|
$where['create_time'] = ['<= time', $endTime];
|
|
|
}
|
|
|
}
|
|
|
$list = Db::name('order_view')->where($where)->paginate(10);
|
|
|
$list = $this->singleData('order_view',$where,2,[],10);
|
|
|
$list->appends($param);
|
|
|
$this->assign('list',$list->items());
|
|
|
$this->assign('page',$list->render());
|
...
|
...
|
@@ -211,7 +214,7 @@ class OrderController extends AdminBaseController |
|
|
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
|
|
|
$this->assign('sort_id',$param['sort_id']);
|
|
|
// 订单类型
|
|
|
$sortList = Db::name('OrderSort')->where(['delete_time'=>0])->select()->toArray();
|
|
|
$sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
|
|
|
$this->assign('sortList',$sortList);
|
|
|
return $this->fetch();
|
|
|
}
|
...
|
...
|
@@ -270,7 +273,7 @@ class OrderController extends AdminBaseController |
|
|
$where['create_time'] = ['<= time', $endTime];
|
|
|
}
|
|
|
}
|
|
|
$list = Db::name('order_view')->where($where)->paginate(10);
|
|
|
$list = $this->singleData('order_view',$where,2,[],10);
|
|
|
$list->appends($param);
|
|
|
$this->assign('list',$list->items());
|
|
|
$this->assign('page',$list->render());
|
...
|
...
|
@@ -283,7 +286,7 @@ class OrderController extends AdminBaseController |
|
|
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
|
|
|
$this->assign('user_id',$param['user_id']);
|
|
|
// 订单类型
|
|
|
$sortList = Db::name('OrderSort')->where(['delete_time'=>0])->select()->toArray();
|
|
|
$sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
|
|
|
$this->assign('sortList',$sortList);
|
|
|
return $this->fetch();
|
|
|
}
|
...
|
...
|
@@ -344,14 +347,13 @@ class OrderController extends AdminBaseController |
|
|
}
|
|
|
}
|
|
|
// 查询数据并导出
|
|
|
$list = Db::name('order_view')->where($where)->select()->toArray();
|
|
|
$list = $this->singleData('order_view',$where,1);
|
|
|
$this->expList($list);
|
|
|
}
|
|
|
|
|
|
// 数据导出
|
|
|
private function expList($array)
|
|
|
{
|
|
|
|
|
|
//导出Excel
|
|
|
$objPHPExcel = new \PHPExcel();
|
|
|
|
...
|
...
|
@@ -397,6 +399,7 @@ class OrderController extends AdminBaseController |
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension('AN')->setWidth(20);
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension('AO')->setWidth(20);
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension('AP')->setWidth(20);
|
|
|
$objPHPExcel->getActiveSheet()->getColumnDimension('AQ')->setWidth(20);
|
|
|
// 设置水平居中
|
|
|
$objPHPExcel->getDefaultStyle()->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
|
|
// 设置垂直居中
|
...
|
...
|
@@ -444,7 +447,8 @@ class OrderController extends AdminBaseController |
|
|
->setCellValue('AM1', '不适龄备注')
|
|
|
->setCellValue('AN1', '图片')
|
|
|
->setCellValue('AO1', '月龄版升级年份')
|
|
|
->setCellValue('AP1', '备注');
|
|
|
->setCellValue('AP1', '备注')
|
|
|
->setCellValue('AQ1', '客户编号');
|
|
|
|
|
|
$i = 2;
|
|
|
|
...
|
...
|
@@ -475,6 +479,7 @@ class OrderController extends AdminBaseController |
|
|
'id' => $vs['id']
|
|
|
];
|
|
|
$vs['cell'] = Db::name('OrderOption')->where($where)->value('cell');
|
|
|
if(!empty($vs['cell'])) {
|
|
|
if($vs['type'] == 3) {
|
|
|
// 纯数字字段转化为字符串格式,防止以科学计数法进行显示
|
|
|
$objPHPExcel->setActiveSheetIndex(0)
|
...
|
...
|
@@ -508,6 +513,7 @@ class OrderController extends AdminBaseController |
|
|
->setCellValue($vs['cell'] . $i, $vs['user_choose']);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$i++;
|
|
|
Db::name('Order')->where(['order_sn'=>$v['order_sn']])->update(['is_excel'=>1,'excel_time'=>time()]);
|
|
|
}
|
...
|
...
|
|