<br>
<div class="row form-group">
    <div class="col-md-4" id="demand_type">
        <div class="input-group">
            <span class="input-group-addon color-red">需求类型</span>
            <input type="hidden" name="demand_type_require">
            <span class="input-group-addon widthAuto">
                <input type="checkbox" name="new_house" id="new_house" value="{{ result.new_house }}" style="margin: 0;"{% if
                result.new_house == 1 %} checked {% endif %}>
                <span>新房</span>
            </span>
            <span class="input-group-addon widthAuto">
                <input type="checkbox" name="secondHand_house" id="secondHand_house" value="{{ result.secondHand_house }}"
                       style="margin: 0;"{% if result.secondHand_house == 1 %} checked {% endif %}>
                <span>二手房</span>
            </span>
            <span class="input-group-addon widthAuto">
                <input type="checkbox" name="rent_house" id="rent_house" value="{{ result.rent_house }}" style="margin: 0;"{% if
                result.rent_house == 1 %} checked {% endif %}>
                <span>租房</span>
            </span>
        </div>
    </div>
    <div class="col-md-4">
        <div class="input-group">
            <span class="input-group-addon">性质</span>
            <select name="character" id="character" class="form-control">
                <option value="公客">公客</option>
                <option value="私客">私客</option>
            </select>
        </div>
    </div>
    <div class="col-md-4">
        <div class="input-group">
            <span class="input-group-addon">来源</span>
            <select name="origin" id="origin" class="form-control">
                <option value="来电">来电</option>
                <option value="来访">来访</option>
                <option value="扫街">扫街</option>
                <option value="网络">网络</option>
                <option value="派单">派单</option>
                <option value="广告">广告</option>
                <option value="陌拜">陌拜</option>
                <option value="微信">微信</option>
                <option value="内部推荐">内部推荐</option>
                <option value="老带新">老带新</option>
                <option value="租转售">租转售</option>
                <option value="售转租">售转租</option>
                <option value="盘源">盘源</option>
                <option value="CALL客">CALL客</option>
                <option value="其他">其他</option>
            </select>
        </div>
    </div>
</div>
<br>
<div id="new_secondHand_house_input">
    <div class="row form-group">
        <div class="col-md-4">
            <div class="input-group">
                <span class="input-group-addon">付款</span>
                <select name="payment_mode" id="payment_mode" class="form-control" disabled="disabled">
                    <option value="其它">其它</option>
                    <option value="商业贷款">商业贷款</option>
                    <option value="公积金贷款">公积金贷款</option>
                    <option value="组合贷款">组合贷款</option>
                    <option value="全款">全款</option>
                </select>
            </div>
        </div>
        <div class="col-md-4">
            <div class="input-group">
                <span class="input-group-addon">总价</span>
                <label for="min_totalPrice" class="hidden"></label>
                <input type="text" name="min_totalPrice" id="min_totalPrice" value="{{ result.min_totalPrice }}"
                       class="form-control" disabled="disabled">
                <span class="input-group-addon">～</span>
                <label for="max_totalPrice" class="hidden"></label>
                <input type="text" name="max_totalPrice" id="max_totalPrice" value="{{ result.max_totalPrice }}"
                       class="form-control" disabled="disabled">
                <span class="input-group-addon">万</span>
            </div>
        </div>
        <div class="col-md-4">
            <div class="input-group">
                <span class="input-group-addon">单价</span>
                <label for="min_unitPrice" class="hidden"></label>
                <input type="text" name="min_unitPrice" id="min_unitPrice" value="{{ result.min_unitPrice }}"
                       class="form-control" disabled="disabled">
                <span class="input-group-addon">~</span>
                <label for="max_unitPrice" class="hidden"></label>
                <input type="text" name="max_unitPrice" id="max_unitPrice" value="{{ result.max_unitPrice }}"
                       class="form-control" disabled="disabled">
                <span class="input-group-addon">元/m²</span>
            </div>
        </div>
    </div>
</div>
<br>
<div id="rent_house_input">
    <div class="row form-group">
        <div class="col-md-4">
            <div class="input-group">
                <span class="input-group-addon">月租</span>
                <label for="min_rent" class="hidden"></label>
                <input type="text" name="min_rent" id="min_rent" value="{{ result.min_rent }}" class="form-control"
                       disabled="disabled">
                <span class="input-group-addon">~</span>
                <label for="max_rent" class="hidden"></label>
                <input type="text" name="max_rent" id="max_rent" value="{{ result.max_rent }}" class="form-control"
                       disabled="disabled">
                <span class="input-group-addon">元/月</span>
            </div>
        </div>
        <div class="col-md-4">
            <div class="input-group">
                <span class="input-group-addon">整租</span>
                <select name="rent" id="rent" class="form-control" disabled="disabled">
                    <option value="不限">不限</option>
                    <option value="整租">整租</option>
                    <option value="合租">合租</option>
                </select>
            </div>
        </div>
        <div class="col-md-4">
            <div class="input-group">
                <span class="input-group-addon">租期</span>
                <select name="tenancy" id="tenancy" class="form-control" disabled="disabled">
                    <option value="不限">不限</option>
                    <option value="一个月">一个月</option>
                    <option value="三个月">三个月</option>
                    <option value="半年">半年</option>
                    <option value="一年">一年</option>
                    <option value="一年以上">一年以上</option>
                </select>
            </div>
        </div>
    </div>
</div>
<script>
    (function ($) {
        var new_house_checkbox, secondHand_house_checkbox, rent_house_checkbox;
        $(document).ready(function () {
            new_house_checkbox = $('input[name=new_house]');
            secondHand_house_checkbox = $('input[name=secondHand_house]');
            rent_house_checkbox = $('input[name=rent_house]');
            $('input[type=checkbox]').change(function () {
                if ($(this).is(':checked')) {
                    $(this).val(1);
                } else {
                    $(this).val(0);
                }
                changeCheckBox();
            });
            changeCheckBox();
        });

        function changeCheckBox() {
            if (new_house_checkbox.is(':checked') || secondHand_house_checkbox.is(':checked')) {
                $('#new_secondHand_house_input').find('select, input').removeAttr('disabled');
            } else if (!new_house_checkbox.is(':checked') && !secondHand_house_checkbox.is(':checked')) {
                $('#new_secondHand_house_input').find('select, input').attr('disabled', 'disabled');
            }
            if (rent_house_checkbox.is(':checked')) {
                $('#rent_house_input').find('select, input').removeAttr('disabled');
            } else {
                $('#rent_house_input').find('select, input').attr('disabled', 'disabled');
            }
        }
    })(jQuery);
</script>