| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-activity" lay-title="首页活动"> |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-activity" lay-title="活动列表"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | |
| | | </div> |
| | | </form> |
| | | <table lay-filter="activityTable" lay-data="{id: 'activityTable'}"></table> |
| | | <style type="text/css"> |
| | | .layui-table-cell{ |
| | | text-align:center; |
| | | height: auto; |
| | | white-space: nowrap; /*文本不会换行,在同一行显示*/ |
| | | overflow: hidden; /*超出隐藏*/ |
| | | text-overflow: ellipsis; /*省略号显示*/ |
| | | } |
| | | .layui-table img{ |
| | | max-width:100px |
| | | } |
| | | </style> |
| | | <!-- <style type="text/css">--> |
| | | <!-- ::-webkit-scrollbar {--> |
| | | <!-- height: 20px !important;--> |
| | | <!-- background-color: #f4f4f4;--> |
| | | <!-- }--> |
| | | <!-- </style>--> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | table.on('tool(activityTable)', function (obj) { |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | if (layEvent === 'closeAct') { |
| | | febs.modal.confirm('关闭', '确认关闭该活动?', function () { |
| | | closeAct(data.id); |
| | | }); |
| | | } |
| | | if (layEvent === 'startAct') { |
| | | febs.modal.confirm('开启', '确认开启该活动?', function () { |
| | | startAct(data.id); |
| | | }); |
| | | } |
| | | if (layEvent === 'delAct') { |
| | | febs.modal.confirm('删除', '确认删除该活动?', function () { |
| | | delAct(data.id); |
| | |
| | | }); |
| | | } |
| | | }); |
| | | function closeAct(id) { |
| | | febs.get(ctx + 'admin/act/closeMallAct/' + id, null, function () { |
| | | febs.alert.success('关闭成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | function startAct(id) { |
| | | febs.get(ctx + 'admin/act/startMallAct/' + id, null, function () { |
| | | febs.alert.success('开启成功'); |
| | | function changeState(id,state) { |
| | | febs.get(ctx + 'admin/activity/changeState/' + id+'/' + state, null, function (data) { |
| | | febs.alert.success(data.message); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | function delAct(id) { |
| | | febs.get(ctx + 'admin/act/delMallAct/' + id, null, function () { |
| | | febs.alert.success('删除成功'); |
| | | febs.get(ctx + 'admin/activity/delActivity/' + id, null, function (data) { |
| | | febs.alert.success(data.message); |
| | | $query.click(); |
| | | }); |
| | | } |
| | |
| | | }); |
| | | |
| | | $add.on('click', function () { |
| | | febs.modal.open('新增活动', 'modules/act/actAddNew/', { |
| | | febs.modal.open('新增活动', 'modules/activity/add/', { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | |
| | | // 遍历每一行数据 |
| | | res.data.forEach(function(item, index) { |
| | | // 根据状态值控制按钮显示 |
| | | if (item.state === 2) { |
| | | if (item.state === 0) { |
| | | // 如果状态为1,显示 |
| | | $('#commissionOption' + index).show(); |
| | | $('#activityOption' + index).show(); |
| | | } else { |
| | | // 否则,隐藏 |
| | | $('#commissionOption' + index).hide(); |
| | | $('#activityOption' + index).hide(); |
| | | } |
| | | }); |
| | | } |
| | |
| | | |
| | | form.on('switch(activityStateSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | startAct(data.value); |
| | | changeState(data.value,1); |
| | | } else { |
| | | closeAct(data.value); |
| | | changeState(data.value,0); |
| | | } |
| | | }) |
| | | |