商户入驻申请页面js效果修复

This commit is contained in:
liuxiaoquan 2023-03-14 12:32:21 +08:00
parent 22bcf9a4ed
commit 4ff308f2b5

View File

@ -25,7 +25,7 @@
<div class="layui-btn-group"> <div class="layui-btn-group">
<input id="chonse_start_date" type="hidden" name="start_date" value="" readonly placeholder="选择时间"> <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="选择时间"> <input id="chonse_end_date" type="hidden" name="end_date" value="" readonly placeholder="选择时间">
<button name="both" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal">全部</button> <button 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="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="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="week" lay-submit="" lay-filter="chonse_date" type="button" class="layui-btn layui-btn-normal layui-btn-primary">最近7天</button>
@ -347,8 +347,12 @@
}else if(name == 'year'){ }else if(name == 'year'){
var year = (new Date()).getFullYear();//获取当前年份 var year = (new Date()).getFullYear();//获取当前年份
start_date = year+'-01-01' start_date = year+'-01-01'
}else{
end_date = '';
} }
switchClass(this)
switchDateForm(false); switchDateForm(false);
$('#chonse_start_date').val(start_date); $('#chonse_start_date').val(start_date);
$('#chonse_end_date').val(end_date); $('#chonse_end_date').val(end_date);
@ -358,24 +362,7 @@
return false; return false;
}) })
// 两个时间表单是互斥的,只能提交一个
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("");
}
}
// 商户审核 // 商户审核
form.on('submit(statusform)', function(data) { form.on('submit(statusform)', function(data) {
@ -394,7 +381,7 @@
}else{ }else{
$('#status').attr('disabled', false); $('#status').attr('disabled', false);
} }
switchClass(this)
$('#status').val(status); $('#status').val(status);
active['reload'] ? active['reload'].call(this) : ''; active['reload'] ? active['reload'].call(this) : '';
return false; return false;
@ -409,6 +396,30 @@
}); });
// 切换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天以前日期 //获取n天以前日期
function getDaysAgo(n=0) { function getDaysAgo(n=0) {