From f065f051e4b4791d1f1657ce46cbf2e4de469ef7 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期一, 06 十月 2025 19:54:29 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/2.0' into 2.0

---
 cloud-server-management/src/main/webapp/static/modular/system/tGoods/tGoods_info.js |  211 ++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 154 insertions(+), 57 deletions(-)

diff --git a/cloud-server-management/src/main/webapp/static/modular/system/tGoods/tGoods_info.js b/cloud-server-management/src/main/webapp/static/modular/system/tGoods/tGoods_info.js
index fa18148..75756e2 100644
--- a/cloud-server-management/src/main/webapp/static/modular/system/tGoods/tGoods_info.js
+++ b/cloud-server-management/src/main/webapp/static/modular/system/tGoods/tGoods_info.js
@@ -9,6 +9,7 @@
     goodsPicArray:[],
     goodsPicArray1:[],
     storeIds: [],
+    siteIds: [],
 
 };
 
@@ -113,6 +114,18 @@
     });
     this.layerIndex = index;
 }
+function siteList1(){
+    var index = layer.open({
+        type: 2,
+        title: '场地列表',
+        area: ['80%', '80%'], //宽高
+        fix: false, //不固定
+        maxmin: true,
+        content: Feng.ctxPath + '/tGoods/siteList1'
+    });
+    this.layerIndex = index;
+}
+
 function storeList(){
     var index = layer.open({
         type: 2,
@@ -125,10 +138,8 @@
     this.layerIndex = index;
 }
 TGoodsInfoDlg.selecUserOpt = function (arrays){
-
     //获取所有的值
     var subArr= this.storeIds;
-    console.log(subArr)
     $(".timeClass").each(function () {
         subArr.push($(this).find("input[name*='id']").val());
     });
@@ -151,7 +162,51 @@
                 '</td><td><button onclick="deleteSub(this)">移除</button></td></tr>';
         }
     }
+    console.log("添加门店后的场地数组和门店数组")
+    console.log(this.storeIds)
+    console.log(this.siteIds)
     $("#coun").append(str);
+}
+TGoodsInfoDlg.selecUserOpt1 = function (arr){
+    console.log(arr)
+    console.log("返回的数组")
+    console.log("此时的site集合")
+    console.log(this.siteIds)
+    //获取所有的值
+    var subArr= this.siteIds;
+    console.log(subArr)
+    $(".timeClass").each(function () {
+        subArr.push($(this).find("input[name*='id']").val());
+    });
+    var str = '';
+    this.siteIds = [];
+    for(var i in arr){
+        var b = true;
+        for(var j in subArr){
+            if(arr[i].id === Number(subArr[j])){
+                b = false;
+                break
+            }
+        }
+        if(b){
+            console.log("push前")
+            console.log(this.siteIds)
+
+            this.siteIds.push(arr[i].id);
+            console.log("场地push")
+            console.log(arr[i].id)
+            str += '<tr class="timeClass">' +
+                '<td><input type="hidden" id="id" name="id" value="'+arr[i].id+'"><input type="hidden" id="provinceCity" name="provinceCity" value="'+arr[i].provinceCity+'">' + arr[i].provinceCity + '</td>' +
+                '<td><input type="hidden" id="accountName" name="accountName" value="'+arr[i].accountName+'">' + arr[i].accountName + '</td>' +
+                '<td><input type="hidden" id="name" name="name" value="'+arr[i].name+'">' + arr[i].name +
+                '<td><input type="hidden" id="siteName" name="siteName" value="'+arr[i].siteName+'">' + arr[i].siteName +
+                '<td><input type="hidden" id="ids" name="ids" value="'+arr[i].ids+'">' + arr[i].ids +
+                '</td><td><button onclick="deleteSub1(this)">移除</button></td></tr>';
+        }
+    }
+    console.log("这是场地ids")
+    console.log(this.siteIds)
+    $("#coun1").append(str);
 }
 function deleteSub(e) {
     console.log(e);
@@ -160,6 +215,14 @@
     TGoodsInfoDlg.storeIds.splice(TGoodsInfoDlg.storeIds.indexOf(parseInt(value)), 1)
     $(e).parent().parent().remove();
     console.log('storeIds',TGoodsInfoDlg.storeIds)
+}
+function deleteSub1(e) {
+    console.log(e);
+    var row = $(e).closest('tr');
+    var value = row.find('#id').val();
+    TGoodsInfoDlg.siteIds.splice(TGoodsInfoDlg.siteIds.indexOf(parseInt(value)), 1)
+    $(e).parent().parent().remove();
+    console.log('siteIds',TGoodsInfoDlg.siteIds)
 }
 TGoodsInfoDlg.delete = function (o) {
     $(o).parent("div").remove()
@@ -247,8 +310,6 @@
 
     this.clearData();
     this.collectData();
-
-
     const quantityIssuedInput = document.getElementById('quantityIssued');
     const pickUpQuantityInput = document.getElementById('pickUpQuantity');
 
@@ -256,20 +317,11 @@
     const pickUpQuantity2 = Number(pickUpQuantityInput.value);
 
     if (isNaN(quantityIssued2) || isNaN(pickUpQuantity2)) {
-        Feng.error("优惠卷数量必须为数字")
-        console.log('Both quantityIssued and pickUpQuantity must be numbers.');
     } else if (quantityIssued2 >= pickUpQuantity2) {
-
-        console.log('quantityIssued is greater than pickUpQuantity.');
     } else {
-
         Feng.error("发放数量必须大于等于限领数量")
         return
-        console.log('quantityIssued is not greater than pickUpQuantity.');
     }
-
-
-
     let typeAll = document.querySelector('input[name="type"]:checked').value;
     if(typeAll==2){
         let pCode = $("#pCode").val()
@@ -395,7 +447,14 @@
                 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){
@@ -571,14 +630,22 @@
 
         //提交信息
         var ajax = new $ax(Feng.ctxPath + "/tGoods/add", function(data){
+            console.log("看看返回参数")
+            console.log(data)
             if(data=="5001"){
                 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){
@@ -589,7 +656,9 @@
                 window.parent.TPointProducts.table.refresh();
                 TGoodsInfoDlg.close();
             }else{
+                console.log("走这里")
                 Feng.error(data.msg);
+                return;
             }
 
         },function(data){
@@ -620,40 +689,49 @@
 
 }
 TGoodsInfoDlg.addSubmit1 = function() {
-    let company = 3;
-    this.clearData();
-    this.collectData();
-
-    var cityIds = [];
-    var cts = "";
-    if (company === '2'){
-        var myselect=document.getElementById('cityData');
-        var seCity = myselect.options[myselect.selectedIndex].value;
-        if (seCity === null || seCity === undefined || seCity === ''){
-            return Feng.error('请选中一个省市');
-        }
-        cityIds.push(seCity);
-        console.log("看看num")
-        console.log(num)
-        if (num > 0){
-            for (let i = 1; i <= num; i++) {
-                var insSelect=document.getElementById('cityData'+i);
-                var inData = insSelect.options[insSelect.selectedIndex].value;
-                if (inData !== undefined || inData !== null ||  inData !== ''){
-                    cityIds.push(inData);
-                }
-            }
-
-
-        }else {
-            // 如果只有一个城市,则将cts设置为字符串
-            if (cityIds.length === 1) {
-                cts = cityIds[0];
-            } else {
-                cts = cityIds.join(',');
-            }
+    console.log("看看门店ids和场地ids")
+    console.log(this.siteIds)
+    console.log(this.storeIds)
+    var company = 3;
+    var radioButtons = document.getElementsByName("company");
+    for (var i = 0; i < radioButtons.length; i++) {
+        if (radioButtons[i].checked) {
+            company = radioButtons[i].value;
+            break;
         }
     }
+    console.log("看看作用域")
+    console.log(company)
+    this.clearData();
+    this.collectData();
+    var cityIds = [];
+    var cts = "";
+    // if (company === '2'){
+    //     var myselect=document.getElementById('cityData');
+    //     var seCity = myselect.options[myselect.selectedIndex].value;
+    //     if (seCity === null || seCity === undefined || seCity === ''){
+    //         return Feng.error('请选中一个省市');
+    //     }
+    //     cityIds.push(seCity);
+    //     console.log("看看num")
+    //     console.log(num)
+    //     if (num > 0){
+    //         for (let i = 1; i <= num; i++) {
+    //             var insSelect=document.getElementById('cityData'+i);
+    //             var inData = insSelect.options[insSelect.selectedIndex].value;
+    //             if (inData !== undefined || inData !== null ||  inData !== ''){
+    //                 cityIds.push(inData);
+    //             }
+    //         }
+    //     }else {
+    //         // 如果只有一个城市,则将cts设置为字符串
+    //         if (cityIds.length === 1) {
+    //             cts = cityIds[0];
+    //         } else {
+    //             cts = cityIds.join(',');
+    //         }
+    //     }
+    // }
 
         let type = document.querySelector('input[name="redemptionMethod"]:checked').value;
         let name = $("#name").val()
@@ -758,15 +836,28 @@
 
         const commaSeparatedString = this.goodsPicArray.join(',');
 
-
     var stores = "";
-    if (company === 3 && $("#userType").val()!="3"){
+    var sites = "";
+
+    if (company == "3" && $("#userType").val()!="3"){
         console.log('3---this.storeIds',this.storeIds);
         if (TGoodsInfoDlg.storeIds.length === 0 ){
             return Feng.error('请至少选择一个门店');
         }
         stores = this.storeIds.join(',');
         console.log('stores--===--',stores)
+    }
+    if (company == "4" && $("#userType").val()!="3"){
+        console.log('3---this.siteIds',this.siteIds);
+        if (TGoodsInfoDlg.siteIds.length === 0 ){
+            return Feng.error('请至少选择一个场地');
+        }
+        sites = this.siteIds.join(',');
+        console.log('sites--===--',sites)
+    }
+    if ($("#userType").val() == 3){
+
+        sites = this.siteIds.join(',');
     }
         let text  = TGoodsInfoDlg.editor.getContent();
         console.log(text)
@@ -788,8 +879,10 @@
             }else if(data=="5003"){
                 Feng.info("请选择相同运营商门店");
 
-            }else
-            if(data.code == 200){
+            }else if(data=="5004"){
+                Feng.info("请选择相同运营商场地");
+            }
+            else if(data.code == 200){
                 if(language==1){
                     Feng.success("添加成功!");
                 }else if(language==2){
@@ -806,8 +899,8 @@
         },function(data){
             Feng.error("添加失败!" + data.responseJSON.message + "!");
         });
-    console.log("看看城市ids")
-    console.log(cts);
+    console.log("看看场地ids")
+    console.log(sites);
         ajax.set("typeAll",3);
         ajax.set("name",name);
         ajax.set("price",price);
@@ -822,6 +915,7 @@
         ajax.set("startTime",startTime);
         ajax.set("useScope",company);
         ajax.set("cityIds",cts);
+        ajax.set("sites",sites);
         ajax.set("storeIds",stores);
         ajax.set("text",text);
         ajax.set("sort",sort);
@@ -884,6 +978,7 @@
     }
     console.log("结果图片")
     console.log(imgOne)
+    let name = $("#name").val();
     let quantityIssued = $("#quantityIssued").val();
     let pickUpQuantity = $("#pickUpQuantity").val();
     let editor = jQuery.trim(TGoodsInfoDlg.editor.getContent());
@@ -917,6 +1012,7 @@
     },function(data){
         Feng.error("修改失败!" + data.responseJSON.message + "!");
     });
+    ajax.set("name",name);
     ajax.set("pointMerchandiseId",goodsId);
     ajax.set("quantityIssued",quantityIssued);
     ajax.set("pickUpQuantity",pickUpQuantity);
@@ -939,7 +1035,6 @@
     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();
@@ -1018,6 +1113,8 @@
     ajax.set("limit",100);
     ajax.start();
 }
+
+
 TGoodsInfoDlg.timeChange = function (e) {
     var oneId=$(e).val();
     var ajax = new $ax(Feng.ctxPath + "/tCity/timeChange", function(data){

--
Gitblit v1.7.1