作者 jinglong
1 个管道 的构建 通过 耗费 2 秒

修改优惠券排序

@@ -72,7 +72,7 @@ class Coupon extends Backend @@ -72,7 +72,7 @@ class Coupon extends Backend
72 ->select(); 72 ->select();
73 73
74 foreach ($list as $row) { 74 foreach ($list as $row) {
75 - $row->visible(['id','c_type','is_new','gift','type','reduce','discount','coupon_number','createtime','coupon_type','end_time','coupon_name']); 75 + $row->visible(['id','c_type','is_new','gift','type','reduce','discount','coupon_number','createtime','coupon_type','end_time','coupon_name','sort']);
76 76
77 } 77 }
78 $list = collection($list)->toArray(); 78 $list = collection($list)->toArray();
@@ -6,6 +6,7 @@ return [ @@ -6,6 +6,7 @@ return [
6 'Bg_address' => '品牌产地', 6 'Bg_address' => '品牌产地',
7 'Is_new' => '新人专享', 7 'Is_new' => '新人专享',
8 'Gift' => '分享礼包', 8 'Gift' => '分享礼包',
  9 + 'Sort' => '排序',
9 'Bg_id' => '品牌分类', 10 'Bg_id' => '品牌分类',
10 'Coupon_name' => '优惠券名称', 11 'Coupon_name' => '优惠券名称',
11 'C_type' => '优惠券类型', 12 'C_type' => '优惠券类型',
@@ -6,6 +6,7 @@ return [ @@ -6,6 +6,7 @@ return [
6 'Coupon_type' => '优惠类型', 6 'Coupon_type' => '优惠类型',
7 'Is_new' => '新人专享', 7 'Is_new' => '新人专享',
8 'Gift' => '分享礼包', 8 'Gift' => '分享礼包',
  9 + 'Sort' => '排序',
9 'Full_reduce' => '满减金额', 10 'Full_reduce' => '满减金额',
10 'Coupon_name' => '优惠券名称', 11 'Coupon_name' => '优惠券名称',
11 'Reduce' => '减少金额', 12 'Reduce' => '减少金额',
@@ -6,6 +6,7 @@ return [ @@ -6,6 +6,7 @@ return [
6 'Bg_id' => '品牌分类', 6 'Bg_id' => '品牌分类',
7 'Is_new' => '新人专享', 7 'Is_new' => '新人专享',
8 'Gift' => '分享礼包', 8 'Gift' => '分享礼包',
  9 + 'Sort' => '排序',
9 'C_type' => '优惠券类型', 10 'C_type' => '优惠券类型',
10 'Coupon_name' => '优惠券名称', 11 'Coupon_name' => '优惠券名称',
11 'Coupon_type' => '优惠类型', 12 'Coupon_type' => '优惠类型',
@@ -74,6 +74,12 @@ @@ -74,6 +74,12 @@
74 {:build_select('row[gift]', $gift, null, ['class'=>'form-control', 'required'=>''])} 74 {:build_select('row[gift]', $gift, null, ['class'=>'form-control', 'required'=>''])}
75 </div> 75 </div>
76 </div> 76 </div>
  77 + <div class="form-group">
  78 + <label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label>
  79 + <div class="col-xs-12 col-sm-8">
  80 + <input id="c-sort" data-rule="required range(0~)" class="form-control" name="row[sort]" type="number" value="0">
  81 + </div>
  82 + </div>
77 <div class="form-group layer-footer"> 83 <div class="form-group layer-footer">
78 <label class="control-label col-xs-12 col-sm-2"></label> 84 <label class="control-label col-xs-12 col-sm-2"></label>
79 <div class="col-xs-12 col-sm-8"> 85 <div class="col-xs-12 col-sm-8">
@@ -66,6 +66,12 @@ @@ -66,6 +66,12 @@
66 {:build_select('row[gift]', $gift, $row.gift, ['class'=>'form-control', 'required'=>''])} 66 {:build_select('row[gift]', $gift, $row.gift, ['class'=>'form-control', 'required'=>''])}
67 </div> 67 </div>
68 </div> 68 </div>
  69 + <div class="form-group">
  70 + <label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label>
  71 + <div class="col-xs-12 col-sm-8">
  72 + <input id="c-sort" data-rule="required range(0~)" class="form-control" name="row[sort]" type="number" value="{$row.sort|htmlentities}">
  73 + </div>
  74 + </div>
69 <div class="form-group layer-footer"> 75 <div class="form-group layer-footer">
70 <label class="control-label col-xs-12 col-sm-2"></label> 76 <label class="control-label col-xs-12 col-sm-2"></label>
71 <div class="col-xs-12 col-sm-8"> 77 <div class="col-xs-12 col-sm-8">
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 <div class="form-group"> 35 <div class="form-group">
36 <label class="control-label col-xs-12 col-sm-2">{:__('Brand_explain')}:</label> 36 <label class="control-label col-xs-12 col-sm-2">{:__('Brand_explain')}:</label>
37 <div class="col-xs-12 col-sm-8"> 37 <div class="col-xs-12 col-sm-8">
38 - <textarea id="c-brand_explain" data-rule="required" class="form-control " rows="5" name="row[brand_explain]" cols="50">{$row.brand_explain|htmlentities}</textarea> 38 + <textarea id="c-brand_explain" data-rule="required" class="form-control editor" rows="5" name="row[brand_explain]" cols="50">{$row.brand_explain|htmlentities}</textarea>
39 </div> 39 </div>
40 </div> 40 </div>
41 <div class="form-group"> 41 <div class="form-group">
@@ -68,6 +68,12 @@ @@ -68,6 +68,12 @@
68 {:build_select('row[gift]', $gift, null, ['class'=>'form-control', 'required'=>''])} 68 {:build_select('row[gift]', $gift, null, ['class'=>'form-control', 'required'=>''])}
69 </div> 69 </div>
70 </div> 70 </div>
  71 + <div class="form-group">
  72 + <label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label>
  73 + <div class="col-xs-12 col-sm-8">
  74 + <input id="c-sort" data-rule="required range(0~)" class="form-control" name="row[sort]" type="number" value="0">
  75 + </div>
  76 + </div>
71 <div class="form-group layer-footer"> 77 <div class="form-group layer-footer">
72 <label class="control-label col-xs-12 col-sm-2"></label> 78 <label class="control-label col-xs-12 col-sm-2"></label>
73 <div class="col-xs-12 col-sm-8"> 79 <div class="col-xs-12 col-sm-8">
@@ -60,6 +60,12 @@ @@ -60,6 +60,12 @@
60 {:build_select('row[gift]', $gift, $row.gift, ['class'=>'form-control', 'required'=>''])} 60 {:build_select('row[gift]', $gift, $row.gift, ['class'=>'form-control', 'required'=>''])}
61 </div> 61 </div>
62 </div> 62 </div>
  63 + <div class="form-group">
  64 + <label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label>
  65 + <div class="col-xs-12 col-sm-8">
  66 + <input id="c-sort" data-rule="required range(0~)" class="form-control" name="row[sort]" type="number" value="{$row.sort|htmlentities}">
  67 + </div>
  68 + </div>
63 <div class="form-group layer-footer"> 69 <div class="form-group layer-footer">
64 <label class="control-label col-xs-12 col-sm-2"></label> 70 <label class="control-label col-xs-12 col-sm-2"></label>
65 <div class="col-xs-12 col-sm-8"> 71 <div class="col-xs-12 col-sm-8">
@@ -74,6 +74,12 @@ @@ -74,6 +74,12 @@
74 {:build_select('row[gift]', $gift, null, ['class'=>'form-control', 'required'=>''])} 74 {:build_select('row[gift]', $gift, null, ['class'=>'form-control', 'required'=>''])}
75 </div> 75 </div>
76 </div> 76 </div>
  77 + <div class="form-group">
  78 + <label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label>
  79 + <div class="col-xs-12 col-sm-8">
  80 + <input id="c-sort" data-rule="required range(0~)" class="form-control" name="row[sort]" type="number" value="0">
  81 + </div>
  82 + </div>
77 <div class="form-group layer-footer"> 83 <div class="form-group layer-footer">
78 <label class="control-label col-xs-12 col-sm-2"></label> 84 <label class="control-label col-xs-12 col-sm-2"></label>
79 <div class="col-xs-12 col-sm-8"> 85 <div class="col-xs-12 col-sm-8">
@@ -66,6 +66,12 @@ @@ -66,6 +66,12 @@
66 {:build_select('row[gift]', $gift, $row.gift, ['class'=>'form-control', 'required'=>''])} 66 {:build_select('row[gift]', $gift, $row.gift, ['class'=>'form-control', 'required'=>''])}
67 </div> 67 </div>
68 </div> 68 </div>
  69 + <div class="form-group">
  70 + <label class="control-label col-xs-12 col-sm-2">{:__('Sort')}:</label>
  71 + <div class="col-xs-12 col-sm-8">
  72 + <input id="c-sort" data-rule="required range(0~)" class="form-control" name="row[sort]" type="number" value="{$row.sort|htmlentities}">
  73 + </div>
  74 + </div>
69 <div class="form-group layer-footer"> 75 <div class="form-group layer-footer">
70 <label class="control-label col-xs-12 col-sm-2"></label> 76 <label class="control-label col-xs-12 col-sm-2"></label>
71 <div class="col-xs-12 col-sm-8"> 77 <div class="col-xs-12 col-sm-8">
@@ -410,7 +410,7 @@ class Cars extends Api @@ -410,7 +410,7 @@ class Cars extends Api
410 $where['id'] = ['in',$receive_s]; 410 $where['id'] = ['in',$receive_s];
411 $where['end_time'] = ['>',$time]; 411 $where['end_time'] = ['>',$time];
412 412
413 - $data = Common::selectWhereOrData('coupon',$where,$where1,$where2,'id,type,coupon_name,c_type,coupon_type,full_reduce,reduce,discount,coupon_number,end_time','c_type asc,coupon_type desc'); 413 + $data = Common::selectWhereOrData('coupon',$where,$where1,$where2,'id,type,coupon_name,c_type,coupon_type,full_reduce,reduce,discount,coupon_number,end_time','sort desc,id desc');
414 414
415 $res = []; 415 $res = [];
416 foreach($data as $key=>$value){ 416 foreach($data as $key=>$value){
@@ -72,7 +72,7 @@ class Coupons extends Api @@ -72,7 +72,7 @@ class Coupons extends Api
72 $receive = Common::selectWhereData('rcoupon',['uid'=>$this->uid],'id,c_id'); 72 $receive = Common::selectWhereData('rcoupon',['uid'=>$this->uid],'id,c_id');
73 $receive_s = array_column($receive,'c_id'); 73 $receive_s = array_column($receive,'c_id');
74 $limit = config('verify.goods_limit'); 74 $limit = config('verify.goods_limit');
75 - $data = Common::selectWherePageData('coupon',$where,'id,type,coupon_name,c_type,coupon_type,full_reduce,reduce,discount,coupon_number',$page,$limit,'c_type asc,coupon_type desc'); 75 + $data = Common::selectWherePageData('coupon',$where,'id,type,coupon_name,c_type,coupon_type,full_reduce,reduce,discount,coupon_number',$page,$limit,'sort desc,id desc');
76 $res = []; 76 $res = [];
77 $arr = []; 77 $arr = [];
78 foreach($data as $key=>$value){ 78 foreach($data as $key=>$value){
@@ -185,7 +185,7 @@ class Coupons extends Api @@ -185,7 +185,7 @@ class Coupons extends Api
185 //查询已经领取过 185 //查询已经领取过
186 $receive = Common::selectWhereData('rcoupon',['uid'=>$this->uid],'id,c_id'); 186 $receive = Common::selectWhereData('rcoupon',['uid'=>$this->uid],'id,c_id');
187 $receive_s = array_column($receive,'c_id'); 187 $receive_s = array_column($receive,'c_id');
188 - $data = Common::selectWhereData('coupon',$where,'id,c_type,coupon_type,full_reduce,reduce,discount,coupon_number','c_type asc,coupon_type desc'); 188 + $data = Common::selectWhereData('coupon',$where,'id,c_type,coupon_type,full_reduce,reduce,discount,coupon_number','sort desc,id desc');
189 $res = []; 189 $res = [];
190 foreach($data as $key=>$value){ 190 foreach($data as $key=>$value){
191 $res[$key]['id'] = $value['id']; 191 $res[$key]['id'] = $value['id'];
@@ -284,7 +284,7 @@ class Coupons extends Api @@ -284,7 +284,7 @@ class Coupons extends Api
284 $receive = Common::selectWhereData('rcoupon',['uid'=>$this->uid],'id,c_id'); 284 $receive = Common::selectWhereData('rcoupon',['uid'=>$this->uid],'id,c_id');
285 $receive_s = array_column($receive,'c_id'); 285 $receive_s = array_column($receive,'c_id');
286 286
287 - $data = Common::selectWhereData('coupon',$where,'id,type,coupon_name,c_type,coupon_type,full_reduce,reduce,discount,coupon_number','c_type asc,coupon_type desc'); 287 + $data = Common::selectWhereData('coupon',$where,'id,type,coupon_name,c_type,coupon_type,full_reduce,reduce,discount,coupon_number','sort desc,id desc');
288 $res = []; 288 $res = [];
289 289
290 foreach($data as $key=>$value){ 290 foreach($data as $key=>$value){
@@ -113,7 +113,7 @@ class News extends Api @@ -113,7 +113,7 @@ class News extends Api
113 //查询已经领取过 113 //查询已经领取过
114 $receive = Common::selectWhereData('rcoupon',['uid'=>$this->uid],'id,c_id'); 114 $receive = Common::selectWhereData('rcoupon',['uid'=>$this->uid],'id,c_id');
115 $receive_s = array_column($receive,'c_id'); 115 $receive_s = array_column($receive,'c_id');
116 - $data = Common::selectWhereData('coupon',$where,'id,c_type,coupon_type,full_reduce,reduce,discount','c_type asc,coupon_type desc'); 116 + $data = Common::selectWhereData('coupon',$where,'id,c_type,coupon_type,full_reduce,reduce,discount','sort desc,id desc');
117 $res = []; 117 $res = [];
118 foreach($data as $key=>$value){ 118 foreach($data as $key=>$value){
119 $res[$key]['id'] = $value['id']; 119 $res[$key]['id'] = $value['id'];
@@ -395,7 +395,7 @@ class User extends Api @@ -395,7 +395,7 @@ class User extends Api
395 $receive = Common::selectWhereData('rcoupon',$where,'id,c_id'); 395 $receive = Common::selectWhereData('rcoupon',$where,'id,c_id');
396 $receive_s = array_column($receive,'c_id'); 396 $receive_s = array_column($receive,'c_id');
397 $where1['id'] = ['in',$receive_s]; 397 $where1['id'] = ['in',$receive_s];
398 - $data = Common::selectWhereData('coupon',$where1,'id,type,coupon_name,c_type,coupon_type,full_reduce,reduce,discount,coupon_number,end_time','c_type asc,coupon_type desc'); 398 + $data = Common::selectWhereData('coupon',$where1,'id,type,coupon_name,c_type,coupon_type,full_reduce,reduce,discount,coupon_number,end_time','sort desc,id desc');
399 $res = []; 399 $res = [];
400 foreach($data as $key=>$value){ 400 foreach($data as $key=>$value){
401 401
@@ -75,6 +75,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -75,6 +75,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
75 {field: 'is_new', title: __('Is_new'),formatter: Table.api.formatter.label,searchList: {0: __('否'), 1: __('是')}}, 75 {field: 'is_new', title: __('Is_new'),formatter: Table.api.formatter.label,searchList: {0: __('否'), 1: __('是')}},
76 {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 76 {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
77 {field: 'gift', title: __('Gift'),formatter: Table.api.formatter.label,searchList: {0: __('无'), 1: __('分享人'),2:__('被分享人')}}, 77 {field: 'gift', title: __('Gift'),formatter: Table.api.formatter.label,searchList: {0: __('无'), 1: __('分享人'),2:__('被分享人')}},
  78 + {field: 'sort', title: __('Sort'),sortable: true},//排序
78 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 79 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
79 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 80 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
80 ] 81 ]
@@ -73,6 +73,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -73,6 +73,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
73 {field: 'is_new', title: __('Is_new'),formatter: Table.api.formatter.label,searchList: {0: __('否'), 1: __('是')}}, 73 {field: 'is_new', title: __('Is_new'),formatter: Table.api.formatter.label,searchList: {0: __('否'), 1: __('是')}},
74 {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 74 {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
75 {field: 'gift', title: __('Gift'),formatter: Table.api.formatter.label,searchList: {0: __('无'), 1: __('分享人'),2:__('被分享人')}}, 75 {field: 'gift', title: __('Gift'),formatter: Table.api.formatter.label,searchList: {0: __('无'), 1: __('分享人'),2:__('被分享人')}},
  76 + {field: 'sort', title: __('Sort'),sortable: true},//排序
76 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 77 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
77 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 78 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
78 ] 79 ]
@@ -74,6 +74,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -74,6 +74,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
74 {field: 'is_new', title: __('Is_new'),formatter: Table.api.formatter.label,searchList: {0: __('否'), 1: __('是')}}, 74 {field: 'is_new', title: __('Is_new'),formatter: Table.api.formatter.label,searchList: {0: __('否'), 1: __('是')}},
75 {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 75 {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
76 {field: 'gift', title: __('Gift'),formatter: Table.api.formatter.label,searchList: {0: __('无'), 1: __('分享人'),2:__('被分享人')}}, 76 {field: 'gift', title: __('Gift'),formatter: Table.api.formatter.label,searchList: {0: __('无'), 1: __('分享人'),2:__('被分享人')}},
  77 + {field: 'sort', title: __('Sort'),sortable: true},//排序
77 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime}, 78 {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
78 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 79 {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
79 ] 80 ]