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

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

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



查看合并请求 !165
@@ -24,7 +24,8 @@ class OrderController extends AdminBaseController @@ -24,7 +24,8 @@ class OrderController extends AdminBaseController
24 $this->table = 'Order'; 24 $this->table = 'Order';
25 $this->order_model = new OrderModel(); 25 $this->order_model = new OrderModel();
26 $this->option_table = 'OrderOption'; 26 $this->option_table = 'OrderOption';
27 - 27 +
  28 + // 订单字段类型定义
28 $this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}"> 29 $this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}">
29 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 30 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
30 <input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" /> 31 <input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
@@ -93,6 +94,7 @@ class OrderController extends AdminBaseController @@ -93,6 +94,7 @@ class OrderController extends AdminBaseController
93 */ 94 */
94 public function index() { 95 public function index() {
95 $param = $this->request->param(); 96 $param = $this->request->param();
  97 + // 查询条件处理
96 $where = [ 98 $where = [
97 'delete_time'=>0 99 'delete_time'=>0
98 ]; 100 ];
@@ -139,7 +141,7 @@ class OrderController extends AdminBaseController @@ -139,7 +141,7 @@ class OrderController extends AdminBaseController
139 $this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : ''); 141 $this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : '');
140 $this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : ''); 142 $this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
141 $this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : ''); 143 $this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
142 - // 订单类型 144 + // 订单类型查询
143 $sortList = Db::name('OrderSort')->where(['delete_time'=>0])->select()->toArray(); 145 $sortList = Db::name('OrderSort')->where(['delete_time'=>0])->select()->toArray();
144 $this->assign('sortList',$sortList); 146 $this->assign('sortList',$sortList);
145 return $this->fetch(); 147 return $this->fetch();
@@ -259,6 +261,7 @@ class OrderController extends AdminBaseController @@ -259,6 +261,7 @@ class OrderController extends AdminBaseController
259 public function excel() 261 public function excel()
260 { 262 {
261 $param = $this->request->param(); 263 $param = $this->request->param();
  264 + // 进行查询条件的处理
262 $where = [ 265 $where = [
263 'delete_time'=>0 266 'delete_time'=>0
264 ]; 267 ];
@@ -297,6 +300,7 @@ class OrderController extends AdminBaseController @@ -297,6 +300,7 @@ class OrderController extends AdminBaseController
297 $where['create_time'] = ['<= time', $endTime]; 300 $where['create_time'] = ['<= time', $endTime];
298 } 301 }
299 } 302 }
  303 + // 查询数据并导出
300 $list = Db::name('order_view')->where($where)->select()->toArray(); 304 $list = Db::name('order_view')->where($where)->select()->toArray();
301 $this->expList($list); 305 $this->expList($list);
302 } 306 }
@@ -426,20 +430,28 @@ class OrderController extends AdminBaseController @@ -426,20 +430,28 @@ class OrderController extends AdminBaseController
426 $objPHPExcel->setActiveSheetIndex(0) 430 $objPHPExcel->setActiveSheetIndex(0)
427 ->setCellValueExplicit($vs['cell'] . $i, $vs['user_choose'],\PHPExcel_Cell_DataType::TYPE_STRING); 431 ->setCellValueExplicit($vs['cell'] . $i, $vs['user_choose'],\PHPExcel_Cell_DataType::TYPE_STRING);
428 } elseif($vs['type'] == 8) { 432 } elseif($vs['type'] == 8) {
429 - //设置默认行高  
430 - $objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight(80);  
431 - // 图片生成  
432 - $objDrawing[$i] = new \PHPExcel_Worksheet_Drawing();  
433 - $objDrawing[$i]->setPath('./upload/'.$vs['user_choose']);  
434 - // 设置宽度高度  
435 - $objDrawing[$i]->setHeight(80);//照片高度  
436 - $objDrawing[$i]->setWidth(80); //照片宽度  
437 - /*设置图片要插入的单元格*/  
438 - $objDrawing[$i]->setCoordinates($vs['cell'].$i);  
439 - // 图片偏移距离  
440 - $objDrawing[$i]->setOffsetX(12);  
441 - $objDrawing[$i]->setOffsetY(12);  
442 - $objDrawing[$i]->setWorksheet($objPHPExcel->getActiveSheet()); 433 + if(!empty($vs['user_choose']) && file_exists('./upload/'.$vs['user_choose'])) {
  434 + $image = \think\Image::open('./upload/'.$vs['user_choose']);
  435 + // 返回图片的宽度
  436 + $width = $image->width();
  437 + // 返回图片的高度
  438 + $height = $image->height();
  439 + $default = $height/($width/100);
  440 + //设置默认行高
  441 + $objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight($default);
  442 + // 图片生成
  443 + $objDrawing[$i] = new \PHPExcel_Worksheet_Drawing();
  444 + $objDrawing[$i]->setPath('./upload/'.$vs['user_choose']);
  445 + // 设置宽度高度
  446 + $objDrawing[$i]->setHeight(100);//照片高度
  447 + $objDrawing[$i]->setWidth(100); //照片宽度
  448 + /*设置图片要插入的单元格*/
  449 + $objDrawing[$i]->setCoordinates($vs['cell'].$i);
  450 + // 图片偏移距离
  451 + $objDrawing[$i]->setOffsetX(12);
  452 + $objDrawing[$i]->setOffsetY(12);
  453 + $objDrawing[$i]->setWorksheet($objPHPExcel->getActiveSheet());
  454 + }
443 } else { 455 } else {
444 $objPHPExcel->setActiveSheetIndex(0) 456 $objPHPExcel->setActiveSheetIndex(0)
445 ->setCellValue($vs['cell'] . $i, $vs['user_choose']); 457 ->setCellValue($vs['cell'] . $i, $vs['user_choose']);
@@ -45,7 +45,7 @@ class OrderOptionController extends AdminBaseController @@ -45,7 +45,7 @@ class OrderOptionController extends AdminBaseController
45 // 'linkage' => '链接' 45 // 'linkage' => '链接'
46 // ]; 46 // ];
47 // $this->type = ['文本', '单选', '复选', '多行文本', '下拉菜单', '图片', '链接']; 47 // $this->type = ['文本', '单选', '复选', '多行文本', '下拉菜单', '图片', '链接'];
48 - $this->type = [1 => '文本', 2 => '文本(数字)', 3 => '文本(手机号码)', 4 => '单选', 5 => '复选', 6 => '多行文本', 7 => '下拉菜单', 8 => '图片',9 => '链接',10 => '日期',11 => '地区联动']; 48 + $this->type = [1 => '文本', 2 => '文本(数字)', 3 => '文本(手机号码)', 4 => '单选', 5 => '复选', 6 => '多行文本', 7 => '下拉菜单', 8 => '图片',9 => '链接',10 => '日期',11 => '地区联动',12 => '客户编号'];
49 $this->assign('typeList', $this->type); 49 $this->assign('typeList', $this->type);
50 } 50 }
51 51
@@ -16,7 +16,7 @@ class OrderOptionValidate extends Validate @@ -16,7 +16,7 @@ class OrderOptionValidate extends Validate
16 protected $rule = [ 16 protected $rule = [
17 'name' => 'require', 17 'name' => 'require',
18 'icon' => 'require', 18 'icon' => 'require',
19 - 'sort' => 'require|number|between:1,11', 19 + 'sort' => 'require|number|between:1,12',
20 'is_show' => 'in:0,1', 20 'is_show' => 'in:0,1',
21 ]; 21 ];
22 22
@@ -25,7 +25,7 @@ class OrderOptionValidate extends Validate @@ -25,7 +25,7 @@ class OrderOptionValidate extends Validate
25 'icon.require' => '图标不能为空', 25 'icon.require' => '图标不能为空',
26 'sort.require' => '类型不能为空', 26 'sort.require' => '类型不能为空',
27 'sort.number' => '类型必须为数字', 27 'sort.number' => '类型必须为数字',
28 - 'sort.between' => '类型值必须在1-11之间', 28 + 'sort.between' => '类型值必须在1-12之间',
29 'is_show.between' => '用户是否可见值必须在0-1之间', 29 'is_show.between' => '用户是否可见值必须在0-1之间',
30 ]; 30 ];
31 31
@@ -37,38 +37,38 @@ class MemberSalesController extends HomeBaseController @@ -37,38 +37,38 @@ class MemberSalesController extends HomeBaseController
37 $this->order_sort_model = new OrderSortModel(); 37 $this->order_sort_model = new OrderSortModel();
38 $this->option_table = 'OrderOption'; 38 $this->option_table = 'OrderOption';
39 39
40 - $this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}"> 40 + $this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}" data-type="1">
41 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 41 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
42 <input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" /> 42 <input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
43 </div>'; 43 </div>';
44 - $this->sort_model[2] = '<div class="text_item form_options" data-validate="{validate}"> 44 + $this->sort_model[2] = '<div class="text_item form_options" data-validate="{validate}" data-type="2">
45 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 45 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
46 <input type="number" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" /> 46 <input type="number" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
47 </div>'; 47 </div>';
48 - $this->sort_model[3] = '<div class="text_item form_options" data-validate="{validate}"> 48 + $this->sort_model[3] = '<div class="text_item form_options" data-validate="{validate}" data-type="3">
49 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 49 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
50 <input type="number" maxlength="11" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" /> 50 <input type="number" maxlength="11" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
51 </div>'; 51 </div>';
52 - $this->sort_model[4] = '<div class="write_tit form_options" data-validate="{validate}"> 52 + $this->sort_model[4] = '<div class="write_tit form_options" data-validate="{validate}" data-type="4">
53 <p class="tit"><span class=" _validate">{name}</span></p> 53 <p class="tit"><span class=" _validate">{name}</span></p>
54 <div class="flex_style"> 54 <div class="flex_style">
55 {options} 55 {options}
56 </div> 56 </div>
57 </div>'; 57 </div>';
58 - $this->sort_model[5] = '<div class="text_item form_options" data-validate="{validate}"> 58 + $this->sort_model[5] = '<div class="text_item form_options" data-validate="{validate}" data-type="5">
59 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 59 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
60 <input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" /> 60 <input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
61 </div>'; 61 </div>';
62 - $this->sort_model[6] = '<div class="text_item form_options" data-validate="{validate}"> 62 + $this->sort_model[6] = '<div class="text_item form_options" data-validate="{validate}" data-type="6">
63 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 63 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
64 <textarea class="baby_input">{value}</textarea> 64 <textarea class="baby_input">{value}</textarea>
65 </div>'; 65 </div>';
66 - $this->sort_model[7] = '<div class="text_item form_options" data-validate="{validate}"> 66 + $this->sort_model[7] = '<div class="text_item form_options" data-validate="{validate}" data-type="7">
67 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 67 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
68 <input type="text" name="" readonly id="product" value="{value}" class="baby_input" placeholder="请选择{name}" /> 68 <input type="text" name="" readonly id="product" value="{value}" class="baby_input" placeholder="请选择{name}" />
69 <img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" /> 69 <img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
70 </div>'; 70 </div>';
71 - $this->sort_model[8] = '<div class="write_wrap" style="margin: 0;" data-validate="{validate}"> 71 + $this->sort_model[8] = '<div class="write_wrap" style="margin: 0;" data-validate="{validate}" data-type="8">
72 <p class="text_tit" style="line-height: 0.6rem;"><span class=" _validate">{name}</span>{must}</p> 72 <p class="text_tit" style="line-height: 0.6rem;"><span class=" _validate">{name}</span>{must}</p>
73 </div> 73 </div>
74 <div class="up_wrap form_options" data-validate="{validate}"> 74 <div class="up_wrap form_options" data-validate="{validate}">
@@ -78,17 +78,21 @@ class MemberSalesController extends HomeBaseController @@ -78,17 +78,21 @@ class MemberSalesController extends HomeBaseController
78 {img} 78 {img}
79 </div> 79 </div>
80 </div>'; 80 </div>';
81 - $this->sort_model[10] = '<div class="text_item no_margin form_options" data-validate="{validate}"> 81 + $this->sort_model[10] = '<div class="text_item no_margin form_options" data-validate="{validate}" data-type="10">
82 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 82 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
83 <input type="text" name="" id="birthday" readonly="readonly" value="{value}" class="baby_input" placeholder="请选择{name}" /> 83 <input type="text" name="" id="birthday" readonly="readonly" value="{value}" class="baby_input" placeholder="请选择{name}" />
84 <img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" /> 84 <img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
85 </div>'; 85 </div>';
86 - $this->sort_model[11] = '<div class="text_item form_options" data-validate="{validate}"> 86 + $this->sort_model[11] = '<div class="text_item form_options" data-validate="{validate}" data-type="11">
87 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 87 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
88 <weui-distpicker province="广东省" city="广州市" area="海珠区"></weui-distpicker> 88 <weui-distpicker province="广东省" city="广州市" area="海珠区"></weui-distpicker>
89 <input type="text" name="" id="address" readonly="readonly" value="{value}" class="baby_input" placeholder="请输入{name}" /> 89 <input type="text" name="" id="address" readonly="readonly" value="{value}" class="baby_input" placeholder="请输入{name}" />
90 <img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" /> 90 <img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
91 </div>'; 91 </div>';
  92 + $this->sort_model[12] = '<div class="text_item form_options" data-validate="{validate}" data-type="12">
  93 + <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
  94 + <input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
  95 + </div>';
92 } 96 }
93 // 前置方法(判断是否登录销售账号) 97 // 前置方法(判断是否登录销售账号)
94 protected function check_login() 98 protected function check_login()
@@ -34,38 +34,38 @@ class OrderController extends HomeBaseController @@ -34,38 +34,38 @@ class OrderController extends HomeBaseController
34 $this->order_sort_model = new OrderSortModel(); 34 $this->order_sort_model = new OrderSortModel();
35 $this->option_table = 'OrderOption'; 35 $this->option_table = 'OrderOption';
36 36
37 - $this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}"> 37 + $this->sort_model[1] = '<div class="text_item form_options" data-validate="{validate}" data-type="1">
38 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 38 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
39 <input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" /> 39 <input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
40 </div>'; 40 </div>';
41 - $this->sort_model[2] = '<div class="text_item form_options" data-validate="{validate}"> 41 + $this->sort_model[2] = '<div class="text_item form_options" data-validate="{validate}" data-type="2">
42 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 42 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
43 <input type="number" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" /> 43 <input type="number" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
44 </div>'; 44 </div>';
45 - $this->sort_model[3] = '<div class="text_item form_options" data-validate="{validate}"> 45 + $this->sort_model[3] = '<div class="text_item form_options" data-validate="{validate}" data-type="3">
46 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 46 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
47 <input type="number" maxlength="11" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" /> 47 <input type="number" maxlength="11" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
48 </div>'; 48 </div>';
49 - $this->sort_model[4] = '<div class="write_tit form_options" data-validate="{validate}"> 49 + $this->sort_model[4] = '<div class="write_tit form_options" data-validate="{validate}" data-type="4">
50 <p class="tit"><span class=" _validate">{name}</span></p> 50 <p class="tit"><span class=" _validate">{name}</span></p>
51 <div class="flex_style"> 51 <div class="flex_style">
52 {options} 52 {options}
53 </div> 53 </div>
54 </div>'; 54 </div>';
55 - $this->sort_model[5] = '<div class="text_item form_options" data-validate="{validate}"> 55 + $this->sort_model[5] = '<div class="text_item form_options" data-validate="{validate}" data-type="5">
56 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 56 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
57 <input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" /> 57 <input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
58 </div>'; 58 </div>';
59 - $this->sort_model[6] = '<div class="text_item form_options" data-validate="{validate}"> 59 + $this->sort_model[6] = '<div class="text_item form_options" data-validate="{validate}" data-type="6">
60 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 60 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
61 <textarea class="baby_input">{value}</textarea> 61 <textarea class="baby_input">{value}</textarea>
62 </div>'; 62 </div>';
63 - $this->sort_model[7] = '<div class="text_item form_options" data-validate="{validate}"> 63 + $this->sort_model[7] = '<div class="text_item form_options" data-validate="{validate}" data-type="7">
64 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 64 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
65 <input type="text" name="" id="product" value="{value}" class="baby_input" placeholder="请选择{name}" /> 65 <input type="text" name="" id="product" value="{value}" class="baby_input" placeholder="请选择{name}" />
66 <img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" /> 66 <img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
67 </div>'; 67 </div>';
68 - $this->sort_model[8] = '<div class="write_wrap" style="margin: 0;" data-validate="{validate}"> 68 + $this->sort_model[8] = '<div class="write_wrap" style="margin: 0;" data-validate="{validate}" data-type="8">
69 <p class="text_tit" style="line-height: 0.6rem;"><span class=" _validate">{name}</span>{must}</p> 69 <p class="text_tit" style="line-height: 0.6rem;"><span class=" _validate">{name}</span>{must}</p>
70 </div> 70 </div>
71 <div class="up_wrap form_options"> 71 <div class="up_wrap form_options">
@@ -74,17 +74,21 @@ class OrderController extends HomeBaseController @@ -74,17 +74,21 @@ class OrderController extends HomeBaseController
74 <p class="click_up">点击上传</p> 74 <p class="click_up">点击上传</p>
75 </div> 75 </div>
76 </div>'; 76 </div>';
77 - $this->sort_model[10] = '<div class="text_item no_margin form_options" data-validate="{validate}"> 77 + $this->sort_model[10] = '<div class="text_item no_margin form_options" data-validate="{validate}" data-type="10">
78 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 78 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
79 <input type="text" name="" id="birthday" readonly="readonly" value="{value}" class="baby_input" placeholder="请选择{name}" /> 79 <input type="text" name="" id="birthday" readonly="readonly" value="{value}" class="baby_input" placeholder="请选择{name}" />
80 <img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" /> 80 <img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
81 </div>'; 81 </div>';
82 - $this->sort_model[11] = '<div class="text_item form_options" data-validate="{validate}"> 82 + $this->sort_model[11] = '<div class="text_item form_options" data-validate="{validate}" data-type="11">
83 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p> 83 <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
84 <weui-distpicker province="广东省" city="广州市" area="海珠区"></weui-distpicker> 84 <weui-distpicker province="广东省" city="广州市" area="海珠区"></weui-distpicker>
85 <input type="text" name="" id="address" readonly="readonly" value="{value}" class="baby_input" placeholder="请输入{name}" /> 85 <input type="text" name="" id="address" readonly="readonly" value="{value}" class="baby_input" placeholder="请输入{name}" />
86 <img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" /> 86 <img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
87 </div>'; 87 </div>';
  88 + $this->sort_model[12] = '<div class="text_item form_options" data-validate="{validate}" data-type="12">
  89 + <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
  90 + <input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
  91 + </div>';
88 } 92 }
89 93
90 // 我要支付页面 94 // 我要支付页面
@@ -32,6 +32,7 @@ $(function() { @@ -32,6 +32,7 @@ $(function() {
32 ' </select>\n' + 32 ' </select>\n' +
33 ' </div>\n' + 33 ' </div>\n' +
34 ' </div>'; 34 ' </div>';
  35 + sort_list[12] = '<div class="f_formText"><input type="text" disabled class="f_input"/></div>';
35 // 添加表单元素 36 // 添加表单元素
36 $('.f_item').click(function(){ 37 $('.f_item').click(function(){
37 var id = $(this).data('id'); 38 var id = $(this).data('id');
@@ -336,13 +336,27 @@ @@ -336,13 +336,27 @@
336 $(sort).find('.form_options').each(function(index,element){ 336 $(sort).find('.form_options').each(function(index,element){
337 var value = ''; 337 var value = '';
338 if($(this).find('input').length > 0) { 338 if($(this).find('input').length > 0) {
339 - if($(this).find('input').val()=='' && $(this).data('validate') == 1) { 339 + // 判断填写内容是否符合要求
  340 + if($(this).find('input').val()=='' && $(this).find('input').attr('type') != 'file' && $(this).data('validate') == 1) {
340 data = []; 341 data = [];
341 _error($(this).find('._validate').html()+'不能为空'); 342 _error($(this).find('._validate').html()+'不能为空');
342 status = false; 343 status = false;
343 return false; 344 return false;
344 } else { 345 } else {
345 - value = $(this).find('input').val(); 346 + // 判断客户编号类型,长度必须为10位;判断手机号码格式是否正确
  347 + if($(this).data('type') == 12 && $(this).find('input').val().length != 10 && $(this).data('validate') == 1) {
  348 + _error($(this).find('._validate').html()+'长度必须为10位');
  349 + status = false;
  350 + return false;
  351 + } else if($(this).data('type') == 3 && $(this).data('validate') == 1) {
  352 + if(!reg.test($(this).find('input').val())) {
  353 + _error($(this).find('._validate').html()+'格式错误');
  354 + status = false;
  355 + return false;
  356 + }
  357 + } else {
  358 + value = $(this).find('input').val();
  359 + }
346 } 360 }
347 } 361 }
348 if($(this).find('.order_style').length > 0) { 362 if($(this).find('.order_style').length > 0) {
@@ -372,6 +386,7 @@ @@ -372,6 +386,7 @@
372 } 386 }
373 } 387 }
374 388
  389 + // 上传图片
375 $(".up_wrap").on("change","input[type='file']",function(){ 390 $(".up_wrap").on("change","input[type='file']",function(){
376 var file = this.files[0]; 391 var file = this.files[0];
377 var parent = $(this).parent().find('.up_pic'); 392 var parent = $(this).parent().find('.up_pic');
@@ -139,6 +139,7 @@ @@ -139,6 +139,7 @@
139 data: '' 139 data: ''
140 }; 140 };
141 var uploadImgUrl ; 141 var uploadImgUrl ;
  142 + var reg = /^1[0-9]{10}$/;
142 $('.order_style').click(function() { 143 $('.order_style').click(function() {
143 $(this).addClass('active').siblings().removeClass('active') 144 $(this).addClass('active').siblings().removeClass('active')
144 }); 145 });
@@ -286,14 +287,27 @@ @@ -286,14 +287,27 @@
286 $(sort).find('.form_options').each(function(index,element){ 287 $(sort).find('.form_options').each(function(index,element){
287 var value = ''; 288 var value = '';
288 if($(this).find('input').length > 0) { 289 if($(this).find('input').length > 0) {
289 - console.log($(this).find('input').attr('type')); 290 + // 判断填写内容是否符合要求
290 if($(this).find('input').val()=='' && $(this).find('input').attr('type') != 'file' && $(this).data('validate') == 1) { 291 if($(this).find('input').val()=='' && $(this).find('input').attr('type') != 'file' && $(this).data('validate') == 1) {
291 data = []; 292 data = [];
292 _error($(this).find('._validate').html()+'不能为空'); 293 _error($(this).find('._validate').html()+'不能为空');
293 status = false; 294 status = false;
294 return false; 295 return false;
295 } else { 296 } else {
296 - value = $(this).find('input').val(); 297 + // 判断客户编号类型,长度必须为10位;判断手机号码格式是否正确
  298 + if($(this).data('type') == 12 && $(this).find('input').val().length != 10 && $(this).data('validate') == 1) {
  299 + _error($(this).find('._validate').html()+'长度必须为10位');
  300 + status = false;
  301 + return false;
  302 + } else if($(this).data('type') == 3 && $(this).data('validate') == 1) {
  303 + if(!reg.test($(this).find('input').val())) {
  304 + _error($(this).find('._validate').html()+'格式错误');
  305 + status = false;
  306 + return false;
  307 + }
  308 + } else {
  309 + value = $(this).find('input').val();
  310 + }
297 } 311 }
298 } 312 }
299 if($(this).find('.order_style').length > 0) { 313 if($(this).find('.order_style').length > 0) {
@@ -322,6 +336,7 @@ @@ -322,6 +336,7 @@
322 popup_switch = true 336 popup_switch = true
323 } 337 }
324 } 338 }
  339 + // 上传图片
325 $(".up_wrap").on("change","input[type='file']",function(){ 340 $(".up_wrap").on("change","input[type='file']",function(){
326 var file = this.files[0]; 341 var file = this.files[0];
327 var parent = $(this).parent().find('.up_pic'); 342 var parent = $(this).parent().find('.up_pic');