2023-03-16 12:18:52 +08:00

259 lines
5.8 KiB
HTML

{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
<form class="layui-form gg-form-bar border-t border-x">
<div class="layui-input-inline" style="width:300px;">
<input type="text" name="keywords" placeholder="请输入商户名称" class="layui-input" autocomplete="off" />
</div>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="searchform">搜索</button>
</form>
<table class="layui-hide" id="article" lay-filter="article"></table>
</div>
<script type="text/html" id="status">
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="is_home">
<i class="layui-icon {{# if(d.is_home == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
</script>
<script type="text/html" id="thumb">
</script>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
{if {:auth_cache(session('gougu_admin')['id'],$url[1])}==true}
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加">+ 添加</span>
{/if}
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
<!-- {if {:auth_cache(session('gougu_admin')['id'],$url[4])}==true}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a>
{/if} -->
{if {:auth_cache(session('gougu_admin')['id'],$url[2])}==true}
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
{/if}
{if {:auth_cache(session('gougu_admin')['id'],$url[3])}==true}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var table = layui.table,tool = layui.tool, form = layui.form;
layui.pageTable = table.render({
elem: '#article',
title: '列表',
toolbar: '#toolbarDemo',
url: '{$url[4]}',
page: true,
limit: 20,
cols: [
[
{
fixed: 'left',
field: 'id',
title: '编号',
align: 'center',
width:80,
},{
fixed: 'left',
field: 'supplyChain',
title: '供应链',
align: 'center',
templet: function (d)
{
var html = d.supplyChain.name;
return html;
},
width:120,
},{
field: 'brokerage',
title: '团队负责人',
align: 'center',
templet: function (d)
{
var html = d.principal ? '是': '否';
return html;
},
width:150,
},{
field: 'merchant',
title: '商户',
align: 'center',
templet: function (d)
{
var html = d.merchant.mer_name;
return html;
},
width:120,
},{
field: 'merchant',
title: '姓名',
align: 'center',
templet: function (d)
{
var html = d.merchant.real_name;
return html;
},
width:150,
},{
field: 'merchant',
title: '联系电话',
align: 'center',
templet: function (d)
{
var html = d.merchant.mer_phone;
return html;
},
width:150,
},{
field: 'merchant',
title: '店铺状态',
align: 'center',
templet: function (d)
{
var html = '<span style="color:#fbbc05">锁定</span>';
if (d.merchant.status == 1) {
html = '<span style="color:#12bb37">正常</span>';
}
return html;
},
},{
field: 'merchant',
title: '产品数量',
align: 'center',
templet: function (d)
{
var html = d.merchant.mer_phone;
return html;
},
width:150,
},{
field: 'merchant',
title: '产品数量',
align: 'center',
templet: function (d)
{
var html = d.merchant.mer_phone;
return html;
},
width:150,
},{
field: 'merchant',
title: '余额',
align: 'center',
templet: function (d)
{
var html = d.merchant.mer_money;
return html;
},
width:150,
},{
field: 'merchant',
title: '保证金',
align: 'center',
templet: function (d)
{
var html = d.merchant.margin;
return html;
},
width:150,
},{
field: 'order_number',
title: '销量',
align: 'center',
templet: function (d)
{
var html = d.merchant.sales;
return html;
},
width:150,
},{
field: 'merchant',
title: '商户地址',
templet: function (d)
{
var html = d.merchant.mer_address;
return html;
},
align: 'center',
width:150,
},{
field: 'merchant',
title: '入驻时间',
align: 'center',
templet: function (d)
{
var html = d.merchant.create_time;
return html;
},
width:150,
}
]
]
});
//监听表头工具栏事件
table.on('toolbar(article)', function(obj){
if (obj.event === 'add') {
tool.side('{$url[1]}');
return false;
}
});
//监听表格行工具事件
table.on('tool(article)', function(obj) {
var data = obj.data;
if (obj.event === 'read') {
tool.side('{$url[4]}?id='+obj.data.id);
}
else if (obj.event === 'edit') {
tool.side('{$url[2]}?id='+obj.data.id);
}
else if (obj.event === 'del') {
layer.confirm('确定要删除该记录吗?', {
icon: 3,
title: '提示'
}, function(index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
tool.delete('{$url[3]}', { id: data.id }, callback);
layer.close(index);
});
}
return false;
});
//监听搜索提交
form.on('submit(searchform)', function(data) {
layui.pageTable.reload({
where: {
keywords: data.field.keywords,
cate_id: data.field.cate_id
},
page: {
curr: 1
}
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->