<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> <form id="theFrm"> <input type="hidden" name="id" value="<?= isset($info) ? $info->id : '' ?>"> <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table"> <tr> <td class="td_bg"> <select name="category_id"> <option value="1" <?= isset($info) ? (1 == $info->category_id ? 'selected' : '') : '' ?>>配件入库 </option> <option value="2" <?= isset($info) ? (2 == $info->category_id ? 'selected' : '') : '' ?>>辅料入库 </option> </select> </td> </tr> </table> <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table"> <tr> <td width="100" height="25" class="bg_tr">品牌</td> <td height="25" class="td_bg" width="300"> <select name="brand_id" id="brand_id"> <option value="">--请选择--</option> <?php if (isset($brands)): ?> <?php foreach ($brands as $brand): ?> <option value="<?= $brand->id ?>" <?= isset($info) ? ($info->brand_id == $brand->id ? 'selected' : '') : '' ?>><?= $brand->name ?></option> <?php endforeach; ?> <?php endif; ?> </select> </td> <td width="100" height="25" class="bg_tr">车型</td> <td height="25" class="td_bg" width="300"> <select name="series_id" id="series_id"> <option value="">--请选择--</option> <?php if (isset($series)): ?> <?php foreach ($series as $serie): ?> <option value="<?= $serie->id ?>" <?= $serie->id == $info->series_id ? 'selected' : '' ?>><?= $serie->name ?></option> <?php endforeach; ?> <?php endif; ?> </select> </td> <td width="100" height="25" class="bg_tr">排量</td> <td height="25" class="td_bg"> <select name="displacement_id" id="displacement_id"> <option value="">--请选择--</option> <?php if(isset($displacements)): ?> <?php foreach($displacements as $displacement): ?> <option value="<?= $displacement->id ?>" <?= ($displacement->id == $info->displacement_id) ? 'selected' : '' ?>><?= $displacement->name ?></option> <?php endforeach; ?> <?php endif; ?> </select> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">年款</td> <td height="25" class="td_bg" colspan="5"> <input name="car_year" type="text" readonly onclick="WdatePicker({dateFmt:'yyyy'})" value="<?= isset($info) ? $info->car_year : '' ?>"> </td> </tr> </table> <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table"> <tr> <td width="100" height="25" class="bg_tr">分类</td> <td height="25" class="td_bg" width="300"> <select name="category_1"> <option value="1" <?= isset($info) ? (1 == $info->category_1 ? 'selected' : '') : '' ?>>易损类</option> <option value="2" <?= isset($info) ? (2 == $info->category_1 ? 'selected' : '') : '' ?>>养护类</option> </select> </td> <td width="100" height="25" class="bg_tr">配件名称</td> <td class="td_bg" width="300"> <input type="text" name="name" value="<?= isset($info) ? $info->name : '' ?>"> </td> <td width="100" height="25" class="bg_tr">现有库存</td> <td class="td_bg"> <input type="text" name="number" value="<?= isset($info) ? $info->number : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">盘点人</td> <td height="25" class="td_bg" colspan="5"> <input type="text" name="price"> </td> </tr> <tr> <td height="22" colspan="6" align="center" class="td_bg"> <?php if(!isset($info)): ?> <input id="submit-btn" type=button class="ACT_btn" name=Submit1 value=" 提交 "/> <?php else: ?> <input id="save-btn" type=button class="ACT_btn" name=Submit1 value=" 保存 "/> <?php endif; ?> <input id="back-btn" type="button" class="ACT_btn" name="Submit2" value=" 返回 "> </td> </tr> </table> </form> <script type="text/javascript" language="javascript"> //提交按钮 $('#submit-btn').on('click', function () { if (!confirm('确定提交吗')) return false; var params = $('#theFrm').serialize(); $.post('/store-room/put-in-store-info', params, function (msg) { alert(msg.msg); if (msg.success) { // location.reload(); window.location.href = "/store-room/put-in-store"; } }, 'json'); }); //保存按钮 $('#save-btn').on('click',function(){ var params = $('#theFrm').serialize(); $.post('/store-room/put-in-store-info', params, function (msg) { alert(msg.msg); if (msg.success) { location.reload(); } }, 'json'); }); //返回按钮 $('#back-btn').on('click', function () { window.location.href = '/store-room/check-store'; }); $('#brand_id').change(function () { var brand_id = $(this).val(); $('#series_id').html('<option value="0">---请选择---</option>'); $('#displacement_id').html('<option value="0">---请选择---</option>'); if (brand_id > 0) { $.get('/car/series', {brand_id: brand_id}, function (obj) { if (obj.success) { $('#series_id').html(obj.html); } }, 'json'); } }); $('#series_id').change(function () { var series_id = $(this).val(); $('#displacement_id').html('<option value="0">---请选择---</option>'); if (series_id > 0) { $.get('/car/displacement', {series_id: series_id}, function (obj) { if (obj.success) { $('#displacement_id').html(obj.html); } }, 'json'); } }); </script>