admin
2025-07-31 5414f8f6e0034f5c897b18457b4ab47be302bea8
功能完善
3个文件已修改
235 ■■■■ 已修改文件
src/main/java/com/taoke/autopay/controller/admin/AdminClientInfoJS2Controller.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/admin/order-client-list.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/static/admin/order-client-update.html 228 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/taoke/autopay/controller/admin/AdminClientInfoJS2Controller.java
@@ -136,6 +136,11 @@
        }
        if(!StringUtil.isNullOrEmpty(info.getAlipayPassword())){
            info.setAlipayPassword(AESUtil.encrypt(info.getAlipayPassword(), Constant.AES_KEY));
        }else{
            ClientAdditionalInfo old =  clientAdditionalInfoService.getClientAdditionalInfoByClientId(info.getId());
            if(StringUtil.isNullOrEmpty(old.getAlipayPassword())){
                return JsonUtil.loadFalseResult("尚未设置支付宝密码");
            }
        }
        clientAdditionalInfoService.updateClientAdditionalInfo(info);
        return JsonUtil.loadTrueResult("");
@@ -148,6 +153,7 @@
            return JsonUtil.loadFalseResult("数据不完整");
        }
        ClientAdditionalInfo additionalInfo =  clientAdditionalInfoService.getClientAdditionalInfoByClientId(id);
        additionalInfo.setAlipayPassword("");
        return JsonUtil.loadTrueResult(gson.toJson(additionalInfo));
    }
src/main/resources/static/admin/order-client-list.html
@@ -127,6 +127,7 @@
                    }
                });
            }
            
            function showCreateClient(){
                // 创建设备
src/main/resources/static/admin/order-client-update.html
@@ -3,127 +3,127 @@
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>修改下单设备信息</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <link rel="stylesheet" type="text/css" href="layui/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="css/admin.css" />
    <style>
        body {
            padding: 10px;
        }
        #sure {
            visibility: hidden;
        }
        .layui-form-label {
            width: 200px;
        }
        .layui-input-block {
            margin-left: 240px;
            max-width: 500px;
        }
        .layui-input-block input {
            max-width: 150px;
        }
        .small {
            max-width: 75px !important;
        }
        .share-ratio {
            display: flex;
            margin-bottom: 10px;
        }
        .share-ratio .layui-form-label {
            width: 50px;
            padding-left: 0;
            font-size: 12px;
            text-align: left;
        }
        .share-ratio input {
            width: 60px;
            margin-right: 10px;
        }
    </style>
</head>
<body>
    <div class="page-content-wrap">
        <form class="layui-form" action="" lay-filter='edit'>
            <input type="hidden" name="id" id="clientId">
            <div class="layui-form-item">
                <label class="layui-form-label">手机号:</label>
                <div class="layui-input-block">
                    <input type="text" name="mobile" id="mobile" placeholder="请输入手机号" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">支付宝账号:</label>
                <div class="layui-input-block">
                    <input type="text" name="alipayAccount" id="alipayAccount" placeholder="请输入支付宝账号" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">支付宝密码:</label>
                <div class="layui-input-block">
                    <input type="password" name="alipayPassword" id="alipayPassword" placeholder="请输入支付宝密码" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="update">保存</button>
                    <button type="button" class="layui-btn layui-btn-primary" id="cancelBtn">取消</button>
                </div>
            </div>
        </form>
<form class="layui-form" lay-filter="edit">
    <input type="hidden" name="id" />
    <div class="layui-form-item">
        <label class="layui-form-label">手机号:</label>
        <div class="layui-input-inline">
            <input type="text" name="mobile" required lay-verify="required|mobile" placeholder="手机号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <script src="layui/layui.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script>
        layui.use(['form', 'jquery', 'layer'], function() {
            var form = layui.form;
            var $ = layui.jquery;
            var layer = layui.layer;
            // 获取URL参数
            function getQueryString(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
                var r = window.location.search.substr(1).match(reg);
                if (r != null) return unescape(r[2]); return null;
            }
            // 页面加载时获取设备信息
            $(document).ready(function() {
                var clientId = getQueryString("id");
                if (clientId != null) {
                    $.get("/admin/api/clientinfo/js2/getAdditionalInfo", {id: clientId}, function(res) {
                        if (res.code == 0) {
                            var data = res.data;
                            form.val("edit", data);
                        } else {
                            layer.msg("获取设备信息失败");
                        }
                    }, 'json').fail(function() {
                        layer.msg("网络请求失败");
                    });
                }
            });
            // 监听提交
            form.on('submit(update)', function(data) {
                $.post("/admin/api/clientinfo/js2/update", data.field, function(response) {
                    if (response.code == 0) {
                        layer.msg("保存成功", {time: 1000}, function() {
                            // 父页面会处理关闭和刷新
                        });
                    } else {
                        layer.msg(response.msg);
                    }
                }, 'json').fail(function(jqXHR, textStatus, errorThrown) {
                    layer.msg("网络请求失败");
                });
                return false;
            });
            // 取消按钮事件
            $("#cancelBtn").click(function() {
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            });
    <div class="layui-form-item">
        <label class="layui-form-label">支付宝账号:</label>
        <div class="layui-input-inline">
            <input type="text" name="alipayAccount" required lay-verify="required" placeholder="支付宝账号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">支付宝密码:</label>
        <div class="layui-input-inline">
            <input type="text" name="alipayPassword" required lay-verify="" placeholder="无更改无需填写" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-input-block">
        <button class="layui-btn layui-btn-normal" lay-submit lay-filter="sure" id="sure">确定</button>
    </div>
</form>
<script src="layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/http_api.js"></script>
<script>
    var listener;
    function submit(callback) {
        //暂存回调方法
        listener = callback;
        //表单提交按钮
        $("#sure").click();
    }
    layui.use(['form', 'layedit', 'laydate', 'laytpl'], function() {
        var form = layui.form,
                layer = layui.layer,
                laydate = layui.laydate,
                laytpl = layui.laytpl;
        //自定义验证规则
        form.verify({
            num: [/^\d+$/, "必须为正整数"],
            money: [/^\d+(\.\d{1,2})?$/, "金额最多保留2位小数"]
        });
        // 提供给父页面调用的提交函数
        function submit(callback) {
            layui.use(['form', 'jquery'], function() {
                var form = layui.form;
                var $ = layui.jquery;
                // 获取表单数据
                var field = {};
                $(".layui-form input").each(function() {
                    if ($(this).attr("name")) {
                        field[$(this).attr("name")] = $(this).val();
                    }
                });
                // 调用回调函数
                callback(field);
            });
        }
    </script>
        var id = http_util.getQueryString("id");
        // 获取值
        $.post("/admin/api/clientinfo/js2/getAdditionalInfo", {
            "id":id
        }, function(response) {
            if (response.code == 0) {
                form.val("edit", response.data);
            } else {
                layer.msg(response.msg);
            }
        }, 'json').fail(function(jqXHR, textStatus, errorThrown) {
            layer.msg("网络请求失败");
        });
        //监听提交
        form.on('submit(sure)', function(data) {
            listener(data.field);
            return false;
        });
    });
</script>
</body>
</html>