Showing
5 changed files
with
347 additions
and
0 deletions
| @@ -296,4 +296,83 @@ class Seller extends Common | @@ -296,4 +296,83 @@ class Seller extends Common | ||
| 296 | $this->assign ( 'title','商家详情页面'); | 296 | $this->assign ( 'title','商家详情页面'); |
| 297 | return $this->fetch(); | 297 | return $this->fetch(); |
| 298 | } | 298 | } |
| 299 | + | ||
| 300 | + //商家列表 用于配置商家活动 | ||
| 301 | + public function seller_activity_list(){ | ||
| 302 | + if(Request::isAjax()){ | ||
| 303 | + $data = Request::except('file'); | ||
| 304 | + $key= input('post.key') ? input('post.key') : ""; | ||
| 305 | + $channel = @$key['channel'] ? @$key['channel'] : 1; | ||
| 306 | + $limit = '&x='.$data["page"].'&y='.$data["limit"].'&keywords='.@$key['id'].'&channel='.$channel; | ||
| 307 | + | ||
| 308 | + //获取运营人员列表 | ||
| 309 | + $list= file_get_contents(ON_LINE.'App.Seller.GetSellerList'.$limit); | ||
| 310 | + $array = json_decode($list,TRUE); | ||
| 311 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$array['data'][0]['data'],'count'=>$array['data'][0]['total'],'rel'=>1]; | ||
| 312 | + } | ||
| 313 | + $this->assign ( 'title','商家活动配置'); | ||
| 314 | + return $this->fetch(); | ||
| 315 | + } | ||
| 316 | + | ||
| 317 | + /** | ||
| 318 | + * 商家活动列表页 | ||
| 319 | + */ | ||
| 320 | + public function seller_activity(){ | ||
| 321 | + $data = Request::except('file'); | ||
| 322 | + if(Request::isAjax()){ | ||
| 323 | + if($data['hid'] && $data['aid']){ | ||
| 324 | + $seller_activity= file_get_contents(ON_LINE.'App.Seller.SetSellerActivity&sid='.$data['hid'].'&aid='.$data['aid']); | ||
| 325 | + $result['code'] = 1; | ||
| 326 | + $result['msg'] = "配置成功!"; | ||
| 327 | + }else{ | ||
| 328 | + $result['code'] = 0; | ||
| 329 | + $result['msg'] = "配置失败,请重新配置"; | ||
| 330 | + } | ||
| 331 | + return $result; | ||
| 332 | + } | ||
| 333 | + | ||
| 334 | + //获取商家现有活动 | ||
| 335 | + $seller_activity= file_get_contents(ON_LINE.'App.Seller.GetSellerActivity&sid='.$data['id']); | ||
| 336 | + $seller_activity = json_decode($seller_activity,TRUE); | ||
| 337 | + //活动列表 | ||
| 338 | + $activity_list= file_get_contents(ON_LINE.'App.Seller.GetActivityList'); | ||
| 339 | + $activity_list = json_decode($activity_list,TRUE); | ||
| 340 | + $this->assign('sid',$data['id']); | ||
| 341 | + $this->assign ( 'activity_list',$activity_list['data']); | ||
| 342 | + $this->assign ( 'seller_activity',$seller_activity['data']); | ||
| 343 | + $this->assign ( 'title','商家活动配置页面'); | ||
| 344 | + return $this->fetch(); | ||
| 345 | + } | ||
| 346 | + | ||
| 347 | + /** | ||
| 348 | + * 商家活动列表页 | ||
| 349 | + */ | ||
| 350 | + public function activity(){ | ||
| 351 | + if(Request::isAjax()){ | ||
| 352 | + //活动列表 | ||
| 353 | + $activity_list= file_get_contents(ON_LINE.'App.Seller.GetActivityList'); | ||
| 354 | + $activity_list = json_decode($activity_list,TRUE); | ||
| 355 | + return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$activity_list['data'],'rel'=>1]; | ||
| 356 | + } | ||
| 357 | + $this->assign ( 'title','商家活动配置'); | ||
| 358 | + return $this->fetch(); | ||
| 359 | + } | ||
| 360 | + | ||
| 361 | + //添加活动 | ||
| 362 | + public function add_activity(){ | ||
| 363 | + $data = Request::except('file'); | ||
| 364 | + if(Request::isAjax()){ | ||
| 365 | + //添加活动 | ||
| 366 | + $res= file_get_contents(ON_LINE.'App.Seller.SetActivity&title='.$data['title'].'&desc='.$data['desc']); | ||
| 367 | + $res = json_decode($res,TRUE); | ||
| 368 | + if($res['data']){ | ||
| 369 | + $result = ['code'=>1,'msg'=>'添加成功!','data'=>$activity_list['data'],'rel'=>1]; | ||
| 370 | + }else{ | ||
| 371 | + $result = ['code'=>0,'msg'=>'添加失败!','data'=>$activity_list['data'],'rel'=>1]; | ||
| 372 | + } | ||
| 373 | + return $result; | ||
| 374 | + } | ||
| 375 | + $this->assign ( 'title','添加活动'); | ||
| 376 | + return $this->fetch(); | ||
| 377 | + } | ||
| 299 | } | 378 | } |
application/admin/view/seller/activity.html
0 → 100644
| 1 | +{include file="common/head"/} | ||
| 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 | + <blockquote class="layui-elem-quote"> | ||
| 7 | + <a href="javascript:;" class="layui-btn layui-btn-sm" id='add'> | ||
| 8 | + <i class="fa fa-file-image-o"></i> 添加活动 | ||
| 9 | + </a> | ||
| 10 | + </blockquote> | ||
| 11 | + <table class="layui-table" id="list" lay-filter="list"></table> | ||
| 12 | +</div> | ||
| 13 | +{include file="common/foot"/} | ||
| 14 | +<script> | ||
| 15 | + layui.use(['table','form'], function() { | ||
| 16 | + var table = layui.table,$ = layui.jquery; | ||
| 17 | + var tableIn = table.render({ | ||
| 18 | + elem: '#list', | ||
| 19 | + url: '{:url("activity")}', | ||
| 20 | + method: 'post', | ||
| 21 | + title: '商家列表', | ||
| 22 | + cols: [[ | ||
| 23 | + {field: 'id', title: '{:lang("id")}', width:60, fixed: true}, | ||
| 24 | + {field: 'title', title: '活动标题'}, | ||
| 25 | + {field: 'desc', title: '活动描述'}, | ||
| 26 | + {field: 'ctime', align: 'center',title: '创建时间'} | ||
| 27 | + ]] | ||
| 28 | + }); | ||
| 29 | + | ||
| 30 | + $('#add').on('click', function() { | ||
| 31 | + layer.open({ | ||
| 32 | + type: 2, | ||
| 33 | + title: '添加活动', | ||
| 34 | + shadeClose: true, | ||
| 35 | + shade: 0.8, | ||
| 36 | + area: ['90%', '90%'], | ||
| 37 | + content: '{:url("add_activity")}' //iframe的url | ||
| 38 | + /*success:function(dom){ | ||
| 39 | + let $iframeDom=$(dom[0]).find("iframe").eq(0).contents(); | ||
| 40 | + $iframeDom.find("#test").html("我是从父级传来的值哟……") | ||
| 41 | + }*/ | ||
| 42 | + }); | ||
| 43 | + }); | ||
| 44 | + }) | ||
| 45 | +</script> |
| 1 | +{include file="common/head"/} | ||
| 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"> | ||
| 7 | + <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"> | ||
| 11 | + </div> | ||
| 12 | + </div> | ||
| 13 | + | ||
| 14 | + <div class="layui-form-item layui-form-text"> | ||
| 15 | + <label class="layui-form-label">文本域</label> | ||
| 16 | + <div class="layui-input-block"> | ||
| 17 | + <textarea placeholder="请输入内容" class="layui-textarea" id="desc" name="desc"></textarea> | ||
| 18 | + </div> | ||
| 19 | + </div> | ||
| 20 | + | ||
| 21 | + <div class="layui-form-item"> | ||
| 22 | + <div class="layui-input-block"> | ||
| 23 | + <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button> | ||
| 24 | + </div> | ||
| 25 | + </div> | ||
| 26 | + </form> | ||
| 27 | +</div> | ||
| 28 | +{include file="common/foot"/} | ||
| 29 | +<script> | ||
| 30 | + layui.use('form', function () { | ||
| 31 | + var form = layui.form, $ = layui.jquery; | ||
| 32 | + //根据菜品ID 修改对应菜品的GIF、视频url | ||
| 33 | + form.on('submit(submit)', function (data) { | ||
| 34 | + if($('#title').val()=='' || $('#desc').val()==''){ | ||
| 35 | + layer.msg('标题、描述不能为空!', {time: 1000, icon: 2});return; | ||
| 36 | + } | ||
| 37 | + var loading = layer.load(1, {shade: [0.1, '#fff']}); | ||
| 38 | + $.post("{:url('add_activity')}", data.field, function (res) { | ||
| 39 | + layer.close(loading); | ||
| 40 | + if (res.code == 1) { | ||
| 41 | + layer.msg(res.msg, {time: 1000, icon: 1}, function () { | ||
| 42 | + window.parent.location.reload(); | ||
| 43 | + }); | ||
| 44 | + } else { | ||
| 45 | + layer.msg(res.msg, {time: 1000, icon: 2}); | ||
| 46 | + } | ||
| 47 | + }); | ||
| 48 | + }) | ||
| 49 | + }); | ||
| 50 | +</script> |
| 1 | +{include file="common/head"/} | ||
| 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"> | ||
| 7 | + <table class="layui-table"> | ||
| 8 | + <thead> | ||
| 9 | + <tr> | ||
| 10 | + <th lay-data="{field:'id', width:80, sort: true}">ID</th> | ||
| 11 | + <th lay-data="{field:'username', width:80, templet: '#usernameTpl'}">商家ID</th> | ||
| 12 | + <th lay-data="{field:'sex', width:80, sort: true, templet: '#sexTpl'}">标题</th> | ||
| 13 | + <th lay-data="{field:'city', width:80}">描述</th> | ||
| 14 | + </tr> | ||
| 15 | + </thead> | ||
| 16 | + {if $seller_activity} | ||
| 17 | + {foreach $seller_activity as $vo} | ||
| 18 | + <tr> | ||
| 19 | + <th>{$vo.id}</th> | ||
| 20 | + <th>{$vo.sid}</th> | ||
| 21 | + <th>{$vo.title}</th> | ||
| 22 | + <th>{$vo.desc}</th> | ||
| 23 | + </tr> | ||
| 24 | + {/foreach} | ||
| 25 | + {else} | ||
| 26 | + <tr> | ||
| 27 | + <th colspan="4" style="text-align:center">商家暂无活动</th> | ||
| 28 | + </tr> | ||
| 29 | + {/if} | ||
| 30 | + </table> | ||
| 31 | + | ||
| 32 | + | ||
| 33 | + <div class="layui-form-item"> | ||
| 34 | + <label class="layui-form-label">选择活动</label> | ||
| 35 | + <div class="layui-input-block"> | ||
| 36 | + <div class="layui-input-4"> | ||
| 37 | + <select name="aid" id="aid" lay-filter="aid"> | ||
| 38 | + <option value="0" data-val=''>请选择</option> | ||
| 39 | + {foreach $activity_list as $vo} | ||
| 40 | + <option value="{$vo.id}" data-val='{$vo.desc}'>{$vo.title}</option> | ||
| 41 | + {/foreach} | ||
| 42 | + <textarea placeholder="活动描述" name="content" id="txt" class="layui-textarea" disabled></textarea> | ||
| 43 | + </select> | ||
| 44 | + </div> | ||
| 45 | + </div> | ||
| 46 | + </div> | ||
| 47 | + <input type='hidden' name='hid' value='{$sid}'> | ||
| 48 | + <div class="layui-form-item"> | ||
| 49 | + <div class="layui-input-block"> | ||
| 50 | + <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('add')}</button> | ||
| 51 | + <a href="{:url('seller_activity_list')}" class="layui-btn layui-btn-primary">{:lang('back')}</a> | ||
| 52 | + </div> | ||
| 53 | + </div> | ||
| 54 | + </form> | ||
| 55 | +</div> | ||
| 56 | +{include file="common/foot"/} | ||
| 57 | +<script> | ||
| 58 | + layui.use('form', function () { | ||
| 59 | + var form = layui.form, $ = layui.jquery; | ||
| 60 | + //根据菜品ID 修改对应菜品的GIF、视频url | ||
| 61 | + form.on('submit(submit)', function (data) { | ||
| 62 | + if(data.field.aid==0){ | ||
| 63 | + layer.msg('请选择活动后在添加',{icon:0});return; | ||
| 64 | + } | ||
| 65 | + var loading = layer.load(1, {shade: [0.1, '#fff']}); | ||
| 66 | + $.post("{:url('seller_activity')}", data.field, function (res) { | ||
| 67 | + layer.close(loading); | ||
| 68 | + if (res.code == 1) { | ||
| 69 | + layer.msg(res.msg, {time: 1000, icon: 1}, function () { | ||
| 70 | + location.href = "{:url('seller_activity')}?id="+data.field.hid; | ||
| 71 | + }); | ||
| 72 | + } else { | ||
| 73 | + layer.msg(res.msg, {time: 1000, icon: 2}); | ||
| 74 | + } | ||
| 75 | + }); | ||
| 76 | + }) | ||
| 77 | + | ||
| 78 | + //单选按钮显示隐藏 | ||
| 79 | + form.on('select(aid)', function(data){ | ||
| 80 | + var dataval=$(data.elem).find("option:selected").attr("data-val"); | ||
| 81 | + $("#txt").show(); | ||
| 82 | + $("#txt").html(dataval); | ||
| 83 | + }); | ||
| 84 | + }); | ||
| 85 | +</script> |
| 1 | +{include file="common/head"/} | ||
| 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 | + <blockquote class="layui-elem-quote"> | ||
| 7 | + <a href="{:url('Seller/seller_activity_list')}" class="layui-btn layui-btn-sm layui-btn-danger"> | ||
| 8 | + <i class="fa fa-file-image-o"></i> 商家列表 | ||
| 9 | + </a> | ||
| 10 | + <a href="{:url('Seller/activity')}" class="layui-btn layui-btn-sm"> | ||
| 11 | + <i class="fa fa-file-image-o"></i> 活动列表 | ||
| 12 | + </a> | ||
| 13 | + </blockquote> | ||
| 14 | + | ||
| 15 | + <div class="demoTable"> | ||
| 16 | + 搜索商家:<div class="layui-inline"> | ||
| 17 | + <input class="layui-input" name="key" id="key" placeholder="{:lang('pleaseEnter')}店铺名称" autocomplete="off"> | ||
| 18 | + </div> | ||
| 19 | + 商家来源: | ||
| 20 | + <div class="layui-input-inline layui-form"> | ||
| 21 | + <div class="layui-input-8"> | ||
| 22 | + <select name="class" id="channel" lay-filter="myselect"> | ||
| 23 | + <option value="4">全部</option> | ||
| 24 | + <option value="1" selected>合作</option> | ||
| 25 | + <option value="2">推广</option> | ||
| 26 | + <option value="3">测试</option> | ||
| 27 | + </select> | ||
| 28 | + </div> | ||
| 29 | + </div> | ||
| 30 | + <button class="layui-btn" id="search" data-type="reload">搜索</button> | ||
| 31 | + </div> | ||
| 32 | + | ||
| 33 | + <table class="layui-table" id="list" lay-filter="list"></table> | ||
| 34 | +</div> | ||
| 35 | +{include file="common/foot"/} | ||
| 36 | +<script> | ||
| 37 | + layui.use(['table','form'], function() { | ||
| 38 | + var table = layui.table,$ = layui.jquery; | ||
| 39 | + var tableIn = table.render({ | ||
| 40 | + elem: '#list', | ||
| 41 | + url: '{:url("seller_activity_list")}', | ||
| 42 | + method: 'post', | ||
| 43 | + title: '商家列表', | ||
| 44 | + page:true, | ||
| 45 | + cols: [[ | ||
| 46 | + {field: 'id', title: '{:lang("id")}'}, | ||
| 47 | + {field: 'sellername', title: '商家名称'}, | ||
| 48 | + ]] | ||
| 49 | + ,id: 'testReload' | ||
| 50 | + ,page: true | ||
| 51 | + }); | ||
| 52 | + | ||
| 53 | + //搜索 | ||
| 54 | + $('#search').on('click', function() { | ||
| 55 | + var key = $('#key').val(); | ||
| 56 | + tableIn.reload({ page: {page: 1},where: {key: key,channel: $('#channel').val()}}); | ||
| 57 | + }); | ||
| 58 | + | ||
| 59 | + //监听行双击事件 | ||
| 60 | + table.on('row(list)', function(obj){ | ||
| 61 | + location.href='{:url("seller_activity")}?id='+obj.data.id;return; | ||
| 62 | + }); | ||
| 63 | + | ||
| 64 | + var $ = layui.$, active = { | ||
| 65 | + reload: function(){ | ||
| 66 | + var key = $('#key'); | ||
| 67 | + var channel = $('#channel'); | ||
| 68 | + //执行重载 | ||
| 69 | + table.reload('testReload', { | ||
| 70 | + page: { | ||
| 71 | + curr: 1 //重新从第 1 页开始 | ||
| 72 | + } | ||
| 73 | + ,where: { | ||
| 74 | + key: { | ||
| 75 | + id: key.val(), | ||
| 76 | + channel: channel.val() | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + }); | ||
| 80 | + } | ||
| 81 | + }; | ||
| 82 | + | ||
| 83 | + $('.demoTable .layui-btn').on('click', function(){ | ||
| 84 | + var type = $(this).data('type'); | ||
| 85 | + active[type] ? active[type].call(this) : ''; | ||
| 86 | + }); | ||
| 87 | + }) | ||
| 88 | +</script> |
-
Please register or login to post a comment