<div class="layui-fluid">
<div class="layui-card">
<form class="layui-form layui-form-pane">
<div class="layui-tab layui-tab-brief">
<ul class="layui-tab-title">
<li class="layui-this">基本信息</li>
</ul>
<div class="layui-tab-content">
<div class="layui-form-item">
<label class="layui-form-label">供应商名称</label>
<div class="layui-input-inline">
<input type="text" id="name" name="name" lay-verify="required" placeholder="输入代理商名称" autocomplete="off" class="layui-input">
</div>
<label class="layui-form-label">每日额度(元)</label>
<div class="layui-input-inline">
<input type="text" id="dailyAmount" name="dailyAmount" lay-verify="number" placeholder="输入线下充值费率" autocomplete="off" class="layui-input" value="0">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">入金费率%</label>
<div class="layui-input-inline">
<input type="text" id="spInFeeRate" name="spInFeeRate" lay-verify="number" placeholder="" autocomplete="off" class="layui-input" value="0">
</div>
<label class="layui-form-label">出金设置</label>
<div class="layui-input-inline" >
<input type="radio" name="spOutFeeType" value="1" title="费率" lay-filter="spOutFeeTypeFilter" checked="checked">
<input type="radio" name="spOutFeeType" value="2" title="单笔手续费" lay-filter="spOutFeeTypeFilter">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">商户状态</label>
<div class="layui-input-inline">
<input type="radio" name="status" value="1" title="启用" checked="checked">
<input type="radio" name="status" value="0" title="停止">
</div>
</div>
<div class="layui-form-item" id="feeRateId" style="display: none">
<label class="layui-form-label">出金费率(%)</label>
<div class="layui-input-inline">
<input type="tel" id="spOutFeeRate" name="spOutFeeRate" placeholder="输入费率" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item" id="feeLevelId" style="display: none">
<label class="layui-form-label">单笔手续费</label>
<div class="layui-input-inline">
<input type="tel" id="spOutFeeEvery" name="spOutFeeEvery" placeholder="输入单笔手续费" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block" style="padding-bottom: 20px;">
<button type="button" class="layui-btn" lay-submit="" lay-filter="spAdd">保存</button>
<a class="layui-btn" lay-href="sp/list/">返回</a>
</div>
</div>
</div>
</form>
</div>
</div>
<script>
layui.use(['admin', 'form'],function(){
var form = layui.form
,$ = layui.$
,admin = layui.admin
,element = layui.element
,layer = layui.layer ;
element.render('breadcrumb', 'breadcrumb');
$.ajax({
type: 'POST',
url: layui.setter.baseUrl + '/sp/add/post',
data: {
type : 'sp'
},
success: function(res){
if(res.code == 0){
if(res.data.spOutFeeType == 1) {
$("input[name='spOutFeeType'][value='1']").attr("checked",true);
$("#feeRateId").show();
$("#feeLevelId").hide();
}else if(res.data.spOutFeeType == 2) {
$("input[name='spOutFeeType'][value='2']").attr("checked",true);
$("#feeRateId").hide();
$("#feeLevelId").show();
}
$('#spOutFeeRate').val(res.data.spOutFeeRate);
$('#spOutFeeEvery').val(res.data.spOutFeeEvery/100);
form.render();
}
}
})
form.on('submit(spAdd)', function(data) {
admin.req({
type: "POST",
url: layui.setter.baseUrl + '/sp/add',
data: data.field,
success: function(res){
if(res.code == 0) {
layer.alert(res.msg, {title: "保存成功"}, function(index){
layer.close(index);
location.href = layui.setter.baseLocal + 'sp/list';
});
}
}
});
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
form.render();
})
</script>
想用JQuery选择器切换出金设置的选项,但是输入框一直出不来,不知道怎么搞,本人刚入行菜鸟,请大神们帮帮忙!
现在情况
需要效果