<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml" 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 class="bg-white">
<header>
    <div class="header">
        <a href="javascript:backToUrl();" class="btn-a-back"><i class="iconfont">&#xe61f;</i></a>
        <h2>约看记录</h2>
    </div>
</header>
<input type="hidden" id="customerId" th:value="${customerId}"/>
<div class="title">客户约看记录</div>
<div class="weui-cells mt0" id="reports">
</div>
</body>
<script type="text/html" id="reportsTemplate">
    {{each reports as report index}}
    <a class="weui-cell weui-cell_access"
       href="javascript:goToUrl('/project/reportcustomer?customerProjectId={{report.id}}')">
        <div class="weui-cell__bd">
            <p>{{report.projectName}}
                {{if report.remark}}
                <span class="weui-badge report-badge">{{report.remark}}</span>
                {{/if}}
            </p>
        </div>
        {{if report.status == '1'}}
        <div class="weui-cell__ft">约看</div>
        {{else if report.status == '2'}}
        <div class="weui-cell__ft">到访</div>
        {{else if report.status == '3'}}
        <div class="weui-cell__ft">认筹</div>
        {{else if report.status == '4'}}
        <div class="weui-cell__ft">认购</div>
        {{else if report.status == '5'}}
        <div class="weui-cell__ft">签约</div>
        {{else if report.status == '6'}}
        <div class="weui-cell__ft">退房</div>
        {{else}}
        <div class="weui-cell__ft">待定</div>
        {{/if}}
    </a>
    {{/each}}
</script>
<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" src="/static/js/template.js"></script>
<script type="text/javascript" src="/static/js/utils.js"></script>
<script>
    $(function () {
        loadData();
    });
    function loadData() {
        $.ajax({
            url: "/project/getprojectcustomers",
            data: {
                customerId: $("#customerId").val()
            },
            type: "post",
            success: function (data) {
                var html = template('reportsTemplate', {
                    reports: data.data.list
                });
                $("#reports").append(html);
            }
        });
    }
</script>
</html>
