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 |  165 ++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 128 insertions(+), 37 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 1a40591..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()
@@ -626,39 +689,49 @@
 
 }
 TGoodsInfoDlg.addSubmit1 = function() {
-    let company = 3;
+    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(',');
-            }
-        }
-    }
+    // 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()
@@ -763,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)
@@ -793,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){
@@ -811,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);
@@ -827,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);
@@ -889,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());
@@ -922,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);

--
Gitblit v1.7.1