<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 id="category_a" name="category_1" onchange="categoryChange()"> <?php if($categorys): ?> <?php foreach ($categorys as $category): ?> <option value="<?= $category->id ?>" <?= isset($info) ? ($category->id === $info->category_1 ? 'selected' : '') : '' ?>><?= $category->name ?></option> <?php endforeach; ?> <?php endif; ?> </select> </td> </tr> </table> <div id="_1" class="_div"> <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table change-hide"> <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="0">---请选择---</option> <?php if (isset($brands)): ?> <?php foreach ($brands as $brand): ?> <option value="<?= $brand->id ?>" <?= isset($info) && isset($b) ? ($brand->id === $b ? '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="0">---请选择---</option> <?php if (isset($series)): ?> <?php foreach ($series as $serie): ?> <option value="<?= $serie->id ?>" <?= isset($info) ? ($serie->id === $info->parts['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="0">---请选择---</option> <?php if (isset($displacements)): ?> <?php foreach ($displacements as $displacement): ?> <option value="<?= $displacement->id ?>" <?= isset($info) ? (($displacement->id === $info->parts['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"> <select name="year_id" id="year_id"> <option value="0">---请选择---</option> <?php if (isset($years) && count($years) > 0): ?> <?php foreach ($years as $year): ?> <option value="<?= $year->id ?>" <?= isset($info) ? ($year->id === $info->parts['year_id'] ? 'selected' : '') : '' ?>><?= $year->name ?></option> <?php endforeach; ?> <?php endif; ?> </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"> <?php if (count($parents) > 0): ?> <select name="parent_id" onchange="changeCategory($(this))"> <option value="">--请选择--</option> <?php foreach ($parents as $parent): ?> <?php if(213 === $parent->id || 131 === $parent->id):?> <?php continue ?> <?php endif; ?> <option value="<?= $parent->id ?>" <?= isset($info) ? ($parent->id == $info->category->pid ? 'selected' : '') : '' ?>><?= $parent->name ?></option> <?php endforeach; ?> </select> <?php endif; ?> </td> <td width="100" height="25" class="bg_tr">分类名称</td> <td class="td_bg" width="300"> <select name="category_id" id="category_id"> <option value="">--请选择--</option> <?php if(isset($info)): ?> <?php $subs = \common\models\FixCarCategory::find()->where('pid='.$info->category->pid)->all() ?> <?php foreach($subs as $sub): ?> <option value="<?= $sub->id ?>" <?= $sub->id === $info->category_id ? 'selected' : '' ?>><?= $sub->name ?></option> <?php endforeach; ?> <?php else: ?> <?php endif; ?> </select> </td> <td width="100" height="25" class="bg_tr">配件名称</td> <td class="td_bg" width="300"> <input type="text" name="name" id="name" value="<?= isset($info) ? $info->name : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">价格</td> <td height="25" class="td_bg"> <input type="text" name="price" value="<?= isset($info) ? $info->price : '' ?>"> </td> <td width="100" height="25" class="bg_tr">规格/型号</td> <td height="25" class="td_bg"> <input type="text" name="model" value="<?= isset($info) ? $info->model : '' ?>"> </td> <td width="100" height="25" class="bg_tr">产地</td> <td height="25" class="td_bg"> <input type="text" name="producing_area" value="<?= isset($info) ? $info->producing_area : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">数量</td> <td class="td_bg"> <input type="text" name="number" value="<?= isset($info) ? $info->number : '' ?>"> </td> <td width="100" height="25" class="bg_tr">单位</td> <td height="25" class="td_bg" colspan="3"> <input type="text" name="monad" value="<?= isset($info) ? $info->monad : '' ?>"> </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=" 提交 " onclick="insertBtn(1)"/> <?php else: ?> <input id="save-btn" type=button class="ACT_btn" name=Submit1 value=" 保存 " onclick="saveBtn(2)"/> <?php endif; ?> <input type="button" class="ACT_btn back-btn" name="Submit2" value=" 返回 "> </td> </tr> </table> </div> </form> <div id="_2" class="_div" style="display: none"> <form id="form2"> <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 width="100" height="25" class="bg_tr">顶级分类</td> <td height="25" class="td_bg" width="300"> <?php if (count($parents) > 0): ?> <select onchange="changeCategory($(this))" name="parent_id"> <option value="">--请选择--</option> <?php foreach ($parents as $parent): ?> <?php if(213 !== $parent->id):?> <?php continue ?> <?php endif; ?> <option value="<?= $parent->id ?>" <?= isset($info) ? ($parent->id == $info->category->pid ? 'selected' : '') : '' ?>><?= $parent->name ?></option> <?php endforeach; ?> </select> <?php endif; ?> </td> <td width="100" height="25" class="bg_tr">分类名称</td> <td class="td_bg" width="300"> <select name="category_id" id="category_id"> <option value="">--请选择--</option> <?php if(isset($info)): ?> <?php $subs = \common\models\FixCarCategory::find()->where('pid='.$info->category->pid)->all() ?> <?php foreach($subs as $sub): ?> <option value="<?= $sub->id ?>" <?= $sub->id === $info->category_id ? 'selected' : '' ?>><?= $sub->name ?></option> <?php endforeach; ?> <?php else: ?> <?php endif; ?> </select> </td> <td width="100" height="25" class="bg_tr">配件名称</td> <td class="td_bg" width="300"> <input type="text" name="name" id="name" value="<?= isset($info) ? $info->name : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">价格</td> <td height="25" class="td_bg"> <input type="text" name="price" value="<?= isset($info) ? $info->price : '' ?>"> </td> <td width="100" height="25" class="bg_tr">规格/型号</td> <td height="25" class="td_bg"> <input type="text" name="model" value="<?= isset($info) ? $info->model : '' ?>"> </td> <td width="100" height="25" class="bg_tr">产地</td> <td height="25" class="td_bg"> <input type="text" name="producing_area" value="<?= isset($info) ? $info->producing_area : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">数量</td> <td class="td_bg"> <input type="text" name="number" value="<?= isset($info) ? $info->number : '' ?>"> </td> <td width="100" height="25" class="bg_tr">单位</td> <td height="25" class="td_bg" colspan="3"> <input type="text" name="monad" value="<?= isset($info) ? $info->monad : '' ?>"> </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=" 提交 " onclick="insertBtn(2)"/> <?php else: ?> <input id="save-btn" type=button class="ACT_btn" name=Submit1 value=" 保存 " onclick="saveBtn(2)"/> <?php endif; ?> <input type="button" class="ACT_btn back-btn" name="Submit2" value=" 返回 "> </td> </tr> </table> </form> </div> <div id="_3" class="_div" style="display: none"> <form id="form3"> <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table"> <input type="hidden" name="id" value="<?= isset($info) ? $info->id : '' ?>"> <tr> <td width="100" height="25" class="bg_tr">顶级分类</td> <td height="25" class="td_bg" width="300"> <?php if (count($parents) > 0): ?> <select onchange="changeCategory($(this))" name="parent_id"> <option value="">--请选择--</option> <?php foreach ($parents as $parent): ?> <?php if(131 !== $parent->id):?> <?php continue ?> <?php endif; ?> <option value="<?= $parent->id ?>" <?= isset($info) ? ($parent->id == $info->category->pid ? 'selected' : '') : '' ?>><?= $parent->name ?></option> <?php endforeach; ?> </select> <?php endif; ?> </td> <td width="100" height="25" class="bg_tr">分类名称</td> <td class="td_bg" width="300"> <select name="category_id" id="category_id"> <option value="">--请选择--</option> <?php if(isset($info)): ?> <?php $subs = \common\models\FixCarCategory::find()->where('pid='.$info->category->pid)->all() ?> <?php foreach($subs as $sub): ?> <option value="<?= $sub->id ?>" <?= $sub->id === $info->category_id ? 'selected' : '' ?>><?= $sub->name ?></option> <?php endforeach; ?> <?php else: ?> <?php endif; ?> </select> </td> <td width="100" height="25" class="bg_tr">配件名称</td> <td class="td_bg" width="300"> <input type="text" name="name" id="name" value="<?= isset($info) ? $info->name : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">价格</td> <td height="25" class="td_bg"> <input type="text" name="price" value="<?= isset($info) ? $info->price : '' ?>"> </td> <td width="100" height="25" class="bg_tr">规格/型号</td> <td height="25" class="td_bg"> <input type="text" name="model" value="<?= isset($info) ? $info->model : '' ?>"> </td> <td width="100" height="25" class="bg_tr">产地</td> <td height="25" class="td_bg"> <input type="text" name="producing_area" value="<?= isset($info) ? $info->producing_area : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">数量</td> <td class="td_bg"> <input type="text" name="number" value="<?= isset($info) ? $info->number : '' ?>"> </td> <td width="100" height="25" class="bg_tr">单位</td> <td height="25" class="td_bg" colspan="3"> <input type="text" name="monad" value="<?= isset($info) ? $info->monad : '' ?>"> </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=" 提交 " onclick="insertBtn(3)"/> <?php else: ?> <input id="save-btn" type=button class="ACT_btn" name=Submit1 value=" 保存 " onclick="saveBtn(3)"/> <?php endif; ?> <input type="button" class="ACT_btn back-btn" name="Submit2" value=" 返回 "> </td> </tr> </table> </form> </div> <div id="_4" class="_div" style="display: none"> <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"> <?php if (count($parents) > 0): ?> <select onchange="changeCategory($(this))"> <option value="">--请选择--</option> <?php foreach ($parents as $parent): ?> <?php if(213 === $parent->id || 131 === $parent->id):?> <?php continue ?> <?php endif; ?> <option value="<?= $parent->id ?>" <?= isset($info) ? ($parent->id == $info->category->pid ? 'selected' : '') : '' ?>><?= $parent->name ?></option> <?php endforeach; ?> </select> <?php endif; ?> </td> <td width="100" height="25" class="bg_tr">分类名称</td> <td class="td_bg" width="300"> <select name="category_id" id="category_id"> <option value="">--请选择--</option> <?php if(isset($info)): ?> <?php $subs = \common\models\FixCarCategory::find()->where('pid='.$info->category->pid)->all() ?> <?php foreach($subs as $sub): ?> <option value="<?= $sub->id ?>" <?= $sub->id === $info->category_id ? 'selected' : '' ?>><?= $sub->name ?></option> <?php endforeach; ?> <?php else: ?> <?php endif; ?> </select> </td> <td width="100" height="25" class="bg_tr">配件名称</td> <td class="td_bg" width="300"> <input type="text" name="name" id="name" value="<?= isset($info) ? $info->name : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">价格</td> <td height="25" class="td_bg"> <input type="text" name="price" value="<?= isset($info) ? $info->price : '' ?>"> </td> <td width="100" height="25" class="bg_tr">规格/型号</td> <td height="25" class="td_bg"> <input type="text" name="model" value="<?= isset($info) ? $info->model : '' ?>"> </td> <td width="100" height="25" class="bg_tr">产地</td> <td height="25" class="td_bg"> <input type="text" name="producing_area" value="<?= isset($info) ? $info->producing_area : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">数量</td> <td class="td_bg"> <input type="text" name="number" value="<?= isset($info) ? $info->number : '' ?>"> </td> <td width="100" height="25" class="bg_tr">单位</td> <td height="25" class="td_bg" colspan="3"> <input type="text" name="monad" value="<?= isset($info) ? $info->monad : '' ?>"> </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 type="button" class="ACT_btn back-btn" name="Submit2" value=" 返回 "> </td> </tr> </table> </div> <div id="_5" class="_div" style="display: none"> <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"> <?php if (count($parents) > 0): ?> <select onchange="changeCategory($(this))"> <option value="">--请选择--</option> <?php foreach ($parents as $parent): ?> <?php if(213 === $parent->id || 131 === $parent->id):?> <?php continue ?> <?php endif; ?> <option value="<?= $parent->id ?>" <?= isset($info) ? ($parent->id == $info->category->pid ? 'selected' : '') : '' ?>><?= $parent->name ?></option> <?php endforeach; ?> </select> <?php endif; ?> </td> <td width="100" height="25" class="bg_tr">分类名称</td> <td class="td_bg" width="300"> <select name="category_id" id="category_id"> <option value="">--请选择--</option> <?php if(isset($info)): ?> <?php $subs = \common\models\FixCarCategory::find()->where('pid='.$info->category->pid)->all() ?> <?php foreach($subs as $sub): ?> <option value="<?= $sub->id ?>" <?= $sub->id === $info->category_id ? 'selected' : '' ?>><?= $sub->name ?></option> <?php endforeach; ?> <?php else: ?> <?php endif; ?> </select> </td> <td width="100" height="25" class="bg_tr">配件名称</td> <td class="td_bg" width="300"> <input type="text" name="name" id="name" value="<?= isset($info) ? $info->name : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">价格</td> <td height="25" class="td_bg"> <input type="text" name="price" value="<?= isset($info) ? $info->price : '' ?>"> </td> <td width="100" height="25" class="bg_tr">规格/型号</td> <td height="25" class="td_bg"> <input type="text" name="model" value="<?= isset($info) ? $info->model : '' ?>"> </td> <td width="100" height="25" class="bg_tr">产地</td> <td height="25" class="td_bg"> <input type="text" name="producing_area" value="<?= isset($info) ? $info->producing_area : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">数量</td> <td class="td_bg"> <input type="text" name="number" value="<?= isset($info) ? $info->number : '' ?>"> </td> <td width="100" height="25" class="bg_tr">单位</td> <td height="25" class="td_bg" colspan="3"> <input type="text" name="monad" value="<?= isset($info) ? $info->monad : '' ?>"> </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 type="button" class="ACT_btn back-btn" name="Submit2" value=" 返回 "> </td> </tr> </table> </div> <div id="_6" class="_div" style="display: none"> <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"> <?php if (count($parents) > 0): ?> <select onchange="changeCategory($(this))"> <option value="">--请选择--</option> <?php foreach ($parents as $parent): ?> <?php if(213 === $parent->id || 131 === $parent->id):?> <?php continue ?> <?php endif; ?> <option value="<?= $parent->id ?>" <?= isset($info) ? ($parent->id == $info->category->pid ? 'selected' : '') : '' ?>><?= $parent->name ?></option> <?php endforeach; ?> </select> <?php endif; ?> </td> <td width="100" height="25" class="bg_tr">分类名称</td> <td class="td_bg" width="300"> <select name="category_id" id="category_id"> <option value="">--请选择--</option> <?php if(isset($info)): ?> <?php $subs = \common\models\FixCarCategory::find()->where('pid='.$info->category->pid)->all() ?> <?php foreach($subs as $sub): ?> <option value="<?= $sub->id ?>" <?= $sub->id === $info->category_id ? 'selected' : '' ?>><?= $sub->name ?></option> <?php endforeach; ?> <?php else: ?> <?php endif; ?> </select> </td> <td width="100" height="25" class="bg_tr">配件名称</td> <td class="td_bg" width="300"> <input type="text" name="name" id="name" value="<?= isset($info) ? $info->name : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">价格</td> <td height="25" class="td_bg"> <input type="text" name="price" value="<?= isset($info) ? $info->price : '' ?>"> </td> <td width="100" height="25" class="bg_tr">规格/型号</td> <td height="25" class="td_bg"> <input type="text" name="model" value="<?= isset($info) ? $info->model : '' ?>"> </td> <td width="100" height="25" class="bg_tr">产地</td> <td height="25" class="td_bg"> <input type="text" name="producing_area" value="<?= isset($info) ? $info->producing_area : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">数量</td> <td class="td_bg"> <input type="text" name="number" value="<?= isset($info) ? $info->number : '' ?>"> </td> <td width="100" height="25" class="bg_tr">单位</td> <td height="25" class="td_bg" colspan="3"> <input type="text" name="monad" value="<?= isset($info) ? $info->monad : '' ?>"> </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 type="button" class="ACT_btn back-btn" name="Submit2" value=" 返回 "> </td> </tr> </table> </div> <div id="_7" class="_div" style="display: none"> <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"> <?php if (count($parents) > 0): ?> <select onchange="changeCategory($(this))"> <option value="">--请选择--</option> <?php foreach ($parents as $parent): ?> <?php if(213 === $parent->id || 131 === $parent->id):?> <?php continue ?> <?php endif; ?> <option value="<?= $parent->id ?>" <?= isset($info) ? ($parent->id == $info->category->pid ? 'selected' : '') : '' ?>><?= $parent->name ?></option> <?php endforeach; ?> </select> <?php endif; ?> </td> <td width="100" height="25" class="bg_tr">分类名称</td> <td class="td_bg" width="300"> <select name="category_id" id="category_id"> <option value="">--请选择--</option> <?php if(isset($info)): ?> <?php $subs = \common\models\FixCarCategory::find()->where('pid='.$info->category->pid)->all() ?> <?php foreach($subs as $sub): ?> <option value="<?= $sub->id ?>" <?= $sub->id === $info->category_id ? 'selected' : '' ?>><?= $sub->name ?></option> <?php endforeach; ?> <?php else: ?> <?php endif; ?> </select> </td> <td width="100" height="25" class="bg_tr">配件名称</td> <td class="td_bg" width="300"> <input type="text" name="name" id="name" value="<?= isset($info) ? $info->name : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">价格</td> <td height="25" class="td_bg"> <input type="text" name="price" value="<?= isset($info) ? $info->price : '' ?>"> </td> <td width="100" height="25" class="bg_tr">规格/型号</td> <td height="25" class="td_bg"> <input type="text" name="model" value="<?= isset($info) ? $info->model : '' ?>"> </td> <td width="100" height="25" class="bg_tr">产地</td> <td height="25" class="td_bg"> <input type="text" name="producing_area" value="<?= isset($info) ? $info->producing_area : '' ?>"> </td> </tr> <tr> <td width="100" height="25" class="bg_tr">数量</td> <td class="td_bg"> <input type="text" name="number" value="<?= isset($info) ? $info->number : '' ?>"> </td> <td width="100" height="25" class="bg_tr">单位</td> <td height="25" class="td_bg" colspan="3"> <input type="text" name="monad" value="<?= isset($info) ? $info->monad : '' ?>"> </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 type="button" class="ACT_btn back-btn" name="Submit2" value=" 返回 "> </td> </tr> </table> </div> <script src="/js/common.js"></script> <script type="text/javascript" language="javascript"> function insertBtn(type){ if (!confirm('确定提交吗')) return false; var category_1 = $('#category_a').val(),category_2 = $('#category_b').val(); var params = ''; if(1 === type){ params = $('#theFrm').serialize(); }else if(2 === type){ params = $('#form2').serialize(); params += '&category_1=' + category_1 + '&category_2=' + category_2; }else if(3 === type){ params = $('#form3').serialize(); params += '&category_1=' + category_1 + '&category_2=' + category_2; } $.post('/store-room/put-in-store-info', params , function (msg) { alert(msg.msg); if (msg.success) { window.location.href = "/store-room/put-in-store"; } }, 'json'); } function saveBtn(type){ var category_1 = $('#category_a').val(),category_2 = $('#category_b').val(); var params = ''; if(1 === type){ params = $('#theFrm').serialize(); }else if(2 === type){ params = $('#form2').serialize(); params += '&category_1=' + category_1 + '&category_2=' + category_2; }else if(3 === type){ params = $('#form3').serialize(); params += '&category_1=' + category_1 + '&category_2=' + category_2; } $.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/put-in-store'; }); categoryChange(); function categoryChange(){ var index = $('#category_a').val(); $('#category_b').show(); if('1' === index || '5' === index){ $('#category_b').hide(); } $('._div').hide(); $('#_' + index).show(); } function changeCategory(obj){ var pid = obj.val(); if(pid < 1) return false; $.post('/fix-car-category/get-machine',{pid:pid},function(data){ if(data.success){ var categories = data.content,len = categories.length,options = '<option>--请选择--</option>'; for(var i = 0; i < len; i++){ options += '<option value="'+categories[i].id+'">'+categories[i].name+'</option>'; } obj.parents('table').find('#category_id ').html(options); } },'json'); } </script>