<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>编辑页面</title>
</head>
<body>
<script type="text/html" id="form">
    <input type="hidden" name="id" value="{{= d.id }}" />
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">
				<div class="layui-form-item">
    				<label class="layui-form-label" title="昵称">昵称</label>
    				<div class="layui-input-block">
            			<input autocomplete="off" type="text" name="name" id="name" placeholder="请输入邮箱" value="{{=d.name}}" class="layui-input" lay-verify="name">
    				</div>
				</div>

				<div class="layui-form-item">
    				<label class="layui-form-label" title="管理员id">管理员id</label>
    				<div class="layui-input-block">
            			<input autocomplete="off" type="text" name="botad" id="botad" placeholder="管理员id，留空表示不修改" value="{{=d.botad}}"  class="layui-input" lay-verify="">
    				</div>
				</div>
				<div class="layui-form-item">
    				<label class="layui-form-label" title="会员价格配置">会员价格</label>
    				<div class="layui-input-block">
            			<input autocomplete="off" type="text" name="pricelist" id="pricelist" placeholder="会员价格12.5,16.5,30" value="{{=d.pricelist}}"  class="layui-input" lay-verify="">
    				</div>
				</div>
				
                <div class="layui-form-item">
    				<label class="layui-form-label" title="会员价格配置">客服</label>
    				<div class="layui-input-block">
            			<input autocomplete="off" type="text" name="kefutelegram" id="kefutelegram" placeholder="客服飞机号" value="{{=d.kefutelegram}}"  class="layui-input" lay-verify="">
    				</div>
				</div>
				<div class="layui-form-item">
    				<label class="layui-form-label" title="trxadd">trxadd</label>
    				<div class="layui-input-block">
            			<input autocomplete="off" type="text" name="trxadd" id="trxadd" placeholder="请输入trxadd，留空表示不修改" value="{{=d.trxadd}}" class="layui-input" lay-verify="">
    				</div>
				</div>
				<div class="layui-form-item">
    				<label class="layui-form-label" title="botkey">botkey</label>
    				<div class="layui-input-block">
            			<input autocomplete="off" type="text" name="botkey" id="botkey" placeholder="请输入botkey，留空表示不修改" value="{{=d.botkey}}" class="layui-input" lay-verify="">
    				</div>
				</div>

		<div class="layui-form-item">
    				<label class="layui-form-label" title="money">余额</label>
    				<div class="layui-input-block">
            			<input autocomplete="off" type="text" name="money" id="money" placeholder="请输入money，留空表示不修改" value="{{=d.money}}" class="layui-input" lay-verify="">
    				</div>
				</div>

				<div class="layui-form-item">
    				<label class="layui-form-label" title="账号状态">账号状态</label>
    				<div class="layui-input-block">
            			<!-- 隐藏域设置开关未选中时需要传递的参数值 -->
                        <input type="hidden" name="status" id="status-2" value="2" />
                        <input type="checkbox" name="status" id="status-1" lay-skin="switch" lay-text="正常|锁定" value="1" {{# if(1 == d.status){ }}checked="checked"{{# } }} />
    				</div>
				</div>
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="laytp-btn laytp-btn-primary laytp-btn-sm" lay-submit="" lay-filter="laytp-form">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="laytp-btn laytp-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</script>
<form class="layui-form" lay-filter="layui-form"></form>
<script>
    if(localStorage.getItem("staticDomain")){
        document.write("<link rel='stylesheet' href='" + localStorage.getItem("staticDomain") + "/component/laytp/css/laytp.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/layui/layui.js?v="+localStorage.getItem("version")+"'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/laytp/layuiConfig.js?v="+localStorage.getItem("version")+"'><\/script>");
    }else{
        document.write("<link rel='stylesheet' href='/static/component/laytp/css/laytp.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='/static/component/layui/layui.js?v="+localStorage.getItem("version")+"'><\/script>");
        document.write("<script src='/static/component/laytp/layuiConfig.js?v="+localStorage.getItem("version")+"'><\/script>");
    }
</script>
<script>
    layui.use(['laytp'],function(){
        let form = layui.form;
        let $ = layui.jquery;
        //获取参数ID
        var id = facade.getUrlParam('id');
        if(!id){
            facade.error('参数ID不能为空');
            return false;
        }

        //获取数据，渲染到对应的节点上
        facade.ajax({
            route: "/admin.bot/info",
            data: {id: id},
            successAlert: false,
            showLoading: true
        }).done(function(res){
            if(res.code === 0){
                layui.laytpl($("#form").html()).render(res.data,function(string){
                    $("form").html(string);
                    layui.laytpForm.render();
                    form.render();
                });
            }
        });

        form.on('submit(laytp-form)', function(data){
            var btnAnim = layui.button.load({elem:$(this)});
            try{
                data = facade.setEditorField(data);
            }catch (e) {
                facade.error(e);
                return false;
            }
            facade.ajax({
                route:'/admin.bot/edit',
                data:data.field
            }).done(function(res){
                if(res.code === 0){
                    parent.layui.layer.close(parent.layui.layer.getFrameIndex(window.name));//关闭当前页
                    parent.layui.table.reloadData("laytp-table");
                }
                btnAnim.stop();
            }).fail(function(){
                btnAnim.stop();
            });
            return false;
        });
    })
</script>
</body>
</html>