454 lines
18 KiB
HTML
454 lines
18 KiB
HTML
{extend name="common/base"/}
|
||
<!-- 主体 -->
|
||
{block name="body"}
|
||
<style>
|
||
.layui-btn-group{
|
||
display:flex;
|
||
|
||
}
|
||
</style>
|
||
|
||
<div class="p-3">
|
||
|
||
|
||
<!-- 时间选择 -->
|
||
<div class="layui-form">
|
||
|
||
<form id="filterform" class="layui-form" action="">
|
||
<div class="layui-form-item">
|
||
|
||
<div class="layui-form-item">
|
||
|
||
<div class="layui-inline">
|
||
<label class="layui-form-label">选择时间</label>
|
||
<div class="layui-input-block">
|
||
<div class="layui-btn-group">
|
||
<input id="chonse_start_date" type="hidden" name="start_date" value="" readonly placeholder="选择时间">
|
||
<input id="chonse_end_date" type="hidden" name="end_date" value="" readonly placeholder="选择时间">
|
||
<button id="both" name="both" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal">全部</button>
|
||
<button name="today" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal layui-btn-primary">今天</button>
|
||
<button name="yeserday" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal layui-btn-primary">昨天</button>
|
||
<button name="week" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal layui-btn-primary">最近7天</button>
|
||
<button name="30day" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal layui-btn-primary">最近30天</button>
|
||
<button name="month" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal layui-btn-primary">本月</button>
|
||
<button name="year" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal layui-btn-primary">本年</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="layui-inline">
|
||
<!-- <label class="layui-form-label">日期范围</label> -->
|
||
<div class="layui-inline" id="range_date">
|
||
<div class="layui-input-inline">
|
||
<input type="text" autocomplete="off" name="start_date" id="start-date" class="layui-input" placeholder="开始日期">
|
||
</div>
|
||
<div class="layui-form-mid">-</div>
|
||
<div class="layui-input-inline">
|
||
<input type="text" autocomplete="off" name="end_date" id="end-date" class="layui-input" placeholder="结束日期">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="layui-form-item">
|
||
<div class="layui-input-inline" style="width:45%;">
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">商户审核</label>
|
||
<div class="layui-input-block">
|
||
<div class="layui-btn-group">
|
||
<input type="hidden" id="status" name="status" value="" readonly placeholder="核审状态值">
|
||
<button name="both" lay-submit="" lay-filter="statusform" type="button" class="layui-btn layui-btn-normal">全部</button>
|
||
<button name="wait" lay-submit="" lay-filter="statusform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">待审核</button>
|
||
<button name="success" lay-submit="" lay-filter="statusform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">审核通过</button>
|
||
<button name="failed" lay-submit="" lay-filter="statusform" type="button" class="layui-btn layui-btn-normal layui-btn-primary">审核未通过</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="layui-input-inline" style="width:45%;float:none;">
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">商户分类</label>
|
||
<div class="layui-input-block">
|
||
<select name="category_id" lay-filter="seleform">
|
||
<option value=""></option>
|
||
{volist name="category" key="k" id="vo"}
|
||
<option value="{$vo.merchant_category_id}">{$vo.category_name}</option>
|
||
{/volist}
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
</div>
|
||
|
||
<div class="layui-form-item">
|
||
|
||
<div class="layui-input-inline" style="width:45%;">
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">店铺类型</label>
|
||
<div class="layui-input-block">
|
||
<select name="type_id" lay-filter="seleform">
|
||
<option value=""></option>
|
||
{volist name="type" key="k" id="vo"}
|
||
<option value="{$vo.mer_type_id}">{$vo.type_name}</option>
|
||
{/volist}
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="layui-input-inline" style="width:45%;">
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label">关键字</label>
|
||
<div class="layui-input-block" style="display:flex">
|
||
<input style="width:70%;float:left" type="text" name="keywords" placeholder="请输入关键字"
|
||
class="layui-input" autocomplete="off" />
|
||
<button class="layui-btn layui-btn-normal" lay-submit=""
|
||
lay-filter="searchform">提交搜索</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</form>
|
||
<table class="layui-hide" id="intention_list" lay-filter="intention_list">
|
||
</table>
|
||
</div>
|
||
<!-- test end -->
|
||
|
||
|
||
</div>
|
||
|
||
<!-- 操作 -->
|
||
<script type="text/html" id="toolbarDemo"></script>
|
||
<script type="text/html" id="barDemo">
|
||
<div class="layui-btn-group">
|
||
{{# if(d.status == 0 ){ }}
|
||
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="status">审核</a>
|
||
{{# } }}
|
||
|
||
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="mark">备注</a>
|
||
<a class="layui-btn layui-btn-xs" lay-event="del">删除</a>
|
||
</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: '#intention_list',
|
||
title: '商户入驻申请列表',
|
||
toolbar: '#toolbarDemo',
|
||
url: '/admin/merchant/intention/lst',
|
||
parseData: function(res){ //res 即为原始返回的数据
|
||
return {
|
||
"code": res.code, //解析接口状态
|
||
"msg": res.msg, //解析提示文本
|
||
"count": res.data.count, //解析数据长度
|
||
"data": res.data.list //解析数据列表
|
||
};
|
||
},
|
||
page: true,
|
||
limit: 20,
|
||
cellMinWidth: 300,
|
||
cols: [
|
||
[
|
||
{
|
||
fixed: 'ID',
|
||
field: 'mer_intention_id',
|
||
title: 'ID',
|
||
align: 'center',
|
||
width: 80
|
||
},
|
||
{
|
||
field: 'mer_name',
|
||
title: '商户名称',
|
||
align: 'center',
|
||
width: 200,
|
||
}, {
|
||
field: 'category_name',
|
||
title: '商户分类',
|
||
align: 'center',
|
||
width: 220,
|
||
templet: '<div>{{d.merchantCategory.category_name}}</div>'
|
||
},{
|
||
field: 'type_name',
|
||
title: '店铺类型',
|
||
align: 'center',
|
||
width: 220,
|
||
templet: '<div>{{d.merchantType.type_name}}</div>'
|
||
}, {
|
||
field: 'name',
|
||
title: '商户姓名',
|
||
align: 'center',
|
||
width: 220,
|
||
}, {
|
||
field: 'phone',
|
||
title: '联系方式',
|
||
align: 'center',
|
||
width: 100,
|
||
}, {
|
||
field: 'create_time',
|
||
title: '申请时间',
|
||
align: 'center',
|
||
width: 220,
|
||
},{
|
||
field: 'images',
|
||
title: '资质图片',
|
||
align: 'center',
|
||
width: 220,
|
||
},{
|
||
field: 'status',
|
||
title: '状态',
|
||
align: 'center',
|
||
width: 150,
|
||
templet: function(d){
|
||
if (d.status==0){
|
||
return '<span style="color:yellow">待审核</span>'
|
||
}else if(d.status==1){
|
||
return '<span style="color:green">已审核</span>'
|
||
}else if(d.status==2){
|
||
return '<span style="color:red">审核未通过</span>'
|
||
}
|
||
}
|
||
}, {
|
||
field: 'mark',
|
||
title: '备注',
|
||
align: 'center',
|
||
width: 150
|
||
},
|
||
{
|
||
fixed: 'right',
|
||
field: 'right',
|
||
title: '操作',
|
||
toolbar: '#barDemo',
|
||
width: 190,
|
||
align: 'center'
|
||
}
|
||
]
|
||
]
|
||
|
||
});
|
||
|
||
|
||
//监听表头工具栏事件
|
||
// table.on('toolbar(store_product)', function (obj) {
|
||
// if (obj.event === 'add') {
|
||
// tool.side("/admin/merchant/type/form");
|
||
// return false;
|
||
// }
|
||
// });
|
||
|
||
//监听表格行工具事件
|
||
table.on('tool(intention_list)', function (obj) {
|
||
var data = obj.data;
|
||
if (obj.event === 'mark') { //备注
|
||
tool.side('/admin/merchant/intention/markform?id=' + obj.data.mer_intention_id);
|
||
} else if (obj.event === 'status') { //审核
|
||
tool.side('/admin/merchant/intention/statusform?id=' + obj.data.mer_intention_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/merchant/intention/del", { id: data.mer_intention_id }, callback);
|
||
layer.close(index);
|
||
});
|
||
}
|
||
|
||
return false;
|
||
});
|
||
|
||
|
||
|
||
// 日期范围
|
||
layui.use(['laydate','table','element', 'jquery'], function () {
|
||
var laydate = layui.laydate;
|
||
|
||
//日期范围
|
||
laydate.render({
|
||
elem: '#range_date'
|
||
//设置开始日期、日期日期的 input 选择器
|
||
//数组格式为 2.6.6 开始新增,之前版本直接配置 true 或任意分割字符即可
|
||
, range: ['#start-date', '#end-date']
|
||
,done: function(value, date, endDate){
|
||
switchDateForm(true);
|
||
|
||
$('#both').removeClass('layui-btn-primary')
|
||
$('#both').siblings().addClass('layui-btn-primary')
|
||
active['reload'] ? active['reload'].call(this) : '';
|
||
}
|
||
});
|
||
|
||
|
||
//
|
||
var $ = layui.$, active = {
|
||
reload: function(){
|
||
let dataRload = getformdata();
|
||
//console.log(dataRload)
|
||
//执行重载
|
||
table.reload('intention_list', {
|
||
page: {
|
||
curr: 1 //重新从第 1 页开始
|
||
}
|
||
,where: {
|
||
...dataRload
|
||
}
|
||
});
|
||
}
|
||
};
|
||
|
||
|
||
//监听button提交
|
||
form.on('submit(searchform)', function(data) {
|
||
layui.pageTable.reload({
|
||
where: {
|
||
...data.field
|
||
},
|
||
page: {
|
||
curr: 1
|
||
}
|
||
});
|
||
return false;
|
||
});
|
||
|
||
//选择时间
|
||
form.on('submit(chonse_date)', function(data){
|
||
|
||
let start_date = '';
|
||
let end_date = getDaysAgo();
|
||
|
||
let name = data.elem.name;
|
||
if (name =='today') {
|
||
start_date=end_date;
|
||
end_date = getDaysAgo(-1);
|
||
}else if(name == 'yeserday'){
|
||
start_date = getDaysAgo(1);
|
||
}else if(name == 'week'){
|
||
start_date = getDaysAgo(7);
|
||
}else if(name == '30day'){
|
||
start_date = getDaysAgo(30);
|
||
}else if(name == 'month'){
|
||
let days = (new Date).getDate()-1
|
||
start_date = getDaysAgo(days);
|
||
}else if(name == 'year'){
|
||
var year = (new Date()).getFullYear();//获取当前年份
|
||
start_date = year+'-01-01'
|
||
}else{
|
||
end_date = '';
|
||
}
|
||
|
||
switchClass(this)
|
||
|
||
switchDateForm(false);
|
||
$('#chonse_start_date').val(start_date);
|
||
$('#chonse_end_date').val(end_date);
|
||
|
||
active['reload'] ? active['reload'].call(this) : '';
|
||
|
||
return false;
|
||
})
|
||
|
||
|
||
|
||
// 商户审核
|
||
form.on('submit(statusform)', function(data) {
|
||
let name = data.elem.name
|
||
let status = 0;
|
||
|
||
if (name=='wait') {
|
||
status = 0;
|
||
}else if(name=='success'){
|
||
status = 1;
|
||
}else if(name=='failed'){
|
||
status = 2;
|
||
}
|
||
if (name=='both'){
|
||
$('#status').attr('disabled', true);
|
||
}else{
|
||
$('#status').attr('disabled', false);
|
||
}
|
||
switchClass(this)
|
||
$('#status').val(status);
|
||
active['reload'] ? active['reload'].call(this) : '';
|
||
return false;
|
||
});
|
||
|
||
//监听select提交
|
||
form.on('select(seleform)', function(data) {
|
||
active['reload'] ? active['reload'].call(this) : '';
|
||
|
||
return false;
|
||
});
|
||
|
||
});
|
||
|
||
// 切换button选中样式
|
||
function switchClass(e)
|
||
{
|
||
$(e).removeClass('layui-btn-primary')
|
||
$(e).siblings().addClass('layui-btn-primary')
|
||
}
|
||
|
||
// 两个时间表单是互斥的,只能提交一个
|
||
function switchDateForm(chonse=false)
|
||
{
|
||
let range = chonse?false:true;
|
||
$('#start-date').attr("disabled",range);
|
||
$('#end-date').attr("disabled",range);
|
||
|
||
$('#chonse_start_date').attr("disabled",chonse);
|
||
$('#chonse_end_date').attr("disabled",chonse);
|
||
if (chonse) {
|
||
$('#chonse_start_date').val("");
|
||
$('#chonse_end_date').val("");
|
||
}else{
|
||
$('#start-date').val("");
|
||
$('#end-date').val("");
|
||
}
|
||
}
|
||
|
||
//获取n天以前日期
|
||
function getDaysAgo(n=0) {
|
||
let myDate = new Date();
|
||
let lw = new Date(myDate - 1000 * 60 * 60 * 24 * n); //最后一个数字30可改,n天前的意思
|
||
let lastY = lw.getFullYear();
|
||
let lastM = lw.getMonth() + 1;
|
||
let lastD = lw.getDate();
|
||
lastM = lastM < 10 ? "0" + lastM : lastM;
|
||
lastD = lastD < 10 ? "0" + lastD : lastD;
|
||
let startData = lastY+"-"+lastM+"-" +lastD; //n天之前日期
|
||
|
||
return startData;
|
||
}
|
||
|
||
// 获取表单所有参数
|
||
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}
|
||
<!-- /脚本 --> |