<?php
use \common\libs\MyLib;
use \common\models\PriceT;
?>
<link href="/css/tabs.css" rel="stylesheet" type="text/css">
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/datepicker/WdatePicker.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
    <tr>
        <td height="22" colspan="2" class="td_bg">
            <table width="100%" align="center" height="120" border="0" cellpadding="0" cellspacing="0" id="mainTable">
                <tr>
                    <td height="120" valign="top" class="td_bg">
                        <TABLE id=tb cellSpacing=1 cellPadding=0 width="100%" border=0 name="tb">
                            <TR>
                                <TD vAlign=top>
                                    <form id="fixItemForm" method="POST">
                                        <input type="hidden" name="id" value="<?= $id ? $id : 0?>">
                                        <input type="hidden" name="status" value="<?= $status ? $status : 0?>">
                                        <input name="_csrf" type="hidden" id="_csrf" value="<?= Yii::$app->request->csrfToken ?>">
                                        <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table" style="table-layout: fixed;">
                                            <tr>
                                                <td width="100" height="25" class="bg_tr">结算方式</td>
                                                <td width="200" height="25" class="td_bg">
                                                    <select name="big_type_id" id="pay_type">
                                                        <option value="1">保险理赔</option>
                                                        <option value="2">自费维修</option>
<!--                                                        <option value="3">汽车保养</option>-->
<!--                                                        <option value="4">汽车美容</option>-->
                                                    </select>
                                                </td>
                                                <td width="100" height="25" class="bg_tr">类型</td>
                                                <td height="25" class="td_bg">
                                                    <select name="type">
                                                        <option value="钣金">钣金</option>
                                                        <option value="底子">底子</option>
                                                        <option value="漆工">漆工</option>
                                                        <option value="美容">美容</option>
                                                    </select>
                                                </td>
                                                <td align="left" width="100" class="bg_tr">小类：</td>
                                                <td class="td_bg">
                                                    <div align="left">
                                                        <select name="small_type_id" id="small_type_id">
                                                            <option value="1">更换清单</option>
                                                            <option value="2">维修清单</option>
                                                            <option value="3">辅料清单</option>
                                                            <option value="4">待定清单</option>
                                                        </select>
                                                    </div>
                                                </td>

                                            </tr>
                                            <tr>
                                                <td width="100" height="25" class="bg_tr">名称</td>
                                                <td height="25" class="td_bg"><input name="name" type="text"></td>
                                                <td width="100" height="25" class="bg_tr">单价</td>
                                                <td height="25" class="td_bg"><input name="price" type="text"></td>
                                                <td width="100" height="25" class="bg_tr">数量</td>
                                                <td height="25" class="td_bg"><input name="count" type="text"></td>
                                            </tr>
                                            <tr id="tr-2" style="display: none">
                                                <td width="100" height="25" class="bg_tr">实收</td>
                                                <td height="25" class="td_bg" ><input name="pay_real" type="text" ></td>
                                            </tr>
                                            <tr>
                                                <td align="left" class="bg_tr">备注</td>
                                                <td colspan="5" class="td_bg">
                                                    <div align="left">
                                                        <textarea name="remark" style="width:700px; height: 30px;"></textarea>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </form>
                                </TD>
                            </TR>
                            <tr>
                                <td align="center">
                                    <input type=button class="ACT_btn submit-btn" name=Submit2 value=" 提交 "/>
                                    <input type="button" class="ACT_btn back-btn" name="Submit3" value=" 返回 ">
                                </td>
                            </tr>
                        </TABLE>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<script>
    //提交
    $('.submit-btn').click(function(){
        var params = $('#fixItemForm').serialize();
        $.post('/fix-car/step4-save',params,function(msg){
            console.log(msg);
        },'json');
    });
    //实收
    $('#pay_type').on('change',function(){
        $('#tr-2').hide();
        if($(this).val() == 2){
            $('#tr-2').show();
        }
    });
</script>
