{layout name="manager/layout" /}
<style>
    .layui-table-cell{
        height: auto;
        white-space: normal;
    }
    .layui-table .layui-layer-photos {height: 90px;}
    .layui-table img{
        max-height: 100%;
        object-fit: cover;
        margin-left: auto;
        margin-right: auto;
        display: block;
        max-width: 150px;
        vertical-align: middle;
        border: 0;
    }
    #avatar{
        max-width: 100%;
        display: block;
        margin: auto;
    }
</style>

<div class="layui-row layui-col-space12">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md2">
            <div class="layui-col-md12">

                        <div class="layui-layer-photos">
                            <img id="avatar" src="{$consumer.avatar_url}" layer-src="{$consumer.avatar_url}" alt="">
                        </div>
            </div>
        </div>
        <div class="layui-col-md10">
            <div class="layui-col-md12">
                <div class="layui-col-md4">
                    <div class="layui-panel" style="border-radius: 8px;">
                        <div class="layui-row" style="padding: 5% 0;text-align: center">
                            <h3><strong>评论数</strong></h3>
                            <span style="font-size: 36px">{$totalComment ?? 0}</span>
                        </div>
                    </div>
                </div>
                <div class="layui-col-md4">
                    <div class="layui-panel" style="border-radius: 8px;">
                        <div class="layui-row" style="padding: 5% 0;text-align: center">
                            <h3><strong>本月评论数</strong></h3>
                            <span style="font-size: 36px">{$totalTheMonthComment ?? 0}</span>
                        </div>
                    </div>
                </div>
                <div class="layui-col-md4">
                    <div class="layui-panel" style="border-radius: 8px;">
                        <div class="layui-row" style="padding: 5% 0;text-align: center">
                            <h3><strong>标签</strong></h3>
                            <span style="font-size: 32px">{$consumer["tag"]["name"] ?? '无'}</span>
                        </div>
                    </div>
                </div>
                <div class="layui-col-md4">
                    <div class="layui-panel" style="border-radius: 8px;">
                        <div class="layui-row" style="padding: 5% 0;text-align: center">
                            <h3><strong>优惠券领取总数</strong></h3>
                            <span style="font-size: 36px">{$couponTotalCount ?? 0}</span>
                        </div>
                    </div>
                </div>
                <div class="layui-col-md4">
                    <div class="layui-panel" style="border-radius: 8px;">
                        <div class="layui-row" style="padding: 5% 0;text-align: center">
                            <h3><strong>优惠券使用总数</strong></h3>
                            <span style="font-size: 36px">{$couponUsedTotalCount ?? 0}</span>
                        </div>
                    </div>
                </div>
                <div class="layui-col-md4">
                    <div class="layui-panel" style="border-radius: 8px;">
                        <div class="layui-row" style="padding: 5% 0;text-align: center">
                            <h3><strong>优惠券未使用总数</strong></h3>
                            <span style="font-size: 36px">{$couponNotUsedTotalCount ?? 0}</span>
                        </div>
                    </div>
                </div>

             </div>
        </div>



    </div>

    <div class="layui-col-xs12 layui-col-md12">
        <div id="echarts-records" style="background-color:#ffffff;min-height:600px;">
            <div class="layuimini-container location-index-page">
                <div class="layuimini-main">
                    <div>
                        <table id="table-container" class="layui-table" data-url="/manager/consumer/info.html?id={$consumer.id}&&sign={$sign}" lay-filter="table-container"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<!-- 操作列 -->
<script type="text/html" id="row-state">
        {{ d.time_state }}
        |
        {{# if(d.is_verificated == 1){  }}
                已验证
         {{# }else{ }}
                未验证
          {{# } }}
</script>


<!-- 领取位置 -->
<script type="text/html" id="row-received_map">
    <a onclick="getAddress({{d.lat}},{{d.lng}},this)" target="_blank">点击查看</a>
</script>
<!-- 签到位置 -->
<script type="text/html" id="row-sign_map">
    {{# if(d.couponBill!=undefined){ }}
    <a onclick="getAddress({{d.couponBill.lat}},{{d.couponBill.lng}},this)" target="_blank">点击查看</a>
    {{# } }}
</script>

<!-- toolbar -->
<script type="text/html" id="toolbar-tpl">
    <a class="layui-btn layui-btn-primary layui-btn-sm" data-table-refresh lay-event="refresh"><i class="fa fa-refresh"></i></a>
</script>


<script src="__MANAGER__/js/consumer/info.js?v={:mt_rand()}"></script>
<script src="__STATIC__/js/jquery-3.3.1.js?v={:mt_rand()}"></script>

<script>
    // 经纬度逆解析成地址
    //lat = 30.65805;
    //lng = 104.136153;
    function getAddress(lat,lng,obj){
        $.ajax({
            type: 'get',
            url: 'http://apis.map.qq.com/ws/geocoder/v1',
            dataType: 'jsonp',
            data: {
                key: "XJXBZ-7EBCD-2MB45-HB73N-R362T-WRFJR",//开发密钥
                location: lat + "," + lng,//位置坐标
                get_poi: "0",//是否返回周边POI列表：1.返回；0不返回(默认)
                coord_type: "1",//输入的locations的坐标类型,1 GPS坐标
                parameter: { "scene_type": "tohome", "poi_num": 20 },//附加控制功能
                output: "jsonp"
            },
            success: function (data, textStatus) {
                if (data.status == 0) {
                    var address = data.result.formatted_addresses.recommend;
                    //$("#address").html(address);
                    // console.log(data.result.address)
                    // console.log(address)
                    $(obj).text(data.result.address + address);
                } else {
                    alert("位置获取错误，请联系管理员！")
                }
            },
            error: function () {
                alert("位置获取错误，请联系管理员！")
            }
        });
    }


</script>