86 lines
2.7 KiB
HTML
86 lines
2.7 KiB
HTML
{extend name="app/shop/view/base.html"/}
|
|
{block name="resources"}
|
|
<style>
|
|
#selectMemberContent {
|
|
padding: 0 30px;
|
|
}
|
|
</style>
|
|
{/block}
|
|
|
|
{block name="body"}
|
|
<div id="selectMemberContent">
|
|
<!-- 搜索框 -->
|
|
<div class="single-filter-box top">
|
|
<div class="layui-form">
|
|
<div class="layui-input-inline">
|
|
<input type="text" name="member_search" placeholder="请输入商品名称" autocomplete="off" class="layui-input">
|
|
<button id="searchButton" type="button" class="layui-btn layui-btn-primary" lay-filter="search" lay-submit>
|
|
<i class="layui-icon"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- 列表 -->
|
|
<table id="goodsList" lay-filter="goodsList"></table>
|
|
<!--子窗体保存值的临时控件-->
|
|
<input type="hidden" id="selectGoodsInfo" value="" />
|
|
<!-- 操作 -->
|
|
<script type="text/html" id="operation">
|
|
<a class="layui-btn" lay-event="selected">确认选中</a>
|
|
</script>
|
|
</div>
|
|
{/block}
|
|
|
|
{block name="script"}
|
|
<script>
|
|
var form, table,ids = "{$ids}";
|
|
layui.use(['form'], function() {
|
|
// 基本参数
|
|
_thisIndex = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
|
|
form = layui.form;
|
|
form.render();
|
|
table = new Table({
|
|
elem: '#goodsList',
|
|
url: ns.url("shop/goods/selectGoods", { ids:ids }),
|
|
cols: [
|
|
[{
|
|
title: '商品信息',
|
|
unresize: 'false',
|
|
align:'center',
|
|
templet: function(data) {
|
|
var html = '';
|
|
html += `<img src="${data.goods_image}" />`;
|
|
return html;
|
|
}
|
|
}, {
|
|
field: 'goods_name',
|
|
title: '商品名称',
|
|
unresize: 'false',
|
|
align:'center'
|
|
},{
|
|
title: '操作',
|
|
toolbar: '#operation',
|
|
unresize: 'false',
|
|
align:'center'
|
|
}]
|
|
]
|
|
});
|
|
//监听工具栏操作
|
|
table.tool(function(obj) {
|
|
var data = obj.data;
|
|
if(obj.event === 'selected') $("#selectGoodsInfo").val(JSON.stringify(data));
|
|
// 关闭弹框
|
|
parent.layer.close(_thisIndex); //再执行关闭
|
|
});
|
|
//搜索功能
|
|
form.on('submit(search)', function(data) {
|
|
table.reload({
|
|
page: {
|
|
curr: 1
|
|
},
|
|
where: data.field
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
{/block} |