作者 刘朕
1 个管道 的构建 通过 耗费 7 秒

字段导出添加、订单导出筛选支付方式添加

<?php
/**
* Created by PhpStorm.
* User: 29925
* Date: 2018/8/16
* Time: 14:14
*/
namespace app\admin\controller;
use app\admin\model\OrderModel;
use cmf\controller\AdminBaseController;
use think\Db;
class OrderController extends AdminBaseController
{
protected $decto_array;
protected $bin_array;
protected $table;
protected $order_model;
protected $option_table;
protected $sort_model;
protected $order_sort_table;
public function _initialize()
{
$this->decto_array = [ 'A' => 0, 'B' => 1, 'C' => 2, 'D' => 3, 'E' => 4, 'F' => 5, 'G' => 6, 'H' => 7, 'I' => 8, 'J' => 9, 'K' => 10, 'L' => 11, 'M' => 12, 'N' => 13, 'O' => 14, 'P' => 15, 'Q' => 16, 'R' => 17, 'S' => 18, 'T' => 19, 'U' => 20, 'V' => 21, 'W' => 22, 'X' => 23, 'Y' => 24, 'Z' => 25 ];
$this->bin_array = [ 'A' => 0, 'B' => 1, 'C' => 2, 'D' => 3, 'E' => 4, 'F' => 5, 'G' => 6, 'H' => 7, 'I' => 8, 'J' => 9, 'K' => 10, 'L' => 11, 'M' => 12, 'N' => 13, 'O' => 14, 'P' => 15, 'Q' => 16, 'R' => 17, 'S' => 18, 'T' => 19, 'U' => 20, 'V' => 21, 'W' => 22, 'X' => 23, 'Y' => 24, 'Z' => 25 ];
$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}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
$this->sort_model[2] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="number" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
$this->sort_model[3] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="number" maxlength="11" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
$this->sort_model[4] = '<div class="write_tit form_options" data-validate="{validate}">
<p class="tit"><span class=" _validate">{name}</span></p>
<div class="flex_style">
{options}
</div>
</div>';
$this->sort_model[5] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
$this->sort_model[6] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<textarea class="baby_input">{value}</textarea>
</div>';
$this->sort_model[7] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="product" value="{value}" class="baby_input" placeholder="请选择{name}" />
<img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
</div>';
$this->sort_model[8] = '<div class="write_wrap" style="margin: 0;" data-validate="{validate}">
<p class="text_tit" style="line-height: 0.6rem;"><span class=" _validate">{name}</span>{must}</p>
</div>
<div class="up_wrap form_options">
<div class="up_pic">
<i class="iconfont icon-msnui-cloud-upload"></i>
<p class="click_up">点击上传</p>
</div>
</div>';
$this->sort_model[10] = '<div class="text_item no_margin form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="birthday" readonly="readonly" value="{value}" class="baby_input" placeholder="请选择{name}" />
<img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
</div>';
$this->sort_model[11] = '<div class="text_item form_options" data-validate="{validate}">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<weui-distpicker province="广东省" city="广州市" area="海珠区"></weui-distpicker>
<input type="text" name="" id="address" readonly="readonly" value="{value}" class="baby_input" placeholder="请输入{name}" />
<img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
</div>';
$this->sort_model[12] = '<div class="text_item form_options" data-validate="{validate}" data-type="12">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
</div>';
}
/**
* 电子订单列表
* @adminMenu(
* 'name' => '电子订单列表',
* 'parent' => 'admin/OrderOption/default',
* 'display'=> true,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '电子订单列表',
* 'param' => ''
* )
*/
public function index() {
$param = $this->request->param();
// 查询条件处理
$where = [
'delete_time'=>0
];
if(isset($param['keyword'])) {
$where['order_sn|sort_name|user_login|number'] = ['like','%'.$param['keyword'].'%'];
}
if(!empty($param['sort_id'])) {
$where['sort_id'] = $param['sort_id'];
}
if(isset($param['status']) && $param['status'] >= 0) {
$where['status'] = $param['status'];
}
if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
$where['is_excel'] = $param['is_excel'];
}
if(isset($param['is_over']) && $param['is_over'] >= 0) {
if($param['is_over'] == 0) {
$where['over_time'] = ['egt',time()];
}
if($param['is_over'] == 1) {
$where['over_time'] = ['lt',time()];
}
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
if (!empty($startTime) && !empty($endTime)) {
$where['create_time'] = [['>= time', $startTime], ['<= time', $endTime]];
} else {
if (!empty($startTime)) {
$where['create_time'] = ['>= time', $startTime];
}
if (!empty($endTime)) {
$where['create_time'] = ['<= time', $endTime];
}
}
$list = $this->singleData('order_view',$where,2,[],10);
$list->appends($param);
$this->assign('list',$list->items());
$this->assign('page',$list->render());
$this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
$this->assign('sort_id',isset($param['sort_id']) ? $param['sort_id'] : '');
$this->assign('status',isset($param['status']) ? $param['status'] : '');
$this->assign('is_excel',isset($param['is_excel']) ? $param['is_excel'] : '');
$this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : '');
$this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
// 订单类型查询
$sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
$this->assign('sortList',$sortList);
return $this->fetch();
}
/**
* 电子订单列表(表单类型下)
* @adminMenu(
* 'name' => '电子订单列表',
* 'parent' => 'admin/OrderSort/index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 1,
* 'icon' => '',
* 'remark' => '电子订单列表(表单类型下)',
* 'param' => ''
* )
*/
public function index_sort() {
$param = $this->request->param();
$where = [
'delete_time'=>0
];
if(empty($param['sort_id'])) {
$this->error('参数错误');
}
$where['sort_id'] = $param['sort_id'];
if(isset($param['status']) && $param['status'] >= 0) {
$where['status'] = $param['status'];
}
if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
$where['is_excel'] = $param['is_excel'];
}
if(isset($param['is_over']) && $param['is_over'] >= 0) {
if($param['is_over'] == 0) {
$where['over_time'] = ['egt',time()];
}
if($param['is_over'] == 1) {
$where['over_time'] = ['lt',time()];
}
}
$startTime = empty($filter['start_time']) ? 0 : strtotime($filter['start_time']);
$endTime = empty($filter['end_time']) ? 0 : strtotime($filter['end_time']);
if (!empty($startTime) && !empty($endTime)) {
$where['create_time'] = [['>= time', $startTime], ['<= time', $endTime]];
} else {
if (!empty($startTime)) {
$where['create_time'] = ['>= time', $startTime];
}
if (!empty($endTime)) {
$where['create_time'] = ['<= time', $endTime];
}
}
$list = $this->singleData('order_view',$where,2,[],10);
$list->appends($param);
$this->assign('list',$list->items());
$this->assign('page',$list->render());
$this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
$this->assign('status',isset($param['status']) ? $param['status'] : '');
$this->assign('is_excel',isset($param['is_excel']) ? $param['is_excel'] : '');
$this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : '');
$this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
$this->assign('sort_id',$param['sort_id']);
// 订单类型
$sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
$this->assign('sortList',$sortList);
return $this->fetch();
}
/**
* 电子订单列表(销售人员下)
* @adminMenu(
* 'name' => '电子订单列表',
* 'parent' => 'admin/OrderSort/index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 2,
* 'icon' => '',
* 'remark' => '电子订单列表(销售人员下)',
* 'param' => ''
* )
*/
public function index_sales() {
$param = $this->request->param();
$where = [
'delete_time'=>0
];
if(empty($param['user_id'])) {
$this->error('参数错误');
}
$where['user_id'] = $param['user_id'];
if(isset($param['keyword'])) {
$where['order_sn|sort_name|user_login|number'] = ['like','%'.$param['keyword'].'%'];
}
if(!empty($param['sort_id'])) {
$where['sort_id'] = $param['sort_id'];
}
if(isset($param['status']) && $param['status'] >= 0) {
$where['status'] = $param['status'];
}
if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
$where['is_excel'] = $param['is_excel'];
}
if(isset($param['is_over']) && $param['is_over'] >= 0) {
if($param['is_over'] == 0) {
$where['over_time'] = ['egt',time()];
}
if($param['is_over'] == 1) {
$where['over_time'] = ['lt',time()];
}
}
$startTime = empty($filter['start_time']) ? 0 : strtotime($filter['start_time']);
$endTime = empty($filter['end_time']) ? 0 : strtotime($filter['end_time']);
if (!empty($startTime) && !empty($endTime)) {
$where['create_time'] = [['>= time', $startTime], ['<= time', $endTime]];
} else {
if (!empty($startTime)) {
$where['create_time'] = ['>= time', $startTime];
}
if (!empty($endTime)) {
$where['create_time'] = ['<= time', $endTime];
}
}
$list = $this->singleData('order_view',$where,2,[],10);
$list->appends($param);
$this->assign('list',$list->items());
$this->assign('page',$list->render());
$this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
$this->assign('sort_id',isset($param['sort_id']) ? $param['sort_id'] : '');
$this->assign('status',isset($param['status']) ? $param['status'] : '');
$this->assign('is_excel',isset($param['is_excel']) ? $param['is_excel'] : '');
$this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : '');
$this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
$this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
$this->assign('user_id',$param['user_id']);
// 订单类型
$sortList = $this->singleData($this->order_sort_table,['delete_time'=>0],1);
$this->assign('sortList',$sortList);
return $this->fetch();
}
/**
* 用户数据导出
* @adminMenu(
* 'name' => '用户数据导出',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 3,
* 'icon' => '',
* 'remark' => '用户数据导出',
* 'param' => ''
* )
*/
public function excel()
{
$param = $this->request->param();
// 进行查询条件的处理
$where = [
'delete_time'=>0
];
if(!empty($param['ids'])) {
$where['id'] = ['in',$param['ids']];
}
if(isset($param['keyword'])) {
$where['order_sn|sort_name|user_login|number'] = ['like','%'.$param['keyword'].'%'];
}
if(!empty($param['sort_id'])) {
$where['sort_id'] = $param['sort_id'];
}
if(isset($param['status']) && $param['status'] >= 0) {
$where['status'] = $param['status'];
}
if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
$where['is_excel'] = $param['is_excel'];
}
if(isset($param['is_over']) && $param['is_over'] >= 0) {
if($param['is_over'] == 0) {
$where['over_time'] = ['egt',time()];
}
if($param['is_over'] == 1) {
$where['over_time'] = ['lt',time()];
}
}
$startTime = empty($param['start_time']) ? 0 : strtotime($param['start_time']);
$endTime = empty($param['end_time']) ? 0 : strtotime($param['end_time']);
if (!empty($startTime) && !empty($endTime)) {
$where['create_time'] = [['>= time', $startTime], ['<= time', $endTime]];
} else {
if (!empty($startTime)) {
$where['create_time'] = ['>= time', $startTime];
}
if (!empty($endTime)) {
$where['create_time'] = ['<= time', $endTime];
}
}
// 查询数据并导出
$list = $this->singleData('order_view',$where,1);
$this->expList($list);
}
/**
* 数字转字母 (类似于Excel列标)
* @param Int $index 索引值
* @param Int $start 字母起始值
* @return String 返回字母
*/
private function IntToChr($index, $start = 65) {
$str = '';
if (floor($index / 26) > 0) {
$str .= $this->IntToChr(floor($index / 26)-1);
}
return $str . chr($index % 26 + $start);
}
// 数据导出
private function expList($array)
{
// 获取可显示的字段列表
$option_list = $this->singleData($this->option_table,['delete_time'=>0],1);
//导出Excel
$objPHPExcel = new \PHPExcel();
// 设置单元格宽度
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(25);
$objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(15);
$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(20);
// 设置水平居中
$objPHPExcel->getDefaultStyle()->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
// 设置垂直居中
$objPHPExcel->getDefaultStyle()->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);
//Add some data
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'ID')
->setCellValue('B1', '订单号')
->setCellValue('C1', '订单类型')
->setCellValue('D1', '销售用户名')
->setCellValue('E1', '订单确认码')
->setCellValue('F1', '订单状态')
->setCellValue('G1', '收集状态')
->setCellValue('H1', '发布时间')
->setCellValue('I1', '失效时间');
// 设置表单字段的单元格宽度及第一行文字
$option_id_array = [];
foreach ($option_list as $k=>$v) {
$column = $this->IntToChr($k+10);
$objPHPExcel->getActiveSheet()->getColumnDimension($column)->setWidth(20);
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue($column.'1', $v['name']);
$option_id_array[$k] = $v['id'];
}
$i = 2;
// 循环到导出数据
foreach ($array as $v) {
$status = '未支付';
if($v['status'] == 1) {
$status = '已支付';
}
$is_stop = '收集中';
if($v['is_stop'] == 1) {
$is_stop = '已停止';
}
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A' . $i, $v['id'])
->setCellValueExplicit('B' . $i, $v['order_sn'],\PHPExcel_Cell_DataType::TYPE_STRING)
// ->setCellValueExplicit('B' . $i, $v['order_sn'],\PHPExcel_Cell_DataType::TYPE_STRING)
->setCellValue('C' . $i, $v['sort_name'])
->setCellValue('D' . $i, $v['user_login'])
->setCellValue('E' . $i, $v['number'])
->setCellValue('F' . $i, $status)
->setCellValue('G' . $i, $is_stop)
->setCellValue('H' . $i, date('Y-m-d H:i',$v['create_time']))
->setCellValue('I' . $i, date('Y-m-d H:i',$v['over_time']));
$v['options'] = json_decode($v['options'],true);
foreach ($v['options'] as $ks=>$vs) {
// $where = [
// 'id' => $vs['id']
// ];
// $vs['cell'] = Db::name('OrderOption')->where($where)->value('cell');
$key = array_search($vs['id'], $option_id_array);
$vs['cell'] = $this->IntToChr($key+10);
if($vs['cell']) {
if($vs['type'] == 3) {
// 纯数字字段转化为字符串格式,防止以科学计数法进行显示
$objPHPExcel->setActiveSheetIndex(0)
->setCellValueExplicit($vs['cell'] . $i, $vs['user_choose'],\PHPExcel_Cell_DataType::TYPE_STRING);
} elseif($vs['type'] == 8) {
// 导出图片格式,高度自适应
$filePath = './upload/'.$vs['user_choose'];
if(!empty($vs['user_choose']) && file_exists($filePath)) {
$image = \think\Image::open('./upload/'.$vs['user_choose']);
// 返回图片的宽度
$width = $image->width();
// 返回图片的高度
$height = $image->height();
$default = $height/($width/100);
//设置默认行高(通过图片缩放比例计算高度)
$objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight($default);
// 图片生成
$objDrawing[$i] = new \PHPExcel_Worksheet_Drawing();
$objDrawing[$i]->setPath($filePath);
// 设置宽度
$objDrawing[$i]->setWidth(100); //照片宽度
/*设置图片要插入的单元格*/
$objDrawing[$i]->setCoordinates($vs['cell'].$i);
// 图片偏移距离
$objDrawing[$i]->setOffsetX(12);
$objDrawing[$i]->setOffsetY(12);
$objDrawing[$i]->setWorksheet($objPHPExcel->getActiveSheet());
}
} else {
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue($vs['cell'] . $i, $vs['user_choose']);
}
}
}
$i++;
Db::name('Order')->where(['order_sn'=>$v['order_sn']])->update(['is_excel'=>1,'excel_time'=>time()]);
}
$filename = '订单数据导出'. date('Y-m-d').'.xls';
ob_end_clean();
header("Content-type:application/vnd.ms-excel;charset=UTF-8");
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="' . $filename . '"');
header('Cache-Control: max-age=0');
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
}
/**
* 编辑订单
* @adminMenu(
* 'name' => '编辑订单',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 4,
* 'icon' => '',
* 'remark' => '编辑订单',
* 'param' => ''
* )
*/
public function edit() {
$id = $this->request->param('id',0,'intval');
if(!$id) {
$this->error('参数错误');
}
$where = [
'id' => $id,
'delete_time'=>0
];
$info = Db::name('order_view')->where($where)->find();
$info['options'] = json_decode($info['options'],true);
foreach ($info['options'] as $k=>$v) {
$optionsInfo = $this->singleData($this->option_table,['id'=>$v['id']]);
$v['name'] = $optionsInfo['name'];
$v['html'] = $this->form_model($v);
$info['group'][] = $v;
}
$this->assign($info);
return $this->fetch();
}
// 处理订单模型数据
private function form_model($formData) {
$html = $this->sort_model[$formData['type']];
$html = str_replace('{name}',$formData['name'],$html);
if($formData['checked'] == 1) {
$html = str_replace('{must}','*',$html);
$html = str_replace('{validate}',1,$html);
} else {
$html = str_replace('{must}','',$html);
$html = str_replace('{validate}',0,$html);
}
if(!empty($formData['values']) && $formData['values'] != null) {
$array = explode(',',$formData['values']);
$options = '';
foreach ($array as $k=>$v) {
$active = isset($formData['user_choose'])?($formData['user_choose']==$v?'active':''):($k==0?'active':'');
$options .= '<p class="order_style '.$active.'">'.$v.'</p>';
}
$html = str_replace('{options}',$options,$html);
}
if(!empty($formData['user_choose'])) {
$html = str_replace('{value}',$formData['user_choose'],$html);
} else {
$html = str_replace('{value}','',$html);
}
return $html;
}
/**
* 修改订单收集状态
* @adminMenu(
* 'name' => '修改订单收集状态',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 5,
* 'icon' => '',
* 'remark' => '修改订单收集状态',
* 'param' => ''
* )
*/
public function stop()
{
$param = $this->request->param();
$msg = '';
if (isset($param['ids']) && isset($param["is_stop"])) {
$stop = $param["is_stop"];
$ids = $this->request->param('ids/a');
$this->order_model->where(['id' => ['in', $ids]])->update(['is_stop' => $stop, 'update_time' => time()]);
if($stop == 0) {
$msg = "开启收集成功!";
}
if($stop == 1) {
$msg = "停止收集成功!";
}
$this->success($msg, '');
}
if (isset($param['id']) && isset($param["is_stop"])) {
$stop = $param["is_stop"];
$id = $this->request->param('id');
$this->order_model->where(['id' => $id])->update(['is_stop' => $stop, 'update_time' => time()]);
if($stop == 0) {
$msg = "开启收集成功!";
}
if($stop == 1) {
$msg = "停止收集成功!";
}
$this->success($msg,'');
}
}
/**
* 删除订单
* @adminMenu(
* 'name' => '删除订单',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 6,
* 'icon' => '',
* 'remark' => '删除订单',
* 'param' => ''
* )
*/
public function delete() {
$id = $this->request->param('id',0,'intval');
$ids = $this->request->param('ids/a');
if(isset($id)) {
$result = $this->order_model->where(['id'=>$id])->update(['delete_time'=>time()]);
}
if(isset($ids)) {
$result = $this->order_model->where(['id'=>['in',$ids]])->update(['delete_time'=>time()]);
}
if(!$result) {
$this->error('删除失败');
}
$this->success('删除成功');
}
}
\ No newline at end of file
... ...
... ... @@ -183,6 +183,9 @@ class OrderController extends AdminBaseController
if(isset($param['status']) && $param['status'] >= 0) {
$where['status'] = $param['status'];
}
if(!empty($param['pay_type'])) {
$where['pay_type'] = $param['pay_type'];
}
if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
$where['is_excel'] = $param['is_excel'];
}
... ... @@ -212,6 +215,7 @@ class OrderController extends AdminBaseController
$this->assign('page',$list->render());
$this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
$this->assign('status',isset($param['status']) ? $param['status'] : '');
$this->assign('pay_type',isset($param['pay_type']) ? $param['pay_type'] : '');
$this->assign('is_excel',isset($param['is_excel']) ? $param['is_excel'] : '');
$this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : '');
$this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
... ... @@ -254,6 +258,9 @@ class OrderController extends AdminBaseController
if(isset($param['status']) && $param['status'] >= 0) {
$where['status'] = $param['status'];
}
if(!empty($param['pay_type'])) {
$where['pay_type'] = $param['pay_type'];
}
if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
$where['is_excel'] = $param['is_excel'];
}
... ... @@ -284,6 +291,7 @@ class OrderController extends AdminBaseController
$this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
$this->assign('sort_id',isset($param['sort_id']) ? $param['sort_id'] : '');
$this->assign('status',isset($param['status']) ? $param['status'] : '');
$this->assign('pay_type',isset($param['pay_type']) ? $param['pay_type'] : '');
$this->assign('is_excel',isset($param['is_excel']) ? $param['is_excel'] : '');
$this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : '');
$this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
... ... @@ -321,6 +329,9 @@ class OrderController extends AdminBaseController
if(isset($param['keyword'])) {
$where['order_sn|sort_name|user_login|number'] = ['like','%'.$param['keyword'].'%'];
}
if(!empty($param['user_id'])) {
$where['user_id'] = $param['user_id'];
}
if(!empty($param['sort_id'])) {
$where['sort_id'] = $param['sort_id'];
}
... ... @@ -408,6 +419,12 @@ class OrderController extends AdminBaseController
$objPHPExcel->getActiveSheet()->getColumnDimension('AP')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AQ')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AR')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AS')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AT')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AU')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AV')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AW')->setWidth(20);
$objPHPExcel->getActiveSheet()->getColumnDimension('AX')->setWidth(20);
// 设置水平居中
$objPHPExcel->getDefaultStyle()->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
// 设置垂直居中
... ... @@ -424,7 +441,7 @@ class OrderController extends AdminBaseController
->setCellValue('H1', '收集状态')
->setCellValue('I1', '发布时间')
->setCellValue('J1', '失效时间')
->setCellValue('K1', '订购方式')
->setCellValue('K1', '订单来源')
->setCellValue('L1', '来源渠道')
->setCellValue('M1', '销售人员')
->setCellValue('N1', '小朋友姓名')
... ... @@ -433,7 +450,7 @@ class OrderController extends AdminBaseController
->setCellValue('Q1', '家长姓名')
->setCellValue('R1', '家长身份')
->setCellValue('S1', '其他身份')
->setCellValue('R1', '家长电话')
->setCellValue('T1', '联系电话')
->setCellValue('U1', '手机备用电话')
->setCellValue('V1', '座机备用电话')
->setCellValue('W1', '地址')
... ... @@ -443,21 +460,27 @@ class OrderController extends AdminBaseController
->setCellValue('AA1', '收货人电话')
->setCellValue('AB1', '收货区域')
->setCellValue('AC1', '商品选择')
->setCellValue('AD1', '具体版本')
->setCellValue('AE1', '其他版本')
->setCellValue('AD1', '其他具版本')
->setCellValue('AE1', '体版本')
->setCellValue('AF1', '订购长度')
->setCellValue('AG1', '其他订购长度')
->setCellValue('AH1', '订购起始月')
->setCellValue('AI1', '订购价格')
->setCellValue('AJ1', '礼物选择')
->setCellValue('AK1', '加赠礼物')
->setCellValue('AL1', '加赠礼物名称')
->setCellValue('AM1', '是否适龄')
->setCellValue('AN1', '不适龄备注')
->setCellValue('AO1', '图片')
->setCellValue('AP1', '月龄版升级年份')
->setCellValue('AQ1', '备注')
->setCellValue('AR1', '客户编号');
->setCellValue('AK1', '后期加赠礼物')
->setCellValue('AL1', '是否适龄')
->setCellValue('AM1', '不适龄备注')
->setCellValue('AN1', '不适龄照片')
->setCellValue('AO1', '月龄版升级年份')
->setCellValue('AP1', '备注')
->setCellValue('AQ1', '客户编号')
->setCellValue('AR1', '介绍人类型')
->setCellValue('AS1', '介绍人信息')
->setCellValue('AT1', '介绍人礼物')
->setCellValue('AU1', '被介绍人礼物')
->setCellValue('AV1', '固定礼')
->setCellValue('AW1', '选择礼')
->setCellValue('AX1', '商品名称');
$i = 2;
... ...
... ... @@ -33,8 +33,8 @@
支付类型:
<select class="form-control" name="pay_type" style="width: 140px;">
<option value="0">请选择</option>
<option value="1" <eq name="pay_type" value="0">selected</eq>>微信</option>
<option value="2" <eq name="pay_type" value="1">selected</eq>>支付宝</option>
<option value="1" <eq name="pay_type" value="1">selected</eq>>微信</option>
<option value="2" <eq name="pay_type" value="2">selected</eq>>支付宝</option>
</select>&nbsp; &nbsp;
导出状态:
<select class="form-control" name="is_excel" style="width: 140px;">
... ...
... ... @@ -25,6 +25,12 @@
<option value="0" <eq name="is_over" value="0">selected</eq>>否</option>
<option value="1" <eq name="is_over" value="1">selected</eq>>是</option>
</select>&nbsp; &nbsp;
支付类型:
<select class="form-control" name="pay_type" style="width: 140px;">
<option value="0">请选择</option>
<option value="1" <eq name="pay_type" value="1">selected</eq>>微信</option>
<option value="2" <eq name="pay_type" value="2">selected</eq>>支付宝</option>
</select>&nbsp; &nbsp;
导出状态:
<select class="form-control" name="is_excel" style="width: 140px;">
<option value="-1">请选择</option>
... ... @@ -130,8 +136,10 @@
$('#excel').click(function () {
var url1 = "{:url('Order/excel')}";
var url2 = url1.split('.',5);
var user_id = "{$user_id}";
var sort_id = $('select[name=sort_id]').val();
var status = $('select[name=status]').val();
var pay_type = $('select[name=pay_type]').val();
var is_over = $('select[name=is_over]').val();
var is_excel = $('select[name=is_excel]').val();
var keyword = $('input[name=keyword]').val();
... ... @@ -150,11 +158,17 @@
param += '/ids/' + ids;
}
if(sort_id.length > 0) {
param += '/user_id/'+user_id;
}
if(sort_id.length > 0) {
param += '/sort_id/'+sort_id;
}
if(status.length > 0) {
param += '/status/'+status;
}
if(pay_type.length > 0) {
param += '/pay_type/'+pay_type;
}
if(is_over.length > 0) {
param += '/is_over/'+is_over;
}
... ...
... ... @@ -18,6 +18,12 @@
<option value="0" <eq name="is_over" value="0">selected</eq>>否</option>
<option value="1" <eq name="is_over" value="1">selected</eq>>是</option>
</select>&nbsp; &nbsp;
支付类型:
<select class="form-control" name="pay_type" style="width: 140px;">
<option value="0">请选择</option>
<option value="1" <eq name="pay_type" value="1">selected</eq>>微信</option>
<option value="2" <eq name="pay_type" value="2">selected</eq>>支付宝</option>
</select>&nbsp; &nbsp;
导出状态:
<select class="form-control" name="is_excel" style="width: 140px;">
<option value="-1">请选择</option>
... ... @@ -125,6 +131,7 @@
var url2 = url1.split('.',5);
var sort_id = "{$sort_id}";
var status = $('select[name=status]').val();
var pay_type = $('select[name=pay_type]').val();
var is_over = $('select[name=is_over]').val();
var is_excel = $('select[name=is_excel]').val();
var keyword = $('input[name=keyword]').val();
... ... @@ -148,6 +155,9 @@
if(status.length > 0) {
param += '/status/'+status;
}
if(pay_type.length > 0) {
param += '/pay_type/'+pay_type;
}
if(is_over.length > 0) {
param += '/is_over/'+is_over;
}
... ...