From 31755963171a6c7b7fdc286d83882daac6d9310b Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期五, 06 六月 2025 17:30:26 +0800
Subject: [PATCH] bug修改

---
 cloud-server-management/src/main/webapp/static/modular/system/coursePackage/coursePackage_info.js |  299 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 267 insertions(+), 32 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 9a624ee..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
@@ -48,7 +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();
@@ -119,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
@@ -148,7 +154,7 @@
         return
     }
 
-    if (type == 1 ) {
+
 
         var checkboxes1 = document.getElementsByName('payType');
         var isChecked1 = false;
@@ -160,6 +166,8 @@
             }
         }
 
+    console.log("看看选中")
+    console.log(isChecked1)
         if (isChecked1) {
             console.log("At least one checkbox is selected.");
         } else {
@@ -170,6 +178,7 @@
 
         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') {
@@ -178,17 +187,91 @@
             }
         }
 
-        if (isChecked) {
-            console.log("选择了现金");
-            var cashElement = document.querySelector('.cash');
-            var cashValue = cashElement.value.trim();
+        for (var i = 0; i < checkboxes.length; i++) {
+            if (checkboxes[i].checked && checkboxes[i].value === '2') {
+                isChecked1 = true;
+                break;
+            }
+        }
 
-            if (cashValue === '' || cashValue === undefined) {
-                console.log('金额为空或未定义');
-                Feng.error("请输入金额")
-                return;
+        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.");
         }
 
 
@@ -198,7 +281,7 @@
             return
         }
         if (null == codeTime || '' == codeTime) {
-            Feng.error("扣除课时数不能为空不能为空");
+            Feng.error("扣除课时数不能为空");
             return
         }
         if (null == classStartTime || '' == classStartTime) {
@@ -308,13 +391,13 @@
 
     }
 
-    let holitime = $('#holitime').val();
 
     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) {
@@ -344,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
@@ -388,6 +475,152 @@
     //     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){
@@ -406,7 +639,7 @@
     //     Feng.error("课时有效期不能为空");
     //     return
     // }
-
+    let holitime = $('#holitime').val();
     let obj = {
         id: id,
         province: province,
@@ -430,10 +663,12 @@
         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) {

--
Gitblit v1.7.1