74 lines
3.0 KiB
HTML
74 lines
3.0 KiB
HTML
{extend name="../../admin/view/table"}
|
|
|
|
{block name="button"}
|
|
<button class='layui-btn layui-btn-sm layui-btn-primary' data-open='{:url("/merchant/merchant/index")}'
|
|
data-title="返回业务">返回商户
|
|
</button>
|
|
|
|
<!--{if auth("add")}-->
|
|
<button class='layui-btn layui-btn-sm layui-btn-primary' data-modal='{:url("add")}?mid={$mid}'
|
|
data-title="添加商品映射">添加商品映射
|
|
</button>
|
|
<!--{/if}-->
|
|
{/block}
|
|
|
|
{block name="content"}
|
|
<div class="think-box-shadow">
|
|
{include file='merchant_mapping_product/index_search'}
|
|
<table id="MerchantMappingProductTable" data-url="{:request()->url()}" data-target-search="form.form-search"></table>
|
|
</div>
|
|
{/block}
|
|
|
|
{block name='script'}
|
|
<script>
|
|
$(function () {
|
|
$('#MerchantMappingProductTable').layTable({
|
|
even: true, height: 'full',
|
|
sort: {field: 'id', type: 'desc'},
|
|
cols: [[
|
|
{checkbox: true, fixed: 'left'},
|
|
{field: 'id', title: 'ID', width: 80, sort: true, align: 'center'},
|
|
{field: 'proid', title: '产品编码', minWidth: 100, width: '8%', sort: true, align: 'center'},
|
|
{field: 'mapping_id', title: '映射商品编码', minWidth: 120},
|
|
{field: 'product_key', title: '产品KEY', minWidth: 120},
|
|
{field: 'sort', title: '优先级', minWidth: 150},
|
|
{field: 'cash', title: '面值', minWidth: 100, width: '10%'},
|
|
{field: 'status', title: '使用状态', align: 'center', minWidth: 110, templet: '#StatusSwitchRoleTableTpl'},
|
|
{field: 'create_at', title: '创建时间', minWidth: 170, align: 'center', sort: true},
|
|
|
|
{toolbar: '#toolbar', title: '操作面板', align: 'center', minWidth: 210, fixed: 'right'}
|
|
]]
|
|
});
|
|
|
|
// 数据状态切换操作
|
|
layui.form.on('switch(StatusSwitchRoleTable)', function (obj) {
|
|
let data = {id: obj.value, status: obj.elem.checked > 0 ? 1 : 0};
|
|
$.form.load("{:url('state')}", data, 'post', function (ret) {
|
|
if (ret.code < 1) $.msg.error(ret.info, 3, function () {
|
|
$('#RoleTable').trigger('reload');
|
|
});
|
|
return false;
|
|
}, false);
|
|
});
|
|
});
|
|
</script>
|
|
<!-- 数据状态切换模板 -->
|
|
<script type="text/html" id="StatusSwitchRoleTableTpl">
|
|
<!--{if auth("state")}-->
|
|
<input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="{:lang('已激活')}|{:lang('已禁用')}" lay-filter="StatusSwitchRoleTable" {{-d.status>0?'checked':''}}>
|
|
<!--{else}-->
|
|
{{-d.status ? '<b class="color-green">{:lang("已启用")}</b>' : '<b class="color-red">{:lang("已禁用")}</b>'}}
|
|
<!--{/if}-->
|
|
</script>
|
|
|
|
<script type="text/html" id="toolbar">
|
|
<!--{if auth("edit")}-->
|
|
<a class="layui-btn layui-btn-xs" data-dbclick data-modal='{:url("edit")}?id={{d.id}}&mid={{d.mid}}'
|
|
data-title="编辑映射商品ID">编 辑</a>
|
|
<!--{/if}-->
|
|
|
|
|
|
|
|
</script>
|
|
{/block}
|