puzhibing
2024-03-06 b79d17d163a1f162190cb46d881ab1fd5957c602
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,7 +138,6 @@
    this.layerIndex = index;
}
TGoodsInfoDlg.selecUserOpt = function (arrays){
    //获取所有的值
    var subArr= this.storeIds;
    console.log(subArr)
@@ -152,6 +164,36 @@
        }
    }
    $("#coun").append(str);
}
TGoodsInfoDlg.selecUserOpt1 = function (arrays){
    console.log("进入")
    //获取所有的值
    var subArr= this.siteIds;
    console.log(subArr)
    $(".timeClass").each(function () {
        subArr.push($(this).find("input[name*='id']").val());
    });
    var str = '';
    for(var i in arrays){
        var b = true;
        for(var j in subArr){
            if(arrays[i].id === Number(subArr[j])){
                b = false;
                break
            }
        }
        if(b){
            this.siteIds.push(arrays[i].id)
            str += '<tr class="timeClass">' +
                '<td><input type="hidden" id="id" name="id" value="'+arrays[i].id+'"><input type="hidden" id="provinceCity" name="provinceCity" value="'+arrays[i].provinceCity+'">' + arrays[i].provinceCity + '</td>' +
                '<td><input type="hidden" id="accountName" name="accountName" value="'+arrays[i].accountName+'">' + arrays[i].accountName + '</td>' +
                '<td><input type="hidden" id="name" name="name" value="'+arrays[i].name+'">' + arrays[i].name +
                '<td><input type="hidden" id="siteName" name="siteName" value="'+arrays[i].siteName+'">' + arrays[i].siteName +
                '<td><input type="hidden" id="ids" name="ids" value="'+arrays[i].ids+'">' + arrays[i].ids +
                '</td><td><button onclick="deleteSub(this)">移除</button></td></tr>';
        }
    }
    $("#coun1").append(str);
}
function deleteSub(e) {
    console.log(e);
@@ -626,39 +668,46 @@
}
TGoodsInfoDlg.addSubmit1 = function() {
    let company = 3;
    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 +812,24 @@
        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)
    }
        let text  = TGoodsInfoDlg.editor.getContent();
        console.log(text)
@@ -793,8 +851,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,11 +871,12 @@
        },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);
        ajax.set("sites",sites);
        ajax.set("type",type);
        ajax.set("integral",integral);
        ajax.set("cash",cash);