jquery之onchange事件2
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <c:set var="ctx" value="${pageContext.request.contextPath}" /> <jsp:include page="/jsp/common/header1.jsp"></jsp:include> <script type="text/javascript" src="${ctx }/js/common/area_linkage.js"></script> <script type="text/javascript" src="${ctx}/js/order/create_order_main.js?20140930"></script> <% String memberId1 = request.getParameter("memberId"); %> <c:set var="memberId1" value="<%=memberId1%>"/> <input type="hidden" id="memberId1" name="memberId1" value="${memberId1 }"/> <span style="font-weight: bold;font-size: 9pt">请选择订单来源:</span> <table class="queryTable" > <tbody> <tr> <td class="queryTitle" style="width:80px" >订单来源</td> <td class="queryContent" style="width:150px"> <input class="inputText" type="text" id="multiChannelId" style="width: 150px"/> </td> </tr> </tbody> </table> <!-- 会员查询区 --> <br/> <span style="font-weight: bold;font-size: 9pt">请选择会员: <a href="javascript:void(0)" onclick="addMemberPage();">注册新会员</a></span> <table class="queryTable" width="804" > <tr> <td class="queryTitle" width="80">联系电话</td> <td class="queryContent"> <input class="inputText" type="text" id="tel" style="width: 100px"/> </td> <td class="queryTitle" width="80">手机号码</td> <td class="queryContent"> <input class="inputText" type="text" id="mobile" style="width: 100px"/> </td> <td class="queryTitle" width="80">会员登录名</td> <td class="queryContent"> <input class="inputText" type="text" id="loginName" style="width: 100px"/> </td> <td align="right" colspan="2"> <a class="easyui-linkbutton" href="javascript:void(0)" iconCls="icon-search" onclick="queryMember()">查询</a> </td> </tr> </table> <!-- 会员grid --> <table id="memberGrid"></table> <br> <a class="easyui-linkbutton" href="javascript:void(0)" iconCls="icon-exportExcel" onclick="showImportDialog()">订单批量导入</a> <br> <!-- 商品或赠品grid --> <br/> <span style="font-weight: bold;font-size: 9pt">请选择商品和赠品: </span> <br/> <table id="orderItemEditGrid"></table> <br/> <!-- 收货地址grid --> <span style="font-weight: bold;font-size: 9pt">请选择收货地址: <a href="javascript:void(0)" onclick="addMemmberAddress();">使用新地址</a></span> <br/> <table id="addressGrid"></table> <!-- 发票信息 --> <br/> <span style="font-weight: bold;font-size: 9pt">请填写发票信息: </span> <form id="editInvoiceForm"> <table class="queryTable" id="invoiceTable"> <tbody> <tr id="headTr"> <td class="queryTitle" style="width:80px" >发票类型</td> <td class="queryContent" style="width:300px"> <input type="radio" id="general" name="invoiceType" value="general" onclick="changeType('general')"/>普通发票 <input type="radio" id="vat" name="invoiceType" checked="checked" value="none" onclick="changeType('none')"/>无发票 </td> </tr> </tbody> </table> </form> <table style="display: none"> <tbody id="general_table"> <tr rel="dny" id="cHeadTr"> <td class="queryTitle">发票内容类型</td> <td class="queryContent"> <input type="radio" id="private" name="invoiceContentType" value="private" onclick="changeContentType('private')"/>个人 <input type="radio" id="company" name="invoiceContentType" value="company" onclick="changeContentType('company')"/>单位 </td> </tr> </tbody> </table> <table style="display: none"> <tbody id="general_personal_table"> <tr rel="dny_gen"> <td class="queryTitle">发票内容</td> <td class="queryContent"> <input class="inputText text_plus" type="text" id="invoiceContent" name="invoiceContent" value="${orderInfo.invoiceContent }"/> </td> </tr> </tbody> </table> <table style="display: none"> <tbody id="general_company_table"> <tr rel="dny_gen"> <td class="queryTitle">单位名称</td> <td class="queryContent"> <input class="inputText text_plus" type="text" id="invoiceTitle" name="invoiceTitle" value="${orderInfo.invoiceTitle }"/> </td> </tr> <tr rel="dny_gen"> <td class="queryTitle">发票内容</td> <td class="queryContent"> <input class="inputText text_plus" type="text" id="invoiceContent" name="invoiceContent" value="${orderInfo.invoiceContent }"/> </td> </tr> </tbody> </table> <!-- 配送、支付信息 --> <span style="font-weight: bold;font-size: 9pt">请填写配送、支付信息: </span> <table class="queryTable" > <tbody> <!-- <tr> <td class="queryTitle" style="width:80px" >配送日期</td> <td class="queryContent" style="width:300px"> <select id="receiveDateType" name="receiveDateType"> <option value="">请选择</option> <option value="workday">工作日</option> <option value="holiday">节假日</option> <option value="allday" selected="selected">工作日、节假日均可</option> </select> </td> <td class="queryTitle" style="width:80px" >配送时间</td> <td class="queryContent" style="width:300px"> <select name="receiveTimeType" id="receiveTimeType" > <option value="">请选择</option> <option value="morning">上午</option> <option value="afternoon">下午</option> <option value="allday" selected="selected">全天均可</option> </select> </td> </tr> --> <tr> <td class="queryTitle" style="width:80px" >支付类型</td> <td class="queryContent" style="width:300px"> <select name="paymentMode" id="paymentMode" onchange="calcFee()"> <option value="" >请选择</option> <option value="KDFH" id="op_KDFH" selected="selected">款到发货</option> <option value="HDFK" id="op_HDFK">货到付款</option> </select> </td> <!-- <td class="queryTitle" style="width:80px">支付方式</td> <td class="queryContent"> <select id="paymentTypeId" name="paymentTypeId"> </select> </td> --> </tr> </tbody> </table> <span style="font-weight: bold;font-size: 9pt">优惠券信息: </span> <table class="queryTable" width="400"> <tbody> <tr> <td class="queryTitle" align="left"><input type="radio" id="couponNoID1" name="couponNoChoose" value="SRK" />请输入优惠券号 </td> <td class="queryContent"><input class="inputText easyui-validatebox" maxlength="20" type="text" id="couponNo" /></td> </tr> <tr> <td class="queryTitle" align="left"><input type="radio" id="couponNoID2" name="couponNoChoose" value="XL" checked="checked" />请使用账号中优惠券 </td> <td class="queryContent"> <select name="couponNoXLName" id="couponNoXL"> </select> </td> </tr> <tr> <td class="queryContent" align="center" colspan="2"> <label id="checkCouponNoA"><a class="easyui-linkbutton" href="javascript:void(0)" onclick="checkCouponNo()">确定</a></label> <label id="checkCouponNoQK"><a class="easyui-linkbutton" href="javascript:void(0)" onclick="checkCouponNoQK()">清空</a></label> </td> </tr> </tbody> </table> <!-- 结算信息 --> <br/> <span style="font-weight: bold;font-size: 9pt">结算信息如下: </span> <input type="hidden" id="deliveryFeeHid" name="deliveryFeeHid"/><!-- 运费 --> <input type="hidden" id="skuWeightsHid" name="skuWeightsHid"/><!-- 货品总重 --> <input type="hidden" id="skuFeeHid" name="skuFeeHid"/><!-- 货款金额 --> <input type="hidden" id="discountFeeHid" name="discountFeeHid"/><!-- 优惠后金额 --> <input type="hidden" id="orderFeeHid" name="orderFeeHid"/><!-- 订单金额 --> <table class="queryTable" > <tbody> <tr> <td class="queryTitle" style="width:60px" >使用积分</td> <td class="queryContent" style="width:700px" colspan="3"> <input class="inputText" type="text" id="orderPoints" style="width: 150px" onchange="calcFee();"/> 积分与现金兑换比例为<span style="color:red;font-size: 9pt" id="pointVsMoneySpan"></span>, 可用积分数为:<span style="color:red;font-size: 9pt" id="currentPoints"></span>, 兑换后可用现金为:<span style="color:red;font-size: 9pt" id="currentMoney"></span> </td> <td class="queryTitle" style="width:80px" >优惠券优惠金额</td> <td class="queryContent"> <input type="text" id="couponNoFee" value="" style="border:0px" readonly="readonly"/> </td> </tr> <tr> <td class="queryTitle" style="width:60px" >运费</td> <td id="deliveryFeeTd" class="queryContent" style="width:200px"> </td> <td class="queryTitle" style="width:60px" >订单金额</td> <td id="orderFeeTd" class="queryContent" style="width:200px"> </td> <td class="queryTitle" style="width:60px" >来源媒体</td> <td id="orderFeeTd" class="queryContent" style="width:200px"> <select id="addUrlFromNo" name="addUrlFromNo"> <option value="健一网" selected="selected">健一网</option> <option value="网盟">网盟</option> <option value="搜索引擎">搜索引擎</option> </select> </td> </tr> </tbody> </table> <!-- 提交按钮 --> <div style="width:700px;margin-top: 5px;text-align: center"> <!-- <a class="easyui-linkbutton" href="javascript:void(0)" iconCls="icon-ok" onclick="calcFee()">计算订单金额</a> --> <a class="easyui-linkbutton" href="javascript:void(0)" iconCls="icon-ok" onclick="doCreateOrder()">提交订单</a> <a class="easyui-linkbutton" href="javascript:void(0)" iconCls="icon-cancel" onclick="closeTab()">取消下单</a> </div> <!-- 注册新会员 --> <div id="addMemberDlg" class="easyui-window" closed="true" title="" iconCls="icon-add" style="width:400px; height:280px;text-align:center; background: #fafafa;"> <div class="easyui-layout" fit="true"> <div region="center" border="false" style="background:#fff;border:1px solid #ccc;padding-left: 30px;"> <form id="addForm" method="POST"> <table border="0" class="queryTable" > <tr> <td class="queryTitle" width="100">登录帐号</td> <td class="queryContent" align="left" colspan = "2"> <input class="inputText easyui-validatebox" maxlength = "40" type="text" id="addLoginName" /> <a class="easyui-linkbutton" href="javascript:void(0)" onclick="checkLoginName()">校验</a> </td> </tr> <tr> <td class="queryTitle" width="100">登录密码</td> <td class="queryContent" align="left" colspan = "3"> <input class="txt01 easyui-validatebox" maxlength = "20" type="Password" id="addLoginPassword" /> </td> </tr> <tr> <td class="queryTitle" width="100">确认密码</td> <td class="queryContent" align="left" colspan = "3"> <input class="txt01 easyui-validatebox" maxlength = "20" type="Password" id="addConfirmPassword" /> </td> </tr> <tr> <td class="queryTitle" width="100">会员姓名</td> <td class="queryContent" align="left" colspan = "3"> <input class="inputText easyui-validatebox" maxlength = "40" type="text" id="addRealName" /> </td> </tr> <tr> <td class="queryTitle" width="100">手机号</td> <td class="queryContent" align="left" colspan = "3"> <input class="inputText easyui-validatebox" maxlength = "20" type="text" id="addMobile" /> </td> </tr> </table> </form> </div> <div region="south" border="false" style="text-align:center;height:30px;line-height:30px;"> <a class="easyui-linkbutton" href="javascript:void(0)" iconCls="icon-ok" onclick="addMember()">确定</a> <a class="easyui-linkbutton" href="javascript:void(0)" iconCls="icon-cancel" onclick="closeAddMemberDlg()">取消</a> </div> </div> </div> <!-- 新增收货地址 --> <div id="addMemberAddressWindow" class="easyui-window" title="" closed="true" iconCls="icon-add" style="width:650px; height:320px;text-align:center; background: #fafafa;"> <div class="easyui-layout" fit="true"> <div region="center" border="false" style="background:#fff;border:1px solid #ccc;padding-left: 30px;"> <form id="addMemberAddressForm" method="POST" style="width: 380px;height:230px; text-align: center;"> <input type="hidden" id="hdProId" /> <input type="hidden" id="hdCityId" /> <input type="hidden" id="hdAreaId" /> <table border="0" class="queryTable" width="580px" height="190px" style="margin-bottom: 0px" > <tr> <td class="queryTitle" style="width:80px" >收货地址</td> <td class="queryContent" style="width:670px" colspan="3"> <input id="provinceId" required="true" /> 省 <input class="inputText" type="text" id="cityId" required="true" /> 市 <input class="inputText" type="text" id="areaId" required="true" /> 区 <br><br> <input type="text" class="inputText easyui-validatebox" style="margin-bottom: 4px;width: 400px" validType="maxLength[40]" id="fullAddress" name="fullAddress" required="true"/> </td> </tr> <tr> <td class="queryTitle">收货人</td> <td class="queryContent"> <input class="inputText easyui-validatebox" type="text" id="receiveUser" name="receiveUser" required="true"/> </td> <td class="queryTitle">手机</td> <td class="queryContent"> <input class="inputText easyui-validatebox" type="text" id="receiveMobile" name="receiveMobile" required="true" validType="maxLength[11]"/> </td> </tr> <tr> <td class="queryTitle">电话</td> <td class="queryContent"> <input class="inputText" type="text" id="receiveTel" name="receiveTel" validType="maxLength[12]"/> </td> <td class="queryTitle">邮编</td> <td class="queryContent"> <input class="inputText" type="text" id="receivePost" name="receivePost" /> </td> </tr> </table> </form> </div> <div region="south" border="false" style="text-align:center;height:30px;line-height:30px;"> <a id="okBtn" class="easyui-linkbutton" iconCls="icon-ok" href="javascript:void(0)" onclick="saveAdd()">确定</a> <a id="cancelBtn" class="easyui-linkbutton" iconCls="icon-cancel" href="javascript:void(0)" onclick="closeMemberAddressWindow()">取消</a> </div> </div> </div> <!-- 查看会员详情 --> <div id="memberManagerView" class="easyui-window" title="" iconCls="icon-search" closed="true"></div>
create_order_main.js
var appPath = getAppPath(); var _memberId = "";//会员id var _memberCurrentPoints = 0;//会员当前可用积分 var _pointVsMoney = 0;//现金与积分兑换比例参数 $(function(){ $("#checkCouponNoA").show(); $("#checkCouponNoQK").hide(); genMemberGrid(); if($("#memberId1").val()!="" && $("#memberId1").val()!=null){ queryMember2(); } genSkuGrid(); genAddressGrid(); generateAdrr(); genMulChannelComb(); getEcMultiChannelByNo(); //genPaymentTypeComb(); genNumberBox(); $("#vat").click(); $("#deliveryFeeTd").text("0.00");//运费显示为0 $("#orderFeeTd").text("0.00");//订单显示为0 $("#orderPoints").val("0"); $("#currentPoints").text("0"); $("#currentMoney").text("0"); //查找现金与积分兑换比例参数 _pointVsMoney = findPointVsMoneyParam(); $("#pointVsMoneySpan").text(_pointVsMoney+":1"); $.extend($.fn.validatebox.defaults.rules, { maxLength: { validator: function(value, param){ return value.length <= param[0]; }, message: '最大{0}字,请确认 ' } }); }); /** * 生成会员Grid */ function genMemberGrid(){ $("#memberGrid").datagrid({ // url:appPath+'/page/createOrder/member/list', height:'160', nowrap: true, striped: true, remoteSort:false, singleSelect:true, idField:'memberId', checkbox:false, frozenColumns:[[ {field:'memberId',title:'操作',width:50,align:'center', formatter:function(value,rowData,rowIndex){ return "<img onclick='toQueryMemberPage("+value+")' width='12px' height='12px' style='border:0px' src='"+appPath+"/js/lib/jquery-easyui/themes/icons/search.png' title='查看会员详情' />"; } } ]], columns:[[ {field:'realName',title:'会员姓名',width:80,align:'left',sortable:false}, {field:'loginName',title:'会员账号',width:80,align:'left',sortable:false}, {field:'mobile',title:'手机号码',width:80,align:'left',sortable:false}, {field:'tel',title:'电话号码',width:80,align:'left',sortable:false}, {field:'memberRankName',title:'会员等级',width:80,align:'left',sortable:false}, {field:'provinceName',title:'省',width:65,align:'left',sortable:false}, {field:'cityName',title:'市',width:65,align:'left',sortable:false}, {field:'areaName',title:'区/县',width:65,align:'left',sortable:false}, {field:'paymentLimit',title:'支付方式限制',width:65,align:'left',sortable:false, formatter:function(val){ if(val=="only_KDFH"){ return "只能使用款到发货进行支付"; }else{ return ""; } }}, {field:'memberState',title:'黑名单',width:65,align:'left',sortable:false, formatter:function(val){ if(val=="black"){ return "已加入黑名单无法下单"; }else{ return ""; } }} ]], pagination:true, rownumbers:true, pageSize:4, pageList:[4], onLoadSuccess:function(){ $("#memberGrid").datagrid('selectRow','0');//默认选中第1行 }, onSelect:function(rowIndex, rowData){ _memberId = rowData.memberId; _memberCurrentPoints = rowData.currentPoints; $("#op_HDFK").attr("disabled",false); if(rowData.paymentLimit=="only_KDFH"){ $("#op_HDFK").attr("disabled",true); } loadAddressGrid(_memberId); $("#currentPoints").html(_memberCurrentPoints); var currentMoney = Math.round((_memberCurrentPoints/_pointVsMoney)*Math.pow(10,2))/Math.pow(10,2); $("#currentMoney").text(parseInt(currentMoney)); //个人优惠券加载 couponNoXLComb(rowData.memberId); } }); } /** * 生成商品grid */ function genSkuGrid(){ $("#orderItemEditGrid").datagrid({ url:appPath+'/page/order/0/items', height:160, striped: true, remoteSort:false, singleSelect:false, rownumbers:true, idField:'orderItemId', checkbox:true, frozenColumns:[[ {field:'ck',checkbox:true}, {field:'opt',title:'操作',width:32,align:'center', formatter:function(value,rowData,rowIndex){ return "<img class='op-enable' src='"+appPath+"/js/lib/jquery-easyui/themes/icons/pencil.png' onClick='beginEditorData(\""+rowIndex+"\",\""+rowData.goodsType+"\")' title='编辑'/>"; } } ]], columns:[[ {field:'goodsNo',title:'商品编码',width:100,align:'left',sortable:true}, {field:'goodsName',title:'商品名称',width:150,align:'left',sortable:true}, {field:'goodsType',title:'商品类型',width:80,align:'left',sortable:true,formatter:function(value){ switch(value){ case "gift": return "赠品"; break; case "group": return "组合商品"; break; default: return "普通商品"; break; } } }, {field:'goodsBiaoshi',title:'商品标识',width:80,align:'left',sortable:true, formatter:function(value){ if(value=="OTC") { return "非处方药甲类"; }else if(value=="TC") { return "处方药"; }else if(value=="OTHER") { return "普通商品"; }else if(value=="SG") { return "隐形眼镜"; }else if(value=="OTCy") { return "非处方药乙类"; }else if(value=="DF") { return "代发商品"; } } }, {field:'goodsOldPrice',title:'原价',width:80,align:'right',sortable:true,formatter:function(value){if(!isNaN(Number(value))){return Number(value).toFixed(2);}}}, {field:'goodsPrice',title:'成交价',width:60,align:'right',editor:{type:'numberbox',options:{required:true,min:0,precision:2}},sortable:true,formatter:function(value){if(!isNaN(Number(value))){return Number(value).toFixed(2);}}}, {field:'goodsAmount',title:'数量',width:60,align:'right',editor:{type:'numberbox',options:{required:true,min:1,precision:0}},sortable:true, formatter:function(value){ if(!isNaN(Number(value))){ return Number(value).toFixed(2); } } }, {field:'goodStock',title:'库存',width:60,align:'right',sortable:true,formatter:function(value){if(!isNaN(Number(value))){return Number(value).toFixed(2);}}}, {field:'goodsSumFee',title:'小计金额',width:60,align:'right',editor:{type:'numberbox',options:{required:true,min:0,precision:2,disabled:true}},sortable:true,formatter:function(value){if(!isNaN(Number(value))){return Number(value).toFixed(2);}}}, {field:'weight',title:'重量',hidden:true}, {field:'volume',title:'体积',hidden:true} ]], toolbar:[{ id:'btnadd', text:'添加商品', iconCls:'icon-add', handler:function(){ var exceptGoodsIdString = ""; var rows = $("#orderItemEditGrid").datagrid("getRows"); for(var i=0;i<rows.length;i++){ if(rows[i].goodsType != "gift"){ exceptGoodsIdString = exceptGoodsIdString + rows[i].goodsId +","; } } exceptGoodsIdString = exceptGoodsIdString.substring(0,exceptGoodsIdString.lastIndexOf(",")); var argObj = new Object(); if(exceptGoodsIdString){ argObj.exceptGoodsIdString = exceptGoodsIdString; } showGoodsQueryDialog("","","addGoods",argObj); } }, // 屏蔽添加赠品功能-wangjun // '-',{ // id:'btnaddGift', // text:'添加赠品', // iconCls:'icon-add', // handler:function(){ // var exceptGiftIdString = ""; // var rows = $("#orderItemEditGrid").datagrid("getRows"); // for(var i=0;i<rows.length;i++){ // if(rows[i].goodsType == "gift"){ // exceptGiftIdString = exceptGiftIdString + rows[i].goodsId +","; // } // } // exceptGiftIdString = exceptGiftIdString.substring(0,exceptGiftIdString.lastIndexOf(",")); // var argObj = new Object(); // if(exceptGiftIdString){ // argObj.exceptGiftIdString = exceptGiftIdString; // } // showGiftQueryDialog("","","addGift",argObj); // } // }, '-',{ id:'btndelMu', text:'删除', iconCls:'icon-cancel', handler:function(){ var selections = $("#orderItemEditGrid").datagrid('getSelections'); if(selections == null || selections == ''){ $.messager.alert('提示信息','请选择要删除的数据','info'); return ; } for(var i=0;i<selections.length;i++){ var row = selections[i]; var rowIndex = $("#orderItemEditGrid").datagrid('getRowIndex',row); $("#orderItemEditGrid").datagrid('deleteRow',rowIndex); calcFee(); } } }] }); } /** * 生成收货地址grid */ function genAddressGrid(){ $("#addressGrid").datagrid({ url:appPath+'/page/createOrder/memberAddress/list', queryParams:{memberId:'0'},//"ec_refrigeration_info"表示新闻类别为制冷资讯 height:'160', nowrap: true, striped: true, remoteSort:false, singleSelect:true, idField:'memberAddressId', checkbox:false, frozenColumns:[[{field:'ck',checkbox:true}]], columns:[[ {field:'isDefault',title:'默认',width:80,align:'left',sortable:false,formatter:function data(value){ if(value!=""){ if(value=="Y"){ return "是"; }else{ return "否"; } } }}, {field:'consignee',title:'收货人',width:80,align:'left',sortable:false}, {field:'fullAddress',title:'收货地址',width:300,align:'left',sortable:false}, {field:'tel',title:'固定电话',width:100,align:'left',sortable:false}, {field:'mobile',title:'手机号码',width:100,align:'left',sortable:false} ]], pagination:true, rownumbers:true, pageSize:4, pageList:[4], onClickRow:function(){calcFee()}, onLoadSuccess:function(){ $("#addressGrid").datagrid('selectRow','0');//默认选中第1行 } }); } /** * 选择发票类型radio * @param type */ function changeType(type){ $("#invoiceTable tr[rel^=dny]").remove(); var defContentType = $("#defContentType").val(); switch(type){ case "general": $("#headTr").after($("#general_table").html()); if($("input[type=radio][name=invoiceContentType][value="+defContentType+"]").length > 0){ $("input[type=radio][name=invoiceContentType][value="+defContentType+"]").click(); }else{ $("input[type=radio][name=invoiceContentType]:eq(0)").click(); } break; case "vat": $("#headTr").after($("#vat_table").html()); break; default: break; } } /** * 选择发票内容类型radio * @param type */ function changeContentType(type){ $("#invoiceTable tr[rel=dny_gen]").remove(); switch(type){ case "private": $("#cHeadTr").after($("#general_personal_table").html()); break; case "company": $("#cHeadTr").after($("#general_company_table").html()); break; default: $("#cHeadTr").siblings().remove(); break; } } /** * 打开注册新会员窗口 */ function addMemberPage(){ $('#addForm').form('clear'); $('#addMemberDlg').window({ title:'注册新会员', width:500, height:280, left:100, modal: true, shadow: true, collapsible:false, minimizable:false, maximizable:false }); $('#addMemberDlg').window('move',{top:20}); $('#addMemberDlg').window('open'); } /** * 检验会员账号是否存在 * @returns */ function checkLoginName(){ var data = new Object(); data = {"loginName":$.trim($('#addLoginName').val())}; if(data.loginName==""||data.loginName==null){ $.messager.alert('提示信息','请输入登录帐号。','info'); return; } var url = appPath+"/page/createOrder/member/checkLoginName"; var result; doAjax({ url:url, type:'post', async:false, data:data, success:function(data){ if (data == "exist") { $.messager.alert('提示信息','输入的登录帐号已存在。','info'); result = false; } else { $.messager.alert('提示信息','恭喜,该登录帐号可以注册。','info'); result = true; } } }); return result; } /** * 保存新会员 */ function addMember(){ if (checkLoginName()==true){ var loginName = $.trim($("#addLoginName").val()); var loginPassword = $.trim($("#addLoginPassword").val()); var confirmPassword = $.trim($("#addConfirmPassword").val()); var realName = $.trim($("#addRealName").val()); var mobile = $.trim($("#addMobile").val()); if(loginName == '') { $.messager.alert('提示信息','请录入登录帐号!','info'); return; } if(loginPassword == '') { $.messager.alert('提示信息','请录入登录密码!','info'); return; } if(confirmPassword == '') { $.messager.alert('提示信息','请录入确认密码!','info'); return; } if(confirmPassword != loginPassword) { $.messager.alert('提示信息','确认密码与登录密码不一致!','info'); return; } doAjax({ url:appPath+'/page/createOrder/member/add', type:'post', data:{"loginName":loginName, "loginPassword":loginPassword, "realName":realName, "mobile":mobile}, success:function(data){ if(data='ok'){ $.messager.alert('提示信息','注册成功!','info'); } if(data!='ok'){ $.messager.alert('提示信息','抱歉,新增未能完成,'+data,'error'); } closeAddMemberDlg(); //一、根据手机号码,查询出刚添加的记录,并选中 $("#telphone").val(""); $("#mobile").val(mobile); $("#loginName").val(""); queryMember(); }, error:function(XMLHttpRequest, textStatus, errorThrown){ $.messager.alert('提示信息','抱歉,新增未能完成,'+textStatus,'error'); } }); } } /** * 关闭注册会员窗口 */ function closeAddMemberDlg(){ $('#addMemberDlg').window('close'); } /** * 查询会员 */ function queryMember(){ $('#memberGrid').datagrid('options').url = appPath+'/page/createOrder/member/list'; var param = $('#memberGrid').datagrid('options').queryParams; param.mobile = $.trim($('#mobile').val()); param.loginName = $.trim($("#loginName").val()); param.tel = $.trim($("#tel").val()); param.memberId=""; $("#memberGrid").datagrid('unselectAll'); $("#memberGrid").datagrid('load',param); } /** * 查询会员 */ function queryMember2(){ $('#memberGrid').datagrid('options').url = appPath+'/page/createOrder/member/list'; var param = $('#memberGrid').datagrid('options').queryParams; if($("#memberId1").val()!="" && $("#memberId1").val()!=null){ param.memberId = $.trim($("#memberId1").val()); }else{ param.memberId="0"; } $("#memberGrid").datagrid('unselectAll'); $("#memberGrid").datagrid('load',param); } /** * 重新加载会员Grid */ function reloadMemberGrid(){ //$("#memberGrid").datagrid('unselectAll'); $("#memberGrid").datagrid('reload'); } /** * 根据会员id,查询收货地址列表 * @param memberId */ function loadAddressGrid(memberId){ var param = $("#addressGrid").datagrid('options').queryParams; param.memberId = memberId; $("#addressGrid").datagrid('unselectAll'); $("#addressGrid").datagrid('load',param); } /** * 打开收货地址窗口 */ function addMemmberAddress(){ $('#addMemberAddressForm').form('clear'); $('#addMemberAddressWindow').window({ title:"添加收货地址", iconCls:'icon-add', modal: true, shadow: true, collapsible:false, minimizable:false, maximizable:false }); $('#addMemberAddressWindow').window('move',{top:300}); $('#addMemberAddressWindow').window('open'); } /** * 生成地址下拉框 */ function generateAdrr(){ var proFn = function(){ if($("#provinceId").combobox("getData").length > 1 && $("#hdProId").val()){ $("#provinceId").combobox("select",$("#hdProId").val()); } }; var cityFn = function(){ if($("#cityId").combobox("getData").length > 1 && $("#hdCityId").val()){ $("#cityId").combobox("select",$("#hdCityId").val()); $("#hdCityId").val(""); } }; var areaFn = function(){ if($("#areaId").combobox("getData").length > 1 && $("#hdAreaId").val()){ $("#areaId").combobox("select",$("#hdAreaId").val()); $("#hdAreaId").val(""); } }; createAreaLinkage("provinceId","cityId","areaId",proFn,cityFn,areaFn); } /** * 保存收货地址 */ function saveAdd(){ if(!$('#addMemberAddressForm').form('validate')){ return; } var memberId = _memberId; var provinceId = $("#provinceId").combobox("getValue"); var cityId = $("#cityId").combobox("getValue"); var areaId = $("#areaId").combobox("getValue"); var address = $("#fullAddress").val(); var mobile = $("#receiveMobile").val(); var tel = $("#receiveTel").val(); var post = $("#receivePost").val(); var consignee = $("#receiveUser").val(); if(provinceId==null||provinceId==""){ $.messager.alert('提示信息','请选择省份!','info'); return; } if(cityId==null||cityId==""){ $.messager.alert('提示信息','请选择市!','info'); return; } if(areaId==null||areaId==""){ $.messager.alert('提示信息','请选择区县!','info'); return; } var memberAddress = {memberId:memberId,provinceId:provinceId,cityId:cityId,areaId:areaId,address:address,mobile:mobile,tel:tel,post:post,consignee:consignee}; if(memberId==""||memberId==null){ $.messager.alert('提示信息','请先选择会员,再添加收货地址!','info'); return; } doAjax({ url:appPath+'/page/createOrder/memberAddr/add', type:'post', data:memberAddress, success:function(data){ if(data='ok'){ $.messager.alert('提示信息','新增成功!','info'); } if(data!='ok'){ $.messager.alert('提示信息','抱歉,新增未能完成,'+data,'error'); } closeMemberAddressWindow(); loadAddressGrid(memberId); }, error:function(XMLHttpRequest, textStatus, errorThrown){ $.messager.alert('提示信息','抱歉,新增未能完成,'+textStatus,'error'); } }); } /** * 关闭新增收货地址窗口 */ function closeMemberAddressWindow(){ $('#addMemberAddressWindow').window('close'); } /** * 生成多渠道combox */ function genMulChannelComb(){ $("#multiChannelId").combobox({ url:appPath+"/page/createOrder/mulChannel/combox", valueField:"id", textField:"text", panelHeight:"auto", editable:false }); } /** * 生成支付方式combox */ function genPaymentTypeComb(){ doAjax({ url:appPath+'/page/createOrder/paymentType/combox', type:'post', data:"", async:false, success:function(data){ var options=""; for(var i=0;i<data.length;i++){ options = options + "<option value='"+data[i].paymentTypeId+"'>"+data[i].paymentTypeName+"</option>"; } $("#paymentTypeId").html(options); }, error:function(XMLHttpRequest, textStatus, errorThrown){ $.messager.alert('提示信息','系统错误,请与管理员联系!','error'); } }); } /** * 订单来源默认选中呼叫中心 */ function getEcMultiChannelByNo(){ doAjax({ url:appPath+'/page/createOrder/mulChannel/getByNo', type:'post', data:"", async:false, success:function(data){ var multiChannelId = data;//呼叫中心对应的multiChannelId $("#multiChannelId").combobox("setValue",multiChannelId); }, error:function(XMLHttpRequest, textStatus, errorThrown){ $.messager.alert('提示信息','系统错误,请与管理员联系!','error'); } }); } /** * 添加货品(关闭货品查询公共窗口后回调方法) * @param {} goodsDatas */ function addGoods(goodsDatas){ if(!goodsDatas){ return ; } for(var i=0;i<goodsDatas.length;i++){ var goods = goodsDatas[i]; var goodsObj = new Object(); // goodsObj.orderItemId =""; goodsObj.goodsId = goods.goodsId; goodsObj.goodsType = "general"; goodsObj.goodsNo = goods.goodsNo; goodsObj.goodsName = goods.goodsName; goodsObj.goodsBiaoshi = goods.goodsBiaoshi; goodsObj.goodsOldPrice = Number(goods.ecPrice).toFixed(2); goodsObj.goodsPrice = Number(goods.ecPrice).toFixed(2); goodsObj.goodStock = Number(goods.availableStock).toFixed(2); goodsObj.goodsAmount = 1; goodsObj.goodsSumFee = Number(goods.ecPrice).toFixed(2); goodsObj.weight = Number(goods.weight).toFixed(2); goodsObj.volume = Number(goods.volume).toFixed(2); $("#orderItemEditGrid").datagrid("appendRow",goodsObj); } var lastIndex = $('#orderItemEditGrid').datagrid('getRows').length-1; beginEditorData(lastIndex,"general"); $("#orderItemEditGrid").datagrid("getEditor",{index:lastIndex,field:'goodsAmount'}).target.blur(); } /** * 添加赠品(关闭赠品查询公共窗口后回调方法) * @param {} giftDatas */ function addGift(giftDatas){ if(!giftDatas){ return ; } for(var i=0;i<giftDatas.length;i++){ var gift = giftDatas[i]; var giftObj = new Object(); // giftObj.orderItemId = "newOrderItem_"+(new Date()).getTime(); giftObj.goodsId = gift.giftId; giftObj.goodsType = "gift"; giftObj.goodsNo = gift.giftNo; giftObj.goodsName = gift.giftName; giftObj.goodsOldPrice = Number(gift.giftPrice).toFixed(2); giftObj.goodsPrice = 0; giftObj.goodStock = Number(gift.giftStock).toFixed(2); giftObj.goodsAmount = 1; giftObj.goodsSumFee = 0; giftObj.weight = 0; giftObj.volume = 0; $("#orderItemEditGrid").datagrid("appendRow",giftObj); var lastIndex = $('#orderItemEditGrid').datagrid('getRows').length-1; beginEditorData(lastIndex,"gift"); $("#orderItemEditGrid").datagrid("getEditor",{index:lastIndex,field:'goodsAmount'}).target.blur(); } } /** * 货品grid,开始编辑,并且绑定事件 * @param {} rowIndex */ function beginEditorData(rowIndex,goodsType){ $("#orderItemEditGrid").datagrid('beginEdit',rowIndex); var priceEditor = $("#orderItemEditGrid").datagrid("getEditor",{index:rowIndex,field:'goodsPrice'}); var amountEditor = $("#orderItemEditGrid").datagrid("getEditor",{index:rowIndex,field:'goodsAmount'}); // #11198 有改价权限时,可以修改成交价 if (!checkUserButtonRight2('edit_cost_price_create',false) || goodsType == "gift"){ priceEditor.target.attr("disabled","disabled"); } else{ priceEditor.target.removeAttr("disabled"); } priceEditor.target.attr("editIndex",rowIndex); priceEditor.target.blur(function(){sumFee(this);}); amountEditor.target.attr("editIndex",rowIndex); amountEditor.target.blur(function(){sumFee(this);}); } /** * 货品grid,计算金额,退出编辑 */ function sumFee(dom){ var editIndex = $(dom).attr("editIndex"); var priceEditor = $("#orderItemEditGrid").datagrid("getEditor",{index:editIndex,field:"goodsPrice"}); var amountEditor = $("#orderItemEditGrid").datagrid("getEditor",{index:editIndex,field:"goodsAmount"}); var feeEditor = $("#orderItemEditGrid").datagrid("getEditor",{index:editIndex,field:"goodsSumFee"}); var price = priceEditor.actions.getValue(priceEditor.target); var amount = amountEditor.actions.getValue(amountEditor.target); amount = Number(amount); if(isNaN(amount)){ return ; } price = Number(price); if(isNaN(price)){ return ; } var allRows = $("#orderItemEditGrid").datagrid("getRows"); //计算Grid中当前编辑记录中“小计金额” var sumFee = Math.round((price*amount)*Math.pow(10,2))/Math.pow(10,2); feeEditor.actions.setValue(feeEditor.target,sumFee); $("#orderItemEditGrid").datagrid("endEdit",editIndex); calcFee(); } /*检查用户是否为黑名单*/ function checkIsBlack(memberId){ var flag = true; doAjax({ url:appPath + "/page/member/checkIsBlack", type:"post", async : false, data:{ "memberId":memberId }, success:function(data){ if(data.memberState=="black"){ flag = false; } } }); return flag; } /** * 保存订单, */ function doCreateOrder(){ var submitObj = new Object(); var calcParam = new Object(); //订单来源提交数据 submitObj.multiChannelId = $("#multiChannelId").combobox("getValue"); if(submitObj.multiChannelId==null){ $('body,html').scrollTop(0); $.messager.alert('提示',"请选择订单来源!",'info'); return; } //会员提交数据 var memberRecord = $("#memberGrid").datagrid("getSelected"); //#13492 bug 修复 if (!checkUserButtonRight2('commit_order_hfl',false) && !(/^((?!hfl).)*$/.test(memberRecord.loginName)) ) { $.messager.alert('提示',"会员名包含hfl的用户暂时不支持后台下单!",'info'); return ; } if(memberRecord==null){ $('body,html').scrollTop(0); $.messager.alert('提示',"请选择会员!",'info'); return; } /*判断是否是黑名单*/ if(!checkIsBlack(memberRecord.memberId)){ $.messager.alert('提示',"对不起,您的账号暂时无法下单,谢谢!"); return; } submitObj.memberId = memberRecord.memberId; submitObj.loginName = memberRecord.loginName; //货品和赠品提交数据 var changedArray = []; var insertRows = $("#orderItemEditGrid").datagrid("getChanges","inserted"); var insertLength = insertRows.length; if(insertLength > 0){ for(var i=0;i<insertLength;i++){ insertRows[i].orderItemId = null; } $.merge(changedArray,insertRows); } if(changedArray.length > 0){ submitObj.items = JSON.stringify(changedArray); }else{ $('body,html').scrollTop(0); $.messager.alert('提示',"请选择商品!",'info'); return; } //收货地址提交数据 var addressRecord = $("#addressGrid").datagrid("getSelected"); if(addressRecord==null){ $('body,html').scrollTop(0); $.messager.alert('提示',"请选择收货地址!",'info'); return; } submitObj.memberAddressId = addressRecord.memberAddressId; //地址ID submitObj.receiveUser = addressRecord.consignee; submitObj.provinceId = addressRecord.provinceId; submitObj.cityId = addressRecord.cityId; submitObj.areaId = addressRecord.areaId; submitObj.receiveAddress = addressRecord.address; submitObj.receiveFullAddress = addressRecord.fullAddress2; if(addressRecord.post==null){ submitObj.receivePost = ""; }else{ submitObj.receivePost = addressRecord.post; } submitObj.receiveTel = addressRecord.tel2; submitObj.receiveMobile = addressRecord.mobile2; submitObj.receiveEmail = addressRecord.email; //发票信息提交数据 var invioceObj = $("#editInvoiceForm").serializeObject(); $.extend(submitObj,invioceObj); //配送和支付提交数据 //submitObj.receiveDateType = $("#receiveDateType").val(); //submitObj.receiveTimeType = $("#receiveTimeType").val(); submitObj.paymentMode = $("#paymentMode").val(); //submitObj.paymentTypeId = $("#paymentTypeId").val(); submitObj.orderPoints =$("#orderPoints").val(); // if(submitObj.receiveDateType==null||submitObj.receiveDateType==""){ // $('body,html').scrollTop(0); // $.messager.alert('提示',"请选择配送日期!",'info'); // return; // } // if(submitObj.receiveTimeType==null||submitObj.receiveTimeType==""){ // $('body,html').scrollTop(0); // $.messager.alert('提示',"请选择配送时间!",'info'); // return; // } if(submitObj.paymentMode==null||submitObj.paymentMode==""){ $.messager.alert('提示',"请选择支付类型!",'info'); return; } submitObj.orderPoints =$("#orderPoints").val(); if(submitObj.orderPoints==null||submitObj.orderPoints==""){ submitObj.orderPoints =0; } if(submitObj.orderPoints>_memberCurrentPoints){ $('body,html').scrollTop(0); $.messager.alert('提示',"所输入的积分数不能大于该会员的可用积分数!",'info'); return; } //结算信息提交数据,计算运费、货品总重、货款金额、优惠后金额、订单金额 $.extend(submitObj,calcFee()); if(submitObj.orderFee<=0){ $.messager.alert('提示',"订单金额不能小于0",'info'); return; } if(submitObj.orderFee<submitObj.deliveryFee){ $.messager.alert('提示',"订单金额不能小于运费",'info'); return; } submitObj.urlFromNo=$("#addUrlFromNo").val(); if($("#couponNoFee").val()>0){ var str=$('input:radio[name="couponNoChoose"]:checked').val(); //判断是选择输入框还是下拉框 if(str=="SRK"){ submitObj.couponNo=$("#couponNo").val(); //优惠券号码 }else if(str=="XL"){ submitObj.couponNo=$("#couponNoXL").val(); //优惠券号码 } } //销售下单账号积分使用判断 if(submitObj.orderPoints>0 && "jy"==submitObj.loginName){ $('body,html').scrollTop(0); $.messager.alert('提示',"jy账号不能使用积分!",'info'); return; } $('body,html').scrollTop(0); $.messager.confirm('提示信息','您确定提交订单吗?',function(r){ if(r){ doAjax({ url:appPath + "/page/createOrderConnector/orderInfo/save", type:"post", data:submitObj, success:function(data){ var code = data.code; switch(code){ case 0: $.messager.alert('提示',data.msg,'info'); break; case 1: $.messager.alert("下单成功!","订单号为:"+data.msg,'info'); break; case 2: $.messager.alert('提示',data.msg,'info'); break; case 3: $.messager.alert('提示',data.msg,'info'); break; default: $.messager.alert('提示',data,'info'); break; } }, error:function(XMLHttpRequest, textStatus, errorThrown){ $.messager.alert('提示信息','订单提交失败!,'+textStatus,'error'); } }); } }); } /** * 关闭货品Grid的编辑功能 */ function endEdit(){ var allRows = $("#orderItemEditGrid").datagrid("getRows"); for (var i=0;i<allRows.length;i++){ $("#orderItemEditGrid").datagrid("endEdit",i); } } /** * 计算运费、货品总重、货款金额、优惠后金额、订单金额 */ function calcFee(){ //积分必须是_pointVsMoney的倍数 if(parseInt($("#orderPoints").val())%_pointVsMoney>0){ $.messager.alert('提示',"积分必须是"+_pointVsMoney+"的倍数",'info'); return; } var calcParam = new Object(); //关闭货品Grid的编辑功能 //endEdit(); //收货地址提交数据 var addressRecord = $("#addressGrid").datagrid("getSelected"); if(addressRecord!=null){ calcParam.provinceId = addressRecord.provinceId; calcParam.cityId = addressRecord.cityId; calcParam.areaId = addressRecord.areaId; } var feeObject = new Object(); var orderSkuWeights = 0;//货品总重 var orderSkuVolume = 0;//货品总体积 var orderDeliveryFee = 0;//运费 var orderSkuFee = 0;//货款金额 var orderDiscountFee = 0;//优惠后金额 var orderFee = 0;//订单金额 var orderPointsMoney=0;//积分兑换后的现金值 var orderPoints = $("#orderPoints").val(); var otherDiscounts = 0;//其他优惠 var orderVouchers = 0;//使用代金劵 var discountFee = 0;//手工优惠 var couponNoFee=$("#couponNoFee").val(); //优惠券优惠金额 //检查现金与积分兑换比例参数是否设置 if(_pointVsMoney==""||_pointVsMoney==null){ $('body,html').scrollTop(0); $.messager.alert('提示',"现金与积分兑换比例参数未设置!",'info'); return; } //计算现金与积分兑换后的值 if(_memberCurrentPoints>0&&orderPoints>0&&_pointVsMoney!=0){ orderPointsMoney = Math.round((orderPoints/_pointVsMoney)*Math.pow(10,2))/Math.pow(10,2); } var allRows = $("#orderItemEditGrid").datagrid("getRows"); for (var i=0;i<allRows.length;i++){ var goodsOldPrice = Number(allRows[i].goodsOldPrice); var goodsPrice = Number(allRows[i].goodsPrice); var goodsAmount = Number(allRows[i].goodsAmount); var weight = Number(allRows[i].weight); var volume = Number(allRows[i].volume); var sumPrice = Number(allRows[i].goodsSumFee); var sumOldPrice = Math.round((goodsOldPrice*goodsAmount)*Math.pow(10,2))/Math.pow(10,2); orderSkuWeights += weight; orderSkuVolume += volume; orderSkuFee += sumOldPrice; orderDiscountFee += sumPrice; } calcParam.skuFee = orderDiscountFee; calcParam.skuWeights = orderSkuWeights; calcParam.skuVolume = orderSkuVolume; var temp=""; // if(addressRecord!=null&&(orderSkuWeights!=0||orderSkuVolume!=0)){ // //计算运费 // temp = calcDeliveryFee(calcParam); // } // if(temp=="-1"){ // $.messager.alert('提示',"运费规则未设置!",'info'); // return; // }else if(temp!=""&&temp!="-1"){ // orderDeliveryFee = temp; // } // orderFee =(orderDiscountFee + orderDeliveryFee) - orderPointsMoney - otherDiscounts - orderVouchers - discountFee; //积分的钱丢弃小数,取整 orderFee =((orderDiscountFee + orderDeliveryFee) - parseInt(orderPointsMoney) - otherDiscounts - orderVouchers - discountFee)-couponNoFee; feeObject.skuWeights = orderSkuWeights; feeObject.skuVolume = orderSkuVolume; feeObject.deliveryFee = orderDeliveryFee; feeObject.skuFee = orderDiscountFee;//新需求,货款金额取修改后金额orderDiscountFee feeObject.orderFee = orderFee; // feeObject.orderPoints = orderPointsMoney;//积分兑换后的金额 feeObject.otherDiscounts = otherDiscounts; feeObject.orderVouchers = orderVouchers; feeObject.discountFee = discountFee; feeObject.orderPayFee = orderFee; $("#deliveryFeeTd").text(orderDeliveryFee.toFixed(2)); if(orderDiscountFee-(parseInt(couponNoFee)+parseInt(orderPointsMoney))<=0){ orderFee=orderDeliveryFee; //优惠券不能抵消运费 } $("#orderFeeTd").text(orderFee.toFixed(2)); return feeObject; } /** * 生成积分数字框 */ function genNumberBox(){ $("#orderPoints").numberbox({ min:0, precision:0, max:9999999 }); } /** * 取消下单 */ function closeTab(){ parent.closeNewOrderTab(); } /** * 提交订单成功,打开新页签 */ function submitOrderOk(orderId,loginName,orderFee){ document.domain = 'j1.com'; parent.addTab("订单提交成功",appPath+"/page/createOrder/orderInfo/submitOk?orderId="+orderId+"&loginName="+encodeURI(encodeURI(loginName))+"&orderFee="+orderFee,"icon icon-auditPass",true,"submitOrderOk_iframe"); document.domain = null; } /** * 查找现金与积分兑换比例 */ function findPointVsMoneyParam(){ var pointVsMoney=""; doAjax({ url:appPath+'/page/createOrder/ecParam/findPointVsMoneyParam', type:'post', data:"", async:false, success:function(ecParams){ if(ecParams!=null&&ecParams!=""){ pointVsMoney = ecParams.pointVsMoney; } }, error:function(XMLHttpRequest, textStatus, errorThrown){ $.messager.alert('提示信息','系统错误,请与管理员联系!','error'); } }); return pointVsMoney; } /** * 查看会员详情 * @param memberId */ function toQueryMemberPage(memberId) { var data = new Object(); data = {"memberId":memberId}; var id = "memberManagerView"; var url = appPath+"/page/member/detail"; doAjax({ url:url, type:'post', data:data, success:function(data){ $("#"+id).empty().html(data); $("#"+id).window({ title:'查看会员详细信息', width:700, height:450, left:100, modal: true, shadow: true, collapsible:false, minimizable:false, maximizable:false }); $("#"+id).window('move',{top:0}); $("#"+id).window('open'); } }); } /** * 计算运费 * @param submitObj * @returns {String} */ function calcDeliveryFee(calcParam){ var orderInfo = new Object(); orderInfo.provinceId = calcParam.provinceId; orderInfo.cityId = calcParam.cityId; orderInfo.areaId = calcParam.areaId; orderInfo.skuFee = calcParam.skuFee; orderInfo.skuWeights = calcParam.skuWeights; orderInfo.skuVolume = calcParam.skuVolume; orderInfo.paymentMode = $("#paymentMode").val(); var orderDeliveryFee=""; doAjax({ url:appPath+'/page/getDeliveryFee', type:'post', data:orderInfo, async:false, success:function(data){ if(data!=null&&data!=""){ orderDeliveryFee = data; } }, error:function(XMLHttpRequest, textStatus, errorThrown){ $.messager.alert('提示信息','系统错误,请与管理员联系!','error'); } }); return orderDeliveryFee; } function showImportDialog(){ if(!$("#memberGrid").datagrid("getSelected")){ $.messager.alert('提示信息','请先选择会员!','info'); return ; } var isOpen = false; //访问一次服务器,检测是否登录失效,如果失效,就不打开子窗口,防止在子窗口中打开登录页面 doAjax({ async:false, url:appPath+'/page/system/checkOpenCommonPage', success:function(data,textStatus,jqXHR){ if(data && data == "ok"){ isOpen = true; } }, error:function(XMLHttpRequest, textStatus, errorThrown){ } }); if(!isOpen){ return ; } var isChrome = navigator.userAgent.toLowerCase().match(/chrome/) != null; if (isChrome) { var args1 = "height=510," + "width=850," + "toolbar =no," + "top =150," + "left =250," + "menubar=no," + "scrollbars=no," + "resizable=no," + "location=no," + "status=no"; window.open(appPath+"/jsp/order/order_import.jsp","",args1); }else{ var args = "dialogHeight:510px;"+ "dialogWidth:850px;"+ "center:true;"+ "help:no;"+ "status:no;"+ "location:no;"+ "dialogLeft:200px;"+ "dialogTop:170px;"+ "resizable:yes;"; var obj = new Object(); var member = $("#memberGrid").datagrid("getSelected"); obj.memberId = member.memberId; obj.realName = member.realName; obj.loginName = member.loginName; window.showModalDialog(appPath+"/jsp/order/order_import.jsp",obj,args); } } /** * 个人查询可用优惠劵 */ function couponNoXLComb(memberId){ doAjax({ url:appPath+"/page/createOrderConnector/memberCouponNoList?memberId="+memberId, type:'post', async:false, success:function(data){ if(data.length>0){ $("#couponNoXL").empty(); for(var i=0;i<data.length;i++){ $("#couponNoXL").append( "<option value='"+data[i].id+"'>"+data[i].text+"</option>" ); } } }, }); } /** * 验证优惠券(确定按钮,减金额) */ function checkCouponNo(){ var orderInfo=new Object(); //货品和赠品提交数据 var changedArray = []; var insertRows = $("#orderItemEditGrid").datagrid("getChanges","inserted"); var insertLength = insertRows.length; if(insertLength > 0){ for(var i=0;i<insertLength;i++){ insertRows[i].orderItemId = null; } $.merge(changedArray,insertRows); } if(changedArray.length > 0){ orderInfo.items = JSON.stringify(changedArray); }else{ $('body,html').scrollTop(0); $.messager.alert('提示',"请选择商品!",'info'); return; } //会员提交数据 var memberRecord = $("#memberGrid").datagrid("getSelected"); if(memberRecord==null){ $('body,html').scrollTop(0); $.messager.alert('提示',"请选择会员!",'info'); return; } var str=$('input:radio[name="couponNoChoose"]:checked').val(); //判断是选择输入框还是下拉框 //优惠券号 if(str=="SRK"){ if($("#couponNo").val()==null||$("#couponNo").val()==""){ $.messager.alert('提示',"请输入优惠券号",'info'); return; } if(checkNumberOrStr($("#couponNo").val())==false){ $.messager.alert('提示',"优惠券号只能为字母、数字",'info'); return; } orderInfo.couponNo=$("#couponNo").val(); }else if(str=="XL"){ if($("#couponNoXL").val()=="请选择"||$("#couponNoXL").val()==null||$("#couponNoXL").val()==""){ $.messager.alert('提示',"请使用账号中优惠券",'info'); return; } orderInfo.couponNo=$("#couponNoXL").val(); } orderInfo.memberId = memberRecord.memberId; doAjax({ url:appPath+'/page/createOrderConnector/order/checkVoucher', type:'post', data:orderInfo, async:false, success:function(data){ if(data.status=="NORMAL"){ //扣金额,灰按钮 if(data.result.result!="ok"){ $("#couponNoFee").val(""); //优惠券金额清空 if(str=="SRK"){ $("#couponNo").val(""); //优惠券号码清空 }else if(str=="XL"){ //个人优惠券加载 couponNoXLComb(_memberId); } $.messager.alert('提示信息',data.result.resultStr,'info'); return; }else{ //赋值优惠券金额 $("#couponNoFee").val(data.result.ecCoupons.discountFee); //重新计算订单金额(金额进行加) calcFee(); $("#checkCouponNoA").hide(); $("#checkCouponNoQK").show(); $("#couponNo").attr("readonly",true); } } $.messager.alert('提示信息',data.message,'info'); }, }); } /** * 优惠券清空(加金额) */ function checkCouponNoQK(){ var str=$('input:radio[name="couponNoChoose"]:checked').val(); //判断是选择输入框还是下拉框 $("#checkCouponNoA").show(); $("#checkCouponNoQK").hide(); $("#couponNoFee").val(""); //清空优惠券优惠金额,订单金额进行重新计算 $("#couponNo").attr("readonly",false); if(str=="SRK"){ $("#couponNo").val(""); //优惠券号码清空 }else if(str=="XL"){ //个人优惠券加载 couponNoXLComb(_memberId); //下拉框重置 } //重新计算订单金额(金额进行减) calcFee(); }
jquery之onchange事件2的更多相关文章
- jquery之onchange事件
$(function(){ $("#opreateHtml").window("close"); $("#deliveryGrid").da ...
- 使用JQuery UI selectmenu, onchange事件失效
今天, 在用jQuery UI的一套东西是发现<select class="dropmenu" onchange="do();"></sele ...
- 为什么Jquery对input file控件的onchange事件只生效一次
今天在做jquery对input file控件的onchange事件进行监听,就一直只生效一次,不知道Jquery为什么对file控件没有做到每次改变触发onchange事件的效果,但是还是有好几种解 ...
- JQuery EasyUI Combobox的onChange事件
html中的select 的change事件 <select id="consult_province" name="consult_province" ...
- JQuery EasyUI内Combobox的onChange事件
1.原始方法 我想写个html代码的都对下拉选择标签select不陌生,关于这个标签,在不加任何渲染的情况下,想要触发其onchange事件是很简单的一件事情,如下: <select id=&q ...
- jQuery下的onChange事件在某些情况下无效
onChage无效的原因: 虽然表面上感觉是当内容发生变化时,就会触发onchange事件,但是那只能在页面上操作.而如果通过dom对象去修改它的value则什么事也不会发生. onchange触发原 ...
- jquery触发两次onchange事件
在项目中需要给select绑定改变事件,来触发动作,但是发现改变一次select,onchange方法执行两遍 //这是那个标签,用的是我们公司内部的selectlist <select cla ...
- html input的file文件输入框onchange事件触发一次失效解决方法
最近在做一个图片上传的功能,出现提交一次后,file输入框的change事件无法再次触发的bug,就是说提交一次后必须刷新才能再次提交,这就坑了~ 于是想办法解决它~ 在网上找了一些资料,找到这几种方 ...
- JS改变input的value值不触发onchange事件解决方案 (转)
方法(一)(转载的网络资料) 需要了解的知识 首先,我们需要了解onchange和onpropertychange的不同: IE下,当一个HTML元素的属性改变的时候,都能通过 onprope ...
随机推荐
- smokeping报错Can't locate RRDs.pm in @INC (@INC contains
安装完smokeping,执行debug语句: ./bin/smokeping --debug-daemon ,提示如下错误: Can't locate RRDs.pm in @INC (@INC c ...
- SQL用row_number进行高速循环
SQL用row_number进行循环查询 declare @count int=0,@R int=0select row_number()over(order by RoomID) as R,* in ...
- SQL函数:用于将小写的数值翻译成大写的字符串
--功能: 用于将小写的数值翻译成大写的字符串(支持到分,即小数点后两位) --入口参数:@decNum------数字型变量 --返回:字符串 --举例:select db ...
- 总结:如何获取同一个DIV里的多个不同子标签的值,并赋值给input?
这个问题说起来简单,但对于新手来说,也着实卡了好久,并且我在网上搜了好久没能找到合适的答案, 于是去博问问了一下,得到许多大神们的帮助与回答,接下来我就总结一下能够实现这个效果的几种方法,既为了自己更 ...
- JQuery连接地址
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script> http://co ...
- memcache实例
<?php class demo { private $str_attr; private $int_attr; public function __get($name) { return $t ...
- FileReader
Reader 字符流的基类,抽象类 FileReader 读取文件的字符流 package file; import java.io.File; import java.io.FileReader; ...
- WinMain与WndProc以及窗口诞生过程总结
一.int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int nCmdShow) 四个 ...
- dos命令弹出对话框---Msg命令详解
标签: dos批处理对话框 2015-11-12 17:20 497人阅读 评论(0) 收藏 举报 脚本(30) 版权声明:本文为博主原创文章,未经博主允许不得转载. dos命令弹出对话框---Ms ...
- vector,list和deque区别
stl提供了三个最基本的容器:vector,list,deque. vector和built-in数组类似,它拥有一段连续的内存空间,并且起始地址不变,因此它能非常好的支持随即存取,即[]操作符,但由 ...