Showing
4 changed files
with
138 additions
and
55 deletions
| @@ -308,8 +308,17 @@ class Seller extends Common | @@ -308,8 +308,17 @@ class Seller extends Common | ||
| 308 | $limit = '&x='.$data["page"].'&y='.$data["limit"].'&keywords='.@$key['id'].'&channel='.$channel; | 308 | $limit = '&x='.$data["page"].'&y='.$data["limit"].'&keywords='.@$key['id'].'&channel='.$channel; |
| 309 | 309 | ||
| 310 | //获取运营人员列表 | 310 | //获取运营人员列表 |
| 311 | - $list= file_get_contents(ON_LINE.'App.Seller.GetSellerList'.$limit); | 311 | + $list= file_get_contents(ON_LINE.'App.Seller.GetSellerListByActivity'.$limit); |
| 312 | $array = json_decode($list,TRUE); | 312 | $array = json_decode($list,TRUE); |
| 313 | + foreach($array['data'][0]['data'] as $key=>$value){ | ||
| 314 | + if(!empty($value['activity'])){ | ||
| 315 | + foreach ($value['activity'] as $k => $v) { | ||
| 316 | + $str[] = $v['id'].'、'.$v['title']; | ||
| 317 | + } | ||
| 318 | + $array['data'][0]['data'][$key]['activity'] = implode('<br/>', $str); | ||
| 319 | + //$array['data'][0]['data'][$key]['activity'] = implode('<br/>', array_column($value['activity'], 'title')); | ||
| 320 | + } | ||
| 321 | + } | ||
| 313 | return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0]['data'],'count'=>$array['data'][0]['total'],'rel'=>1]; | 322 | return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0]['data'],'count'=>$array['data'][0]['total'],'rel'=>1]; |
| 314 | } | 323 | } |
| 315 | $this->assign ( 'title','商家活动配置'); | 324 | $this->assign ( 'title','商家活动配置'); |
| @@ -321,26 +330,11 @@ class Seller extends Common | @@ -321,26 +330,11 @@ class Seller extends Common | ||
| 321 | */ | 330 | */ |
| 322 | public function seller_activity(){ | 331 | public function seller_activity(){ |
| 323 | $data = Request::except('file'); | 332 | $data = Request::except('file'); |
| 324 | - if(Request::isAjax()){ | ||
| 325 | - if($data['hid'] && $data['aid']){ | ||
| 326 | - $seller_activity= file_get_contents(ON_LINE.'App.Seller.SetSellerActivity&sid='.$data['hid'].'&aid='.$data['aid']); | ||
| 327 | - $result['code'] = 1; | ||
| 328 | - $result['msg'] = "配置成功!"; | ||
| 329 | - }else{ | ||
| 330 | - $result['code'] = 0; | ||
| 331 | - $result['msg'] = "配置失败,请重新配置"; | ||
| 332 | - } | ||
| 333 | - return $result; | ||
| 334 | - } | ||
| 335 | - | ||
| 336 | //获取商家现有活动 | 333 | //获取商家现有活动 |
| 337 | $seller_activity= file_get_contents(ON_LINE.'App.Seller.GetSellerActivity&sid='.$data['id']); | 334 | $seller_activity= file_get_contents(ON_LINE.'App.Seller.GetSellerActivity&sid='.$data['id']); |
| 338 | $seller_activity = json_decode($seller_activity,TRUE); | 335 | $seller_activity = json_decode($seller_activity,TRUE); |
| 339 | //活动列表 | 336 | //活动列表 |
| 340 | - $activity_list= file_get_contents(ON_LINE.'App.Seller.GetActivityList'); | ||
| 341 | - $activity_list = json_decode($activity_list,TRUE); | ||
| 342 | $this->assign('sid',$data['id']); | 337 | $this->assign('sid',$data['id']); |
| 343 | - $this->assign ( 'activity_list',$activity_list['data']); | ||
| 344 | $this->assign ( 'seller_activity',$seller_activity['data']); | 338 | $this->assign ( 'seller_activity',$seller_activity['data']); |
| 345 | $this->assign ( 'title','商家活动配置页面'); | 339 | $this->assign ( 'title','商家活动配置页面'); |
| 346 | return $this->fetch(); | 340 | return $this->fetch(); |
| @@ -364,16 +358,37 @@ class Seller extends Common | @@ -364,16 +358,37 @@ class Seller extends Common | ||
| 364 | public function add_activity(){ | 358 | public function add_activity(){ |
| 365 | $data = Request::except('file'); | 359 | $data = Request::except('file'); |
| 366 | if(Request::isAjax()){ | 360 | if(Request::isAjax()){ |
| 361 | + switch ($data['type']) { | ||
| 362 | + case '1': | ||
| 363 | + $data['title'] = '满'.$data['max_num'].'元,立减'.$data['min_num'].'元'; | ||
| 364 | + break; | ||
| 365 | + case '2': | ||
| 366 | + $data['title'] = '满赠'; | ||
| 367 | + break; | ||
| 368 | + case '3': | ||
| 369 | + $data['title'] = '满'.$data['max_num'].'元,立享'.$data['min_num'].'折'; | ||
| 370 | + break; | ||
| 371 | + case '4': | ||
| 372 | + $data['title'] = $data['max_num'].'元代金券,现价'.$data['min_num'].'元'; | ||
| 373 | + break; | ||
| 374 | + case '5': | ||
| 375 | + $data['title'] = '会员价'; | ||
| 376 | + break; | ||
| 377 | + default: | ||
| 378 | + # code... | ||
| 379 | + break; | ||
| 380 | + } | ||
| 367 | //添加活动 | 381 | //添加活动 |
| 368 | - $res= file_get_contents(ON_LINE.'App.Seller.SetActivity&title='.$data['title'].'&desc='.$data['desc']); | 382 | + $res= file_get_contents(ON_LINE.'App.Seller.SetActivity&str='.serialize($data)); |
| 369 | $res = json_decode($res,TRUE); | 383 | $res = json_decode($res,TRUE); |
| 370 | if($res['data']){ | 384 | if($res['data']){ |
| 371 | - $result = ['code'=>1,'msg'=>'添加成功!','data'=>$activity_list['data'],'rel'=>1]; | 385 | + $result = ['code'=>1,'msg'=>'添加成功!','rel'=>1]; |
| 372 | }else{ | 386 | }else{ |
| 373 | - $result = ['code'=>0,'msg'=>'添加失败!','data'=>$activity_list['data'],'rel'=>1]; | 387 | + $result = ['code'=>0,'msg'=>'添加失败!','rel'=>1]; |
| 374 | } | 388 | } |
| 375 | return $result; | 389 | return $result; |
| 376 | } | 390 | } |
| 391 | + $this->assign ( 'hid',$data['sid']); | ||
| 377 | $this->assign ( 'title','添加活动'); | 392 | $this->assign ( 'title','添加活动'); |
| 378 | return $this->fetch(); | 393 | return $this->fetch(); |
| 379 | } | 394 | } |
| 1 | {include file="common/head"/} | 1 | {include file="common/head"/} |
| 2 | <div class="admin-main layui-anim layui-anim-upbit"> | 2 | <div class="admin-main layui-anim layui-anim-upbit"> |
| 3 | - <fieldset class="layui-elem-field layui-field-title"> | ||
| 4 | - <legend>{$title}</legend> | ||
| 5 | - </fieldset> | ||
| 6 | <form class="layui-form layui-form-pane"> | 3 | <form class="layui-form layui-form-pane"> |
| 7 | <div class="layui-form-item"> | 4 | <div class="layui-form-item"> |
| 8 | - <label class="layui-form-label">活动标题</label> | ||
| 9 | - <div class="layui-input-block"> | ||
| 10 | - <input type="text" name="title" lay-verify="title" id="title" autocomplete="off" placeholder="请输入活动标题" class="layui-input"> | 5 | + <label class="layui-form-label">活动类型</label> |
| 6 | + <div class="layui-input-inline"> | ||
| 7 | + <select name="type" lay-verify="required" lay-filter="aid"> | ||
| 8 | + <option value="1">满减</option> | ||
| 9 | + <option value="2">满赠</option> | ||
| 10 | + <option value="3">折扣</option> | ||
| 11 | + <option value="4">代金券</option> | ||
| 12 | + <option value="5">会员价</option> | ||
| 13 | + </select> | ||
| 14 | + </div> | ||
| 11 | </div> | 15 | </div> |
| 16 | + | ||
| 17 | + <div class="layui-form-item" id="title_tag"> | ||
| 18 | + <label class="layui-form-label">活动标题</label> | ||
| 19 | + <div class="layui-input-block"> | ||
| 20 | + <div class="layui-form-mid" id="first_html"> 满</div> | ||
| 21 | + <div class="layui-input-inline" style="width: 100px;"> | ||
| 22 | + <input type="text" name="max_num" autocomplete="off" class="layui-input"> | ||
| 23 | + </div> | ||
| 24 | + <div class="layui-form-mid" id="mid_html">元,立减</div> | ||
| 25 | + <div class="layui-input-inline" style="width: 100px;"> | ||
| 26 | + <input type="text" name="min_num" autocomplete="off" class="layui-input"> | ||
| 27 | + </div> | ||
| 28 | + <div class="layui-form-mid" id="last_html">元</div> | ||
| 29 | + </div> | ||
| 12 | </div> | 30 | </div> |
| 13 | 31 | ||
| 14 | <div class="layui-form-item layui-form-text"> | 32 | <div class="layui-form-item layui-form-text"> |
| 15 | - <label class="layui-form-label">活动描述</label> | 33 | + <label class="layui-form-label">活动说明</label> |
| 16 | <div class="layui-input-block"> | 34 | <div class="layui-input-block"> |
| 17 | - <textarea placeholder="请输入活动描述" class="layui-textarea" id="desc" name="desc"></textarea> | 35 | + <textarea placeholder="请填写活动说明" class="layui-textarea" id="desc" name="desc"></textarea> |
| 18 | </div> | 36 | </div> |
| 19 | </div> | 37 | </div> |
| 20 | - | 38 | + <input type="hidden" name='sid' value="{$hid}"> |
| 21 | <div class="layui-form-item"> | 39 | <div class="layui-form-item"> |
| 22 | <div class="layui-input-block"> | 40 | <div class="layui-input-block"> |
| 23 | <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button> | 41 | <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button> |
| @@ -46,5 +64,39 @@ | @@ -46,5 +64,39 @@ | ||
| 46 | } | 64 | } |
| 47 | }); | 65 | }); |
| 48 | }) | 66 | }) |
| 67 | + | ||
| 68 | + //单选按钮显示隐藏 | ||
| 69 | + form.on('select(aid)', function(data){ | ||
| 70 | + //console.log(data.value); | ||
| 71 | + switch(data.value){ | ||
| 72 | + case "2": | ||
| 73 | + $('#title_tag').hide(); | ||
| 74 | + $('#title').val('满增活动'); | ||
| 75 | + break; | ||
| 76 | + case "1": | ||
| 77 | + $('#title_tag').show(); | ||
| 78 | + $('#first_html').html(' 满'); | ||
| 79 | + $('#mid_html').html('元,立减'); | ||
| 80 | + $('#last_html').html('元'); | ||
| 81 | + break; | ||
| 82 | + case "3": | ||
| 83 | + $('#title_tag').show(); | ||
| 84 | + $('#mid_html').html('元,立享'); | ||
| 85 | + $('#last_html').html('折'); | ||
| 86 | + break; | ||
| 87 | + case "4": | ||
| 88 | + $('#title_tag').show(); | ||
| 89 | + $('#first_html').html(' '); | ||
| 90 | + $('#mid_html').html('元代金券,现价'); | ||
| 91 | + $('#last_html').html('元'); | ||
| 92 | + break; | ||
| 93 | + case "5": | ||
| 94 | + $('#title_tag').hide(); | ||
| 95 | + break; | ||
| 96 | + default: | ||
| 97 | + $('#title_tag').show(); | ||
| 98 | + break; | ||
| 99 | + } | ||
| 100 | + }); | ||
| 49 | }); | 101 | }); |
| 50 | </script> | 102 | </script> |
| @@ -21,7 +21,10 @@ | @@ -21,7 +21,10 @@ | ||
| 21 | <th>{$vo.sid}</th> | 21 | <th>{$vo.sid}</th> |
| 22 | <th>{$vo.title}</th> | 22 | <th>{$vo.title}</th> |
| 23 | <th>{$vo.desc}</th> | 23 | <th>{$vo.desc}</th> |
| 24 | - <th><a href="{:url('del_activity')}?aid={$vo.id}&sid={$vo.sid}" class="layui-btn layui-btn-xs">删除</a></th> | 24 | + <th> |
| 25 | + <a href="{:url('del_activity')}?aid={$vo.id}&sid={$vo.sid}" class="layui-btn layui-btn-xs">删除</a> | ||
| 26 | + <a href="javascript:;" class="layui-btn layui-btn-xs" name="edit">修改</a> | ||
| 27 | + </th> | ||
| 25 | </tr> | 28 | </tr> |
| 26 | {/foreach} | 29 | {/foreach} |
| 27 | {else} | 30 | {else} |
| @@ -30,29 +33,11 @@ | @@ -30,29 +33,11 @@ | ||
| 30 | </tr> | 33 | </tr> |
| 31 | {/if} | 34 | {/if} |
| 32 | </table> | 35 | </table> |
| 33 | - | ||
| 34 | 36 | ||
| 37 | + <input type='hidden' name='hid' value='{$sid}' id="hid"> | ||
| 35 | <div class="layui-form-item"> | 38 | <div class="layui-form-item"> |
| 36 | - <label class="layui-form-label">选择活动</label> | ||
| 37 | <div class="layui-input-block"> | 39 | <div class="layui-input-block"> |
| 38 | - <div class="layui-input-4"> | ||
| 39 | - <select name="aid" id="aid" lay-filter="aid"> | ||
| 40 | - <option value="0" data-val=''>请选择</option> | ||
| 41 | - {foreach $activity_list as $vo} | ||
| 42 | - <option value="{$vo.id}" data-val='{$vo.desc}'>{$vo.title}</option> | ||
| 43 | - {/foreach} | ||
| 44 | - <textarea placeholder="活动描述" name="content" id="txt" class="layui-textarea" disabled></textarea> | ||
| 45 | - </select> | ||
| 46 | - </div> | ||
| 47 | - <div class="layui-input-4"> | ||
| 48 | - <a href="{:url('activity')}" class="layui-btn">添加活动</a> | ||
| 49 | - </div> | ||
| 50 | - </div> | ||
| 51 | - </div> | ||
| 52 | - <input type='hidden' name='hid' value='{$sid}'> | ||
| 53 | - <div class="layui-form-item"> | ||
| 54 | - <div class="layui-input-block"> | ||
| 55 | - <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('add')}</button> | 40 | + <a href="javascript:;" class="layui-btn" id='add'>添加活动</a> |
| 56 | <a href="{:url('seller_activity_list')}" class="layui-btn layui-btn-primary">{:lang('back')}</a> | 41 | <a href="{:url('seller_activity_list')}" class="layui-btn layui-btn-primary">{:lang('back')}</a> |
| 57 | </div> | 42 | </div> |
| 58 | </div> | 43 | </div> |
| @@ -80,11 +65,33 @@ | @@ -80,11 +65,33 @@ | ||
| 80 | }); | 65 | }); |
| 81 | }) | 66 | }) |
| 82 | 67 | ||
| 83 | - //单选按钮显示隐藏 | ||
| 84 | - form.on('select(aid)', function(data){ | ||
| 85 | - var dataval=$(data.elem).find("option:selected").attr("data-val"); | ||
| 86 | - $("#txt").show(); | ||
| 87 | - $("#txt").html(dataval); | 68 | + $('#add').on('click', function(obj) { |
| 69 | + layer.open({ | ||
| 70 | + type: 2, | ||
| 71 | + title: '添加活动', | ||
| 72 | + shadeClose: true, | ||
| 73 | + shade: 0.8, | ||
| 74 | + area: ['90%', '90%'], | ||
| 75 | + content: '{:url("add_activity")}?sid='+$('#hid').val() //iframe的url | ||
| 76 | + /*success:function(dom){ | ||
| 77 | + let $iframeDom=$(dom[0]).find("iframe").eq(0).contents(); | ||
| 78 | + $iframeDom.find("#test").html("我是从父级传来的值哟……") | ||
| 79 | + }*/ | ||
| 80 | + }); | ||
| 81 | + }); | ||
| 82 | + $("a[name='edit']").on('click', function() { | ||
| 83 | + layer.open({ | ||
| 84 | + type: 2, | ||
| 85 | + title: '修改活动', | ||
| 86 | + shadeClose: true, | ||
| 87 | + shade: 0.8, | ||
| 88 | + area: ['90%', '90%'], | ||
| 89 | + content: '{:url("add_activity")}?sid='+$('#hid').val() //iframe的url | ||
| 90 | + /*success:function(dom){ | ||
| 91 | + let $iframeDom=$(dom[0]).find("iframe").eq(0).contents(); | ||
| 92 | + $iframeDom.find("#test").html("我是从父级传来的值哟……") | ||
| 93 | + }*/ | ||
| 94 | + }); | ||
| 88 | }); | 95 | }); |
| 89 | }); | 96 | }); |
| 90 | </script> | 97 | </script> |
| 1 | {include file="common/head"/} | 1 | {include file="common/head"/} |
| 2 | + | ||
| 3 | +<style type="text/css"> | ||
| 4 | + {# 设置table每一行的height #} | ||
| 5 | + .layui-table-cell { | ||
| 6 | + height: auto; | ||
| 7 | + line-height: 20px; | ||
| 8 | + } | ||
| 9 | +</style> | ||
| 2 | <div class="admin-main layui-anim layui-anim-upbit"> | 10 | <div class="admin-main layui-anim layui-anim-upbit"> |
| 3 | <fieldset class="layui-elem-field layui-field-title"> | 11 | <fieldset class="layui-elem-field layui-field-title"> |
| 4 | <legend>{:$title}</legend> | 12 | <legend>{:$title}</legend> |
| @@ -38,13 +46,14 @@ | @@ -38,13 +46,14 @@ | ||
| 38 | var table = layui.table,$ = layui.jquery; | 46 | var table = layui.table,$ = layui.jquery; |
| 39 | var tableIn = table.render({ | 47 | var tableIn = table.render({ |
| 40 | elem: '#list', | 48 | elem: '#list', |
| 41 | - url: '{:url("seller_activity_list")}', | 49 | + url: '{:url("seller_activity_list")}', |
| 42 | method: 'post', | 50 | method: 'post', |
| 43 | title: '商家列表', | 51 | title: '商家列表', |
| 44 | page:true, | 52 | page:true, |
| 45 | cols: [[ | 53 | cols: [[ |
| 46 | {field: 'id', title: '{:lang("id")}'}, | 54 | {field: 'id', title: '{:lang("id")}'}, |
| 47 | {field: 'sellername', title: '商家名称'}, | 55 | {field: 'sellername', title: '商家名称'}, |
| 56 | + {field: 'activity', title: '活动'}, | ||
| 48 | ]] | 57 | ]] |
| 49 | ,id: 'testReload' | 58 | ,id: 'testReload' |
| 50 | ,page: true | 59 | ,page: true |
-
Please register or login to post a comment