238 lines
5.1 KiB
HTML
238 lines
5.1 KiB
HTML
{extend name="common/base"/}
|
|
<!-- 主体 -->
|
|
{block name="body"}
|
|
<style>
|
|
.layui-input-inline{
|
|
width:35% !important;
|
|
}
|
|
.layui-input-inline .layui-form-item{
|
|
display:flex;
|
|
}
|
|
.layui-input-inline .layui-form-item .layui-form-label{
|
|
width:30%;
|
|
}
|
|
.layui-input-block{
|
|
margin-left:unset !important;
|
|
width:75%;
|
|
}
|
|
#seleform{
|
|
border-color: #eee;
|
|
background-color: #fff;
|
|
color:#a39f9f;
|
|
width:100%;
|
|
}
|
|
</style>
|
|
<div class="p-3">
|
|
<form id="filterform" 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="store_product" lay-filter="store_product"></table>
|
|
</div>
|
|
|
|
|
|
<script type="text/html" id="barDemo">
|
|
<div class="layui-btn-group"></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: '#store_product',
|
|
title: '商品表列表',
|
|
toolbar: '#toolbarDemo',
|
|
url: '/admin/store_product/log',
|
|
page: true,
|
|
limit: 20,
|
|
cellMinWidth: 300,
|
|
cols: [
|
|
[
|
|
{
|
|
fixed: 'left',
|
|
field: 'id',
|
|
title: '编号',
|
|
align: 'center',
|
|
width: 80
|
|
},{
|
|
field: 'order_sn',
|
|
title: '订单号',
|
|
align: 'center',
|
|
width: 180
|
|
},{
|
|
field: 'paid_at',
|
|
title: '交易时间',
|
|
align: 'center',
|
|
width: 150,
|
|
},{
|
|
field: 'name',
|
|
title: '对方信息',
|
|
align: 'center',
|
|
width: 150
|
|
},{
|
|
field: 'type',
|
|
title: '交易类型',
|
|
align: 'center',
|
|
width: 100
|
|
},{
|
|
field: 'total_fee',
|
|
title: '收支金额(元)',
|
|
align: 'center',
|
|
width: 150
|
|
}, {
|
|
fixed: 'right',
|
|
field: 'right',
|
|
title: '操作',
|
|
toolbar: '#barDemo',
|
|
width: 136,
|
|
align: 'center'
|
|
}
|
|
]
|
|
]
|
|
});
|
|
|
|
//监听表头工具栏事件
|
|
table.on('toolbar(store_product)', function(obj){
|
|
if (obj.event === 'add') {
|
|
tool.side("/admin/store_product/add");
|
|
return false;
|
|
}
|
|
if (obj.event === 'adds') {
|
|
tool.side("/admin/store_product/adds");
|
|
return false;
|
|
}
|
|
});
|
|
|
|
// 商户商品分类搜索
|
|
layui.use(['rate','dropdown', 'util', 'layer', 'table'], function(){
|
|
var dropdown = layui.dropdown
|
|
,util = layui.util
|
|
,layer = layui.layer
|
|
,rate = layui.rate
|
|
// ,table = layui.table
|
|
,$ = layui.jquery;
|
|
|
|
var $ = layui.$, active = {
|
|
reload: function(){
|
|
let dataRload = getformdata();
|
|
//执行重载
|
|
table.reload('store_product', {
|
|
page: {
|
|
curr: 1 //重新从第 1 页开始
|
|
}
|
|
,where: {
|
|
...dataRload
|
|
}
|
|
});
|
|
},
|
|
};
|
|
|
|
|
|
//基础效果
|
|
rate.render({
|
|
elem: '#is_good'
|
|
})
|
|
|
|
|
|
|
|
|
|
//监听搜索提交
|
|
form.on('submit(searchform)', function(data) {
|
|
layui.pageTable.reload({
|
|
where: {
|
|
...data.field
|
|
},
|
|
page: {
|
|
curr: 1
|
|
}
|
|
});
|
|
return false;
|
|
});
|
|
|
|
//监听select提交
|
|
form.on('select(seleform)', function(data) {
|
|
active['reload'] ? active['reload'].call(this) : '';
|
|
return false;
|
|
});
|
|
|
|
//监听removeselect点击
|
|
$('#removeselect').on('click', function(){
|
|
$('#seleform').text('请选择');
|
|
$('#seleform').css({color:'#a39f9f'});
|
|
$('#store_cate').val('');
|
|
active['reload'] ? active['reload'].call(this) : '';
|
|
return false;
|
|
});
|
|
|
|
// tab 状态列表切换
|
|
$('.site-demo-active').on('click', function(){
|
|
var othis = $(this), type = othis.data('type');
|
|
$('#protype').val(this.getAttribute('type'));
|
|
active[type] ? active[type].call(this, othis) : '';
|
|
});
|
|
|
|
});
|
|
//监听表格行工具事件
|
|
table.on('tool(store_product)', function(obj) {
|
|
var data = obj.data;
|
|
if (obj.event === 'read') {
|
|
tool.side('/admin/store_product/read?product_id='+obj.data.product_id);
|
|
}
|
|
else if (obj.event === 'edit') {
|
|
tool.side('/admin/store_product/edit?product_id='+obj.data.product_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("/admin/store_product/del", { product_id: data.product_id }, callback);
|
|
layer.close(index);
|
|
});
|
|
}
|
|
return false;
|
|
});
|
|
|
|
//监听搜索提交
|
|
form.on('submit(searchform)', function(data) {
|
|
layui.pageTable.reload({
|
|
where: {
|
|
keywords: data.field.keywords
|
|
},
|
|
page: {
|
|
curr: 1
|
|
}
|
|
});
|
|
return false;
|
|
});
|
|
|
|
// 获取表单所有参数
|
|
function getformdata() {
|
|
var form = $('#filterform').serializeArray();
|
|
|
|
var data = new Array();
|
|
for(let i=0;i<form.length; i++){
|
|
data[form[i].name] = form[i].value;
|
|
}
|
|
|
|
return data;
|
|
}
|
|
|
|
}
|
|
</script>
|
|
{/block}
|
|
<!-- /脚本 --> |