<?php if (count($type1_items) > 0): ?>
    <?php foreach ($type1_items as $key => $val): ?>
        <?php if (1 == $key && count($val) > 0): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">更换清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('保险理赔->更换清单',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (2 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">维修清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->insurance_price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('保险理赔->维修清单',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (3 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">辅料清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('保险理赔->辅料清单',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (4 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">待定清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('保险理赔->待定清单',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (5 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">汽车保养</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('保险理赔->汽车保养',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (6 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">美容装饰</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('保险理赔->美容装饰',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php endif; ?>

    <?php endforeach; ?>
<?php endif; ?>
<?php if (count($type2_items) > 0): ?>
    <?php foreach ($type2_items as $key => $val): ?>
        <?php if (1 == $key && count($val) > 0): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">更换清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('自费维修->更换清单',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (2 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">维修清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('自费维修->维修清单',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (3 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">辅料清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('自费维修->辅料清单',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (4 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">待定清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('自费维修->待定清单',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (5 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">汽车保养</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('自费维修->汽车清单',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (6 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">美容装饰</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('自费维修->美容装饰',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php endif; ?>

    <?php endforeach; ?>
<?php endif; ?>
<?php if (count($type3_items) > 0): ?>
    <?php foreach ($type3_items as $key => $val): ?>
        <?php if (1 == $key && count($val) > 0): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">更换清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('保险理赔->更换清单',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (2 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">维修清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('保险理赔->更换清单',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (3 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">辅料清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('保险理赔->更换清单',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (4 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">待定清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="50" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap>自费维修</td>
                        <td align="center" class="td_bg" nowrap>美容</td>
                        <td align="center" class="td_bg" nowrap>小刘</td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('保险理赔->更换清单',<?= $item->id ?>)">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table >
        <?php elseif (5 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">配件清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('保险理赔->更换清单',<?= $item->id ?>)">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (6 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">美容装饰</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>

                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>
                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('保险理赔->更换清单',<?= $item->id ?>)">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php endif; ?>

    <?php endforeach; ?>
<?php endif; ?>
<?php if (count($type4_items) > 0): ?>
    <?php foreach ($type4_items as $key => $val): ?>
        <?php if (1 == $key && count($val) > 0): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">更换清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>

                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>

                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('保险理赔->更换清单',<?= $item->id ?>)">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (2 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">维修清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>

                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>

                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('保险理赔->更换清单',<?= $item->id ?>)">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (3 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">辅料清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>

                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>

                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('汽车美容',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (4 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">待定清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>

                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>

                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('汽车美容',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (5 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">汽车保养</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>

                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>

                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('汽车美容',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php elseif (6 == $key): ?>
            <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table" style="table-layout: fixed;">
                <tr>
                    <td colspan="8" style="text-align: left">配件清单</td>
                </tr>
                <tr>
                    <td width="50" align="center" class="bg_tr" nowrap>序号</td>
                    <td width="100" align="center" class="bg_tr" nowrap>名称</td>
                    <td width="80" align="center" class="bg_tr" nowrap>保险单价</td>
                    <td width="50" align="center" class="bg_tr" nowrap>单价</td>
                    <td width="80" align="center" class="bg_tr" nowrap>数量</td>
                    <td width="100" align="center" class="bg_tr" nowrap>结算方式</td>
                    <td width="80" align="center" class="bg_tr" nowrap>维修班组</td>
                    <td width="100" align="center" class="bg_tr" nowrap>维修人</td>
                    <td width="100" align="center" class="bg_tr" nowrap>状态</td>
                    <td width="100" align="center" class="bg_tr" nowrap>操作</td>
                </tr>
                <?php foreach ($val as $index => $item): ?>
                    <tr>
                        <td rowspan="2" align="center" class="td_bg" nowrap><?= $index + 1 ?></td>
                        <td class="td_bg" style="word-break: break-all"><?= $item->name ?></td>
                        <td align="center" class="td_bg" nowrap><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" style="word-break: break-all"><?= $item->price ?>元</td>
                        <td align="center" class="td_bg" nowrap><?= $item->count ?></td>
                        <td class="td_bg" nowrap><?= $item->pay_type == 1 ? '保险理赔' : '自费维修'?></td>
                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->getType2Name() ?>(<?= \common\models\UserT::findOne($item->fix_user)->group->name ?>)</td>

                        <td align="center" class="td_bg" nowrap><?= \common\models\FixItemT::findOne($item->id)->userT->name?></td>
                        <td align="center" class="td_bg" nowrap><?= 0 == $item->status ? FIX_WAIT : FIX_FINISH ?></td>

                        <td align="center" class="td_bg" nowrap>
                            [<a href="javascript:void(0)" onclick="fixCarItemInfo('汽车美容',1,<?= $item->id ?>,<?= $item->fix_id ?>,'<?= $item->name ?>','<?= $item->insurance_price ?>','<?= $item->price ?>','<?= $item->count ?>','<?= $item->type ?>','<?= $item->fix_user ?>','<?= $item->fix_remark ?>')">详情</a>]
                            [<a href="javascript:void(0)" onclick="fixItemRemove(<?= $item->id ?>)">删除</a>]
                            [<a href="javascript:void(0)" onclick="fixItemFinish('<?= $item->id ?>',$(this))">确认</a>]
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="bg_tr" nowrap>备注</td>
                        <td class="td_bg" nowrap colspan="8"><?= $item->fix_remark ?></td>
                    </tr>
                <?php endforeach; ?>
            </table>
        <?php endif; ?>
    <?php endforeach; ?>
<?php endif; ?>
<script>
    //清单详情
//    function fixCarItemInfo(title,id){
//        art.dialog.open('/business-order/dialog-box?id='+id+'&info=1',{width:520,title:title,lock:true,opacity:0.5},true);
//    }
    //删除
    function fixItemRemove(id){
        if(confirm('确定要删除吗？')) {
            $.post('/business-order/fix-item-remove', {id: id}, function (msg) {
                alert(msg.msg);
                if (msg.success) {
                    gotoPage('/fix-car/ajax-item-list?fix_id=' + msg.fix_id + '&pay_type=1', 'list3');
                    gotoPage('/fix-car/ajax-item-list?fix_id=' + msg.fix_id + '&pay_type=2', 'list4');
                    gotoPage('/fix-car/ajax-item-list?fix_id=' + msg.fix_id + '&small_type_id=5', 'list5');
                    gotoPage('/fix-car/ajax-item-list?fix_id=' + msg.fix_id + '&small_type_id=6', 'list6');
                }
            }, 'json');
        }
    }
    //弹框
    function fixCarItemInfo(title, big_type,id, fix_id,name,insurance_price,price,count,type,fix_user,fix_remark) {
        var roles = JSON.parse(fixCarRole),
            rolesLen = roles.length;

        var dialog = '<form id="dialogFrm2"><table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">' +
            '<input type="hidden" name="id" value="' + id + '">' +
            '<input type="hidden" name="fix_id" value="' + fix_id + '">' +
            '<input type="hidden" name="list_type" value="' + big_type + '">' +
            '<input type="hidden" name="big_type_id" value="' + big_type + '">' +
            '<tr><th colspan="4" id="dialog-title">' + title + '</th></tr>' +
            '<tr class="bg_tr"><td colspan="4"><select name="small_type_id">';
        if (1 == big_type || 2 == big_type) {
            dialog += '<option value="1">更换清单</option>' +
                '<option value="2">维修清单</option>' +
                '<option value="3">辅料清单</option>' +
                '<option value="4">待定清单</option>' +
                '<option value="5">汽车保养</option>' +
                '<option value="6">美容装饰</option>';
        } else if (3 == big_type || 4 == big_type) {
            dialog += '<option value="1">更换清单</option>' +
                '<option value="2">维修清单</option>' +
                '<option value="3">辅料清单</option>' +
                '<option value="4">待定清单</option>';
        }

        dialog += '</select></td></tr>' +
            '        <tr>' +
            '            <td class="bg_tr">配件名称</td>' +
            '            <td class="td_bg"><input type="text" name="name" class="js-name" value="'+name+'" list="id-list" onkeyup="dataList($(this))"><datalist id="id-list"></datalist></td>' +
            '            <td class="bg_tr">数量</td>' +
            '            <td class="td_bg"><input name="count" type="text" value="'+count+'"></td>' +
            '        </tr>' +
            '        <tr>' +
            '            <td class="bg_tr">保险定价</td>' +
            '            <td class="td_bg"><input name="insurance_price" type="text" value="'+insurance_price+'"></td>' +
            '            <td class="bg_tr">自费单价</td>' +
            '            <td class="td_bg"><input name="price" type="text" value="'+price+'"></td>' +
            '</select></td>' +
            '        </tr>' +
            '        <tr>' +
            '            <td class="bg_tr">类型</td>' +
            '            <td class="td_bg"><select name="type" onchange="typeChange($(this))">' +
            '<option value="">--请选择--</option>';
           for(var i = 0 ; i < rolesLen ; i++){
               dialog += '<option value="'+roles[i].id+'">'+roles[i].name+'</option>';
           }
           dialog +=  '</select></td>' +
            '            <td class="bg_tr">维修人</td>' +
            '            <td class="td_bg"><select name="fix_user" id="fix-user">' +
            '<option value="">--请选择--</option>' +
            '</select></td>' +
            '        </tr>' +
            '<tr>' +
            '            <td class="bg_tr">结算方式</td>' +
            '            <td class="td_bg" colspan="3"><select name="pay_type" id="">';
        if (1 == big_type) {
            dialog += '<option value="1">保险理赔</option>';
        } else if (2 == big_type) {
            dialog += '<option value="2">自费维修</option>';
        }
        dialog += '</select>' +
            '</tr>' +
            '        <tr>' +
            '            <td class="bg_tr">备注</td>' +
            '            <td class="td_bg" colspan="3"><textarea name="fix_remark" id="" cols="40" rows="2">'+fix_remark+'</textarea></td>' +
            '        </tr>' +
            '        <tr>' +
            '            <td colspan="4" align="center" class="td_bg"><input type="button" class="ACT_btn" value="保存" onclick="saveBtn()"></td>' +
            '        </tr>' +
            '    </table></form>';
        $('#dialog').html($(dialog));
        getSibling(fix_user);
        $('#dialog').show();
        $('.js-name').focus();
        maskOpen();
    }
    //类型联动
    function typeChange(obj) {
        var options = '<option value="">--请选择--</option>';
        if (obj.val()) {
            $.post('/fix-car/ajax-fix-user', {gid: obj.val()}, function (msg) {
                if (msg.success) {
                    for (var i = 0; i < msg.content.length; i++) {
                        options += '<option value="' + msg.content[i].id + '">' + msg.content[i].name + '</option>';
                    }
                    $('#fix-user').html(options);
                    return false;
                }
            }, 'json');
        }
        $('#fix-user').html(options);
    }
    //清单添加
    function saveBtn() {
        if(confirm('确认提交吗？')) {
            if($.inArray($('.js-name').val(),dataListArr) < 0){
                alert('该配件不存在');
                return false;
            }
            var param = $('#dialogFrm2').serialize();
            $.post('/fix-car/fix-item-save', param, function (msg) {
                maskClose();
                alert(msg.msg);
                if (msg.success) {
                    if (3 == msg.list_type || 4 == msg.list_type) {
                        gotoPage('/fix-car/ajax-item-list?fix_id=' + msg.fix_id + '&pay_type=' + msg.pay_type, 'list' + msg.list_type);
                    } else if (5 == msg.list_type) {
                        gotoPage('/fix-car/ajax-item-list?fix_id=' + msg.fix_id + '&small_type_id=5', 'list' + msg.list_type);
                    } else if (6 == msg.list_type) {
                        gotoPage('/fix-car/ajax-item-list?fix_id=' + msg.fix_id + '&small_type_id=6', 'list' + msg.list_type);
                    }
                }
            },'json');
        }
    }
    //获取当前维修工的其它组员
    function getSibling(fix_user){
        $.post('/business-order/fix-user-sibling',{fix_user:fix_user},function(msg){
            if(msg.success){
                var op = '';
                for(var i = 0 ; i < msg.content.length ;i++){
                    op += '<option value="'+msg.content[i].id+'" '+((fix_user == msg.content[i].id) ? 'selected' : '')+'>'+msg.content[i].name+'</option>'
                }
                $('#fix-user').html(op);
            }
        },'json');
    }
    //维修确认
    function fixItemFinish(id,obj){
        if(!id) alert("操作失败!");
        obj.parent().prev().addClass('finish-'+id);
        $.post('/business-order/fix-item-finish',{id:id},function(msg){
            alert(msg.msg);
            if(msg.success){
                $('.finish-'+id).text(msg.status);
            }
        },'json');
    }
    dataListArr = [];
    function dataList(obj){
        if(obj.val()){
            $.post('/store-room/ajax-store-search',{search:obj.val()},function(msg){
                if(msg.success){
                    var data = msg.content,
                        len = data.length,
                        options = '';
                    for(var i = 0 ; i < len; i ++ ){
                        options += '<option label="'+data[i].name+'" value="'+data[i].name+'"/>'
                        dataListArr.push(data[i].name);
                    }

                    $('#id-list').html(options);
                }
            },'json')
        }else{
            $('#id-list').html('');
        }
    }
</script>

