File was renamed from src/main/resources/templates/febs/views/modules/goods/goodsCoupon.html |
| | |
| | | background-color: #5FB878 !important; |
| | | } |
| | | </style> |
| | | |
| | | <script type="text/html" id="isStateSwitch"> |
| | | {{# if(d.state === 2) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="上架|下架" checked lay-skin="switch" lay-filter="isStateSwitch"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="上架|下架" lay-skin="switch" lay-filter="isStateSwitch"> |
| | | {{# } }} |
| | | </script> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | // 引入组件并初始化 |
| | |
| | | table.on('tool(couponRuleTable)', function (obj) { |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | if (layEvent === 'carriageRuleDel') { |
| | | febs.modal.confirm('删除', '确认删除['+data.name+']运费模板?', function () { |
| | | carriageRuleDel(data.id); |
| | | if (layEvent === 'couponRuleDel') { |
| | | febs.modal.confirm('删除', '确认删除['+data.name+']优惠卷?', function () { |
| | | couponRuleDel(data.id); |
| | | }); |
| | | } |
| | | if (layEvent === 'carriageRuleUpdate') { |
| | | febs.modal.open('运费模板编辑', 'modules/goods/carriageRuleUpdate/' + data.id, { |
| | | if (layEvent === 'couponRuleUpdate') { |
| | | febs.modal.open('优惠卷编辑', 'modules/goods/goodsCouponUpdate/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | |
| | | }); |
| | | } |
| | | }); |
| | | function carriageRuleDel(id) { |
| | | febs.get(ctx + 'admin/goods/carriageRuleDel/' + id, null, function () { |
| | | function couponRuleDel(id) { |
| | | febs.get(ctx + 'admin/goods/couponRuleDel/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | |
| | | form.on('switch(isStateSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | upCoupon(data.value); |
| | | } else { |
| | | downCoupon(data.value); |
| | | } |
| | | }) |
| | | |
| | | function upCoupon(id) { |
| | | febs.get(ctx + 'admin/goods/upCoupon/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | function downCoupon(id) { |
| | | febs.get(ctx + 'admin/goods/downCoupon/' + id, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | $query.click(); |
| | | }); |
| | |
| | | }); |
| | | |
| | | $add.on('click', function () { |
| | | febs.modal.open('运费模板新增', 'modules/goods/carriageRuleAdd/', { |
| | | febs.modal.open('优惠卷新增', 'modules/goods/goodsCouponAdd/', { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | |
| | | url: ctx + 'admin/goods/couponRuleList', |
| | | cols: [[ |
| | | {field: 'name', title: '名称', minWidth: 200,align:'left'}, |
| | | {field: 'isState', title: '是否生效', templet: '#isStateSwitch', minWidth: 100,align:'center'}, |
| | | {field: 'costAmount', title: '满足金额', minWidth: 200,align:'left'}, |
| | | {field: 'realAmount', title: '减免金额', minWidth: 200,align:'left'}, |
| | | {field: 'expireDay', title: '过期天数', minWidth: 200,align:'left'}, |
| | | {field: 'createdTime', title: '创建时间', minWidth: 140,align:'left'}, |
| | | {title: '操作', |
| | | templet: function (d) { |
| | | if (d.state === 1) { |
| | | return '' |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="carriageRuleUpdate" shiro:hasPermission="user:update">编辑</button>' |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs febs-bg-red" lay-event="carriageRuleDel" shiro:hasPermission="user:update">删除</button>' |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="couponRuleUpdate" shiro:hasPermission="user:update">编辑</button>' |
| | | + '<button class="layui-btn layui-btn-normal layui-btn-xs febs-bg-red" lay-event="couponRuleDel" shiro:hasPermission="user:update">删除</button>' |
| | | |
| | | }else{ |
| | | return ''; |
| | | |
| | | } |
| | | },minWidth: 160,align:'center'} |
| | | ]] |
| | | }); |