diff --git a/app/controller/api/Consumer.php b/app/controller/api/Consumer.php index 01871d5..c279a5c 100644 --- a/app/controller/api/Consumer.php +++ b/app/controller/api/Consumer.php @@ -186,7 +186,7 @@ class Consumer extends Base $page = input("page/d",1); $size = input("size/d",1000); $couponId = input("coupon_id/d",0); - + $coupon = CouponRepository::getInstance()->findById($couponId, [], function ($q) { return $q->with([ "business" => function ($q) { diff --git a/public/static/manager/js/slide_agency.js b/public/static/manager/js/slide_agency.js new file mode 100644 index 0000000..8935426 --- /dev/null +++ b/public/static/manager/js/slide_agency.js @@ -0,0 +1,120 @@ +layui.use(['laytpl', 'table', 'jquery', 'form', 'miniTab', 'xmSelect'], function () { + let $ = layui.jquery, + form = layui.form, + table = layui.table, + layer = layui.layer, + xmSelect = layui.xmSelect, + miniTab = layui.miniTab; + + /**** index begin ***/ + //index页面 + if ($('.location-index-page').length > 0) { + miniTab.listen(); + + // 渲染表格 + let listUrl = $('#table-container').data('url'); + let sort = $('#table-container-sort').data('url'); + let insTb = table.render({ + elem: '#table-container', + toolbar: '#toolbar-tpl', + defaultToolbar: [{ //自定义头部工具栏右侧图标。如无需自定义,去除该参数即可 + title: '搜索' + , layEvent: 'search' + , icon: 'layui-icon-search' + }], + url: listUrl, + method: 'post', + even: true, + limits: [10,20,50,100,200,500,1000], + request: { + pageName: 'page', + limitName: 'size', + }, + parseData: function (res) { + return { + "code": res.code, //解析接口状态 + "msg": res.msg, //解析提示文本 + "count": res.data.total, //解析数据长度 + "data": res.data.list //解析数据列表 + }; + }, + page: true, + cols: [[ + {type: 'checkbox'}, + {field: 'id', width: 80, title: 'ID'}, + {field: 'title', minWidth: 200, title: '标题'}, + {templet: '#row-cover', minWidth:150, title: '轮播图', style: 'height: 90px;'}, + {field: 'url', title: '跳转链接'}, + {field: 'created_at', width: 170, title: '创建时间'}, + {field: 'sort', width: 80, title: '排序', edit: 'text'}, + {templet: '#row-operate', minWidth: 150, align: 'center', title: '操作',} + ]], + done: function () { + Tools.setInsTb(insTb); + } + }); + + // 监听搜索操作 + form.on('submit(data-search-btn)', function (data) { + //执行搜索重载 + table.reload('table-container', { + page: {curr: 1} + , where: data.field + }, 'data'); + + return false; + }); + + /** td edit **/ + + table.on('edit(table-container)', function (obj) { + let id = obj.data.id; + if (obj.field == 'sort') { + $.ajax(sort, { + data: { + "sort": obj.value, + "id": id + } + ,dataType : 'json' + ,type: 'POST' + }) + .done(function () { + insTb.reload(); + }) + } + }); + } + /*** index end ***/ + + /** add and edit **/ + if ($('.location-operate-page').length > 0) { + let positions = $('#position-list'); + let positionList = positions.data('menu') ? positions.data('menu') : []; + xmSelect.render({ + el: '#position-list', + paging: false, + autoRow: true, + radio: true, + clickClose: true, + name: 'item[position]', + tips: '请选择显示位置', + direction: 'auto', + height: 'auto', + model: { + icon: 'hidden', + }, + prop: { + name: 'title', + value: 'key', + }, + theme: { + color: '#1e84ff', + }, + data: positionList, + on: function (data) { + + }, + }); + } + +}); \ No newline at end of file diff --git a/view/manager/slide/agency_poster.html b/view/manager/slide/agency_poster.html index 9bc23f6..254d158 100644 --- a/view/manager/slide/agency_poster.html +++ b/view/manager/slide/agency_poster.html @@ -52,4 +52,4 @@ - \ No newline at end of file + \ No newline at end of file