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

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

字段验证逻辑修改、后台订单问题修改、销售订单列表显示数据修改



查看合并请求 !205
@@ -77,6 +77,10 @@ class OrderController extends AdminBaseController @@ -77,6 +77,10 @@ class OrderController extends AdminBaseController
77 <input type="text" name="" id="address" readonly="readonly" value="{value}" class="baby_input" placeholder="请输入{name}" /> 77 <input type="text" name="" id="address" readonly="readonly" value="{value}" class="baby_input" placeholder="请输入{name}" />
78 <img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" /> 78 <img src="__TMPL__/public/mobile/images/youjiantou.png" class="jiantou" />
79 </div>'; 79 </div>';
  80 + $this->sort_model[12] = '<div class="text_item form_options" data-validate="{validate}" data-type="12">
  81 + <p class="text_tit"><span class=" _validate">{name}</span>{must}</p>
  82 + <input type="text" name="" id="" value="{value}" class="baby_input" placeholder="请输入{name}" />
  83 + </div>';
80 } 84 }
81 85
82 /** 86 /**
@@ -169,8 +173,19 @@ class OrderController extends AdminBaseController @@ -169,8 +173,19 @@ class OrderController extends AdminBaseController
169 $this->error('参数错误'); 173 $this->error('参数错误');
170 } 174 }
171 $where['sort_id'] = $param['sort_id']; 175 $where['sort_id'] = $param['sort_id'];
172 - if(isset($param['keyword'])) {  
173 - $where['sort_name'] = ['like','%'.$param['keyword'].'%']; 176 + if(isset($param['status']) && $param['status'] >= 0) {
  177 + $where['status'] = $param['status'];
  178 + }
  179 + if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
  180 + $where['is_excel'] = $param['is_excel'];
  181 + }
  182 + if(isset($param['is_over']) && $param['is_over'] >= 0) {
  183 + if($param['is_over'] == 0) {
  184 + $where['over_time'] = ['egt',time()];
  185 + }
  186 + if($param['is_over'] == 1) {
  187 + $where['over_time'] = ['lt',time()];
  188 + }
174 } 189 }
175 $startTime = empty($filter['start_time']) ? 0 : strtotime($filter['start_time']); 190 $startTime = empty($filter['start_time']) ? 0 : strtotime($filter['start_time']);
176 $endTime = empty($filter['end_time']) ? 0 : strtotime($filter['end_time']); 191 $endTime = empty($filter['end_time']) ? 0 : strtotime($filter['end_time']);
@@ -189,6 +204,11 @@ class OrderController extends AdminBaseController @@ -189,6 +204,11 @@ class OrderController extends AdminBaseController
189 $this->assign('list',$list->items()); 204 $this->assign('list',$list->items());
190 $this->assign('page',$list->render()); 205 $this->assign('page',$list->render());
191 $this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : ''); 206 $this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
  207 + $this->assign('status',isset($param['status']) ? $param['status'] : '');
  208 + $this->assign('is_excel',isset($param['is_excel']) ? $param['is_excel'] : '');
  209 + $this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : '');
  210 + $this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
  211 + $this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
192 $this->assign('sort_id',$param['sort_id']); 212 $this->assign('sort_id',$param['sort_id']);
193 // 订单类型 213 // 订单类型
194 $sortList = Db::name('OrderSort')->where(['delete_time'=>0])->select()->toArray(); 214 $sortList = Db::name('OrderSort')->where(['delete_time'=>0])->select()->toArray();
@@ -221,6 +241,23 @@ class OrderController extends AdminBaseController @@ -221,6 +241,23 @@ class OrderController extends AdminBaseController
221 if(isset($param['keyword'])) { 241 if(isset($param['keyword'])) {
222 $where['order_sn|sort_name|user_login|number'] = ['like','%'.$param['keyword'].'%']; 242 $where['order_sn|sort_name|user_login|number'] = ['like','%'.$param['keyword'].'%'];
223 } 243 }
  244 + if(!empty($param['sort_id'])) {
  245 + $where['sort_id'] = $param['sort_id'];
  246 + }
  247 + if(isset($param['status']) && $param['status'] >= 0) {
  248 + $where['status'] = $param['status'];
  249 + }
  250 + if(isset($param['is_excel']) && $param['is_excel'] >= 0) {
  251 + $where['is_excel'] = $param['is_excel'];
  252 + }
  253 + if(isset($param['is_over']) && $param['is_over'] >= 0) {
  254 + if($param['is_over'] == 0) {
  255 + $where['over_time'] = ['egt',time()];
  256 + }
  257 + if($param['is_over'] == 1) {
  258 + $where['over_time'] = ['lt',time()];
  259 + }
  260 + }
224 $startTime = empty($filter['start_time']) ? 0 : strtotime($filter['start_time']); 261 $startTime = empty($filter['start_time']) ? 0 : strtotime($filter['start_time']);
225 $endTime = empty($filter['end_time']) ? 0 : strtotime($filter['end_time']); 262 $endTime = empty($filter['end_time']) ? 0 : strtotime($filter['end_time']);
226 if (!empty($startTime) && !empty($endTime)) { 263 if (!empty($startTime) && !empty($endTime)) {
@@ -238,6 +275,12 @@ class OrderController extends AdminBaseController @@ -238,6 +275,12 @@ class OrderController extends AdminBaseController
238 $this->assign('list',$list->items()); 275 $this->assign('list',$list->items());
239 $this->assign('page',$list->render()); 276 $this->assign('page',$list->render());
240 $this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : ''); 277 $this->assign('keyword',isset($param['keyword']) ? $param['keyword'] : '');
  278 + $this->assign('sort_id',isset($param['sort_id']) ? $param['sort_id'] : '');
  279 + $this->assign('status',isset($param['status']) ? $param['status'] : '');
  280 + $this->assign('is_excel',isset($param['is_excel']) ? $param['is_excel'] : '');
  281 + $this->assign('is_over',isset($param['is_over']) ? $param['is_over'] : '');
  282 + $this->assign('start_time',isset($param['start_time']) ? $param['start_time'] : '');
  283 + $this->assign('end_time',isset($param['end_time']) ? $param['end_time'] : '');
241 $this->assign('user_id',$param['user_id']); 284 $this->assign('user_id',$param['user_id']);
242 // 订单类型 285 // 订单类型
243 $sortList = Db::name('OrderSort')->where(['delete_time'=>0])->select()->toArray(); 286 $sortList = Db::name('OrderSort')->where(['delete_time'=>0])->select()->toArray();
@@ -254,12 +254,23 @@ class MemberSalesController extends HomeBaseController @@ -254,12 +254,23 @@ class MemberSalesController extends HomeBaseController
254 $this->redirect(url('portal/MemberSales/order_type')); 254 $this->redirect(url('portal/MemberSales/order_type'));
255 } 255 }
256 $user_id = cmf_get_current_user_sale_id(); 256 $user_id = cmf_get_current_user_sale_id();
257 - $order_where = [ 257 + $order_where1 = [
258 'user_id' => $user_id, 258 'user_id' => $user_id,
  259 + 'status' => 0,
  260 + 'over_time' => ['egt',time()],
259 'is_stop' => 0, 261 'is_stop' => 0,
260 'delete_time' => 0 262 'delete_time' => 0
261 ]; 263 ];
262 - $orderList = Db::name('OrderView')->where($order_where)->select()->toArray(); 264 + $order_where2 = [
  265 + 'user_id' => $user_id,
  266 + 'status' => 1,
  267 + 'is_stop' => 0,
  268 + 'delete_time' => 0
  269 + ];
  270 + $orderList = Db::name('OrderView')
  271 + ->where(function ($q) use ($order_where1) {$q->where($order_where1);})
  272 + ->whereOr(function ($q) use ($order_where2) {$q->where($order_where2);})
  273 + ->select()->toArray();
263 foreach ($orderList as $k=>$v) { 274 foreach ($orderList as $k=>$v) {
264 $mobile = ''; 275 $mobile = '';
265 $v['options'] = json_decode($v['options'],true); 276 $v['options'] = json_decode($v['options'],true);
@@ -6,6 +6,31 @@ @@ -6,6 +6,31 @@
6 <li class="active"><a href="javascript:;">订单列表</a></li> 6 <li class="active"><a href="javascript:;">订单列表</a></li>
7 </ul> 7 </ul>
8 <form class="well form-inline margin-top-20" method="post" action="{:url('Order/index_sales',['user_id'=>$user_id])}"> 8 <form class="well form-inline margin-top-20" method="post" action="{:url('Order/index_sales',['user_id'=>$user_id])}">
  9 + 订单类型:
  10 + <select class="form-control" name="sort_id" style="width: 140px;">
  11 + <option value="0">请选择</option>
  12 + <volist name="sortList" id="vo">
  13 + <option value="{$vo.id}" <eq name="sort_id" value="$vo['id']">selected</eq>>{$vo.name}</option>
  14 + </volist>
  15 + </select>&nbsp; &nbsp;
  16 + 订单状态:
  17 + <select class="form-control" name="status" style="width: 140px;">
  18 + <option value="-1">请选择</option>
  19 + <option value="0" <eq name="status" value="0">selected</eq>>未支付</option>
  20 + <option value="1" <eq name="status" value="1">selected</eq>>已支付</option>
  21 + </select>&nbsp; &nbsp;
  22 + 是否失效:
  23 + <select class="form-control" name="is_over" style="width: 140px;">
  24 + <option value="-1">请选择</option>
  25 + <option value="0" <eq name="is_over" value="0">selected</eq>>否</option>
  26 + <option value="1" <eq name="is_over" value="1">selected</eq>>是</option>
  27 + </select>&nbsp; &nbsp;
  28 + 导出状态:
  29 + <select class="form-control" name="is_excel" style="width: 140px;">
  30 + <option value="-1">请选择</option>
  31 + <option value="0" <eq name="is_excel" value="0">selected</eq>>未导出</option>
  32 + <option value="1" <eq name="is_excel" value="1">selected</eq>>已导出</option>
  33 + </select>&nbsp; &nbsp;
9 时间: 34 时间:
10 <input type="text" class="form-control js-bootstrap-datetime" name="start_time" 35 <input type="text" class="form-control js-bootstrap-datetime" name="start_time"
11 value="{$start_time|default=''}" 36 value="{$start_time|default=''}"
@@ -18,6 +43,7 @@ @@ -18,6 +43,7 @@
18 value="{$keyword|default=''}" placeholder="请输入关键字..."> 43 value="{$keyword|default=''}" placeholder="请输入关键字...">
19 <input type="submit" class="btn btn-primary" value="搜索"/> 44 <input type="submit" class="btn btn-primary" value="搜索"/>
20 <a class="btn btn-danger" href="{:url('Order/index_sales',['user_id'=>$user_id])}">清空</a> 45 <a class="btn btn-danger" href="{:url('Order/index_sales',['user_id'=>$user_id])}">清空</a>
  46 + <input type="button" class="btn btn-primary" id="excel" value="导出"/>
21 </form> 47 </form>
22 <form class="js-ajax-form" action="" method="post"> 48 <form class="js-ajax-form" action="" method="post">
23 <div class="table-actions"> 49 <div class="table-actions">
@@ -101,6 +127,52 @@ @@ -101,6 +127,52 @@
101 </div> 127 </div>
102 <script src="__STATIC__/js/admin.js"></script> 128 <script src="__STATIC__/js/admin.js"></script>
103 <script> 129 <script>
  130 + $('#excel').click(function () {
  131 + var url1 = "{:url('Order/excel')}";
  132 + var url2 = url1.split('.',5);
  133 + var sort_id = $('select[name=sort_id]').val();
  134 + var status = $('select[name=status]').val();
  135 + var is_over = $('select[name=is_over]').val();
  136 + var is_excel = $('select[name=is_excel]').val();
  137 + var keyword = $('input[name=keyword]').val();
  138 + var start_time = $('input[name=start_time]').val();
  139 + var end_time = $('input[name=end_time]').val();
  140 + var param = '/excel/1';
  141 + var ids = [];
  142 + $('.js-check').each(function(index,element) {
  143 + if($(this).prop('checked') == true) {
  144 + ids.push($(this).val());
  145 + }
  146 + });
  147 + console.log(ids);
  148 + if(ids.length>0) {
  149 + ids = ids.join(',');
  150 + param += '/ids/' + ids;
  151 + }
  152 + if(sort_id.length > 0) {
  153 + param += '/sort_id/'+sort_id;
  154 + }
  155 + if(status.length > 0) {
  156 + param += '/status/'+status;
  157 + }
  158 + if(is_over.length > 0) {
  159 + param += '/is_over/'+is_over;
  160 + }
  161 + if(is_excel.length > 0) {
  162 + param += '/is_excel/'+is_excel;
  163 + }
  164 + if(keyword.length > 0) {
  165 + param += '/keyword/'+keyword;
  166 + }
  167 + if(start_time.length > 0) {
  168 + param += '/start_time/'+start_time;
  169 + }
  170 + if(end_time.length > 0) {
  171 + param += '/end_time/'+end_time;
  172 + }
  173 + var url = url2[0]+param+'.html';
  174 + window.open(url);
  175 + });
104 function reloadPage(win) { 176 function reloadPage(win) {
105 win.location.reload(); 177 win.location.reload();
106 } 178 }
@@ -6,6 +6,24 @@ @@ -6,6 +6,24 @@
6 <li class="active"><a href="javascript:;">订单列表</a></li> 6 <li class="active"><a href="javascript:;">订单列表</a></li>
7 </ul> 7 </ul>
8 <form class="well form-inline margin-top-20" method="post" action="{:url('Order/index_sort',['sort_id'=>$sort_id])}"> 8 <form class="well form-inline margin-top-20" method="post" action="{:url('Order/index_sort',['sort_id'=>$sort_id])}">
  9 + 订单状态:
  10 + <select class="form-control" name="status" style="width: 140px;">
  11 + <option value="-1">请选择</option>
  12 + <option value="0" <eq name="status" value="0">selected</eq>>未支付</option>
  13 + <option value="1" <eq name="status" value="1">selected</eq>>已支付</option>
  14 + </select>&nbsp; &nbsp;
  15 + 是否失效:
  16 + <select class="form-control" name="is_over" style="width: 140px;">
  17 + <option value="-1">请选择</option>
  18 + <option value="0" <eq name="is_over" value="0">selected</eq>>否</option>
  19 + <option value="1" <eq name="is_over" value="1">selected</eq>>是</option>
  20 + </select>&nbsp; &nbsp;
  21 + 导出状态:
  22 + <select class="form-control" name="is_excel" style="width: 140px;">
  23 + <option value="-1">请选择</option>
  24 + <option value="0" <eq name="is_excel" value="0">selected</eq>>未导出</option>
  25 + <option value="1" <eq name="is_excel" value="1">selected</eq>>已导出</option>
  26 + </select>&nbsp; &nbsp;
9 时间: 27 时间:
10 <input type="text" class="form-control js-bootstrap-datetime" name="start_time" 28 <input type="text" class="form-control js-bootstrap-datetime" name="start_time"
11 value="{$start_time|default=''}" 29 value="{$start_time|default=''}"
@@ -18,6 +36,7 @@ @@ -18,6 +36,7 @@
18 value="{$keyword|default=''}" placeholder="请输入关键字..."> 36 value="{$keyword|default=''}" placeholder="请输入关键字...">
19 <input type="submit" class="btn btn-primary" value="搜索"/> 37 <input type="submit" class="btn btn-primary" value="搜索"/>
20 <a class="btn btn-danger" href="{:url('Order/index_sort',['sort_id'=>$sort_id])}">清空</a> 38 <a class="btn btn-danger" href="{:url('Order/index_sort',['sort_id'=>$sort_id])}">清空</a>
  39 + <input type="button" class="btn btn-primary" id="excel" value="导出"/>
21 </form> 40 </form>
22 <form class="js-ajax-form" action="" method="post"> 41 <form class="js-ajax-form" action="" method="post">
23 <div class="table-actions"> 42 <div class="table-actions">
@@ -101,6 +120,52 @@ @@ -101,6 +120,52 @@
101 </div> 120 </div>
102 <script src="__STATIC__/js/admin.js"></script> 121 <script src="__STATIC__/js/admin.js"></script>
103 <script> 122 <script>
  123 + $('#excel').click(function () {
  124 + var url1 = "{:url('Order/excel')}";
  125 + var url2 = url1.split('.',5);
  126 + var sort_id = "{$sort_id}";
  127 + var status = $('select[name=status]').val();
  128 + var is_over = $('select[name=is_over]').val();
  129 + var is_excel = $('select[name=is_excel]').val();
  130 + var keyword = $('input[name=keyword]').val();
  131 + var start_time = $('input[name=start_time]').val();
  132 + var end_time = $('input[name=end_time]').val();
  133 + var param = '/excel/1';
  134 + var ids = [];
  135 + $('.js-check').each(function(index,element) {
  136 + if($(this).prop('checked') == true) {
  137 + ids.push($(this).val());
  138 + }
  139 + });
  140 + console.log(ids);
  141 + if(ids.length>0) {
  142 + ids = ids.join(',');
  143 + param += '/ids/' + ids;
  144 + }
  145 + if(sort_id.length > 0) {
  146 + param += '/sort_id/'+sort_id;
  147 + }
  148 + if(status.length > 0) {
  149 + param += '/status/'+status;
  150 + }
  151 + if(is_over.length > 0) {
  152 + param += '/is_over/'+is_over;
  153 + }
  154 + if(is_excel.length > 0) {
  155 + param += '/is_excel/'+is_excel;
  156 + }
  157 + if(keyword.length > 0) {
  158 + param += '/keyword/'+keyword;
  159 + }
  160 + if(start_time.length > 0) {
  161 + param += '/start_time/'+start_time;
  162 + }
  163 + if(end_time.length > 0) {
  164 + param += '/end_time/'+end_time;
  165 + }
  166 + var url = url2[0]+param+'.html';
  167 + window.open(url);
  168 + });
104 function reloadPage(win) { 169 function reloadPage(win) {
105 win.location.reload(); 170 win.location.reload();
106 } 171 }
@@ -138,6 +138,7 @@ @@ -138,6 +138,7 @@
138 var res = { 138 var res = {
139 data: '' 139 data: ''
140 }; 140 };
  141 + var reg = /^1[0-9]{10}$/;
141 var is_stop = "{$orderInfo.is_stop}"; 142 var is_stop = "{$orderInfo.is_stop}";
142 if(is_stop == 1) { 143 if(is_stop == 1) {
143 $('.change_text_o').html('对不起,当前功能已暂停'); 144 $('.change_text_o').html('对不起,当前功能已暂停');
@@ -344,16 +345,18 @@ @@ -344,16 +345,18 @@
344 return false; 345 return false;
345 } else { 346 } else {
346 // 判断客户编号类型,长度必须为10位;判断手机号码格式是否正确 347 // 判断客户编号类型,长度必须为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) { 348 + // if($(this).data('type') == 12 && $(this).find('input').val().length != 10 && $(this).data('validate') == 1) {
  349 + // _error($(this).find('._validate').html()+'长度必须为10位');
  350 + // status = false;
  351 + // return false;
  352 + // } else
  353 + if($(this).data('type') == 3 && $(this).data('validate') == 1) {
352 if(!reg.test($(this).find('input').val())) { 354 if(!reg.test($(this).find('input').val())) {
353 _error($(this).find('._validate').html()+'格式错误'); 355 _error($(this).find('._validate').html()+'格式错误');
354 status = false; 356 status = false;
355 return false; 357 return false;
356 } 358 }
  359 + value = $(this).find('input').val();
357 } else { 360 } else {
358 value = $(this).find('input').val(); 361 value = $(this).find('input').val();
359 } 362 }
@@ -295,16 +295,18 @@ @@ -295,16 +295,18 @@
295 return false; 295 return false;
296 } else { 296 } else {
297 // 判断客户编号类型,长度必须为10位;判断手机号码格式是否正确 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) { 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
  303 + if($(this).data('type') == 3 && $(this).data('validate') == 1) {
303 if(!reg.test($(this).find('input').val())) { 304 if(!reg.test($(this).find('input').val())) {
304 _error($(this).find('._validate').html()+'格式错误'); 305 _error($(this).find('._validate').html()+'格式错误');
305 status = false; 306 status = false;
306 return false; 307 return false;
307 } 308 }
  309 + value = $(this).find('input').val();
308 } else { 310 } else {
309 value = $(this).find('input').val(); 311 value = $(this).find('input').val();
310 } 312 }