{% block listBlock %}
<div class="wrap">
    <h2> {% if house_type == 0%}新房列表{% elseif house_type == 1 %}二手房列表{% else %}租房房列表{% endif %}</h2>
    <form id="scores-filter" method="GET">
        <!-- For plugins, we also need to ensure that the form posts back to our current page -->
        <input type="hidden" name="page" value="{{page}}"/>
        <select id="listCity" name="listCity">
            <option value="0"> 城市</option>
            {% for item in city %}
            <option {{ item.id == cityId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
            {% endfor %}
        </select>
        <select id="listDistrict" name="listDistrict">
            <option value="0">区域</option>
            {% if district %}
            {% for item in district %}
            <option {{ item.id == districtId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
            {% endfor %}
            {% endif %}
        </select>
        <select  id="listPlate" name="listPlate">
            <option value="0">板块</option>
            {% if plate %}
            {% for item in plate %}
            <option {{ item.id == plateId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
            {% endfor %}
            {% endif %}
        </select>
        {% if house_type == 2%}
            <select id="rentalPrice" name="rentalPrice">
                <option value ="">租金</option>
                {% if dicRentalPrice %}
                {% for item in dicRentalPrice %}
                <option {{ item.value == rentalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
                {% endfor %}
                {% endif %}
            </select>
        {% else%}
            <select id="totalPrice" name="totalPrice">
                <option value ="">价格</option>
                {% if dicTotalPrice %}
                {% for item in dicTotalPrice %}
                <option {{ item.value == totalPrice ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
                {% endfor %}
                {% endif %}
            </select>
        {% endif %}
        {% if house_type == 0%}
        <select id="room" name="room">
            <option value="0">类型</option>
            {% for item in room %}
            <option {{ item.id == roomId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
            {% endfor %}
        </select>
        {% endif %}
        <select id="buildProperty" name="buildProperty">
            <option value="0"> 房型</option>
            {% for item in buildProperty %}
            <option {{ item.id == buildPropertyId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
            {% endfor %}
        </select>
        <select id="acreage" name="acreage">
            <option value ="">面积</option>
            {% if acreage %}
            {% for item in dicArea %}
            <option {{ item.value == acreage ?"selected":"" }} value="{{ item.value }}">{{ item.value }}</option>
            {% endfor %}
            {% endif %}
        </select>
        <select name="status" name="status">
            <option value="-1">状态</option>
            {% for item in status%}
            <option {{ item.id == statusId ?"selected":"" }} value="{{ item.id }}">{{ item.value }}</option>
            {% endfor %}
        </select>
        <input type="text" placeholder="请出入楼盘名" name="searchText">
        <input type="hidden" name="hasSearch" value="1"/>
        <input type="hidden" id="house_type" value="{{house_type}}"/>
        <input type="submit" id="submit" class="button action" value="搜索">
        <!-- Now we can render the completed list table -->
    </form>
    <form method="post">
        {% if house_type == 0 %}
        {{function("addNewHouseTable")}}
        {% elseif house_type == 1%}
        {{function("addSecTable")}}
        {% else %}
        {{function("addRentTable")}}
        {% endif %}
        <input type="hidden" name="allot_consultant_id" id="allot_consultant_id">
    </form>
</div>
{% include 'recConsultant.html' %}
{{ block('recConsultant') }}
<script>
    (function ($) {
        $(document).ready(function(){
            var acreage =$("#acreage");
            var totalPrice = $("#totalPrice");
            var rentalPrice = $("#rentalPrice");
            $("#listCity").change(function() {
                var cityId = $("#listCity").val();
                setCity("listCity", "listDistrict", "listPlate");
                acreage.find('option:not(:first-child)').remove();
                totalPrice.find('option:not(:first-child)').remove();
                rentalPrice.find('option:not(:first-child)').remove();
                //面积
                searchAcreage(cityId, acreage);
                //城市联动房子价格
                if ($("#house_type").val() == 2) {
                    searchRentalPrice(cityId, rentalPrice);
                }else{
                    searchTotalPrice(cityId,totalPrice);
                }
            });
            //设置区域
            $("#listDistrict").change(function(){
                setArea("listCity","listDistrict","listPlate");
            })

            {% if house_type == 1 %}
                allot_consultant('sechandhouselist');
            {% elseif house_type == 2 %}
                allot_consultant('renthouselist');
            {% endif %}
        });
    })(jQuery);
</script>
{% endblock %}