javascript - 无法获取dialog的值
扔个三星炸死你
扔个三星炸死你 2017-06-12 09:32:14
[JavaScript讨论组]

问题:有一个页面的input选值,点击input之后弹出dialog,选值之后,无法正确传回,怎么解决呢?

1.入口html

2.dialog

#foreach($item in $groups) #end
分销组代码 分销组名称 所属供应商 是否为公共分组 当前状态 操作时间 操作方式
$!item.code $!item.name $!item.supplierName #if($item.get_public() == 1) 是 #else 否 #end $statusMap.get($item.status) $dateTool.format("yyyy-MM-dd HH:mm:ss",$!item.updateTime) #if($shiro.hasPermission("groupUpd")) 修改 #end #if($shiro.hasPermission("groupProduct")) 分销产品 #end

#paginate($pagination, $url, $param)

3.js文件

/**
 * 控制分销组分销规则添加和修改页面
 * Created by yipeng.wang on 2015/9/10.
 */
var DistributorRule = {

    init: function() {
        $("#txt_proName").bind("click", DistributorRuleSelector.selectProduct);
        $("#span_proName").bind("click", DistributorRuleSelector.selectProduct);
        $("#btn_save").bind("click", DistributorRule.onSave);
        $("#sale_price_type").bind("change", function(){
            var txtCon = $("#sale_price_val");
            var type = parseInt($(this).val(), 10);
            switch(type) {
                case 0:
                    txtCon.val("");
                    break;
                case 1:
                    txtCon.val("{price}+");
                    break;
                case 2:
                    txtCon.val("{price}-");
                    break;
                case 3:
                    txtCon.val("{price}*");
                    break;
            }
        });
        $("#bookPessengerRequired").bind("change", function(){
            var val = $(this).val();
            if(val == 0) {
                $("#p_pessenger").hide();
            } else {
                $("#p_pessenger").show();
            }
        });
        $("input[name='chargeType_type']").each(function(index, ele){
            $(ele).bind("click", function(){
                var type = $(this).val();
                if(type == 0) {
                    $("#p_chargeType_type_1").hide();
                    $("#p_chargeType_type_2").hide();
                } else if(type == 1) {
                    $("#p_chargeType_type_1").show();
                    $("#p_chargeType_type_2").hide();
                } else {
                    $("#p_chargeType_type_1").hide();
                    $("#p_chargeType_type_2").show();
                }
            });
        });
        $("#btnAddFee").bind("click", function(){
            DistributorRule.onAddFeeClicked(null, null);
        });
        $("#bookAdvanceTime_picker").datetimepicker({
            pickDate: false
        });
        $("#bookStartTime_picker").datetimepicker({
            pickDate: false
        });
        $("#bookEndTime_picker").datetimepicker({
            pickDate: false
        });
        $("#refundType_2_time_picker").datetimepicker({
            pickDate: false
        });
        $("#refund_datepicker").datetimepicker({
            pickDate: true
        });
    },

    onAddFeeClicked: function(hour, fee){
        var p = $("

"); p.append($("在游玩日期前")); var input1 = $(""); input1.attr("type", "text"); input1.attr("name", "chargeType_type_2_hour"); if(hour != null && hour != undefined) { input1.val(hour); } p.append(input1); p.append($("小时退订费率为")); var input2 = $(""); input2.attr("type", "text"); input2.attr("name", "chargeType_type_2_fee"); if(fee != null && fee != undefined) { input2.val(fee); } p.append(input2); p.append($("  ")); var btn = $(""); btn.attr("href", "javascript:void(0)"); btn.html("删除"); btn.bind("click", function(){ p.remove(); }); p.append(btn); $("#p_chargeType_type_2").append(p); }, onSave: function() { if(!DistributorRuleValidate.checkBookingDatas()) { return; } if(!DistributorRuleValidate.checkPriceDatas()) { return; } if(!DistributorRuleValidate.checkRefundDatas()) { return; } var bookContactCredentialsType = DistributorRuleJCreator.createContactCredentials(); if(bookContactCredentialsType != null) { $("#bookContactCredentialsType").val(JSON.stringify(bookContactCredentialsType)); } var bookCredentialsType = DistributorRuleJCreator.createVisitorCredentials(); if(bookCredentialsType != null) { $("#bookCredentialsType").val(JSON.stringify(bookCredentialsType)); } var salePriceRule = DistributorRuleJCreator.createPrice(); if(salePriceRule != null) { $("#salePriceRule").val(JSON.stringify(salePriceRule)); } var refundRule = DistributorRuleJCreator.createRefund(); if(refundRule != null) { $("#refundRule").val(JSON.stringify(refundRule)); } $("#fdata").trigger("submit"); } }; var DistributorRuleValidate = { checkBookingDatas: function() { if(!DistributorRuleSelector.productSelected) { DistributorRuleTool.showMessage("请选择产品"); return false; } if($("input[name='ruleDto\\.bookLimitTime'][value='0']")[0].checked) { $("#bookAdvanceDay").val(""); $("#bookAdvanceTime").val(""); $("#bookMaxDay").val(""); } else { var bookAdvanceDay = $("#bookAdvanceDay").val(); var bookMaxDay = $("#bookMaxDay").val(); if(!DistributorRuleTool.checkDayNumber(bookAdvanceDay)) { DistributorRuleTool.showMessage("提前预定天数输入错误,输入值不能大于128。"); return false; } if(!DistributorRuleTool.checkDayNumber(bookMaxDay)) { DistributorRuleTool.showMessage("最多预定天数输入错误,输入值不能大于128。"); return false; } } var bookValidDay = $("#bookValidDay").val(); if(bookValidDay == "") { DistributorRuleTool.showMessage("请填写产品有效期"); return false; } if(!DistributorRuleTool.checkDayNumber(bookValidDay)) { DistributorRuleTool.showMessage("产品有效期,输入错误,输入值不能大于128。"); return false; } var bookStartTime = $("#bookStartTime").val(); var bookEndTime = $("#bookEndTime").val(); if((bookStartTime == "" && bookEndTime != "") || (bookStartTime != "" && bookEndTime == "")) { DistributorRuleTool.showMessage("预定的时间必须成对出现"); return false; } else if(bookStartTime != "" && bookEndTime != "") { var datas1 = bookStartTime.split(":"); var datas2 = bookEndTime.split(":"); var idata1 = parseInt(datas1[0], 10) * 3600 + parseInt(datas1[1], 10) * 60 + parseInt(datas1[2], 10); var idata2 = parseInt(datas2[0], 10) * 3600 + parseInt(datas2[1], 10) * 60 + parseInt(datas2[2], 10); if(idata1 >= idata2) { DistributorRuleTool.showMessage("预定开始时间不能大于或等于预定结束时间"); return false; } } var bookOrderMinimum = $("#bookOrderMinimum").val(); var bookOrderMaximum = $("#bookOrderMaximum").val(); var bookCredentialsMaximum = $("#bookCredentialsMaximum").val(); var bookPhoneMaximum = $("#bookPhoneMaximum").val(); if(bookOrderMinimum != "" && !DistributorRuleTool.checkNumber(bookOrderMinimum)) { DistributorRuleTool.showMessage("订单最少预定份数输入错误"); return false; } if(bookOrderMaximum != "" && !DistributorRuleTool.checkNumber(bookOrderMaximum)) { DistributorRuleTool.showMessage("订单最多预定份数输入错误"); return false; } if(bookCredentialsMaximum != "" && !DistributorRuleTool.checkNumber(bookCredentialsMaximum)) { DistributorRuleTool.showMessage("证件最多预定份数输入错误"); return false; } if(bookPhoneMaximum != "" && !DistributorRuleTool.checkNumber(bookPhoneMaximum)) { DistributorRuleTool.showMessage("手机号最多预定份数输入错误"); return false; } return true; }, checkPriceDatas: function(){ var workday = $("#sale_price_workday").val(); var weekend = $("#sale_price_weekend").val(); if(workday != "") { if(!DistributorRuleTool.checkMoney(workday)) { DistributorRuleTool.showMessage("请填写正确的产品平时价"); return false; } } if(weekend != "") { if(!DistributorRuleTool.checkMoney(weekend)) { DistributorRuleTool.showMessage("请填写正确的产品周末价"); return false; } } //var cval = /^\{price\}(\+|\-|\*)(([1-9]\d{0,6})|0)(\.\d{1,2})?$/; //if(!cval.test(val)) { // DistributorRuleTool.showMessage("产品价格公式填写有误"); // return false; //} return true; }, checkRefundDatas: function(){ if($("input[name='refundType'][value='0']")[0].checked) { return true; } if($("input[name='refundType'][value='2']")[0].checked) { var day = $("#refundType_2_day").val(); if(day == "") { DistributorRuleTool.showMessage("请填写提前退订的天数"); return false; } if(!DistributorRuleTool.checkDayNumber(day)) { DistributorRuleTool.showMessage("提前退订的天数输入错误,输入值不能大于128。"); return false; } } if($("input[name='refundType'][value='3']")[0].checked) { var day = $("#refundType_3_day").val(); if(day == "") { DistributorRuleTool.showMessage("请填写提前退订的天数"); return false; } if(!DistributorRuleTool.checkDayNumber(day)) { DistributorRuleTool.showMessage("提前退订的天数输入错误,输入值不能大于128。"); return false; } } if($("input[name='refundType'][value='4']")[0].checked) { var day = $("#refundType_4_day").val(); if(day == "") { DistributorRuleTool.showMessage("请填写允许退订的最终日期"); return false; } } if($("input[name='chargeType_type'][value='0']").checked) { return true; } if($("input[name='chargeType_type'][value='1']").checked) { var val = $("#chargeType_type_1_fee").val(); if(val == "") { DistributorRuleTool.showMessage("请填写退订手续费"); return false; } if(!DistributorRuleTool.checkMoney(val)) { DistributorRuleTool.showMessage("退订手续费输入错误"); return false; } } if($("input[name='chargeType_type'][value='2']").checked) { var hours = $("input[name='chargeType_type_2_hour']"); var fees = $("input[name='chargeType_type_2_fee']"); if(hours.length == 0 || fees.length == 0) { DistributorRuleTool.showMessage("请至少添加一条阶梯退款费率规则"); return false; } for(var index = 0; index < hours.length; index++) { var hour = $(hours[index]).val(); if(hour == "") { DistributorRuleTool.showMessage("请填写第" + (index + 1) + "条阶梯退款费率规则的小时参数"); return false; } if(!DistributorRuleTool.checkNumber(hour)) { DistributorRuleTool.showMessage("第" + (index + 1) + "条阶梯退款费率规则的小时参数输入错误"); return false; } } for(var index = 0; index < fees.length; index++) { var fee = $(fees[index]).val(); if(fee == "") { DistributorRuleTool.showMessage("请填写第" + (index + 1) + "条阶梯退款费率规则的费率参数"); return false; } if(!DistributorRuleTool.checkMoney(fee)) { DistributorRuleTool.showMessage("第" + (index + 1) + "条阶梯退款费率规则的费率参数输入错误"); return false; } } } return true; } }; var DistributorRuleJCreator = { createPrice: function(){ var workday_val = $("#sale_price_workday").val(); var weekend_val = $("#sale_price_weekend").val(); var root = {}; root.workday = workday_val; root.weekend = weekend_val; return root; }, createContactCredentials: function(){ if(!$("#bookContactCredentialsRequired")[0].checked) { return []; } var root = []; var eles = $("input[name='bookContactCredentials_type']"); for(var index = 0; index < eles.length; index++) { var ele = eles[index]; if(!ele.checked) { continue; } var jele = $(ele); var credential = {}; credential.key = jele.data("name"); credential.value = jele.val(); root.push(credential); } return root; }, createVisitorCredentials: function(){ if(!$("#bookCredentialsRequired")[0].checked) { return []; } var root = []; var eles = $("input[name='book_credentials_type']"); for(var index = 0; index < eles.length; index++) { var ele = eles[index]; if(!ele.checked) { continue; } var jele = $(ele); var credential = {}; credential.key = jele.data("name"); credential.value = jele.val(); root.push(credential); } return root; }, createRefund: function(){ var root = {}; var refund = {}; if($("input[name='refundType'][value='0']")[0].checked) { refund.type = 0; refund.value = ""; } else if($("input[name='refundType'][value='1']")[0].checked) { refund.type = 1; refund.value = ""; } else if ($("input[name='refundType'][value='2']")[0].checked) { refund.type = 2; var day = $("#refundType_2_day").val(); var time = $("#refundType_2_time").val(); refund.value = day + "-" + time; } else if($("input[name='refundType'][value='3']")[0].checked) { refund.type = 3; refund.value = $("#refundType_3_day").val(); } else { refund.type = 4; refund.value = $("#refundType_4_day").val(); } root.refund = refund; var charge = {}; var fees = []; if($("input[name='chargeType_type'][value='0']")[0].checked) { charge.type = 0; charge.feetype = 0; } else if($("input[name='chargeType_type'][value='1']")[0].checked) { charge.type = 1; var checked = $("input[name='chargeType_type_1_feetype'][value='0']")[0].checked; charge.feetype = checked ? 0 : 1; var fee = {}; fee.hour = "-1"; fee.value = $("#chargeType_type_1_fee").val(); fees.push(fee); } else { charge.type = 2; var checked = $("input[name='chargeType_type_2_feetype'][value='0']")[0].checked; charge.feetype = checked ? 0 : 1; var hourEles = $("input[name='chargeType_type_2_hour']"); var feeEles = $("input[name='chargeType_type_2_fee']"); for(var index = 0; index < hourEles.length; index++) { var fee = {}; fee.hour = $(hourEles[index]).val(); fee.value = $(feeEles[index]).val(); fees.push(fee); } } charge.fee = fees; root.charge = charge; return root; } }; var DistributorRuleJAnalysis = { analysisPrice: function(s) { var json = null; try { json = $.parseJSON(s); } catch(e) { return; } $("#sale_price_workday").val(json.workday); $("#sale_price_weekend").val(json.weekend); }, analysisContactCredentials: function(s) { var json = null; try { json = $.parseJSON(s); } catch(e) { return; } for(var index = 0; index < json.length; index++) { var jitem = json[index]; var val = jitem.value; $("input[name='bookContactCredentials_type'][value='" + val + "']").attr("checked", "checked"); } }, analysisVisitorCredentials: function(s) { var json = null; try { json = $.parseJSON(s); } catch(e) { return; } for(var index = 0; index < json.length; index++) { var jitem = json[index]; var val = jitem.value; $("input[name='book_credentials_type'][value='" + val + "']").attr("checked", "checked"); } }, analysisRefundRule: function(s) { var json = null; try { json = $.parseJSON(s); } catch(e) { return; } var refund = json.refund; $("input[name='refundType'][value='" + refund.type + "']").attr("checked", "checked"); var data = refund.value; var datas = data.split("-"); if(refund.type == 2) { $("#refundType_2_day").val(datas[0]); $("#refundType_2_time").val(datas[1]); } else if(refund.type == 3) { $("#refundType_3_day").val(datas[0]); } else if(refund.type == 4) { $("#refundType_4_day").val(datas[0]); } var charge = json.charge; var fees = charge.fee; $("input[name='chargeType_type'][value='" + charge.type + "']").attr("checked", "checked"); if(charge.type == 1) { $("#p_chargeType_type_1").show(); $("input[name='chargeType_type_1_feetype'][value='" + charge.feetype + "']").attr("checked", "checked"); $("#chargeType_type_1_fee").val(fees[0].value); } else if(charge.type == 2) { $("#p_chargeType_type_2").show(); $("input[name='chargeType_type_2_feetype'][value='" + charge.feetype + "']").attr("checked", "checked"); for(var index = 0; index < fees.length; index++) { var fee = fees[index]; DistributorRule.onAddFeeClicked(fee.hour, fee.value); } } }, makeSafe: function(data) { if(data == null || data == undefined) { return ""; } else { return data; } } }; var DistributorRuleSelector = { productSelected: false, selectProduct: function() { var url = "/distributorGroupRule/selectProducts.do"; var supplierId = $('#supplierId').val(); if(supplierId != undefined && supplierId != "") { url = url + "?supplierId=" + supplierId; } parent.ecModal({ title: "请点击选择产品", windowSize: "lg", button: false, closem: true, ajaxUrl: url, ajaxType: "list", shownFunction: function(){//弹出窗口后 对数据处理 parent.document.onkeydown = function(event){ var e = event || window.event || arguments.callee.caller.arguments[0]; if(e && e.keyCode==13){//enter 键 return false; } if(e && e.keyCode==32){//空格键 return false; } }; document.onkeydown = function(event){ var e = event || window.event || arguments.callee.caller.arguments[0]; if(e && e.keyCode==13){//enter 键 return false; } if(e && e.keyCode==32){//空格键 return false; } }; var mBody = parent.$(".modal-body", parent.$("#modalMsgTemplateHtml")); $("table tr:gt(0) button[class='btnClick btn btn-primary']", mBody).click(function(){ parent.$("#modalMsgTemplateHtml >.modal").modal("hide"); var thisTr = $(this.parentElement.parentElement); var productId = thisTr.data("productid"); var productName = $("td:eq(1)", this.parentElement.parentElement).text(); var goodName = $("td:eq(2)", this.parentElement.parentElement).text(); var supplierId = thisTr.data("supplierid"); var parentId = thisTr.data("id"); var parentProductId = thisTr.data("parentproductid"); var radios = parent.$("input[type=radio][name=type]", mBody); if($(radios).prop("checked") && $(radios).val() == 0){ $(".PMS_PRODUCT_ID").removeClass("hidden"); } else if($(radios).prop("checked") && $(radios).val() == 1){ $(".PMS_PRODUCT_ID").addClass("hidden"); $(".PMS_PRODUCT_ID").val(""); } else { $(".PMS_PRODUCT_ID").addClass("hidden"); $(".PMS_PRODUCT_ID").val(""); } DistributorRuleSelector.loadProductInfo(productId, productName, goodName, supplierId, parentProductId, parentId); }) } }); }, loadProductInfo: function(productId, productName, goodName, supplierId, parentProductId, parentId){ DistributorRuleSelector.productSelected = false; $("#txt_proName").val(""); var groupId = $("#distributorGroupId").val(); var params = "groupId=" + groupId + "&productId=" + productId + "&parentProductId=" + parentProductId + "&parentId=" + parentId; $.ajax({ url: "/distributorGroupRule/loadProductRule.do", type: "post", data: {"groupId":groupId, "productId":productId, "parentProductId":parentProductId, "parentId":parentId}, success: function(callbackData) { var json = null; try { json = callbackData; } catch(e) { //DistributorRuleTool.showMessage("无法获取产品信息"); alert("无法获取产品信息"); $(".PMS_PRODUCT_ID").addClass("hidden"); $(".PMS_PRODUCT_ID").val(""); return; } if(json.isExists) { //DistributorRuleTool.showMessage("当前分销组中已存在指定商品的分销规则,不能重复添加。"); alert("当前分销组已存在指定产品,请勿重复添加"); $(".PMS_PRODUCT_ID").addClass("hidden"); $(".PMS_PRODUCT_ID").val(""); return; } if(json.notAdd){ alert("当前分销组中不可分销该产品"); $(".PMS_PRODUCT_ID").addClass("hidden"); $(".PMS_PRODUCT_ID").val(""); return; } var booking = json.booking; if(json.hasProductRule) { var bookLimitTimes = $("input[name='ruleDto\\.bookLimitTime']"); if(booking.bookLimitTime == 0) { $(bookLimitTimes[0]).attr("checked", "checked"); } else { $(bookLimitTimes[1]).attr("checked", "checked"); $("#bookAdvanceDay").val(booking.bookAdvanceDay); $("#bookAdvanceTime").val(booking.bookAdvanceTime); $("#bookMaxDay").val(booking.bookMaxDay); } $("#bookStartTime").val(booking.bookStartTime); $("#bookEndTime").val(booking.bookEndTime); var bookValidTypes = $("input[name='ruleDto\\.bookValidType']"); if(booking.bookValidType == 0) { $(bookValidTypes[0]).attr("checked", "checked"); } else { $(bookValidTypes[1]).attr("checked", "checked"); } $("#bookValidDay").val(booking.bookValidDay); $("#p_bookValidArea").html(booking.bookValidArea); $("#bookValidArea").val(booking.bookValidArea); $("#bookOrderMinimum").val(booking.bookOrderMinimum); $("#bookOrderMaximum").val(booking.bookOrderMaximum); $("#bookCredentialsMaximum").val(booking.bookCredentialsMaximum); $("#bookPhoneMaximum").val(booking.bookPhoneMaximum); if(booking.bookContactCredentialsRequired == 1) { $("#bookContactCredentialsRequired").attr("checked", "checked"); var bookContactCredentialsTypes = booking.bookContactCredentialsTypes; for(var index = 0; index < bookContactCredentialsTypes.length; index++) { var bookContactCredentialsType = bookContactCredentialsTypes[index]; var checkbox = $("input[name='bookContactCredentials_type'][value='" + bookContactCredentialsTypes.key + "']"); if(checkbox.length > 0) { checkbox.attr("checked", "checked"); } } } if(booking.bookPessengerRequired == 1 || booking.bookPessengerRequired == 2) { if(booking.bookPessengerRequired == 1) { $("#bookPessengerRequired option").eq(1).attr("selected", "selected"); } else { $("#bookPessengerRequired option").eq(2).attr("selected", "selected"); } if(booking.bookNameRequired == 1) { $("#bookNameRequired").attr("checked", "checked"); } if(booking.bookPhoneRequired == 1) { $("#bookPhoneRequired").attr("checked", "checked"); } if(booking.bookCredentialsRequired) { $("#bookCredentialsRequired").attr("checked", "checked"); var bookCredentialsTypes = booking.bookCredentialsTypes; for(var index = 0; index < bookCredentialsTypes.length; index++) { var bookCredentialsType = bookCredentialsTypes[index]; var checkbox = $("input[name='book_credentials_type'][value='" + bookCredentialsType.key + "']"); if(checkbox.length > 0) { checkbox.attr("checked", "checked"); } } } } } $("#txt_proName").val(productName + "(" + goodName + ")"); $("#productId").val(productId); $("#supplierId").val(supplierId); //$("#parentProductId").val(parentProductId); $("#parentProductId").val(parentId); if(undefined != json.combinationFlag && json.combinationFlag == 1) { $('#combinationFlag').val("1"); } DistributorRuleSelector.productSelected = true; DistributorRuleSelector.getPriceList(json.prices, json.combinationFlag); } }); }, getPriceList : function(data, flag){ var productPrices = data; var results = []; var weeks = new Array('周日','周一','周二','周三','周四','周五','周六'); var week = []; $.each(productPrices, function(i, e){ results.push(""); results.push(''); results.push(e.saleStartTime + "到" + e.saleEndTime); results.push(''); results.push(""); var week_purchase_price = 0; var week_sell_price = 0; var work_purchase_price = 0; var work_sell_price = 0; if(undefined != flag && flag == 1) { results.push(''); $.each(e.prices, function(i2, e2){ results.push("产品:" + e2.productName); results.push(""); results.push("
"); results.push('

'); results.push('结算价:周末' + ''); results.push('  平日' + ''); results.push("

"); results.push('

'); results.push('销售价:周末' + ''); results.push('  平日' + ''); results.push("

"); results.push('
'); week_purchase_price = parseFloat(week_purchase_price) + parseFloat(e2.weekendDistributorPrice.purchasePrice); week_sell_price = parseFloat(week_sell_price) + parseFloat(e2.weekendDistributorPrice.salePrice); work_purchase_price = parseFloat(work_purchase_price) + parseFloat(e2.workdayDistributorPrice.purchasePrice); work_sell_price = parseFloat(work_sell_price) + parseFloat(e2.workdayDistributorPrice.salePrice); }); results.push(''); results.push(''); results.push(''); results.push(''); results.push(""); } else { results.push(''); results.push('

'); results.push('结算价:周末' + ''); results.push('  平日' + ''); results.push("

"); results.push('

'); results.push('销售价:周末' + ''); results.push('  平日' + ''); results.push("

"); results.push(""); week_purchase_price = parseFloat(week_purchase_price) + parseFloat(e.weekendPrice.purchasePrice); week_sell_price = parseFloat(week_sell_price) + parseFloat(e.weekendPrice.sellPrice); work_purchase_price = parseFloat(work_purchase_price) + parseFloat(e.workdayPrice.purchasePrice); work_sell_price = parseFloat(work_sell_price) + parseFloat(e.workdayPrice.sellPrice); } results.push(''); results.push('

'); results.push("结算总价:周末¥" + week_purchase_price.toFixed(2) +",平日¥" + work_purchase_price.toFixed(2) +""); results.push("

"); results.push('

'); results.push("销售总价:周末¥" + week_sell_price.toFixed(2) +",平日¥" + work_purchase_price.toFixed(2) +""); results.push("

"); results.push(""); results.push(''); for(var i = 0; i < e.weeksEffective.length; i++) { week.push(weeks[e.weeksEffective[i]]); } results.push(week.join(",")); week = []; results.push(""); results.push(""); }); $('.priceRule').html(results.join("")); } }; var DistributorRuleTool = { showMessage: function(msg, onOk, showCancel, title) { if(onOk == null || onOk == undefined) { onOk = function(){}; } if(showCancel == null || showCancel == undefined) { showCancel = false; } if(title == null || title == undefined) { title = "提示"; } parent.ecModal({ header: true, title: title, button: true, buttonCancel: showCancel, msg: msg, confirmCallback: onOk, shownFunction: function(){ parent.document.onkeydown = function(event){ var e = event || window.event || arguments.callee.caller.arguments[0]; if(e && e.keyCode==13){//enter 键 return false; } if(e && e.keyCode==32){//空格键 return false; } }; document.onkeydown = function(event){ var e = event || window.event || arguments.callee.caller.arguments[0]; if(e && e.keyCode==13){//enter 键 return false; } if(e && e.keyCode==32){//空格键 return false; } }; } }); }, checkMoney: function(data) { var regex = /^(([1-9]\d{0,6})|0)(\.\d{1,2})?$/; return regex.test(data); }, checkDayNumber: function(data) { if(!DistributorRuleTool.checkNumber(data)) { return false; } var idata = parseInt(data, 10); return (idata < 128); }, checkNumber: function(data) { var regex = /^\d+$/; return regex.test(data); } }; $(function(){ DistributorRule.init(); var pageMode = $("#pageMode").val(); if(pageMode == "edit") { DistributorRuleSelector.productSelected = true; } var bookContactCredentialsType = $("#bookContactCredentialsType").val(); var bookCredentialsType = $("#bookCredentialsType").val(); var salePriceRule = $("#salePriceRule").val(); var refundRule = $("#refundRule").val(); if(bookContactCredentialsType != "") { DistributorRuleJAnalysis.analysisContactCredentials(bookContactCredentialsType); } if(bookCredentialsType != "") { DistributorRuleJAnalysis.analysisVisitorCredentials(bookCredentialsType); } if(salePriceRule != "") { DistributorRuleJAnalysis.analysisPrice(salePriceRule); } if(refundRule != "") { DistributorRuleJAnalysis.analysisRefundRule(refundRule); } $("#bookContactCredentialsType").val(""); $("#bookCredentialsType").val(""); $("#salePriceRule").val(""); $("#refundRule").val(""); }); function js_week_sum(priceId) { var js_week_sum = 0; $.each($('.js_week_'+ priceId), function(i,e){ js_week_sum = parseFloat(js_week_sum) + parseFloat($(e).val()); }); $('.js_week_sum_' + priceId).html(js_week_sum.toFixed(2)); $('.js_week_sum_hidden_' + priceId).val(js_week_sum.toFixed(2)); } function js_work_sum(priceId) { var js_work_sum = 0; $.each($('.js_work_'+ priceId), function(i,e){ js_work_sum = parseFloat(js_work_sum) + parseFloat($(e).val()); }); $('.js_work_sum_' + priceId).html(js_work_sum.toFixed(2)); $('.js_work_sum_hidden_' + priceId).val(js_work_sum.toFixed(2)); } function xs_week_sum(priceId) { var xs_week_sum = 0; $.each($('.xs_week_'+ priceId), function(i,e){ xs_week_sum = parseFloat(xs_week_sum) + parseFloat($(e).val()); }); $('.xs_week_sum_' + priceId).html(xs_week_sum.toFixed(2)); $('.xs_week_sum_hidden_' + priceId).val(xs_week_sum.toFixed(2)); } function xs_work_sum(priceId) { var xs_work_sum = 0; $.each($('.xs_work_'+ priceId), function(i,e){ xs_work_sum = parseFloat(xs_work_sum) + parseFloat($(e).val()); }); $('.xs_work_sum_' + priceId).html(xs_work_sum.toFixed(2)); $('.xs_work_sum_hidden_' + priceId).val(xs_work_sum.toFixed(2)); }
扔个三星炸死你
扔个三星炸死你

全部回复(2)
typecho

同上、估计你也没有认真看玩这些代码、或者不属于你的代码

因为一般提问都是把出错地方的那段代码、或核心代码贴出来、

你这样一大坨真心不会去慢慢看啊、最重要的是问题很不明确、

言归正传

建议你把传的值存入Cookie中、要用就取出来、
这是最简单的解决方法、

PHP中文网

我猜没人会一行一行的把你 800+ 行的代码看完的。

/**
 * 控制分销组分销规则添加和修改页面
 * Created by yipeng.wang on 2015/9/10.
 */

你正在维护 2015 年的老系统吗?

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号