<?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/product.css?ver=<?php echo mvc::$cfg['VER']['css'];?>">
<div class="maintb">
	<div class="navrow">
        <ul class="navrow_ul">
            <li class="active">
                <a href="<?php echo mvc::$cfg['ADMIN_URI'];?>pjlProduct/purchaseInfo?purId=<?php echo $_GET['purId'];?>">基本信息</a>
            </li>
            <!-- <li>
                <a href="<?php echo mvc::$cfg['ADMIN_URI'];?>pjlProduct/purchaseProduct?purId=<?php echo $_GET['purId'];?>">询价单产品</a>
            </li>
            <li>
                <a href="<?php echo mvc::$cfg['ADMIN_URI'];?>pjlProduct/purchaseOffer?purId=<?php echo $_GET['purId'];?>">报价单</a>
            </li> -->
        </ul>
    </div>
    <table class="table table-bordered product-table">
        <?php if(!empty($data)){?>
    	<colgroup>
			<col width="100" align="right">
		</colgroup>
    	<tr>
    		<th class="text-right">询价单状态</th>
    		<td>
            <?php if($data['pur_status']>0){?>
                已完成
            <?php }else if($data['pur_status']<0){?>
                已关闭
            <?php }else{?>
                询价中
            <?php }?>      
            </td>
    	</tr>
        <tr>
            <th class="text-right">询价单ID</th>
            <td><?php echo $data['pur_id'];?></td>
        </tr>
        <tr>
            <th class="text-right">发布者</th>
            <td><?php echo $user['u_name'];?></td>
        </tr>
        <tr>
            <th class="text-right">VIN</th>
            <td><?php echo $data['pur_vin'];?></td>
        </tr>
        <tr>
            <th class="text-right">品牌</th>
            <td><?php echo $brand;?></td>
        </tr>
        <tr>
            <th class="text-right">车型</th>
            <td><?php echo $data['pur_model'];?></td>
        </tr>
        <tr>
            <th class="text-right">图片</th>
            <td>
                <?php if(!empty($imgArr)){?>
                    <?php foreach($imgArr as $img){?>
                        <a href="<?php echo str_replace('240/','800/',$img);?>" target="_blank">
                            <img width="100px" height="100px;" src="<?php echo $img;?>">
                        </a>
                    <?php }?>
                <?php }else{?>
                <img src="<?php echo mvc::$cfg['ADMIN_URL'];?>static/images/no_img.gif"/>
                <?php }?>
            </td>
        </tr>
        <tr>
            <th class="text-right">地区</th>
            <td><?php echo $area;?></td>
        </tr>
        <tr>
            <th class="text-right">发布时间</th>
            <td><?php echo date('Y-m-d H:i',$data['pur_atime']);?></td>
        </tr>
        <?php if(!empty($data['pur_close_time'])){?>
        <tr>
            <th class="text-right">关闭时间</th>
            <td><?php echo date('Y-m-d H:i',$data['pur_close_time']);?></td>
        </tr>
        <?php }?>
        <?php if(!empty($data['pur_ok_time'])){?>
        <tr>
            <th class="text-right">完成时间</th>
            <td><?php echo date('Y-m-d H:i',$data['pur_ok_time']);?></td>
        </tr>
        <?php }?>
        <tr>
            <th class="text-right">备注</th>
            <td><?php echo $data['pur_remark'];?></td>
        </tr>
    <?php }else{?>
        <tr>
            <td colspan="10" class="orange center">没有找到询价单信息,可能已被删除</td>
        </tr>
    <?php }?>
    </table>
</div>

<div class="maintb">
    <div>
        询价单产品
    </div>
    <table class="table table-bordered">
        <colgroup>
            <col width="200" align="right">
            <col width="100" align="right">
            <col width="100" align="right">
            <col width="100" align="right">
        </colgroup>
        <thead>
            <tr>
                <th>配件名称</th>
                <th>OE</th>
                <th>数量</th>
            </tr>
        </thead>
        <?php if(!empty($prodata)){?>
        <?php foreach($prodata as $v){?>
        <tr>
            <td><?php echo $v['pup_name'];?></td>
            <td><?php echo $v['pup_number'];?></td>
            <td><?php echo $v['pup_count'];?></td>
        </tr>
        <?php }?>
        <?php }else{?>
        <tr>
            <td colspan="4" class="red text-center">暂无配件</td>
        </tr>
        <?php }?>
    </table>
</div>

<div class="maintb">
    <div>
        报价单
    </div>
    <table class="table table-bordered">
        <colgroup>
            <col width="100" align="right">
            <col width="100" align="right">
            <col width="200" align="right">
            <col width="200" align="right">
        </colgroup>
        <thead>
            <tr>
                <th>报价单ID</th>
                <th>状态</th>
                <th>报价人</th>
                <th>配件商</th>
                <th>报价时间</th>
            </tr>
        </thead>
        <?php if(!empty($offerData)){?>
        <?php foreach($offerData as $v){?>
        <tr>
            <td><a href="<?php echo mvc::$cfg['ADMIN_URI'];?>pjlProduct/purchaseOfferView?poId=<?php echo $v['po_id'];?>" class="a_blue"><?php echo $v['po_id'];?></a></td>
            <td>
                <?php if($v['po_status']>0){?>
                    正常
                <?php }else{?>
                    关闭
                <?php }?>
            </td>
            <td><?php echo $uArr[$v['po_opu_uid']]['u_name'];?></td>
            <td><?php echo $shopArr[$v['po_shop_id']]['shop_name'];?></td>
            <td><?php echo date('Y-m-d H:i',$v['po_atime']);?></td>
        </tr>
        <?php }?>
        <?php }else{?>
        <tr>
            <td colspan="5" class="text-center red">暂无报价</td>
        </tr>
        <?php }?>
    </table>


    <div style="margin-top: 30px;">
        拨打电话数
    </div>
    <table class="table table-bordered" style="width: 320px;">
        <colgroup>
            <col width="100" align="right">
            <col width="100" align="right">
        </colgroup>
        <thead>
        <tr>
            <th>拨打用户</th>
            <th>拨打时间</th>
        </tr>
        </thead>
        <?php if(!empty($productCallData)){?>
            <?php foreach($productCallData as $v){?>
                <tr>
                    <td><?php echo $uArr[$v['puca_by_uid']]['u_name'] ?: '未知';?></td>
                    <td><?php echo date('Y-m-d H:i',$v['puca_atime']);?></td>
                </tr>
            <?php }?>
        <?php }else{?>
            <tr>
                <td colspan="2" class="text-center red">暂无拨打电话</td>
            </tr>
        <?php }?>
    </table>
</div>
<script type="text/javascript" src="<?php echo mvc::$cfg['ADMIN_URL'];?>static/js/product.js?ver=<?php echo mvc::$cfg['VER']['js'];?>"></script>