From 7e7f901b2172281dc294dfbc67e6ad00625f09f4 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期一, 04 三月 2024 10:11:21 +0800 Subject: [PATCH] 合并代码 --- cloud-server-management/src/main/webapp/static/modular/system/coursePackage/coursePackage_info.js | 437 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 384 insertions(+), 53 deletions(-) diff --git a/cloud-server-management/src/main/webapp/static/modular/system/coursePackage/coursePackage_info.js b/cloud-server-management/src/main/webapp/static/modular/system/coursePackage/coursePackage_info.js index abd40bf..d994f41 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/coursePackage/coursePackage_info.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/coursePackage/coursePackage_info.js @@ -2,7 +2,9 @@ * 用户详情对话框(可用于添加和修改对话框) */ var CoursePackageInfo = { + goodsPicArray1:[], userInfoData: {}, + goodsPicArray: [], }; @@ -46,6 +48,9 @@ * 提交添加用户 */ CoursePackageInfo.addSubmit = function () { + let objectType= $('#objectType').val(); + console.log("看看角色类型") + console.log(objectType) let province = $('#provinceCode option:checked').text(); let provinceCode = $('#provinceCode').val(); let city = $('#cityCode option:checked').text(); @@ -59,6 +64,23 @@ let codeTime = $('#codeTime').val(); let type = $('#type').val(); let holitime = $('#holitime').val(); + + console.log("=======这是type======"+type) + + var goodImgs = CoursePackageInfo.goodsPicArray1; + if(goodImgs.length==0){ + Feng.info("请上传详情图片") + return; + } + var imgOne =""; + for (let i = 0; i <goodImgs.length; i++) { + if(i==goodImgs.length-1){ + imgOne += (goodImgs[i].response) + }else { + imgOne+=(goodImgs[i].response+",") + } + + } // let classStartTime = JSON.stringify($('#classStartTime').val()); @@ -74,7 +96,12 @@ classWeeks += $(e).val() + ";"; }) let coverDrawing = $('#coverDrawing').val(); - let detailDrawing = $('#detailDrawing').val(); + var detailDrawing=""; + for (let i = 0; i <CoursePackageInfo.goodsPicArray.length ; i++) { + detailDrawing = detailDrawing+CoursePackageInfo.goodsPicArray[i]+","; + } + + let introduceDrawing = $('#introduceDrawing').val(); let sort = $('#sort').val(); let validDays = $('#validDays').val(); @@ -82,6 +109,9 @@ $('#price > .form-group').each(function (i, e) { let classHours = $($(e).find(".classNumber_span input[class='classNumber']")[0]).val(); let cash = $($(e).find(".cash_span input[class='cash']")[0]).val(); + if (typeof cash == "undefined"){ + console.log("========进入===") + } let paiCoin = $($(e).find(".paiCoin_span input[class='paiCoin']")[0]).val(); let counpons = $($(e).find(".counpons")).val(); price.push({ @@ -91,14 +121,18 @@ couponIds: typeof counpons == "undefined" ? 0 : counpons }); }); - if(null == provinceCode || '' == provinceCode){ - Feng.error("所在省不能为空"); - return + + if (objectType==1){ + if(null == provinceCode || '' == provinceCode){ + Feng.error("所在省不能为空"); + return + } + if(null == cityCode || '' == cityCode){ + Feng.error("所在市不能为空"); + return + } } - if(null == cityCode || '' == cityCode){ - Feng.error("所在市不能为空"); - return - } + if(null == storeId || '' == storeId){ Feng.error("所属门店不能为空"); return @@ -119,40 +153,165 @@ Feng.error("授课教师不能为空"); return } - // if(null == maxSubscribeNumber || '' == maxSubscribeNumber){ - // Feng.error("最多预约人数不能为空"); - // return - // } - // if(null == codeTime || '' == codeTime){ - // Feng.error("扣除课时数不能为空不能为空"); - // return - // } - // if(null == classStartTime || '' == classStartTime){ - // Feng.error("上课时间不能为空"); - // return - // } - // if(null == classWeeks || '' == classWeeks){ - // Feng.error("上课时间不能为空"); - // return - // } + + + + var checkboxes1 = document.getElementsByName('payType'); + var isChecked1 = false; + + for (var i = 0; i < checkboxes1.length; i++) { + if (checkboxes1[i].checked) { + isChecked1 = true; + break; + } + } + + console.log("看看选中") + console.log(isChecked1) + if (isChecked1) { + console.log("At least one checkbox is selected."); + } else { + Feng.error("请选择支付方式") + return; + } + + + var checkboxes = document.getElementsByName('payType'); + var isChecked = false; + var isChecked1 = false; + + for (var i = 0; i < checkboxes.length; i++) { + if (checkboxes[i].checked && checkboxes[i].value === '1') { + isChecked = true; + break; + } + } + + for (var i = 0; i < checkboxes.length; i++) { + if (checkboxes[i].checked && checkboxes[i].value === '2') { + isChecked1 = true; + break; + } + } + + if (isChecked1) { + var elements3 = document.getElementsByClassName('paiCoin'); + + for (var i = 0; i < elements3.length; i++) { + var value = elements3[i].value.trim(); + + if (value === '') { + Feng.error("请输入玩湃币价格") + return; + // Value is empty + // Perform your desired action + } else { + // Value is not empty + // Perform other actions + } + } + + + } + + + + if (isChecked) { + var elements2 = document.getElementsByClassName('cash'); + + for (var i = 0; i < elements2.length; i++) { + var value = elements2[i].value.trim(); + + if (value === '') { + Feng.error("请输入现金价格") + return; + // Value is empty + // Perform your desired action + } else { + // Value is not empty + // Perform other actions + } + } + + + } + + if (type == 1 ) { + var elements1 = document.getElementsByClassName('classNumber'); + + for (var i = 0; i < elements1.length; i++) { + var value = elements1[i].value.trim(); + + if (value === '') { + Feng.error("请输入课时数") + return; + // Value is empty + // Perform your desired action + } else { + // Value is not empty + // Perform other actions + } + } + + + + + var elements = document.querySelectorAll('[name="classStartTime"]'); + var isEmpty = false; + + for (var i = 0; i < elements.length; i++) { + if (elements[i].value.trim() === '') { + isEmpty = true; + break; + } + } + + if (isEmpty) { + Feng.error("请输入上课时间") + return; + console.log("At least one element with the name 'yourName' is empty."); + } else { + console.log("All elements with the name 'yourName' are filled."); + } + + + + if (null == maxSubscribeNumber || '' == maxSubscribeNumber) { + Feng.error("最多预约人数不能为空"); + return + } + if (null == codeTime || '' == codeTime) { + Feng.error("扣除课时数不能为空"); + return + } + if (null == classStartTime || '' == classStartTime) { + Feng.error("上课时间不能为空"); + return + } + if (null == classWeeks || '' == classWeeks) { + Feng.error("上课时间不能为空"); + return + } + + + + if (null == validDays || '' == validDays) { + Feng.error("课时有效期不能为空"); + return + } + } classWeeks = classWeeks.substring(0, classWeeks.length - 1); if(null == coverDrawing || '' == coverDrawing){ Feng.error("课包封面不能为空"); return } - if(null == detailDrawing || '' == detailDrawing){ - Feng.error("详情页不能为空"); - return - } + if(null == introduceDrawing || '' == introduceDrawing){ Feng.error("课包介绍不能为空"); return } - // if(null == validDays || '' == validDays){ - // Feng.error("课时有效期不能为空"); - // return - // } + let obj = { province: province, @@ -171,7 +330,7 @@ // classEndTime: classStartTime.split(" - ")[1], classWeeks: classWeeks, coverDrawing: coverDrawing, - detailDrawing: detailDrawing, + detailDrawing: imgOne, introduceDrawing: introduceDrawing, sort: sort, validDays: validDays, @@ -214,13 +373,31 @@ let codeTime = $('#codeTime').val(); let type = $('#type').val(); - let holitime = $('#holitime').val(); + + + + var goodImgs = CoursePackageInfo.goodsPicArray1; + // if(goodImgs.length==0){ + // Feng.info("请上传赛事活动图片") + // return; + // } + var imgOne =""; + for (let i = 0; i <goodImgs.length; i++) { + if(i==goodImgs.length-1){ + imgOne += (goodImgs[i].response) + }else { + imgOne+=(goodImgs[i].response+",") + } + + } + var inputElements = document.querySelectorAll('input[name="classStartTime"]'); - let classStartTime = JSON.stringify(Array.from(inputElements).map(function(element) { + var classStartTime = JSON.stringify(Array.from(inputElements).map(function(element) { return element.value; })) - + console.log("看下修改后的时间"); + console.log(classStartTime) // let classStartTime = $('#classStartTime').val(); let classWeeks = ''; $('input[name="classWeeks"]:checked').each(function (index, e) { @@ -240,6 +417,8 @@ let paiCoin = $($(e).find(".paiCoin_span input[class='paiCoin']")[0]).val(); let counpons = $($(e).find(".counpons")).val(); + + price.push({ classHours: classHours, cashPayment: typeof cash == "undefined" ? 0 : cash, @@ -248,14 +427,18 @@ }) }); - if(null == provinceCode || '' == provinceCode){ - Feng.error("所在省不能为空"); - return + + if ($('#objectType').val() == 1) { + if (null == provinceCode || '' == provinceCode) { + Feng.error("所在省不能为空"); + return + } + if (null == cityCode || '' == cityCode) { + Feng.error("所在市不能为空"); + return + } } - if(null == cityCode || '' == cityCode){ - Feng.error("所在市不能为空"); - return - } + if(null == storeId || '' == storeId){ Feng.error("所属门店不能为空"); return @@ -292,16 +475,162 @@ // Feng.error("周不能为空"); // return // } + if (type == 1 ) { + + var checkboxes1 = document.getElementsByName('payType'); + var isChecked1 = false; + + for (var i = 0; i < checkboxes1.length; i++) { + if (checkboxes1[i].checked) { + isChecked1 = true; + break; + } + } + + if (isChecked1) { + console.log("At least one checkbox is selected."); + } else { + Feng.error("请选择支付方式") + return; + } + + + var checkboxes = document.getElementsByName('payType'); + var isChecked = false; + var isChecked1 = false; + + for (var i = 0; i < checkboxes.length; i++) { + if (checkboxes[i].checked && checkboxes[i].value === '1') { + isChecked = true; + break; + } + } + + for (var i = 0; i < checkboxes.length; i++) { + if (checkboxes[i].checked && checkboxes[i].value === '2') { + isChecked1 = true; + break; + } + } + + if (isChecked1) { + var elements3 = document.getElementsByClassName('paiCoin'); + + for (var i = 0; i < elements3.length; i++) { + var value = elements3[i].value.trim(); + + if (value === '') { + Feng.error("请输入玩湃币价格") + return; + // Value is empty + // Perform your desired action + } else { + // Value is not empty + // Perform other actions + } + } + + + } + + + + if (isChecked) { + var elements2 = document.getElementsByClassName('cash'); + + for (var i = 0; i < elements2.length; i++) { + var value = elements2[i].value.trim(); + + if (value === '') { + Feng.error("请输入现金价格") + return; + // Value is empty + // Perform your desired action + } else { + // Value is not empty + // Perform other actions + } + } + + + } + + + var elements1 = document.getElementsByClassName('classNumber'); + + for (var i = 0; i < elements1.length; i++) { + var value = elements1[i].value.trim(); + + if (value === '') { + Feng.error("请输入课时数") + return; + // Value is empty + // Perform your desired action + } else { + // Value is not empty + // Perform other actions + } + } + + + + + var elements = document.querySelectorAll('[name="classStartTime"]'); + var isEmpty = false; + + for (var i = 0; i < elements.length; i++) { + if (elements[i].value.trim() === '') { + isEmpty = true; + break; + } + } + + if (isEmpty) { + Feng.error("请输入上课时间") + return; + console.log("At least one element with the name 'yourName' is empty."); + } else { + console.log("All elements with the name 'yourName' are filled."); + } + + + + if (null == maxSubscribeNumber || '' == maxSubscribeNumber) { + Feng.error("最多预约人数不能为空"); + return + } + if (null == codeTime || '' == codeTime) { + Feng.error("扣除课时数不能为空"); + return + } + if (null == classStartTime || '' == classStartTime) { + Feng.error("上课时间不能为空"); + return + } + if (null == classWeeks || '' == classWeeks) { + Feng.error("上课时间不能为空"); + return + } + + + + if (null == validDays || '' == validDays) { + Feng.error("课时有效期不能为空"); + return + } + } + + classWeeks = classWeeks.substring(0, classWeeks.length - 1); if(null == coverDrawing || '' == coverDrawing){ Feng.error("课包封面不能为空"); return } - if(null == detailDrawing || '' == detailDrawing){ - Feng.error("详情页不能为空"); - return - } + // if(null == detailDrawing || '' == detailDrawing){ + // Feng.error("详情页不能为空"); + // return + // } if(null == introduceDrawing || '' == introduceDrawing){ Feng.error("课包介绍不能为空"); return @@ -310,7 +639,7 @@ // Feng.error("课时有效期不能为空"); // return // } - + let holitime = $('#holitime').val(); let obj = { id: id, province: province, @@ -329,15 +658,17 @@ // classEndTime: classStartTime.split(" - ")[1], classWeeks: classWeeks, coverDrawing: coverDrawing, - detailDrawing: detailDrawing, + detailDrawing: imgOne, introduceDrawing: introduceDrawing, sort: sort, validDays: validDays, coursePackagePaymentConfig: JSON.stringify(price), - holitime:holitime + holitime:$("#holitime").val() } - - console.log("======="+obj) + console.log("看看") + console.log("======="+holitime) + console.log(holitime) + console.log($("#holitime").val()) //提交信息 var ajax = new $ax(Feng.ctxPath + "/coursePackage/updateCoursePackage", function (data) { @@ -451,7 +782,7 @@ htmlStr += '玩湃币支付:<input class="paiCoin" type="number" min="0" placeholder="请输入金额" style="width: 110px;background-color: #FFFFFF;background-image: none;border: 1px solid #e5e6e7;border-radius: 1px;color: inherit;padding: 6px 12px;"> 币 \n'; } htmlStr += '<button type="button" class="btn btn-info " onclick="CoursePackageInfo.openDia('+i+')" id="ensure">\n' + - ' <i class="fa fa-check"></i> 优惠卷\n' + + ' <i class="fa fa-check"></i> 优惠券\n' + '</button>'; htmlStr += '</span> <i class="fa fa-trash-o" style="font-size:24px" onclick="removePrice(this)"></i>\n' + -- Gitblit v1.7.1