<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="format-detection" content="telephone=no"/>
    <title>精准导购系统企业号应用</title>
    <link rel="stylesheet" href="/static/css/wechat/weui.min.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/wechat/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="/static/css/wechat/style.css?v=04130948">
</head>

<body ontouchstart>
<header>
    <div class="header">
        <a href="javascript:backToUrl()" class="btn-a-back"><i class="iconfont">
            &#xe61f;</i></a>
        <h2 th:text="修改客户+${keyName}">修改客户信息</h2>
    </div>
</header>
<input type="hidden" id="userId" th:value="${userId}"/>
<input type="hidden" id="customerId" th:value="${customerId}"/>
<input type="hidden" id="key" th:value="${key}"/>
<div class="weui-cells weui-cells_form mt0">
    <div class="weui-cell">
        <div class="weui-cell__bd">
            <textarea id="remark" class="weui-textarea" th:text="${value}" th:placeholder="修改客户+${keyName}"
                      rows="7"></textarea>
        </div>
    </div>
</div>
<div class="btn-modify">
    <a class="weui-btn weui-btn_blue" id="showToast" href="javascript:saveRemarks()">保存</a>
</div>
<!--提交成功提示-->
<div id="toast" style="display: none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast">
        <i class="weui-icon-success-no-circle weui-icon_toast"></i>
        <p class="weui-toast__content">提交成功</p>
    </div>
</div>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/statistics.js"></script>
<script type="text/javascript" src="/static/js/history.js"></script>
<script type="text/javascript">
    function saveRemarks() {
        $.ajax({
            url: "/customer/modifytextarea",
            data: {
                userId: $("#userId").val(),
                customerId: $("#customerId").val(),
                key: $("#key").val(),
                value: $("#remark").val()
            },
            type: "post",
            success: function (data) {
                if (data.result == "1") {
                    // 提交成功提示
                    var $toast = $('#toast');
                    if ($toast.css('display') != 'none') return;

                    $toast.fadeIn(100);
                    setTimeout(function () {
                        $toast.fadeOut(100);
                        backToUrl();
                    }, 1000);
                }
            }
        });
    }
</script>
</body>

</html>
