<?php include_once(mvc::$cfg['PATH_TPL'].'public/headBase.php');?>
<link rel="stylesheet" type="text/css" href="<?php echo mvc::$cfg['ADMIN_URL'];?>static/css/jquery.autocomplete.css">
<link rel="stylesheet" type="text/css" href="<?php echo mvc::$cfg['ADMIN_URL'];?>static/css/check_box.css?ver=<?php echo mvc::$cfg['VER']['css'];?>">
<div class="marauto iframes-left-main" id="SearchProduct">
    <form action="<?php echo mvc::$cfg['ADMIN_URI'];?>product/productList" method="get" target="ListFrame">
            <table class="table table-bordered table-hover" id="SearchTable">
				<tr>
                    <th class="right" width="80px">搜索类型：</th>
                    <td class="stypet-td">
                       <label class="marr10 active"><input type="radio" name="stype" value="item" checked/>配件</label>
                       <label class="marr10"><input type="radio" name="stype" value="num"/>ID/号码</label>
                       <label><input type="radio" name="stype" value="chk"/>检测</label>
                    </td>
                </tr>
				<tr class="stype item chk">
                    <th class="right" width="80px">配件状态：</th>
                    <td>
                        <select name="status" class="form-control" id="Make">
                            <option value="all">--全部--</option>
                            <option value="0">未上架</option>
                            <option value="1">售卖中</option>
                            <option value="-1">违规</option>
                            <option value="2">预售</option>
                        </select>
                    </td>
                </tr>
                <tr class="stype item chk">
                    <th class="right">配件分类：</th>
                    <td>
                        <select name="path1" id="Part1" onchange="GetSearchChildPart(this,this.options[this.selectedIndex].getAttribute('path'),this.options[this.selectedIndex].getAttribute('endVal'),'top')" class="partSelect form-control" >
                            <option path='0' value="0" endVal='all'>--全部--</option>
                            <?php foreach ($partArr as $row){?>
                            <option endVal="<?php echo $row['part_is_end'];?>" value="<?php echo $row['pt_part_id'];?>" path="<?php echo $row['pt_path'];?>"><?php echo $row['part_name'];?></option>
                            <?php }?>
                        </select>
                    </td>
                </tr>
				<tr class="stype item">
                    <th class="right">适用车型：</th>
                    <td>
                        <div id="modalArr">
                        </div>
                    </td>
                </tr>
				<tr class="stype num">
                    <th class="right">配件ID：</th>
                    <td><input type="text" class="form-control" id="proId" name="proId"/></td>
                </tr>
				<tr class="stype num">
                    <th class="right">配件号码：</th>
                    <td>
                        <input type="text" class="form-control" id="proNumber" name="proNumber"/>
                    </td>
                </tr>
                <tr class="stype item">
                    <th class="right">配件名称：</th>
                    <td>
                        <input type="text" class="form-control" id="proName" name="proName"/>
                    </td>
                </tr>
               <tr class="stype item chk">
                    <th class="right">店铺名称：</th>
                    <td>
                        <input type="text" name="shopName" class="form-control" id="shop"/>
                        <input type="hidden" name="shopId" id="shopId">
                    </td>
                </tr>
				<tr class="stype chk">
					<th class="right">检测项：</th>
                    <td>
                       <label class="marr10"><input type="checkbox" name="noimg" value="1"/>无图</label>
                       <label class="marr10"><input type="checkbox" name="noprice" value="1"/>无销售价</label>
                       <label class="marr10"><input type="checkbox" name="nonum" value="1"/>无互换号</label>
                       <label class="marr10"><input type="checkbox" name="nomod" value="1"/>无车型</label>
                    </td>
                </tr>
				<tr class="stype item chk">
                    <th class="right">添加时间：</th>
                    <td>
                        <input type="text" id="addTime" class="form-control" name="addTime" value="">
                        <span>-</span>
                        <input type="text" id="endTime" class="form-control" name="endTime" value="">
                    </td>
                </tr>
                <tr>
                    <th class="right">排序条件：</th>
                    <td>
                        <select name="orderBy" class="form-control">
                            <option value="tdesc">添加时间降序</option>
                            <option value="tasc">添加时间升序</option>
                            <option value="adesc">更新时间降序</option>
                            <option value="sdesc">销量降序</option>
                            <option value="sasc">销量升序</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="right">显示列：</th>
                    <td style="position: relative;">
                        <input type="hidden" name="showColumn" class="showColumn_input">
                        <input class="form-control showColumn_textarea" readonly value="配件ID,配件状态,配件名称">
                        <div id="showColumn" class="pull-right"></div>
                    </td>
                </tr>
            </table>
			<div class="center mart10">
				<input type="submit" class="btn btn-primary" value="搜 索"/>&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="button" class="btn btn-default" value="重 置" onclick="ResetAll()"/>
			</div>
        </form>
        <div class="searchCheck">
            <form id="proCheckForm" action="<?php echo mvc::$cfg['ADMIN_URI'];?>product/productList" method="get" target="ListFrame">
                <div id="proCheckTable">
                    <table class="table">
                        <thead>
                            <tr>
                                <th>已选配件</th>
                                <th width="40px">移除</th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>
                <div class="changeStatus-remark hidden">
                    <span>状态修改原因</span>
                    <textarea class="form-control" rows="3" name="remark" placeholder="请填写状态变更原因"></textarea>
                </div>
            </form>           
            <div class="checkFoot">
                <a type="button" href="<?php echo mvc::$cfg['ADMIN_URI'];?>product/productList?select=1" target="ListFrame" class="btn btn-primary">已选</a>&nbsp;&nbsp;
                <button type="button" class="btn btn-primary" onclick="clearAll();return false;">清空</button>&nbsp;&nbsp;
                <button type="button" class="btn btn-primary" onclick="changePro('out');return false;">下架</button>&nbsp;&nbsp;
                <button type="button" class="btn btn-primary" onclick="changePro('put');return false;">上架</button>&nbsp;&nbsp;
                <button type="button" class="btn btn-primary" onclick="changePro('illegal');return false;">违规</button>
				<div class="mar10">
					<button type="button" class="btn btn-info" onclick="resetModelsByOes(0)" title="根据配件的OE号码更新配件的适用车型">刷适用车型</button>
				</div>
				<!--<button type="button" class="btn btn-danger" onclick="changePro('del');return false;">删除</button>-->
            </div>
        </div>
</div>
<?php include_once(mvc::$cfg['PATH_TPL'].'public/footBase.php');?>
<script type="text/javascript" src="<?php echo mvc::$cfg['ADMIN_URL'];?>static/js/product.js?ver=<?php echo mvc::$cfg['VER']['js'];?>"></script>
<script type="text/javascript" src="<?php echo mvc::$cfg['ADMIN_URL'];?>static/js/jquery.autocomplete.js"></script>
<script type="text/javascript" src="<?php echo mvc::$cfg['ADMIN_URL'];?>static/js/check_box.js?ver=<?php echo mvc::$cfg['VER']['js'];?>"></script>
<script type="text/javascript" src="<?php echo mvc::$cfg['ADMIN_URL'];?>static/laydate/laydate.js?ver=1.0.0"></script>
<script type="text/javascript">
var AutoProArr=<?php echo json_encode($proArr);?>;
var AutoShopArr=<?php echo json_encode($shopArr);?>;
$(function() {
	//搜索事件
	initItemSeachParams();
    $(':radio[name="stype"]').eq(0).click();
	AjaxProCheck('','');
    //父级自动完成
     $("#shop").autocomplete(AutoShopArr, {
        minChars: 0,
        max: 500,
        matchContains : true,
        formatItem: function(row) {
            return row.shop_name;
        },
        formatMatch: function(row) {
            return row.shop_name;
        },
        formatResult: function(row) {
            return row.shop_name;
        },
    }).result(function(event, data, formatted){
        $('#shopId').val(data.shop_id);
    });
    $('#shop').blur(function(){
        if($(this).val()==''){
            $('#shopId').val('');
        }
    });
    laydate.render({ 
      elem: '#addTime',
      format: 'yyyy-MM-dd' //可任意组合
    });
    laydate.render({ 
      elem: '#endTime',
      format: 'yyyy-MM-dd' //可任意组合
    });
});
</script>
<script type="text/javascript">
    var params = <?php echo json_encode($params,JSON_UNESCAPED_UNICODE)?>;
    var data = <?php echo json_encode($data,JSON_UNESCAPED_UNICODE)?>;
    var a=new check_box(params, data);
    $('.check_box_text_list').addClass('hidden');
    $('.check_box_text button').addClass('hidden');
    function putIntoCheckColumn(value,obj,ev){
        var val=ev.getCheckVal();
        var nameArr=ev.getCheckName();
        $('.showColumn_input').val(val.join(","));
        $('.showColumn_textarea').val(nameArr.join(","));
    }
    $('.showColumn_textarea').click(function(e){
        $('.check_box_content').toggleClass('hidden');
        var e = e || window.event; //浏览器兼容性 
        e.stopPropagation();
    })
    buildModel.modalInit('modalArr');
</script>
<?php include_once(mvc::$cfg['PATH_TPL'].'public/footBase.php');?>