| | |
| | | * 验证数据是否为空 |
| | | */ |
| | | TGoodsInfoDlg.validate = function () { |
| | | $('#carInfoForm').data("bootstrapValidator").resetForm(); |
| | | $('#carInfoForm').bootstrapValidator('validate'); |
| | | return $("#carInfoForm").data('bootstrapValidator').isValid(); |
| | | |
| | | }; |
| | | |
| | | /** |
| | |
| | | |
| | | this.clearData(); |
| | | this.collectData(); |
| | | if(!this.validate()){ |
| | | return ; |
| | | } |
| | | const quantityIssuedInput = document.getElementById('quantityIssued'); |
| | | const pickUpQuantityInput = document.getElementById('pickUpQuantity'); |
| | | |
| | | const quantityIssued2 = Number(quantityIssuedInput.value); |
| | | const pickUpQuantity2 = Number(pickUpQuantityInput.value); |
| | | |
| | | if (isNaN(quantityIssued2) || isNaN(pickUpQuantity2)) { |
| | | } else if (quantityIssued2 >= pickUpQuantity2) { |
| | | } else { |
| | | Feng.error("发放数量必须大于等于限领数量") |
| | | return |
| | | } |
| | | let typeAll = document.querySelector('input[name="type"]:checked').value; |
| | | if(typeAll==2){ |
| | | let pCode = $("#pCode").val() |
| | |
| | | console.log("请选择相同运营商门店") |
| | | Feng.info("请选择相同运营商门店"); |
| | | |
| | | }else if(data.code == 200){ |
| | | }else if (data==5009){ |
| | | Feng.error("有效期开始时间不应小于假期课开始时间"); |
| | | return; |
| | | }else if (data==5008){ |
| | | Feng.error("有效期结束时间不应大于假期课结束时间"); |
| | | return; |
| | | } |
| | | else if(data.code == 200){ |
| | | if(language==1){ |
| | | Feng.success("添加成功!"); |
| | | }else if(language==2){ |
| | |
| | | },function(data){ |
| | | Feng.error("添加失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | var selectElement = document.getElementById("coursePackageId"); |
| | | var selectedText = selectElement.options[selectElement.selectedIndex].text; |
| | | |
| | | ajax.set("name",selectedText); |
| | | |
| | | ajax.set("typeAll",typeAll); |
| | | ajax.set("provinceCode",pCode); |
| | | ajax.set("cityCode",cCode); |
| | |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/tGoods/add", function(data){ |
| | | console.log("看看返回参数") |
| | | console.log(data) |
| | | if(data=="5001"){ |
| | | Feng.error("改账号已经存在"); |
| | | Feng.error("该账号已经存在"); |
| | | return; |
| | | }else if(data=="5003"){ |
| | | console.log("请选择相同运营商门店") |
| | | Feng.info("请选择相同运营商门店"); |
| | | |
| | | }else |
| | | if(data.code == 200){ |
| | | Feng.error("请选择相同运营商门店"); |
| | | return; |
| | | }else if (data==5009){ |
| | | Feng.error("有效期开始时间不应小于假期课开始时间"); |
| | | return; |
| | | }else if (data==5008){ |
| | | Feng.error("有效期结束时间不应大于假期课结束时间"); |
| | | return; |
| | | } else if(data.code == 200){ |
| | | if(language==1){ |
| | | Feng.success("添加成功!"); |
| | | }else if(language==2){ |
| | |
| | | window.parent.TPointProducts.table.refresh(); |
| | | TGoodsInfoDlg.close(); |
| | | }else{ |
| | | console.log("走这里") |
| | | Feng.error(data.msg); |
| | | return; |
| | | } |
| | | |
| | | },function(data){ |
| | |
| | | |
| | | } |
| | | TGoodsInfoDlg.addSubmit1 = function() { |
| | | let company = document.querySelector('input[name="company"]:checked').value; |
| | | let company = 3; |
| | | this.clearData(); |
| | | this.collectData(); |
| | | if(!this.validate()){ |
| | | return ; |
| | | } |
| | | var cityIds = []; |
| | | var cts = ""; |
| | | if (company === '2'){ |
| | |
| | | }else { |
| | | // 如果只有一个城市,则将cts设置为字符串 |
| | | if (cityIds.length === 1) { |
| | | console.log("是1吗?") |
| | | cts = cityIds[0]; |
| | | console.log(cts) |
| | | } else { |
| | | console.log("走下面了") |
| | | cts = cityIds.join(','); |
| | | console.log(cts) |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | var stores = ""; |
| | | if (company === '3'){ |
| | | if (company === 3 && $("#userType").val()!="3"){ |
| | | console.log('3---this.storeIds',this.storeIds); |
| | | if (TGoodsInfoDlg.storeIds.length === 0 ){ |
| | | return Feng.error('请至少选择一个门店'); |
| | |
| | | Feng.info("请上传实景图") |
| | | return; |
| | | } |
| | | |
| | | |
| | | const quantityIssuedInput = document.getElementById('quantityIssued'); |
| | | const pickUpQuantityInput = document.getElementById('pickUpQuantity'); |
| | | |
| | | const quantityIssued1 = Number(quantityIssuedInput.value); |
| | | const pickUpQuantity1 = Number(pickUpQuantityInput.value); |
| | | |
| | | if (isNaN(quantityIssued1) || isNaN(pickUpQuantity1)) { |
| | | Feng.error("优惠卷数量必须为数字") |
| | | console.log('Both quantityIssued and pickUpQuantity must be numbers.'); |
| | | return |
| | | } else if (quantityIssued1 >= pickUpQuantity1) { |
| | | |
| | | console.log('quantityIssued is greater than pickUpQuantity.'); |
| | | } else { |
| | | |
| | | Feng.error("发放数量必须大于限领数量") |
| | | return |
| | | console.log('quantityIssued is not greater than pickUpQuantity.'); |
| | | } |
| | | var imgOne =""; |
| | | console.log(goodImgs) |
| | | console.log(goodImgs.length) |
| | |
| | | return Feng.error('限领数量不能为空!'); |
| | | } |
| | | |
| | | // |
| | | // let quantityHas = $("#quantityHas").val(); |
| | | // if (quantityIssued <= quantityHas){ |
| | | // return Feng.error('发放数量小于已领数量!'); |
| | | // } |
| | | // let nums = $("#nums").val(); |
| | | // if (quantityIssued <= nums){ |
| | | // return Feng.error('发放数量小于已领数量!'); |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | TGoodsInfoDlg.editor = UE.getEditor('editor'); |
| | | TGoodsInfoDlg.editor1 = UE.getEditor('editor1'); |
| | | getProvince(null); |
| | | Feng.initValidator("carInfoForm", TGoodsInfoDlg.validateFields); |
| | | var drivingLicensePhoto = new $WebUpload("drivingLicensePhoto"); |
| | | drivingLicensePhoto.setUploadBarId("progressBar"); |
| | | drivingLicensePhoto.init(); |
| | |
| | | /** |
| | | * 选择分公司后执行 |
| | | */ |
| | | TGoodsInfoDlg.oneChange = function () { |
| | | TGoodsInfoDlg.oneChange = function (e) { |
| | | var oneId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tCity/onChange", function(data){ |
| | | if(data!=null){ |
| | |
| | | } |
| | | TGoodsInfoDlg.storeChange = function (e) { |
| | | var oneId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tCity/storeChange", function(data){ |
| | | var ajax = new $ax(Feng.ctxPath + "/coursePackage/queryStore", function(data){ |
| | | if(data!=null){ |
| | | if(language==1){ |
| | | var content='<option value="">选择门店</option>'; |
| | |
| | | $("#storeId").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("oneId",oneId); |
| | | ajax.set("cityCode",oneId); |
| | | ajax.start(); |
| | | } |
| | | TGoodsInfoDlg.packageChange = function (e) { |
| | | var oneId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tCity/packageChange", function(data){ |
| | | var ajax = new $ax(Feng.ctxPath + "/coursePackage/queryCoursePackageLists", function(data){ |
| | | if(data!=null){ |
| | | if(language==1){ |
| | | var content='<option value="">选择课包</option>'; |
| | |
| | | }else { |
| | | var content='<option value="">Pilih franchisee Anda</option>'; |
| | | } |
| | | $.each(data, function(k,v) { |
| | | $.each(data.rows, function(k,v) { |
| | | content += "<option value='"+v.id+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#coursePackageId").empty().append(content); |
| | | } |
| | | }); |
| | | ajax.set("oneId",oneId); |
| | | ajax.set("coursePackageTypeId",oneId); |
| | | ajax.set("order","desc"); |
| | | ajax.set("offset",0); |
| | | ajax.set("limit",100); |
| | | ajax.start(); |
| | | } |
| | | |
| | | |
| | | TGoodsInfoDlg.timeChange = function (e) { |
| | | var oneId=$(e).val(); |
| | | var ajax = new $ax(Feng.ctxPath + "/tCity/timeChange", function(data){ |
| | |
| | | var content='<option value="">Pilih franchisee Anda</option>'; |
| | | } |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.id+"'>"+v.classHours+"</option>"; |
| | | content += "<option value='"+v.id+"'>"+v.value+"</option>"; |
| | | }); |
| | | $("#coursePackageConfigId").empty().append(content); |
| | | } |