<!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">
</head>

<body ontouchstart>
<header>
    <div class="header">
        <a href="javascript:history.back();" class="btn-a-back"><i class="iconfont">&#xe61f;</i></a>
        <h2>客户详情</h2>
        <a th:href="@{/project/addvisit(customerId=${customerId})}"
           class="btn-add-visit">添加回访</a>
    </div>
</header>
<input type="hidden" id="customerId" th:value="${customerId}"/>
<div class="weui-cells__title">基本信息</div>
<div class="weui-cells weui-cells_form">
    <div class="weui-cell weui-cell_access">
        <div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
        <div class="weui-cell__bd">
            <input id="customerName" class="weui-input" type="text" th:value="${customer.name}"/>
        </div>
    </div>
    <div class="weui-cell weui-cell_select-after">
        <div class="weui-cell__hd">
            <label for="" class="weui-label">性别</label>
        </div>
        <div class="weui-cell__bd " th:switch="${customer.sex}">
            <input class="weui-input" type="text" th:case="0" value="女" readonly="readonly"/>
            <input class="weui-input" type="text" th:case="1" value="男" readonly="readonly"/>
            <input class="weui-input" type="text" th:case="2" value="未知" readonly="readonly"/>
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">手机号</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="tel" th:value="${customer.phone}" readonly="readonly"/>
        </div>
    </div>
    <div class="weui-cell others-tel" th:if="${customer.bakPhone1} ne ''">
        <div class="weui-cell__hd"><label class="weui-label">其他号码1</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="tel" th:value="${customer.bakPhone1}" readonly="readonly"/>
        </div>
    </div>
    <div class="weui-cell others-tel" th:if="${customer.bakPhone2} ne ''">
        <div class="weui-cell__hd"><label class="weui-label">其他号码2</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="tel" th:value="${customer.bakPhone2}" readonly="readonly"/>
        </div>
    </div>
    <div class="weui-cell others-tel" th:if="${customer.bakPhone3} ne ''">
        <div class="weui-cell__hd"><label class="weui-label">其他号码3</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="tel" th:value="${customer.bakPhone3}" readonly="readonly"/>
        </div>
    </div>
    <!--<div class="weui-cell weui-a-more"><a href="">添加更多号码</a></div>-->
</div>
<div class="weui-cells__title">客户属性</div>
<div class="weui-cells weui-cells_form">
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">客户类型</label></div>
        <div class="weui-cell__bd" th:switch="${customer.customerSourceType}">
            <input class="weui-input" type="text" th:case="1" value="常规" readonly="readonly"/>
            <input class="weui-input" type="text" th:case="2" value="抢客" readonly="readonly"/>
            <input class="weui-input" type="text" th:case="3" value="营销" readonly="readonly"/>
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">置业顾问</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="text" th:value="${customer.managerName}" readonly="readonly"/>
        </div>
    </div>
</div>
<div class="weui-cells__title">客户情况与来源</div>
<div class="weui-cells weui-cells_form">
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label for="" class="weui-label">购房意向</label>
        </div>
        <div class="weui-cell__bd" th:switch="${customer.buyIntention}">
            <p th:case="1">A</p>
            <p th:case="2">B</p>
            <p th:case="3">C</p>
            <p th:case="4">D</p>
            <p th:case="5">E</p>
            <p th:case="*">待定</p>
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label for="" class="weui-label">活动来源</label>
        </div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="text" th:value="${customer.actSource}" readonly="readonly"/>
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label for="" class="weui-label">初次来源</label>
        </div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="text" th:value="${customer.firstSource}" readonly="readonly"/>
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label for="" class="weui-label">最近来源</label>
        </div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="text" th:value="${customer.latestSource}" readonly="readonly"/>
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label for="" class="weui-label">最近回访</label>
        </div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="text" th:value="${customer.crmLatestCall}" readonly="readonly"/>
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd">
            <label for="" class="weui-label">回访结果</label>
        </div>
        <div class="weui-cell__bd">
            <input class="weui-input" type="text" th:value="${customer.crmLatestCallResult}" readonly="readonly"/>
        </div>
    </div>
</div>
<div class="weui-cells__title">客户状态</div>
<div class="weui-cells weui-cells_form">
    <div class="weui-cell weui-cell_select-after">
        <div class="weui-cell__hd">
            <label for="" class="weui-label">跟踪状态</label>
        </div>
        <div class="weui-cell__bd" th:switch="${customer.traceStatus}">
            <input class="weui-input" type="text" th:case="1" value="有效" readonly="readonly"/>
            <input class="weui-input" type="text" th:case="2" value="已购" readonly="readonly"/>
            <input class="weui-input" type="text" th:case="3" value="我购" readonly="readonly"/>
            <input class="weui-input" type="text" th:case="4" value="暂缓" readonly="readonly"/>
        </div>
    </div>
    <a class="weui-cell weui-cell_access bg-gray gray" th:href="@{/project/visitrecord(customerId=${customerId})}">
        <div class="weui-cell__bd">
            <p>回访记录</p>
        </div>
        <div class="weui-cell__ft">
        </div>
    </a>
    <a class="weui-cell weui-cell_access bg-gray gray" th:href="@{/project/projectcustomers(customerId=${customerId})}">
        <div class="weui-cell__bd">
            <p>约看记录</p>
        </div>
        <div class="weui-cell__ft">
        </div>
    </a>
</div>
<div class="p40">
    <a class="weui-btn weui-btn_blue" href="javascript:" id="showToast">保存</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>


<div class="js_dialog" id="deleteDialog" style=" display: none;">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
        <div class="weui-dialog__hd"><strong class="weui-dialog__title">是否将该客户购房意向置为无效？</strong></div>
        <div class="weui-dialog__bd"></div>
        <div class="weui-dialog__ft">
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_default">否</a>
            <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary">是</a>
        </div>
    </div>
</div>
<script type="text/javascript" src="/static/js/wechat/zepto.min.js"></script>
<script type="text/javascript" src="/static/js/statistics.js"></script>
<script type="text/javascript">
    $(function () {
        // 其他号码删除
        $(".weui-cells_form").on("click", ".others-tel .weui-icon-cancel", function () {
            $(this).parents('.others-tel').remove();
        });
        // 提交成功提示
        var $toast = $('#toast');
        $('#showToast').on('click', function () {
            if ($toast.css('display') != 'none') return;

            $toast.fadeIn(100);
            setTimeout(function () {
                $toast.fadeOut(100);
            }, 2000);
        });

        $('#deleteDialog').on('click', '.weui-dialog__btn_default', function () {
            $('#deleteDialog').fadeOut(200);
        });

        $('#deleteDialog').on('click', '.weui-dialog__btn_primary', function () {
            $('#deleteDialog').fadeOut(200);
            var customerProjectId = $("#customerProjectId").val();
            $.ajax({
                url: "/project/changerecordedstatus",
                data: {
                    customerProjectId: customerProjectId
                },
                type: "post",
                success: function (data) {
                    if (data.result == "1") {
                        $('#deleteDialog').fadeOut(200);
                        showMessage("success", "修改成功", 1000);
                    } else {
                        showMessage("error", "修改失败", 1000);
                    }
                }
            });
        });
    });
</script>
</body>

</html>
