愛彈吉他的小盆友 2019-06-26 10:44 采纳率: 100%
浏览 247
已结题

求大神解答JQuery问题

<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选择器切换出金设置的选项,但是输入框一直出不来,不知道怎么搞,本人刚入行菜鸟,请大神们帮帮忙!

现在情况
图片说明

需要效果
图片说明

  • 写回答

2条回答 默认 最新

  • 听楼一夜雨 2019-06-26 11:16
    关注

    用class控制 removeClass('layui-hide');

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 寻找一位有逆向游戏盾sdk 应用程序经验的技术
  • ¥15 请问有用MZmine处理 “Waters SYNAPT G2-Si QTOF质谱仪在MSE模式下采集的非靶向数据” 的分析教程吗
  • ¥50 opencv4nodejs 如何安装
  • ¥15 adb push异常 adb: error: 1409-byte write failed: Invalid argument
  • ¥15 nginx反向代理获取ip,java获取真实ip
  • ¥15 eda:门禁系统设计
  • ¥50 如何使用js去调用vscode-js-debugger的方法去调试网页
  • ¥15 376.1电表主站通信协议下发指令全被否认问题
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥15 复杂网络,变滞后传递熵,FDA