修正折扣方案

This commit is contained in:
Anyon 2022-04-18 11:04:08 +08:00
parent 9bf96845c5
commit 6c461d8243
2 changed files with 11 additions and 5 deletions

View File

@ -18,7 +18,7 @@ class BaseUserDiscount extends Model
*/ */
public function getItemsAttr($value) public function getItemsAttr($value)
{ {
return empty($value) ? json_decode($value, true) : $value; return empty($value) ? $value : json_decode($value, true);
} }
/** /**

View File

@ -2,7 +2,7 @@
{block name="button"} {block name="button"}
<!--{if auth("add")}--> <!--{if auth("add")}-->
<button class='layui-btn layui-btn-sm layui-btn-primary' data-modal="{:url('add')}" data-title="添加折扣方案">添加折扣方案</button> <button class='layui-btn layui-btn-sm layui-btn-primary' data-table-id="DiscountTable" data-modal="{:url('add')}" data-title="添加折扣">添加折扣</button>
<!--{/if}--> <!--{/if}-->
{/block} {/block}
@ -30,13 +30,19 @@
sort: {field: 'sort desc,id', type: 'desc'}, sort: {field: 'sort desc,id', type: 'desc'},
where: {type: '{$type|default="index"}'}, where: {type: '{$type|default="index"}'},
cols: [[ cols: [[
// {checkbox: true, fixed: true},
{field: 'sort', title: '排序权重', align: 'center', width: 100, sort: true, templet: '#SortInputTpl'}, {field: 'sort', title: '排序权重', align: 'center', width: 100, sort: true, templet: '#SortInputTpl'},
{field: 'id', title: 'ID', align: "center", width: 80}, {field: 'id', title: 'ID', align: "center", width: 80},
{field: 'name', title: '折扣名称', align: 'left', minWidth: 140}, {field: 'name', title: '折扣名称', align: 'left', minWidth: 140},
{field: 'status', title: '状态', align: 'center', minWidth: 110, templet: '#StatusSwitchTpl'}, {
field: 'items', title: '折扣方案', align: 'left', minWidth: 200, templet: function (d) {
return (d.html = ''), d.items.forEach(function (item) {
d.html += laytpl('<span class="layui-badge layui-bg-gray">VIP{{d.level}} 折扣 {{d.discount}}%</span>').render(item);
}), d.html;
}
},
{field: 'status', title: '状态', align: 'center', width: 110, templet: '#StatusSwitchTpl'},
{field: 'create_at', title: '创建时间', align: 'center', minWidth: 170, sort: true}, {field: 'create_at', title: '创建时间', align: 'center', minWidth: 170, sort: true},
{toolbar: '#toolbar', title: '操作面板', align: 'center', minWidth: 160, fixed: 'right'}, {toolbar: '#toolbar', title: '操作面板', align: 'center', minWidth: 80, fixed: 'right'},
]] ]]
}); });