@model List<Hyt.Model.Api.OrderItem> <div class="caseout"> <form id="OrderShipForm" name="OrderShipForm" action=""> <div class="boxs_detail_dispay"> <div class="tit_con"> <table width="100%" cellspacing="0" cellpadding="0" border="0"> <tbody> <tr> <td></td> <td class="border_rnone"></td> <td class="nameright border_rnone">配送方式:</td> <td class="borde_left"> <div class="fl m10_l" style="margin-left: 0"> <select name="status" id="fstatus" class="fl select_ht28 wd150" onchange="changeStatus();"> <option value="1" selected="selected">全部发货:@ViewBag.deliveryTypeName</option> <option value="2">部分发货:请指定商品</option> @*<option value="3">321</option>*@ </select> </div> </td> </tr> <tr> <td></td> <td class="border_rnone"></td> <td class="nameright border_rnone"><span class="v_star">*</span>快递单号:</td> <td class="borde_left"> <input type="text" name="expressNo" id="expressNo" class="wd150" value="" maxlength="100" /><span class="prompt m10_l" id="c_expressNo">填写快递单号</span> </td> </tr> @{ foreach (var item in Model) { var specStr = ""; var productSysNo = Hyt.BLL.Supply.OrderBLL.Instance.GetProductSysNo(item.SysNo); var d = Hyt.DataAccess.Supply.IOrderDao.Instance.GetPdProductSpecPricessSysId(productSysNo); if (d != null) { var j = Newtonsoft.Json.Linq.JObject.Parse(d.SpecValue); try { specStr = j["PdProductSpecValues"]["spec"].ToString() + j["PdProductSpecValues"]["unit"].ToString(); } catch (Exception) { specStr = j["PdProductSpecValues"][0]["spec"].ToString() + j["PdProductSpecValues"][0]["unit"].ToString(); } } if (item.Quantity != item.RealStockOutQuantity) { <tr> <td> <input name="sysNo" type="checkbox" class="checktd" value="@item.SysNo"> </td> <td style="30%" class="nameright border_rnone">@(item.ProductName)</td> <td style="13%" class="nameright border_rnone">@(specStr)</td> <td style="57%" class="borde_left"> <input type="text" name="shopNO" class="shopNO pdCount" maxlength="999" value=" " /> <input type="hidden" value="@item.SysNo" class="sysid" /> <span class="prompt_qty m10_l">填写数量,最大<span class="v_star">@item.Quantity</span>件,已发 <span class="real">@item.RealStockOutQuantity</span>件</span> </td> </tr> } } } </tbody> </table> </div> <input type="hidden" id="soOrderSysNo" value="@ViewBag.soOrderSysNo" /> <input type="hidden" id="deliveryTypeName" value="@ViewBag.deliveryTypeName" /> <input type="hidden" id="TransactionSysNo" value="@ViewBag.deliveryTypeName" /> </div> </form> </div> <script src="~/Theme/scripts/jquery.validate.yui.js"></script> <script> $(function () { //表单验证 $("#OrderShipForm").validate({ rules: { expressNo: { required: true, maxlength: 100 } }, messages: { expressNo: { required: "快递单号必填", maxlength: "长度超出100个字" } }, errorPlacement: function (error, element) { element.parent().find('.prompt').attr('class', 'prompt error m10_l').text($(error).text()); }, success: function (span, element) { element.parent().find('.prompt').attr('class', 'prompt success m10_l').text('填写正确'); } }); //取可发数量 $(".pdCount").each(function () { var count = $(this).next().next().children('.v_star').html(); var realid = $(this).next().next().children(".v_star").next(".real").html(); var qty = Number(count) - Number(realid); $(this).val(qty); }); //全部发货禁用数量全选商品 if ($("#fstatus option:selected").val() == 1){ $('.shopNO').attr('readonly', true); //$('.checktd').checked = true; } }); //获取发货方式 vals = $('#fstatus option:selected').val(); function changeStatus() { if ($("#fstatus option:selected").val() == 2) { $('.shopNO').attr('readonly', false); //$('.checktd').checked = false; } else { $('.shopNO').attr('readonly', true); } vals = $('#fstatus option:selected').val(); } </script>