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

合并分支 '1iuzhen' 到 'master'

订单导出bug修改及优化,客户编号字段添加、格式及手机号格式验证添加



查看合并请求 !165
... ... @@ -24,7 +24,8 @@ class OrderController extends AdminBaseController
$this->table = 'Order';
$this->order_model = new OrderModel();
$this->option_table = 'OrderOption';
// 订单字段类型定义
$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}" />
... ... @@ -93,6 +94,7 @@ class OrderController extends AdminBaseController
*/
public function index() {
$param = $this->request->param();
// 查询条件处理
$where = [
'delete_time'=>0
];
... ... @@ -139,7 +141,7 @@ class OrderController extends AdminBaseController
$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 = Db::name('OrderSort')->where(['delete_time'=>0])->select()->toArray();
$this->assign('sortList',$sortList);
return $this->fetch();
... ... @@ -259,6 +261,7 @@ class OrderController extends AdminBaseController
public function excel()
{
$param = $this->request->param();
// 进行查询条件的处理
$where = [
'delete_time'=>0
];
... ... @@ -297,6 +300,7 @@ class OrderController extends AdminBaseController
$where['create_time'] = ['<= time', $endTime];
}
}
// 查询数据并导出
$list = Db::name('order_view')->where($where)->select()->toArray();
$this->expList($list);
}
... ... @@ -426,20 +430,28 @@ class OrderController extends AdminBaseController
$objPHPExcel->setActiveSheetIndex(0)
->setCellValueExplicit($vs['cell'] . $i, $vs['user_choose'],\PHPExcel_Cell_DataType::TYPE_STRING);
} elseif($vs['type'] == 8) {
//设置默认行高
$objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight(80);
// 图片生成
$objDrawing[$i] = new \PHPExcel_Worksheet_Drawing();
$objDrawing[$i]->setPath('./upload/'.$vs['user_choose']);
// 设置宽度高度
$objDrawing[$i]->setHeight(80);//照片高度
$objDrawing[$i]->setWidth(80); //照片宽度
/*设置图片要插入的单元格*/
$objDrawing[$i]->setCoordinates($vs['cell'].$i);
// 图片偏移距离
$objDrawing[$i]->setOffsetX(12);
$objDrawing[$i]->setOffsetY(12);
$objDrawing[$i]->setWorksheet($objPHPExcel->getActiveSheet());
if(!empty($vs['user_choose']) && file_exists('./upload/'.$vs['user_choose'])) {
$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('./upload/'.$vs['user_choose']);
// 设置宽度高度
$objDrawing[$i]->setHeight(100);//照片高度
$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']);
... ...
... ... @@ -45,7 +45,7 @@ class OrderOptionController extends AdminBaseController
// 'linkage' => '链接'
// ];
// $this->type = ['文本', '单选', '复选', '多行文本', '下拉菜单', '图片', '链接'];
$this->type = [1 => '文本', 2 => '文本(数字)', 3 => '文本(手机号码)', 4 => '单选', 5 => '复选', 6 => '多行文本', 7 => '下拉菜单', 8 => '图片',9 => '链接',10 => '日期',11 => '地区联动'];
$this->type = [1 => '文本', 2 => '文本(数字)', 3 => '文本(手机号码)', 4 => '单选', 5 => '复选', 6 => '多行文本', 7 => '下拉菜单', 8 => '图片',9 => '链接',10 => '日期',11 => '地区联动',12 => '客户编号'];
$this->assign('typeList', $this->type);
}
... ...
... ... @@ -16,7 +16,7 @@ class OrderOptionValidate extends Validate
protected $rule = [
'name' => 'require',
'icon' => 'require',
'sort' => 'require|number|between:1,11',
'sort' => 'require|number|between:1,12',
'is_show' => 'in:0,1',
];
... ... @@ -25,7 +25,7 @@ class OrderOptionValidate extends Validate
'icon.require' => '图标不能为空',
'sort.require' => '类型不能为空',
'sort.number' => '类型必须为数字',
'sort.between' => '类型值必须在1-11之间',
'sort.between' => '类型值必须在1-12之间',
'is_show.between' => '用户是否可见值必须在0-1之间',
];
... ...
... ... @@ -37,38 +37,38 @@ class MemberSalesController extends HomeBaseController
$this->order_sort_model = new OrderSortModel();
$this->option_table = 'OrderOption';
$this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}">
$this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}" data-type="1">
<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}">
$this->sort_model[2] = '<div class="text_item form_options" data-validate="{validate}" data-type="2">
<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}">
$this->sort_model[3] = '<div class="text_item form_options" data-validate="{validate}" data-type="3">
<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}">
$this->sort_model[4] = '<div class="write_tit form_options" data-validate="{validate}" data-type="4">
<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}">
$this->sort_model[5] = '<div class="text_item form_options" data-validate="{validate}" data-type="5">
<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}">
$this->sort_model[6] = '<div class="text_item form_options" data-validate="{validate}" data-type="6">
<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}">
$this->sort_model[7] = '<div class="text_item form_options" data-validate="{validate}" data-type="7">
<p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
<input type="text" name="" readonly 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}">
$this->sort_model[8] = '<div class="write_wrap" style="margin: 0;" data-validate="{validate}" data-type="8">
<p class="text_tit" style="line-height: 0.6rem;"><span class=" _validate">{name}</span>{must}</p>
</div>
<div class="up_wrap form_options" data-validate="{validate}">
... ... @@ -78,17 +78,21 @@ class MemberSalesController extends HomeBaseController
{img}
</div>
</div>';
$this->sort_model[10] = '<div class="text_item no_margin form_options" data-validate="{validate}">
$this->sort_model[10] = '<div class="text_item no_margin form_options" data-validate="{validate}" data-type="10">
<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}">
$this->sort_model[11] = '<div class="text_item form_options" data-validate="{validate}" data-type="11">
<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>';
}
// 前置方法(判断是否登录销售账号)
protected function check_login()
... ...
... ... @@ -34,38 +34,38 @@ class OrderController extends HomeBaseController
$this->order_sort_model = new OrderSortModel();
$this->option_table = 'OrderOption';
$this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}">
$this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}" data-type="1">
<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}">
$this->sort_model[2] = '<div class="text_item form_options" data-validate="{validate}" data-type="2">
<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}">
$this->sort_model[3] = '<div class="text_item form_options" data-validate="{validate}" data-type="3">
<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}">
$this->sort_model[4] = '<div class="write_tit form_options" data-validate="{validate}" data-type="4">
<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}">
$this->sort_model[5] = '<div class="text_item form_options" data-validate="{validate}" data-type="5">
<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}">
$this->sort_model[6] = '<div class="text_item form_options" data-validate="{validate}" data-type="6">
<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}">
$this->sort_model[7] = '<div class="text_item form_options" data-validate="{validate}" data-type="7">
<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}">
$this->sort_model[8] = '<div class="write_wrap" style="margin: 0;" data-validate="{validate}" data-type="8">
<p class="text_tit" style="line-height: 0.6rem;"><span class=" _validate">{name}</span>{must}</p>
</div>
<div class="up_wrap form_options">
... ... @@ -74,17 +74,21 @@ class OrderController extends HomeBaseController
<p class="click_up">点击上传</p>
</div>
</div>';
$this->sort_model[10] = '<div class="text_item no_margin form_options" data-validate="{validate}">
$this->sort_model[10] = '<div class="text_item no_margin form_options" data-validate="{validate}" data-type="10">
<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}">
$this->sort_model[11] = '<div class="text_item form_options" data-validate="{validate}" data-type="11">
<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>';
}
// 我要支付页面
... ...
... ... @@ -32,6 +32,7 @@ $(function() {
' </select>\n' +
' </div>\n' +
' </div>';
sort_list[12] = '<div class="f_formText"><input type="text" disabled class="f_input"/></div>';
// 添加表单元素
$('.f_item').click(function(){
var id = $(this).data('id');
... ...
... ... @@ -336,13 +336,27 @@
$(sort).find('.form_options').each(function(index,element){
var value = '';
if($(this).find('input').length > 0) {
if($(this).find('input').val()=='' && $(this).data('validate') == 1) {
// 判断填写内容是否符合要求
if($(this).find('input').val()=='' && $(this).find('input').attr('type') != 'file' && $(this).data('validate') == 1) {
data = [];
_error($(this).find('._validate').html()+'不能为空');
status = false;
return false;
} else {
value = $(this).find('input').val();
// 判断客户编号类型,长度必须为10位;判断手机号码格式是否正确
if($(this).data('type') == 12 && $(this).find('input').val().length != 10 && $(this).data('validate') == 1) {
_error($(this).find('._validate').html()+'长度必须为10位');
status = false;
return false;
} else if($(this).data('type') == 3 && $(this).data('validate') == 1) {
if(!reg.test($(this).find('input').val())) {
_error($(this).find('._validate').html()+'格式错误');
status = false;
return false;
}
} else {
value = $(this).find('input').val();
}
}
}
if($(this).find('.order_style').length > 0) {
... ... @@ -372,6 +386,7 @@
}
}
// 上传图片
$(".up_wrap").on("change","input[type='file']",function(){
var file = this.files[0];
var parent = $(this).parent().find('.up_pic');
... ...
... ... @@ -139,6 +139,7 @@
data: ''
};
var uploadImgUrl ;
var reg = /^1[0-9]{10}$/;
$('.order_style').click(function() {
$(this).addClass('active').siblings().removeClass('active')
});
... ... @@ -286,14 +287,27 @@
$(sort).find('.form_options').each(function(index,element){
var value = '';
if($(this).find('input').length > 0) {
console.log($(this).find('input').attr('type'));
// 判断填写内容是否符合要求
if($(this).find('input').val()=='' && $(this).find('input').attr('type') != 'file' && $(this).data('validate') == 1) {
data = [];
_error($(this).find('._validate').html()+'不能为空');
status = false;
return false;
} else {
value = $(this).find('input').val();
// 判断客户编号类型,长度必须为10位;判断手机号码格式是否正确
if($(this).data('type') == 12 && $(this).find('input').val().length != 10 && $(this).data('validate') == 1) {
_error($(this).find('._validate').html()+'长度必须为10位');
status = false;
return false;
} else if($(this).data('type') == 3 && $(this).data('validate') == 1) {
if(!reg.test($(this).find('input').val())) {
_error($(this).find('._validate').html()+'格式错误');
status = false;
return false;
}
} else {
value = $(this).find('input').val();
}
}
}
if($(this).find('.order_style').length > 0) {
... ... @@ -322,6 +336,7 @@
popup_switch = true
}
}
// 上传图片
$(".up_wrap").on("change","input[type='file']",function(){
var file = this.files[0];
var parent = $(this).parent().find('.up_pic');
... ...