const initSearchFormProduct = [{ label: "产品型号", type: "text", name: "Asset_Model_No__c", isInput: true }, { label: "产品名称", type: "text", name: "Name__c", isInput: true } ] export var arrTempsss = []; export var arrProductTempsss = []; export var NewDefaultDatass = []; export var AddProductDatass = []; export var jzDataFixedPriceTemps = []; export var jzDataDiscountTemps = []; export var DeftCopyQtyLists = []; export var jzDataDefaultExp = []; export var jzDataProductExp = []; export var jzDataFixedPriceExp = []; export var jzDataDiscountExp = []; export var jzDataDefaultCopyQuantityListExp = []; export var newArrsTemp3Exp = []; export var newArrsTemp4Exp = []; export var jzDataDefaultCopyExp = []; export var newArrsTempExp = []; export var newArrsTemp2Exp = []; export var booleanExp = 0; export var boolean2Exp = false; export var boolean3Exp = false; export var dataExp = []; export var newDataExp = []; export var newData2Exp = []; export var newData3Exp = []; export var editnewDateExp = []; export var GuaranteeDiscount__cZuiXiaoExp =0; export var NormalDiscount__cZuiXiaoExp =0; export var CompareFullDataExp =[]; export var HeTongTotalExp =[]; export var SelectedFnDataFixedPriceExp = []; export var idsExp = []; export var CompareFullDataTempExp = []; export var jzDataDefaultNotChangeExp = []; export var iflagExp = false; export var falgExp = false; export var newTempExp = []; export var ifnullExp = true; export var isChangeExp; export var buttonIsShowE; export var initDTFP; export var initDTD; export var initDTOD; export var initDTC; export function GetName() { } //=======更新促销方案次数数据逻辑 export function updatesNumsLogic(jzDataFixedPriceTemp,jzDataDiscountTemp,CompareFullData) { CompareFullData.forEach(item => { if (item.ListName == "价格政策") { var filterTemp = jzDataFixedPriceTemp.filter(fItem => { if (fItem.Id == item.Id) { return true; } else { return false; } }) if (filterTemp != undefined || filterTemp.length > 0) { var fileterTempObject = { ...{}, ...filterTemp[0] }; fileterTempObject.Counts = item.num; jzDataFixedPriceTemp = jzDataFixedPriceTemp.map(element => { if (element.Id == fileterTempObject.Id) { element = fileterTempObject; } else { let elementTemp = { ...{}, ...element }; element = elementTemp; } return element; }); } } if (item.ListName == "折扣政策") { var filterTemp = jzDataDiscountTemp.filter(fItem => { if (fItem.Id == item.Id) { return true; } else { return false; } }) if (filterTemp != undefined || filterTemp.length > 0) { var fileterTempObject = { ...{}, ...filterTemp[0] }; fileterTempObject.Counts = item.num; jzDataDiscountTemp = jzDataDiscountTemp.map(element => { if (element.Id == fileterTempObject.Id) { element = fileterTempObject; } else { let elementTemp = { ...{}, ...element }; element = elementTemp; } return element; }); } } }) jzDataFixedPriceTemps = jzDataFixedPriceTemp; jzDataDiscountTemps = jzDataDiscountTemp; } //反算折扣时修改折扣政策逻辑 export function ReverseCalculationModifyDiscountLogic(arrTemp1,arrProductTemp,Id,Category__c,GuaranteeDiscount__c_Input, NormalDiscount__c_Input,GuaranteeDiscount_H_Money__c, NormalDiscount_H_Money__c, item){ //price和 var sumListCount = 0; //nod和 var sumNodCount = 0; //特约折扣nod和list合 var sumListAndNod = 0; //含多年保产品list var ObjectProducList=[]; //不含多年保产品list var NotObjectProducList=[]; //折扣 var NormalDisN = 0; var NormalDisG = 0; var distinguish = 0; var distinguish2 = 0; arrProductTemp.forEach(itemss => { if(itemss.recordTypeName__c=="Authorizer"){ if (itemss.PromotionId==Id&& itemss.NormalDiscount__c_Input == NormalDiscount__c_Input && itemss.GuaranteeDiscount__c_Input == GuaranteeDiscount__c_Input) { if(itemss.warrantyType__c=="市场多年保修"){ sumListAndNod +=itemss.Quantity *(itemss.ListPrice+itemss.ServicePrice__c); ObjectProducList.push(itemss); }else if(itemss.warrantyType__c!="市场多年保修"){ sumListCount += itemss.Quantity * itemss.ListPrice; sumNodCount += itemss.Quantity * itemss.ServicePrice__c; NotObjectProducList.push(itemss); } } }else{ if (itemss.NormalDiscount__c_Input == NormalDiscount__c_Input && itemss.Category__c == Category__c) { sumListCount += itemss.Quantity * itemss.ListPrice; sumNodCount += itemss.Quantity * itemss.ServicePrice__c; } } }); if (sumListCount != 0||sumListAndNod!=0) { if(item.JxsType=='一般折扣'||NotObjectProducList.length!=0){ NormalDisN = ((NormalDiscount_H_Money__c - sumNodCount) / sumListCount * 100).toFixed(2); if(item.JxsType!='一般折扣'){ if(item.NormalDiscount__c!=undefined&&item.NormalDiscount__c!=''){ var NormalDiscount__cc=parseFloat(item.NormalDiscount__c); if(NormalDisN { if (item.JxsType=="一般折扣") { if(arrte.NormalDiscount__c_Input == NormalDiscount__c_Input && arrte.Category__c == Category__c){ if(distinguish==1||distinguish==3){ arrte.NormalDiscount_H_Money__c = arrte.NormalDiscount_H_Money_yuan; item.NormalDiscount_H_Money__c = item.NormalDiscount_H_Money_yuan; }else{ arrte.NormalDiscount__c_Input = NormalDisN+'%'; item.NormalDiscount__c_Input = NormalDisN+'%'; } } }else if(item.JxsType=="特约折扣"){ if(arrte.Id==Id&& arrte.NormalDiscount__c_Input == NormalDiscount__c_Input && arrte.GuaranteeDiscount__c_Input == GuaranteeDiscount__c_Input){ if(distinguish2==2||distinguish==1||distinguish==3){ arrte.NormalDiscount_H_Money__c = arrte.NormalDiscount_H_Money_yuan; item.NormalDiscount_H_Money__c = item.NormalDiscount_H_Money_yuan; arrte.GuaranteeDiscount_H_Money__c = arrte.GuaranteeDiscount_H_Money_yuan; item.GuaranteeDiscount_H_Money__c = item.GuaranteeDiscount_H_Money_yuan; }else{ if(NormalDisN!=0){ arrte.NormalDiscount__c_Input = NormalDisN+'%'; item.NormalDiscount__c_Input = NormalDisN+'%'; } if(NormalDisG!=0){ arrte.GuaranteeDiscount__c_Input = NormalDisG+'%'; item.GuaranteeDiscount__c_Input = NormalDisG+'%'; } } } } }); if(distinguish!=1&&distinguish2!=2&&distinguish!=3){ arrProductTemp.forEach(arrpt => { if(arrpt.recordTypeName__c=="Authorizer"){ if(arrpt.PromotionId==Id&& arrpt.NormalDiscount__c_Input == NormalDiscount__c_Input && arrpt.GuaranteeDiscount__c_Input == GuaranteeDiscount__c_Input){ if(NormalDisN!=0){ arrpt.NormalDiscount__c_Input = NormalDisN+'%'; } if(NormalDisG!=0){ arrpt.GuaranteeDiscount__c_Input = NormalDisG+'%'; } } }else{ if (arrpt.NormalDiscount__c_Input == NormalDiscount__c_Input && arrpt.Category__c == Category__c) { arrpt.NormalDiscount__c_Input = NormalDisN+'%'; } } }); } arrTempsss =arrTemp1; arrProductTempsss = arrProductTemp; } debugger if(distinguish==1&&distinguish2!=2){ return 1; }else if(distinguish!=1&&distinguish2==2){ return 2; }else if(distinguish==1&&distinguish2==2){ return 12; }else if(distinguish==3){ return 3; }else{ return item; } } //反算折扣提示信息 export function InverseCalculationTiShi(ffgg,GuaranteeDiscount__cZuiXiao,NormalDiscount__cZuiXiao){ if(ffgg==1){ return "修改错误,非对象品折扣不得小于非对象品最低折扣:"+NormalDiscount__cZuiXiao+"%"; }else if(ffgg==2){ return "修改错误,对象品折扣不得小于对象品最低折扣:"+GuaranteeDiscount__cZuiXiao+"%"; }else if(ffgg==12){ return "修改错误,对象品折扣不得小于对象品最低折扣:"+GuaranteeDiscount__cZuiXiao+"%"+",且非对象品折扣不得小于非对象品最低折扣:"+NormalDiscount__cZuiXiao+"%"; }else if(ffgg==3){ return "修改错误,非对象品折扣不得小于0"; }else{ return "数据修改成功"; } } //合同价格汇总逻辑 export function ContractPriceComputeLogic(sum,jzDataProductList,jzDataDiscountList,jzDataFixedPriceList){ var DataDiscount = []; //折扣政策产品明细 jzDataProductList.forEach(jdpd => { jzDataDiscountList.forEach(jddp => { var PromotionHeadRecordId = jddp.recordTypeName__c; if (PromotionHeadRecordId == "Authorizer") { if (jdpd.PromotionId == jddp.Id && //方案Id jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //非对象品折扣录入 jddp.GuaranteeDiscount__c_Input == jdpd.GuaranteeDiscount__c_Input) { //对象品折扣录入 DataDiscount.push(jdpd); } } else { if (jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //非对象品折扣录入 jddp.Category__c == jdpd.Category__c) { //折扣政策分类 DataDiscount.push(jdpd); } } }); }); DataDiscount.forEach(jjc => { jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c) sum = sum + jjc.AgencySubtotal__c; }); jzDataFixedPriceList.forEach(jzdfp => { var HeTongTotals = parseFloat(jzdfp.HeTongTotal) if (jzdfp.HeTongTotal == undefined || jzdfp.HeTongTotal == "") { HeTongTotals = 0; } sum = sum + HeTongTotals; }); sum = Math.round(sum * 100) / 100; return sum; } //计算过后特约折扣的合同价格 export function SpecialPriceComputeReverse(DataDiscount,fag){ var sum=0; var sum1=0 DataDiscount.forEach(jjc => { if(jjc.warrantyType__c=="市场多年保修"){ jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c) sum = sum + jjc.AgencySubtotal__c; sum=parseFloat(sum.toFixed(2)); } if(jjc.warrantyType__c!="市场多年保修"){ jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c) sum1 = sum1 + jjc.AgencySubtotal__c; sum1=parseFloat(sum1.toFixed(2)); } }); if(fag){ return sum; }else{ return sum1; } } //更改一般折扣合同价格计算合同总价逻辑 export function GeneralDiscountContractSummaryLogic(sum,jzDataDiscountList,jzDataFixedPriceList){ jzDataDiscountList.forEach(jddp => { var HeTongPrice = parseFloat(jddp.HeTongPrice) if (jddp.HeTongPrice == undefined || jddp.HeTongPrice == "") { HeTongPrice = 0; } sum =sum + HeTongPrice; }); jzDataFixedPriceList.forEach(jzdfp =>{ var HeTongTotals = parseFloat(jzdfp.HeTongTotal) if (jzdfp.HeTongTotal == undefined || jzdfp.HeTongTotal == "") { HeTongTotals = 0; } sum =sum + HeTongTotals; }); sum = Math.round(sum * 100) / 100; return sum; } //折扣政策匹配规则部分逻辑 //SelectedData 选中的数据 IdStr 选中的数据Id CompareId 方案中用到的uuid export function SpecialSavesChangePartLogic(jzDataDefaultList,SaveName, SelectedData, IdStr, CompareId,DefalutQuantity,newDicountData,jzDataDiscountList){ var NewDefaultData = []; var AddProductData = []; jzDataDefaultList.forEach(defaultItem => { //待选产品 var defaultItemTemp = { ...{}, ...defaultItem }; var SelectedList = SelectedData.itemss.filter(items => { if (items.Id == defaultItem.Id) { return true; } else { return false; } }) if (SelectedList != undefined && SelectedList.length > 0) { var SelectedListDataTemp = { ...{}, ...SelectedList[0] }; SelectedListDataTemp.PromotionNo__c = SelectedData.PromotionNo__c; SelectedListDataTemp.Name = SelectedData.Name; SelectedListDataTemp.TypeName = "折扣政策"; SelectedListDataTemp.PromotionId = IdStr; if (SaveName == "一般折扣") { SelectedListDataTemp.NormalDiscount__c_Input = SelectedData.NormalDiscount__c_Input; } else { SelectedListDataTemp.NormalDiscount__c_Input = SelectedData.NormalDiscount__c; } SelectedListDataTemp.GuaranteeDiscount__c_Input = SelectedData.GuaranteeDiscount__c; SelectedListDataTemp.Category__c = SelectedData.Category__c; SelectedListDataTemp.CompareId = CompareId; SelectedListDataTemp.Quantity = SelectedListDataTemp.SplitQuantity; if (defaultItemTemp.Quantity != SelectedListDataTemp.Quantity) { defaultItemTemp.Quantity = defaultItemTemp.Quantity - SelectedListDataTemp.Quantity; DefalutQuantity += defaultItemTemp.Quantity; NewDefaultData.push(defaultItemTemp); AddProductData.push(SelectedListDataTemp); } else { DefalutQuantity += SelectedListDataTemp.Quantity; AddProductData.push(SelectedListDataTemp); return } } else { NewDefaultData.push(defaultItemTemp); } }) NewDefaultDatass=NewDefaultData; AddProductDatass=AddProductData; //添加数量 jzDataDiscountList.forEach(disItem => { //折扣政策 var newTemp = { ...{}, ...disItem }; if (newTemp.Id == IdStr) { newTemp.Counts = DefalutQuantity; } newDicountData.push(newTemp); }) return newDicountData; } //折扣政策合同价格汇总逻辑 export function HeTongPriceComputeLogic(jzdateList,jzDataProductList){ var HeTongPriceList = []; jzdateList.forEach(jddp => { var sum = 0; var sumNor = 0; var sumGua = 0; var PromotionHeadRecordId = jddp.recordTypeName__c; jzDataProductList.forEach(jdpd => { if (PromotionHeadRecordId == "Authorizer") { if (jddp.Id == jdpd.PromotionId && //方案Id jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //非对象品折扣录入 jddp.GuaranteeDiscount__c_Input == jdpd.GuaranteeDiscount__c_Input) { //对象品折扣录入 if(jdpd.warrantyType__c=="市场多年保修"){ sumGua = sumGua +jdpd.AgencySubtotal__c; }else if(jdpd.warrantyType__c!="市场多年保修"){ sumNor = sumNor +jdpd.AgencySubtotal__c; } sum = sum + jdpd.AgencySubtotal__c; } } else { if (jddp.NormalDiscount__c_Input == jdpd.NormalDiscount__c_Input && //非对象品折扣录入 jddp.Category__c == jdpd.Category__c) { //折扣政策分类 sum = sum + jdpd.AgencySubtotal__c; } } }); sum = Math.round(sum * 100) / 100; sumGua = Math.round(sumGua * 100) / 100; sumNor = Math.round(sumNor * 100) / 100; jddp.HeTongPrice = sum; if(PromotionHeadRecordId == "Authorizer"){ jddp.GuaranteeDiscount_H_Money__c = sumGua; jddp.NormalDiscount_H_Money__c = sumNor; }else{ jddp.NormalDiscount_H_Money__c = sum; } HeTongPriceList.push(jddp); }); return HeTongPriceList; } //价格策合并明细逻辑 export function PriceConsolidation(arrSchemes,jzdataList){ arrSchemes.forEach(arrsch=>{ var Setmap=new Map(); var arrList=[]; jzdataList.forEach(jdpd=>{ if(arrsch.Id==jdpd.PromotionId){ var object={}; if(Setmap.has(jdpd.Id)){ object={...{},...Setmap.get(jdpd.Id)}; object.Quantity=object.Quantity+jdpd.Quantity; Setmap.set(jdpd.Id,object); }else{ Setmap.set(jdpd.Id,jdpd); } }else{ arrList.push(jdpd); } }); for (let [k, v] of Setmap) { arrList.push(v); } // jzdataList=[...[],...arrList];//20230214 jzdataList = [].concat(arrList);//20230214 }); return jzdataList; } //合并折扣政策重复方案逻辑 export function ConsolidatedDiscountPolicyLogic(SchemeSet,arr){ var Setmap=new Map(); var arr2=SchemeSet; arr2.forEach(arrs=>{ var object={}; var PromotionHeadRecordId = arrs.recordTypeName__c; if(PromotionHeadRecordId == "Authorizer"){ var key=arrs.Id+"_"+arrs.NormalDiscount__c_Input+"_"+arrs.GuaranteeDiscount__c_Input;//方案Id/非对象品折扣录入/对象品折扣录入 if(Setmap.has(key)){ object={...{},...Setmap.get(key)}; object.determine=''; arrs.HeTongPrice=Number(arrs.HeTongPrice); object.HeTongPrice=Number(object.HeTongPrice); object.HeTongPrice +=arrs.HeTongPrice; arrs.GuaranteeDiscount_H_Money__c=Number(arrs.GuaranteeDiscount_H_Money__c); object.GuaranteeDiscount_H_Money__c=Number(object.GuaranteeDiscount_H_Money__c); object.GuaranteeDiscount_H_Money__c +=arrs.GuaranteeDiscount_H_Money__c; arrs.NormalDiscount_H_Money__c=Number(arrs.NormalDiscount_H_Money__c); object.NormalDiscount_H_Money__c=Number(object.NormalDiscount_H_Money__c); object.NormalDiscount_H_Money__c +=arrs.NormalDiscount_H_Money__c; Setmap.set(key,object); }else{ Setmap.set(key,arrs); } }else{ var key=arrs.NormalDiscount__c_Input+"_"+arrs.Category__c;//非对象品折扣录入、折扣政策分类 if(Setmap.has(key)){ object={...{},...Setmap.get(key)}; object.determine=''; arrs.HeTongPrice=Number(arrs.NormalDiscount_H_Money__c); object.HeTongPrice=Number(object.HeTongPrice); object.HeTongPrice +=arrs.HeTongPrice; arrs.NormalDiscount_H_Money__c=Number(arrs.NormalDiscount_H_Money__c); object.NormalDiscount_H_Money__c=Number(object.NormalDiscount_H_Money__c); object.NormalDiscount_H_Money__c +=arrs.NormalDiscount_H_Money__c; Setmap.set(key,object); }else{ Setmap.set(key,arrs); } } }); for (let [k, v] of Setmap) { arr.push(v); } return arr; } //合并折扣政策产品明细逻辑 export function ConsolidatedDiscountDetailsLogic(arrSchemes,jzdataList){ arrSchemes.forEach(arrsch=>{ var Setmap=new Map(); var arrList=[]; jzdataList.forEach(jdpd=>{ var PromotionHeadRecordId = arrsch.recordTypeName__c; if(PromotionHeadRecordId == "Authorizer"){ if(arrsch.Id==jdpd.PromotionId&&//方案Id arrsch.NormalDiscount__c_Input==jdpd.NormalDiscount__c_Input&&//非对象品折扣录入 arrsch.GuaranteeDiscount__c_Input==jdpd.GuaranteeDiscount__c_Input){//对象品折扣录入 var object={}; if(Setmap.has(jdpd.Id)){ object={...{},...Setmap.get(jdpd.Id)}; object.Quantity=object.Quantity+jdpd.Quantity; Setmap.set(jdpd.Id,object); }else{ Setmap.set(jdpd.Id,jdpd); } }else{ arrList.push(jdpd); } }else{ if(arrsch.NormalDiscount__c_Input==jdpd.NormalDiscount__c_Input&&//非对象品折扣录入 arrsch.Category__c==jdpd.Category__c){//折扣政策分类 var object={}; if(Setmap.has(jdpd.Id)){ object={...{},...Setmap.get(jdpd.Id)}; object.Quantity=object.Quantity+jdpd.Quantity; Setmap.set(jdpd.Id,object); }else{ Setmap.set(jdpd.Id,jdpd); } }else{ arrList.push(jdpd); } } }); for (let [k, v] of Setmap) { arrList.push(v); } // jzdataList=[...[],...arrList];//20230214 jzdataList = [].concat(arrList);//20230214 }); return jzdataList; } //合并上一次的报价行的逻辑 export function addOfferLogic(TrialLine){ var Offermap=new Map(); var arr=[]; var arr2=TrialLine; arr2.forEach(arrs=>{ var object={}; if(Offermap.has(arrs.Id)){ object={...{},...Offermap.get(arrs.Id)}; object.Quantity=object.Quantity+arrs.Quantity; Offermap.set(arrs.Id,object); }else{ Offermap.set(arrs.Id,arrs); } }); for (let [k, v] of Offermap) { arr.push(v); } return arr; } // ==============生成UUID export function GetUUID() { var s = []; var hexDigits = "0123456789abcdef"; for (var i = 0; i < 36; i++) { s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1); } s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010 s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01 s[8] = s[13] = s[18] = s[23] = "-"; var uuid = s.join(""); return uuid; } //一般产品部分逻辑 export function partGeneralDiscountLogical(itemsss,item){ itemsss.AgencySubtotal__c = itemsss.AgencyUnitPrice__c * itemsss.Quantity; itemsss.AgencySubtotal__c = Math.round(itemsss.AgencySubtotal__c * 100) / 100; itemsss.AgencyUnitPrice__c = Math.round(itemsss.AgencyUnitPrice__c * 100) / 100; itemsss.NoDiscountTotal__c = itemsss.ServicePrice__c * itemsss.Quantity; itemsss.UseCount__c = item.Counts; itemsss.ifNecessary__c = item.ifNecessary__c; itemsss.recordTypeName__c = item.recordTypeName__c; return itemsss; } //促销方案部分逻辑 export function partPromotionSchemeLogical(itemsss,item,multiYearWarranty__c){ debugger if(multiYearWarranty__c){ itemsss.AgencyUnitPrice__c = (item.HeTongTotal / item.Counts) * (itemsss.ListPrice / item.sumListPrice); }else{ itemsss.AgencyUnitPrice__c = ((item.HeTongTotal / item.Counts) - item.sumNoDiscount) * (itemsss.ListPrice / item.sumListPrice) + itemsss.ServicePrice__c; } itemsss.AgencySubtotal__c = itemsss.AgencyUnitPrice__c * itemsss.Quantity; itemsss.AgencySubtotal__c = Math.round(itemsss.AgencySubtotal__c * 100) / 100; itemsss.AgencyUnitPrice__c = Math.round(itemsss.AgencyUnitPrice__c * 100) / 100; itemsss.NoDiscountTotal__c = itemsss.ServicePrice__c * itemsss.Quantity; itemsss.UseCount__c = item.Counts; itemsss.if_Fix__c = item.if_Fix__c; itemsss.if_Contain_Nod__c = item.if_Contain_Nod__c; itemsss.recordTypeName__c = item.recordTypeName__c; return itemsss; } //一般折扣计算逻辑 export function commonlyDiscountLogic(itemss,item){ var Discount__c_Input = parseFloat(item.NormalDiscount__c_Input)*0.01; debugger itemss.AgencyUnitPrice__c = itemss.ListPrice * (Discount__c_Input) + itemss.ServicePrice__c; itemss.AgencySubtotal__c = itemss.AgencyUnitPrice__c * itemss.Quantity; itemss.AgencySubtotal__c = Math.round(itemss.AgencySubtotal__c * 100) / 100; itemss.AgencyUnitPrice__c = Math.round(itemss.AgencyUnitPrice__c * 100) / 100; itemss.NoDiscountTotal__c = itemss.ServicePrice__c * itemss.Quantity; itemss.Discount__c_Input = item.NormalDiscount__c_Input; itemss.Category__c=item.Category__c; return itemss } //特约折扣计算逻辑 export function contributingDiscountLogic(itemss,Discount__c_Input,item){ if (itemss.warrantyType__c=="市场多年保修") { itemss.AgencyUnitPrice__c = (itemss.ListPrice + itemss.ServicePrice__c) * (Discount__c_Input*0.01); } else { itemss.AgencyUnitPrice__c = itemss.ListPrice * (Discount__c_Input*0.01) + itemss.ServicePrice__c; } itemss.AgencySubtotal__c = itemss.AgencyUnitPrice__c * itemss.Quantity; itemss.AgencySubtotal__c = Math.round(itemss.AgencySubtotal__c * 100) / 100; itemss.AgencyUnitPrice__c = Math.round(itemss.AgencyUnitPrice__c * 100) / 100; itemss.NoDiscountTotal__c = itemss.ServicePrice__c * itemss.Quantity; debugger itemss.Discount__c_Input = Discount__c_Input+"%"; // itemss.Discount__c_Input = Discount__c_Input; itemss.GuaranteeDiscount__c_Input=item.GuaranteeDiscount__c_Input; itemss.NormalDiscount__c_Input=item.NormalDiscount__c_Input; itemss.recordTypeName__c = item.recordTypeName__c; return itemss } //计算价格政策的最大次数逻辑 export function ComputationalLogic(Pricepolicy,b,selectproducts){ var num=0; var flag=true; for(var j=0;jfrequency){ num=frequency; } } } fg=false; } } if(fg){ num=0; break; } } } var Counts = Number(Pricepolicy.Counts); return Counts+num; } //替换listprice单价逻辑 export function ReplacementUnitPriceLogic(arr,ifTrade){ arr.forEach(jdpct => { //产品明细 if (ifTrade == "内貿") { jdpct.ListPrice = jdpct.Product2.Intra_Trade_List_RMB__c; if (jdpct.multiYearWarranty__c) { jdpct.ServicePrice__c = jdpct.Product2.Intra_Trade_Service_RMB__c; } else { jdpct.ServicePrice__c = 0; } } else if (ifTrade == "外貿") { jdpct.ListPrice = jdpct.Product2.Foreign_Trade_List_US__c; if (jdpct.multiYearWarranty__c) { jdpct.ServicePrice__c = jdpct.Product2.NoDiscount_Foreign__c; } else { jdpct.ServicePrice__c = 0; } } }); return arr } //合并方案 export function ConsolidationScheme(data,ParamIdStr,Trade__c){ var NewData = []; data.forEach(itms => { //价格政策和折和折扣政策 let Temp = {}; Temp.itemCounts = itms.Counts + ""; Temp.Id = itms.Id; Temp.JxsType = itms.JxsType; //促销方案 if (itms.JxsType != "一般折扣") { var PromotionHeadRecordId = itms.recordTypeName__c; //tt if (itms.JxsType == "特约折扣") { Temp.GuaranteeDiscountcInput = parseFloat(itms.GuaranteeDiscount__c_Input); Temp.GuaranteeDiscountc = parseFloat(itms.GuaranteeDiscount__c); Temp.NormalDiscountc = parseFloat(itms.NormalDiscount__c); Temp.NormalDiscountcInput = parseFloat(itms.NormalDiscount__c_Input); } }else{ //tt Temp.NormalDiscountcInput = parseFloat(itms.NormalDiscount__c_Input); } if (PromotionHeadRecordId == 'Promotion') { Temp.Categoryc = '促销方案'; } //一般产品 else if (PromotionHeadRecordId == 'NormalProduct') { Temp.Categoryc = '一般产品'; } //特约固定 else if (PromotionHeadRecordId == 'Authorizer') { Temp.Categoryc = '经销商固定折扣'; } else { Temp.Categoryc = itms.Category__c; } Temp.PromotionNocEqual = itms.PromotionNo__cEqual; Temp.typess = itms.typess; Temp.PromotionNoc = itms.PromotionNo__c; Temp.Name = itms.Name; Temp.ParamIdStr = ParamIdStr; Temp.Descriptionc = itms.Description__c; Temp.ifContainNodc = itms.if_Contain_Nod__c; Temp.ifFixc = itms.if_Fix__c; Temp.PriceCNYc = itms.Price_CNY__c; Temp.Total = itms.Total; Temp.ListPriceTotalc = itms.sumListPrice; Temp.sumNod = itms.sumNoDiscount; // Temp.sumNodUSD=itms.sumNodUSD; Temp.HeTongTotal = itms.HeTongTotal; Temp.ifNecessaryc = itms.ifNecessary__c; Temp.Trade = Trade__c; Temp.maxCounts = itms.maxCounts; Temp.CompareId = itms.CompareId; Temp.sumNoDiscountTotal = itms.sumNoDiscountTotal; Temp.GuaranteeDiscountHMoneyc = itms.GuaranteeDiscount_H_Money__c; Temp.NormalDiscountHMoneyc = itms.NormalDiscount_H_Money__c; //...c/compent NewData.push(Temp); }); return NewData; } //待选产品数据变化字段赋值 export function ProductAssignmentSelect(item){ item.Quantity = item.Quantity__c; item.Name = item.Name__c; item.Name__c = item.Name_c__c; item.ListPrice = item.ListPrice__c; item.Id = item.QuoteTrialKey__c; item.PromotionId = item.Promotion_id__c; item.TypeName = item.TypeName__c; item.RecordTypeId = item.RecordTypeId__c; item.ParamIdStr = item.QuantityId__c; item.Product2Id = item.Product2__c; item.QuiteLineitem__c = item.QuiteLineitem__c; return item; } //已选产品数据变化字段赋值 export function ProductSelected(item){ item.Quantity = item.Quantity__c; item.Name = item.Name__c; item.Name__c = item.Name_c__c; item.ListPrice = item.ListPrice__c; item.Id = item.QuoteTrialKey__c; item.Product2Id = item.Product2__c; item.Product2 = item.Product2__r; if (item.Name == "一般折扣") { item.PromotionId = item.PromotionSales__c; // item.GuaranteeDiscount__c_Input = item.GuaranteeDiscountcInput__c; // item.Discount__c_Input = item.DiscountRate__c; item.Discount__c_Input = item.DiscountRate__c+'%'; // item.NormalDiscount__c_Input = item.NormalDiscountcInput__c item.NormalDiscount__c_Input = item.NormalDiscountcInput__c+'%'; } else { item.PromotionId = item.Promotion_id__c; if(item.TypeName__c != "价格政策"){ // item.GuaranteeDiscount__c_Input = item.GuaranteeDiscountcInput__c; item.GuaranteeDiscount__c_Input = item.GuaranteeDiscountcInput__c+'%'; // item.Discount__c_Input = item.DiscountRate__c; item.Discount__c_Input = item.DiscountRate__c+'%'; // item.NormalDiscount__c_Input = item.NormalDiscountcInput__c; item.NormalDiscount__c_Input = item.NormalDiscountcInput__c+'%'; // item.GuaranteeDiscount__c_Input=Number(item.GuaranteeDiscount__c_Input.toFixed(2)); } } item.warrantyType__c=item.GuranteeType__c; item.TypeName = item.TypeName__c; item.RecordTypeId = item.RecordTypeId__c; item.ParamIdStr = item.QuantityId__c; item.QuiteLineitem__c = item.QuiteLineitem__c; item.CompareId = item.CompareId__c; // item.Discount__c_Input=Number(item.Discount__c_Input.toFixed(2)); // item.NormalDiscount__c_Input = item.NormalDiscountcInput__c; // item.NormalDiscount__c_Input=Number(item.NormalDiscount__c_Input.toFixed(2)); return item; } //折扣方案数据变化字段赋值 export function UnselectedScheme(items){ items.JxsType = items.JxsType__c; // items.NormalDiscount__c_Input = items.NormalDiscount_c_Input__c; items.NormalDiscount__c_Input=items.NormalDiscount_c_Input__c+'%'; // items.NormalDiscount__c_Input=Number(items.NormalDiscount__c_Input.toFixed(2)); items.TypeName = items.TypeName__c; if (items.JxsType__c != "一般折扣") { items.Id = items.PromotionHead__c; // items.NormalDiscount__c = items.NormalDiscountc__c; items.NormalDiscount__c=items.NormalDiscountc__c+'%'; // items.NormalDiscount__c=Number(items.NormalDiscount__c.toFixed(2)); // items.GuaranteeDiscount__c = items.GuaranteeDiscount__c; items.GuaranteeDiscount__c=items.GuaranteeDiscount__c+'%'; // items.GuaranteeDiscount__c=Number(items.GuaranteeDiscount__c.toFixed(2)); // items.GuaranteeDiscount__c_Input = items.GuaranteeDiscount_c_Input__c; items.GuaranteeDiscount__c_Input=items.GuaranteeDiscount_c_Input__c+'%'; // items.GuaranteeDiscount__c_Input=Number(items.GuaranteeDiscount__c_Input.toFixed(2)); } // else{ // items.NormalDiscount__c = items.NormalDiscountc__c; // items.NormalDiscount__c=items.NormalDiscountc__c+'%'; // items.NormalDiscount__c=Number(items.NormalDiscount__c.toFixed(2)); // items.GuaranteeDiscount__c = items.GuaranteeDiscount__c; // items.GuaranteeDiscount__c=Number(items.GuaranteeDiscount__c.toFixed(2)); // items.GuaranteeDiscount__c_Input = items.GuaranteeDiscount_c_Input__c; // items.GuaranteeDiscount__c_Input=Number(items.GuaranteeDiscount__c_Input.toFixed(2)); // } items.ParamIdStr = items.Quote__c; items.sumNoDiscountTotal = items.sumNoDiscountTotal__c; items.maxCounts = items.maxCounts__c; items.CompareId = items.CompareId__c; return items; } //循环判断空 export function IfCopyProperties(x){ debugger if(x.Asset_Model_No__c==undefined){ x.Asset_Model_No__c=''; } if(x.Name_c__c==undefined){ x.Name_c__c=''; } if(x.Quantity__c==undefined){ x.Quantity__c=''; } if(x.GuranteeType__c==undefined){ x.GuranteeType__c=''; } if(x.PromotionNo__c==undefined){ x.PromotionNo__c=''; } if(x.Name__c==undefined){ x.Name__c=''; } if(x.ListPrice__c==undefined){ x.ListPrice__c=''; } if(x.NoDiscountTotal__c==undefined){ x.NoDiscountTotal__c=''; } if(x.DiscountRate__c==undefined){ x.DiscountRate__c=''; } if(x.AgencyUnitPrice__c==undefined){ x.AgencyUnitPrice__c=''; } if(x.AgencySubtotal__c==undefined){ x.AgencySubtotal__c=''; } return x; } //价格方案数据变化字段赋值 export function SelectedScheme(items){ items.Counts = items.itemCounts__c; items.Total = items.Price_total__c; items.HeTongTotal = items.contractPrice__c; items.TypeName = items.TypeName__c; items.Id = items.PromotionHead__c; items.ParamIdStr = items.Quote__c; if (items.trade__c == "内貿") { items.sumListPrice = items.ListPriceTotal__c; items.sumNoDiscount = items.NodiscountTotal__c; } else if (items.trade__c == "外貿") { items.sumListPrice = items.ListPriceTotalUSD__c; items.sumNoDiscount = items.NodiscountTotalUSD__c; } items.sumNoDiscountTotal = items.sumNoDiscountTotal__c; items.maxCounts = items.maxCounts__c; return items; } //合并产品 export function MergeProducts(arr3,arr4,data,ParamIdStr){ var NewData1 = []; var newTemp3 = []; arr3.forEach(itmsss => { //产品明细 var itemTemp = { ...{}, ...itmsss }; // itemTemp.分类名称(根据 产品状态 1) 0未匹配 2)1以匹配) itemTemp.ismatch = '1'; newTemp3.push(itemTemp); }); var newTemp4 = []; arr4.forEach(itmsss => { //待选产品 var itemTemp = { ...{}, ...itmsss }; // itemTemp.分类名称(根据 产品状态 1) 0未匹配 2)1以匹配) itemTemp.ismatch = '0'; newTemp4.push(itemTemp); }); // var data2 = [...newTemp3, ...newTemp4];//20230213 var data2 = newTemp3.concat(newTemp4);//20230213 data2.forEach(itmss => { //产品明细和待选产品 let Temp1 = {}; Temp1.Id = itmss.Id; Temp1.AssetModelNoc = itmss.Asset_Model_No__c; Temp1.Namec = itmss.Name__c; Temp1.Quantity = itmss.Quantity; Temp1.GuranteeTypec = itmss.warrantyType__c; Temp1.PromotionNoc = itmss.PromotionNo__c; Temp1.Name = itmss.Name; Temp1.ListPrice = itmss.ListPrice; Temp1.AgencyUnitPricec = itmss.AgencyUnitPrice__c; Temp1.AgencySubtotalc = itmss.AgencySubtotal__c; Temp1.NoDiscountTotalc = itmss.NoDiscountTotal__c; Temp1.ParamIdStr =ParamIdStr; Temp1.TypeName = itmss.TypeName; Temp1.UseCountc = itmss.UseCount__c; if (itmss.TypeName == "价格政策") { data.forEach(itemsss => { if (itemsss.PromotionNo__c == itemsss.PromotionNo__c) { Temp1.fanan_id = itemsss.Id; } }); } else if (itmss.TypeName == "折扣政策") { data.forEach(itemss => { if (itemss.PromotionNo__c == itemss.PromotionNo__c) { Temp1.fanan_id = itemss.Id; } }); Temp1.DiscountcInput = parseFloat(itmss.Discount__c_Input); if(itmss.Name=="一般折扣"){ Temp1.NormalDiscountcInput = parseFloat(itmss.NormalDiscount__c_Input); }else{ Temp1.GuaranteeDiscountcInput = parseFloat(itmss.GuaranteeDiscount__c_Input); Temp1.NormalDiscountcInput = parseFloat(itmss.NormalDiscount__c_Input); } } Temp1.ismatch = itmss.ismatch; Temp1.PromotionId = itmss.PromotionId; Temp1.Product2c = itmss.Product2Id; Temp1.ServicePricec = itmss.ServicePrice__c; Temp1.ifFixc = itmss.if_Fix__c; Temp1.ifNecessaryc = itmss.ifNecessary__c; Temp1.CompareId = itmss.CompareId; Temp1.multiYearWarrantyc = itmss.multiYearWarranty__c; Temp1.Categoryc = itmss.Category__c; NewData1.push(Temp1); }); return NewData1; } // //方案需要更新的字段 export function ChangeFiexedData(key) { var keyArr = ['Status__c', 'ifNecessary__c', 'OrderNo__c', 'Price_CNY__c', 'Price_USD__c']; var flag = false; keyArr.forEach(item => { if (item == key) { flag = true; } }) return flag; } export function getQueryVariable(variable,location) { //id字符串 debugger var query = window.location.search.substring(1); if(!query){ query = location; } var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } return ''; } //跳转路径 export function PathJump(DeveloperName,ParamIdStr){ if(DeveloperName=='Opportunity'){ // 测试非完整路径是不是可以正确跳转 window.open('/apex/NewQuoteEntry?id=' + ParamIdStr, '_self'); }else if(DeveloperName=='SI_Oppor'){ // 测试非完整路径是不是可以正确跳转 window.open('/apex/SI_NewQuoteEntry?id=' + ParamIdStr, '_self'); } } //计算过后一般折扣的合同价格 export function ContractPriceComputeReverse(DataDiscount){ var sum=0; DataDiscount.forEach(jjc => { jjc.AgencySubtotal__c = parseFloat(jjc.AgencySubtotal__c) sum = sum + jjc.AgencySubtotal__c; }); sum=sum.toFixed(2); return sum; } //复制逻辑 export function copyLogic(Check_Your_Clipboard,records,x,targetString,reslut){ records=reslut; for (var i = 0; i < records.length; i++) { x = records[i]; //判断空 x=IfCopyProperties(x); targetString += '\r\n' + x. Asset_Model_No__c + '\t' + x.Name_c__c + '\t' + x.Quantity__c + '\t' + x.GuranteeType__c + '\t' + x.PromotionNo__c +'\t' + x.Name__c + '\t' + x.ListPrice__c + '\t' + x.NoDiscountTotal__c + '\t' + x.DiscountRate__c + '\t' + x.AgencyUnitPrice__c + '\t' + x.AgencySubtotal__c ; console.warn(x.PromotionNo__c); } try { console.warn(targetString); var tag = document.createElement('textarea'); tag.setAttribute('id', 'cp_hgz_textarea'); var strlenght=targetString.replace(/[\u0000-\u007f]/g,"a").replace(/[\u0080-\u07ff]/g,"aa").replace(/[\u0800-\uffff]/g,"aaa").length; tag.maxLength=strlenght+666; tag.value = targetString; document.getElementsByTagName('body')[0].appendChild(tag); document.getElementById('cp_hgz_textarea').select(); document.execCommand('copy'); document.getElementById('cp_hgz_textarea').remove(); alert(Check_Your_Clipboard); } catch (error) { alert(error); } } //一般折扣更改过合同价格计算逻辑 export function updateCDLogic(Id,JxsType,GuaranteeDiscount__c_Input,NormalDiscount__c_Input,Category__c,jzDataDiscount,arrProductTemp){ var newArrsTempplus1=[]; var newArrsTempplus2=[]; var jzDataProductlast=[]; jzDataDiscount.forEach(item=>{ if(JxsType=="特约折扣"){ if(item.JxsType=="特约折扣"){ if (Id == item.Id) { if (NormalDiscount__c_Input == item.NormalDiscount__c_Input && //非对象品折扣录入 GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input) { //对象品折扣录入 arrProductTemp.forEach(itemss => { //itemss产品明细 var Discount__c_Input = 0; if (itemss.warrantyType__c=="市场多年保修") { Discount__c_Input = item.GuaranteeDiscount__c_Input; Discount__c_Input = parseFloat(Discount__c_Input); } else { Discount__c_Input = item.NormalDiscount__c_Input; Discount__c_Input = parseFloat(Discount__c_Input); } debugger if (itemss.PromotionId == item.Id && //方案Id itemss.GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input && //对象品折扣录入 itemss.NormalDiscount__c_Input == item.NormalDiscount__c_Input) { //非对象品折扣录入 itemss = contributingDiscountLogic(itemss, Discount__c_Input, item); //特约折扣计算逻辑 newArrsTempplus1.push(itemss); } else if (itemss.PromotionId != item.Id || itemss.GuaranteeDiscount__c_Input != item.GuaranteeDiscount__c_Input || itemss.NormalDiscount__c_Input != item.NormalDiscount__c_Input) { newArrsTempplus2.push(itemss); } }); var newArrsplusG=[]; var newArrsplusN=[]; newArrsTempplus1.forEach(ntp=>{ if(ntp.warrantyType__c=="市场多年保修"){ newArrsplusG.push(ntp); }else if(ntp.warrantyType__c!="市场多年保修"){ newArrsplusN.push(ntp); } }); if(newArrsplusG.length!=0){ var yibanSumG = SpecialPriceComputeReverse(newArrsTempplus1,true); var chazhiG=(Number(item.GuaranteeDiscount_H_Money__c)*100-Number(yibanSumG)*100)/100; var dangechazhiG=Math.round((chazhiG/newArrsplusG[0].Quantity) * 100) / 100; newArrsplusG[0].AgencySubtotal__c =newArrsplusG[0].AgencySubtotal__c+chazhiG; newArrsplusG[0].AgencyUnitPrice__c =newArrsplusG[0].AgencyUnitPrice__c+dangechazhiG; } if(newArrsplusN.length!=0){ var yibanSumN = SpecialPriceComputeReverse(newArrsTempplus1,false); var chazhiN=(Number(item.NormalDiscount_H_Money__c)*100-Number(yibanSumN)*100)/100; var dangechazhiN=Math.round((chazhiN/newArrsplusN[0].Quantity) * 100) / 100; newArrsplusN[0].AgencySubtotal__c =newArrsplusN[0].AgencySubtotal__c+chazhiN; newArrsplusN[0].AgencyUnitPrice__c =newArrsplusN[0].AgencyUnitPrice__c+dangechazhiN; } // newArrsTempplus1=[...newArrsplusG,...newArrsplusN];//20230213 newArrsTempplus1=newArrsplusG.concat(newArrsplusN);//20230213 // jzDataProductlast = [...newArrsTempplus1,...newArrsTempplus2];//20230213 jzDataProductlast = newArrsTempplus1.concat(newArrsTempplus2);//20230213 } } } }else if(JxsType=="一般折扣"){ if(item.JxsType=="一般折扣"){ if (NormalDiscount__c_Input == item.NormalDiscount__c_Input && Category__c == item.Category__c){ arrProductTemp.forEach(itemss => { //itemss产品明细 if (itemss.NormalDiscount__c_Input == NormalDiscount__c_Input && itemss.Category__c == Category__c) { itemss = commonlyDiscountLogic(itemss, item); //一般折扣计算逻辑 newArrsTempplus1.push(itemss); } else if (itemss.Category__c != Category__c || itemss.NormalDiscount__c_Input != NormalDiscount__c_Input) { newArrsTempplus2.push(itemss); } }); var yibanSum = ContractPriceComputeReverse(newArrsTempplus1);//计算过后一般折扣的合同价格 var chazhi=(Number(item.NormalDiscount_H_Money__c)*100-Number(yibanSum)*100)/100; var dangechazhi=Math.round((chazhi/newArrsTempplus1[0].Quantity) * 100) / 100; newArrsTempplus1[0].AgencySubtotal__c =newArrsTempplus1[0].AgencySubtotal__c+chazhi; newArrsTempplus1[0].AgencyUnitPrice__c =newArrsTempplus1[0].AgencyUnitPrice__c+dangechazhi; // jzDataProductlast = [...newArrsTempplus1,...newArrsTempplus2];//20230213 jzDataProductlast =newArrsTempplus1.concat(newArrsTempplus2);//20230213 console.warn('newArrsTempplus2'+newArrsTempplus2); console.warn('jzDataProductlast'+jzDataProductlast); } } } }); return jzDataProductlast; } export function countListAndNodLogic(ifTrade,copydate,item,result,DeftCopyQtyList){ var ListPrices = 0; var Nodiscounts = 0; result.forEach(itemss => { //方案主数据关联的产品 copydate.forEach(jddc => { //报价行项目主数据 if (itemss.Asset_Model_No__c == jddc.Product2.MDM_Model_No__c) { if (ifTrade == "内貿") { ListPrices += itemss.Quantity__c * jddc.Product2.Intra_Trade_List_RMB__c; Nodiscounts += itemss.Quantity__c * jddc.Product2.Intra_Trade_Service_RMB__c; } else if (ifTrade == "外貿") { ListPrices += itemss.Quantity__c * jddc.Product2.Foreign_Trade_List_US__c; Nodiscounts += itemss.Quantity__c * jddc.Product2.NoDiscount_Foreign__c; } var fl = true; if (DeftCopyQtyList.length == 0) { DeftCopyQtyList.push({ Asset_Model_No__c: itemss.Asset_Model_No__c, Quantity__c__c: itemss.Quantity__c, Id_H: item.PromotionNo__c }); } else { DeftCopyQtyList.forEach(jdcql => { //保存方案关联产品数量 if (itemss.Asset_Model_No__c == jdcql.Asset_Model_No__c && jdcql.Id_H == item.PromotionNo__c) { fl = false; } }); if (fl) { DeftCopyQtyList.push({ Asset_Model_No__c: itemss.Asset_Model_No__c, Quantity__c__c: itemss.Quantity__c, Id_H: item.PromotionNo__c }); } } } }); }); item.sumListPrice = ListPrices; item.sumNoDiscount = Nodiscounts; DeftCopyQtyLists=DeftCopyQtyList; return item; } //比对报价行项目改变后试算界面的变化 //‘试算合成待选数据’是为了与现在报价行项目进行比对,用试算产品表数据合并出的上一次进行试算的报价行项目 //试算之前已将报价行项目相同的产品进行了合并 //1.‘报价行项目’条数少于‘试算合成待选数据’条数时将之前的试算清空,使用新的报价行项目 //2.当‘报价行项目’条数大于或等于‘试算合成待选数据’条数将两组数据进行比对 // 2-1)当‘报价行项目’条数等于‘试算合成待选数据’条数时先对比两组数据(根据产品Id进行匹配) // (2-1-1)当数据匹配成功后判断其数量字段,当‘报价行项目’数量小于‘试算合成待选数据’数量时将之前的试算清空,使用新的报价行项目 // (2-1-2)等于则删除‘试算合成待选数据’中匹配成功的数据 // (2-1-3)大于则用‘报价行项目’数量减去‘试算合成待选数据’数量并将这条数据存入待选报价行项目集合 // 2-2)当比对结束后如果‘试算合成待选数据’中有数据没有被匹配则将之前的试算清空,使用新的报价行项目 // 2-3)当‘报价行项目’条数大于‘试算合成待选数据’条数,且‘试算合成待选数据’都已匹配则将‘报价行项目’中未被匹配的数据全部存入待选报价行项目集合 export function comparisonUniqueKeyLogic(index,flagall,jzDataDefaultCopy,jzDataDefault,jzDataProduct,jzDataFixedPrice,jzDataDiscount,lastQuotationc){ debugger if (index == 0) { if (flagall) { if (jzDataDefaultCopy.length < lastQuotationc.length) { //1、条数小于 jzDataDefault = [].concat(jzDataDefaultCopy); jzDataProduct = []; jzDataFixedPrice = []; jzDataDiscount = []; jzDataDefaultExp = jzDataDefault; jzDataProductExp = jzDataProduct; jzDataFixedPriceExp = jzDataFixedPrice; jzDataDiscountExp = jzDataDiscount; return; } else { //2、 var lastQuotation = [].concat(lastQuotationc); var DefaultCopy = [].concat(jzDataDefaultCopy); var Default = []; for (var j = 0; j < DefaultCopy.length; j++) { var arrList = []; var fag = true if (lastQuotation.length != 0) { for (var i = 0; i < lastQuotation.length; i++) { if (DefaultCopy[j].Id == lastQuotation[i].Id) { if (DefaultCopy[j].Quantity < lastQuotation[i].Quantity) { //2-1-1 数量小于 clear jzDataDefault = [].concat(jzDataDefaultCopy); jzDataProduct = []; jzDataFixedPrice = []; jzDataDiscount = []; jzDataDefaultExp = jzDataDefault; jzDataProductExp = jzDataProduct; jzDataFixedPriceExp = jzDataFixedPrice; jzDataDiscountExp = jzDataDiscount; return; } else if (DefaultCopy[j].Quantity == lastQuotation[i].Quantity) { //2-1-2 fag = false; } else { //2-1-3 数量大于 塞到待选产品 DefaultCopy[j].Quantity = DefaultCopy[j].Quantity - lastQuotation[i].Quantity; Default.push(DefaultCopy[j]); fag = false; } } else { arrList.push(lastQuotation[i]); } } lastQuotation = arrList; if (fag) { Default.push(DefaultCopy[j]); } } else { //2-3 条数大于 将数据塞到待选产品 Default.push(DefaultCopy[j]); } } if (lastQuotation.length != 0) { //2-2 合成数据有剩余 jzDataDefault = [].concat(jzDataDefaultCopy); jzDataProduct = []; jzDataFixedPrice = []; jzDataDiscount = []; jzDataDefaultExp = jzDataDefault; jzDataProductExp = jzDataProduct; jzDataFixedPriceExp = jzDataFixedPrice; jzDataDiscountExp = jzDataDiscount; return; } jzDataDefault = [].concat(Default); jzDataDefaultExp = jzDataDefault; } } } jzDataDefaultExp = jzDataDefault; jzDataProductExp = jzDataProduct; jzDataFixedPriceExp = jzDataFixedPrice; jzDataDiscountExp = jzDataDiscount; } export function SearchProductByIdLogic(result,jzDataFixedPrice,jzDataDefaultCopyQuantityList,item){ result.forEach(itemss => { //itemss方案关联的产品 var fl = true; if (jzDataDefaultCopyQuantityList.length == 0) { jzDataDefaultCopyQuantityList.push({ Asset_Model_No__c: itemss.Asset_Model_No__c, Quantity__c__c: itemss.Quantity__c, Id_H: item.PromotionNo__c }); } else { jzDataDefaultCopyQuantityList.forEach(jdcql => { //保存方案关联产品的数量 if (itemss.Asset_Model_No__c == jdcql.Asset_Model_No__c && jdcql.Id_H == item.PromotionNo__c) { fl = false; } }); if (fl) { jzDataDefaultCopyQuantityList.push({ Asset_Model_No__c: itemss.Asset_Model_No__c, Quantity__c__c: itemss.Quantity__c, Id_H: item.PromotionNo__c }); } } }); var iflag = true; var newarrjdf = []; jzDataFixedPrice.forEach(jdf => { //jdf价格政策 if (jdf.Id == item.Id) { iflag = false; newarrjdf.push(jdf); } else { newarrjdf.push(jdf); } }); jzDataDefaultCopyQuantityListExp = jzDataDefaultCopyQuantityList; return newarrjdf; } export function ComputeDataPromotionLogic(newArrsTemp3,newArrsTemp4,jzDataDefaultCopyQuantityList,jzDataDefaultCopy,QuoteData,arrProductTemp,item,arrTemp2,jzDataDefault){ newArrsTemp3 = []; //需要计算的产品明细的数据 newArrsTemp4 = []; //不需要计算的产品明细的数据 var newArrsTemp5 = []; var newArrsTemp6 = []; arrProductTemp.forEach(itemsss => { //itemsss产品明细 if (itemsss.PromotionId == item.Id) { if (item.determine == '改过') { var flag = true; var b = jzDataDefaultCopyQuantityList; //获取方案中的产品数量 arrTemp2.forEach(datedefault => { //datedefault待选产品 var quantity = 0; if (datedefault.Id == itemsss.Id) { b.forEach(iem => { //iem方案中的产品数量 if (iem.Asset_Model_No__c == datedefault.Product2.MDM_Model_No__c && iem.Id_H == item.PromotionNo__c) { quantity = (itemsss.Quantity - iem.Quantity__c__c * item.Counts) + datedefault.Quantity; datedefault.Quantity = quantity; itemsss.Quantity = iem.Quantity__c__c * item.Counts; } }); flag = false; } }); if (flag) { jzDataDefaultCopy.forEach(add => { //add报价行项目主数据 var quantity = 0; if (add.Id == itemsss.Id) { b.forEach(iems => { //iems方案关联产品数量 if (iems.Asset_Model_No__c == add.Product2.MDM_Model_No__c && iems.Id_H == item.PromotionNo__c) { quantity = itemsss.Quantity - iems.Quantity__c__c * item.Counts; add.Quantity = quantity; itemsss.Quantity = iems.Quantity__c__c * item.Counts; arrTemp2.push(add); } }); flag = true; } }); } } itemsss = partPromotionSchemeLogical(itemsss, item,QuoteData[0].multiYearWarranty__c); newArrsTemp3.push(itemsss); } else if (itemsss.PromotionId != item.Id) { newArrsTemp4.push(itemsss); } }); if (item.determine == '改过') { arrTemp2.forEach(itsss => { //itsss待选产品 if (itsss.Quantity != 0) { newArrsTemp6.push(itsss); } }); newArrsTemp5 = [].concat(newArrsTemp6); jzDataDefault = newArrsTemp5; } newArrsTemp3Exp = newArrsTemp3; newArrsTemp4Exp = newArrsTemp4; jzDataDefaultExp = jzDataDefault; jzDataDefaultCopyExp = jzDataDefaultCopy; return arrProductTemp; } export function ComputeDataNormalProductLogic(newArrsTemp3,newArrsTemp4,jzDataDefaultCopyQuantityList,jzDataDefaultCopyc,QuoteData,arrProductTemp,item,arrTemp2,jzDataDefault){ newArrsTemp3 = []; //需要计算的产品明细的数据 newArrsTemp4 = []; //不需要计算的产品明细的数据 var newArrsTemp5 = []; var newArrsTemp6 = []; var jzDataDefaultCopy = jzDataDefaultCopyc; arrProductTemp.forEach(itemsss => { //itemsss产品明细 var flag = true; if (itemsss.PromotionId == item.Id) { if (item.determine == '改过') { var b = jzDataDefaultCopyQuantityList; //获取方案中的产品数量 jzDataDefaultCopy = jzDataDefaultCopyc; arrTemp2.forEach(datedefault => { //datedefault待选产品 var quantity = 0; if (datedefault.Id == itemsss.Id) { b.forEach(iem => { //iem方案中的产品数量 if (iem.Asset_Model_No__c == datedefault.Product2.MDM_Model_No__c && iem.Id_H == item.PromotionNo__c) { quantity = (itemsss.Quantity - iem.Quantity__c__c * item.Counts) + datedefault.Quantity; datedefault.Quantity = quantity; itemsss.Quantity = iem.Quantity__c__c * item.Counts; } }); flag = false; } }); if (flag) { jzDataDefaultCopy.forEach(add => { //add报价行项目主数据 var quantity = 0; if (add.Id == itemsss.Id) { b.forEach(iems => { //iems方案关联产品数量 if (iems.Asset_Model_No__c == add.Product2.MDM_Model_No__c && iems.Id_H == item.PromotionNo__c) { quantity = itemsss.Quantity - iems.Quantity__c__c * item.Counts; add.Quantity = quantity; itemsss.Quantity = iems.Quantity__c__c * item.Counts; arrTemp2.push(add); } }); } }); } } if(QuoteData[0].multiYearWarranty__c){ itemsss.AgencyUnitPrice__c = (item.HeTongTotal / item.Counts) * (itemsss.ListPrice / item.sumListPrice); }else{ itemsss.AgencyUnitPrice__c = ((item.HeTongTotal / item.Counts) - item.sumNoDiscount) * (itemsss.ListPrice / item.sumListPrice) + itemsss.ServicePrice__c; } if (item.HeTongTotal == undefined || item.HeTongTotal == "") { itemsss.AgencyUnitPrice__c = 0; } itemsss = partGeneralDiscountLogical(itemsss, item); newArrsTemp3.push(itemsss); } else if (itemsss.PromotionId != item.Id) { newArrsTemp4.push(itemsss); } }); if (item.determine == '改过') { arrTemp2.forEach(itsss => { //待选产品 if (itsss.Quantity != 0) { newArrsTemp6.push(itsss); } }); newArrsTemp5 = [].concat(newArrsTemp6); jzDataDefault = newArrsTemp5; } newArrsTemp3Exp = newArrsTemp3; newArrsTemp4Exp = newArrsTemp4; jzDataDefaultExp = jzDataDefault; jzDataDefaultCopyExp = jzDataDefaultCopy; return arrProductTemp; } export function ComputeDiscountAuthorizerLogic(newArrsTemp,newArrsTemp2,item,arrProductTemp){ newArrsTemp = []; newArrsTemp2 = []; arrProductTemp.forEach(itemss => { //itemss产品明细 var Discount__c_Input = 0; if (itemss.warrantyType__c=="市场多年保修") { Discount__c_Input = item.GuaranteeDiscount__c_Input; Discount__c_Input = parseFloat(Discount__c_Input); } else { Discount__c_Input = item.NormalDiscount__c_Input; Discount__c_Input = parseFloat(Discount__c_Input); } if (itemss.PromotionId == item.Id && //方案Id itemss.GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input && //对象品折扣录入 itemss.NormalDiscount__c_Input == item.NormalDiscount__c_Input) { //非对象品折扣录入 itemss = contributingDiscountLogic(itemss, Discount__c_Input, item); //特约折扣计算逻辑 newArrsTemp.push(itemss); } else if (itemss.PromotionId != item.Id || itemss.GuaranteeDiscount__c_Input != item.GuaranteeDiscount__c_Input || itemss.NormalDiscount__c_Input != item.NormalDiscount__c_Input) { newArrsTemp2.push(itemss); } }); newArrsTempExp = newArrsTemp; newArrsTemp2Exp = newArrsTemp2; return arrProductTemp; } export function handleSaveDiscountLogic(jzDataDiscount,jzDataProduct,event){ var boolean = 0; var boolean2 = false; var boolean3 = false; var data = event.detail.rows; let newData = []; let newData2 = []; var newMap3 = new Map(); let newData3 = []; var key=0; let editnewDate = []; var GuaranteeDiscount__cZuiXiao =0; var NormalDiscount__cZuiXiao =0; for (var i = 0; i < jzDataDiscount.length; i++) { var editData = {}; var flag = false; for (var j = 0; j < data.length; j++) { var id = data[j].DelectId.replace("row-", ""); if (jzDataDiscount[i].DelectId == id) { editData = { GuaranteeDiscount__c_Input: '', NormalDiscount__c_Input: '', HeTongPrice: '', GuaranteeDiscount_H_Money__c: '', NormalDiscount_H_Money__c: '' }; //对象折扣 editData.GuaranteeDiscount__c_Input = data[j].GuaranteeDiscount__c_Input; //赋值 非对象折扣 editData.NormalDiscount__c_Input = data[j].NormalDiscount__c_Input; //一般折扣合同价格 editData.HeTongPrice = data[j].HeTongPrice; //对象品合同金额 editData.GuaranteeDiscount_H_Money__c = data[j].GuaranteeDiscount_H_Money__c; //非对象品合同金额 editData.NormalDiscount_H_Money__c = data[j].NormalDiscount_H_Money__c; // editData.id=id; flag = true; } } if (flag) { var newItem = { ...jzDataDiscount[i], ...{} }; if (editData.GuaranteeDiscount__c_Input != undefined) { if(newItem.JxsType == "特约折扣"){ var GuaranteeDiscount__c_Input = parseFloat(editData.GuaranteeDiscount__c_Input); editData.GuaranteeDiscount__c_Input=GuaranteeDiscount__c_Input+'%'; var GuaranteeDiscount__c = parseFloat(newItem.GuaranteeDiscount__c); if (GuaranteeDiscount__c_Input < GuaranteeDiscount__c) { GuaranteeDiscount__cZuiXiao=GuaranteeDiscount__c; boolean = 1; break; } else { jzDataProduct.forEach(jdpt => { if (newItem.Id == jdpt.PromotionId && newItem.GuaranteeDiscount__c_Input == jdpt.GuaranteeDiscount__c_Input && newItem.NormalDiscount__c_Input == jdpt.NormalDiscount__c_Input) { jdpt.GuaranteeDiscount__c_Input = editData.GuaranteeDiscount__c_Input; } }); newItem.GuaranteeDiscount__c_Input = editData.GuaranteeDiscount__c_Input; newItem.iftrue = "改过"; } }else{ boolean = 3; break; } } if (editData.NormalDiscount__c_Input != undefined) { if(editData.NormalDiscount__c_Input!=''&&editData.NormalDiscount__c_Input>=0){ var NormalDiscount__c_Input = parseFloat(editData.NormalDiscount__c_Input); editData.NormalDiscount__c_Input = NormalDiscount__c_Input+'%'; var NormalDiscount__c = parseFloat(newItem.NormalDiscount__c); if (NormalDiscount__c_Input < NormalDiscount__c) { NormalDiscount__cZuiXiao=NormalDiscount__c; boolean = 2; break; } else { jzDataProduct.forEach(jdpt => { if (newItem.Id == jdpt.PromotionId && newItem.GuaranteeDiscount__c_Input == jdpt.GuaranteeDiscount__c_Input && newItem.NormalDiscount__c_Input == jdpt.NormalDiscount__c_Input) { jdpt.NormalDiscount__c_Input = editData.NormalDiscount__c_Input; } }); newItem.NormalDiscount__c_Input = editData.NormalDiscount__c_Input; newItem.iftrue = "改过"; } }else{ boolean = 5 break; } } newItem.GuaranteeDiscount_H_Money_yuan=newItem.GuaranteeDiscount_H_Money__c; if (editData.GuaranteeDiscount_H_Money__c != undefined) { if(newItem.JxsType == "特约折扣"){ if(editData.GuaranteeDiscount_H_Money__c==""){ editData.GuaranteeDiscount_H_Money__c=0; } newItem.GuaranteeDiscount_H_Money__c = editData.GuaranteeDiscount_H_Money__c; newMap3.set(key,newItem); boolean = 4; boolean2 = true ; }else{ boolean = 3; break; } } newItem.NormalDiscount_H_Money_yuan=newItem.NormalDiscount_H_Money__c; if (editData.NormalDiscount_H_Money__c != undefined) { if(editData.NormalDiscount_H_Money__c==""){ editData.NormalDiscount_H_Money__c=0; } newItem.NormalDiscount_H_Money__c = editData.NormalDiscount_H_Money__c; if(newItem.JxsType == "一般折扣"){ newData2.push(newItem); boolean = 4; boolean3 = true; }else{ newMap3.set(key,newItem); boolean = 4; boolean2 = true; } } if (editData.NormalDiscount_H_Money__c != undefined||editData.GuaranteeDiscount_H_Money__c != undefined) { if(newItem.JxsType == "一般折扣"){ newItem.HeTongPrice = parseFloat(newItem.NormalDiscount_H_Money__c) }else{ newItem.HeTongPrice = parseFloat(newItem.NormalDiscount_H_Money__c)+parseFloat(newItem.GuaranteeDiscount_H_Money__c); } } key++; newData.push(newItem); editnewDate.push(newItem); } else { newData.push({ ...{}, ...jzDataDiscount[i] }); } } for (let [k, v] of newMap3) { newData3.push(v); } booleanExp = boolean; boolean2Exp = boolean2; boolean3Exp = boolean3; newDataExp = newData; newData2Exp = newData2; newData3Exp = newData3; editnewDateExp = editnewDate; GuaranteeDiscount__cZuiXiaoExp = GuaranteeDiscount__cZuiXiao; NormalDiscount__cZuiXiaoExp = NormalDiscount__cZuiXiao; jzDataProductExp = jzDataProduct; return jzDataDiscount; } export function AddNumsLogic(ListName, Asset_Model_No__c, addNums, Id,CompareFullData){ var FilterList = CompareFullData.filter(item => { if (item.ListName == ListName && item.Id == Id) { return true; } else { return false; } }) if (FilterList == undefined || FilterList.length <= 0) { var newTemp = { ListName: ListName, Asset_Model_No__c: Asset_Model_No__c, Id: Id, num: addNums } CompareFullData.push(newTemp); } else { FilterList[0].Asset_Model_No__c += Asset_Model_No__c + "||"; FilterList[0].num = addNums; } return CompareFullData; } export function MergeDuplicateSchemesLogic(CompareFullData,SchemeSet){ var a = CompareFullData; var CompareFullDataedit = []; var Setmap = new Map(); var arr = []; var arr2 = SchemeSet; arr2.forEach(arrs => { var object = {}; if (Setmap.has(arrs.Id)) { object = { ...{}, ...Setmap.get(arrs.Id) }; object.Counts = object.Counts + arrs.Counts; object.determine = ''; a.forEach(editnum => { if (editnum.Id == object.Id) { editnum.num = object.Counts; CompareFullDataedit.push(editnum); } else { CompareFullDataedit.push(editnum); } }); CompareFullData = [].concat(CompareFullDataedit); Setmap.set(arrs.Id, object); } else { object = { ...{}, ...arrs }; Setmap.set(arrs.Id, object); } }); for (let [k, v] of Setmap) { arr.push(v); } CompareFullDataExp = CompareFullData; return arr; } //计算价格政策的最大次数 export function ComputeMaximumTimes(priceArr,jzDataDefaultCopyQuantityList,jzDataDefault) { // var num=0; var Pricepolicy = { ...{}, ...priceArr }; var b = jzDataDefaultCopyQuantityList; //查出的每个方案的明细的数量 var selectproducts = jzDataDefault; //待选产品 Pricepolicy.maxCounts = ComputationalLogic(Pricepolicy, b, selectproducts); return Pricepolicy; } export function handleSaveFixedPriceLogic(CompareFullData,event,jzDataFixedPrice,jzDataDefaultCopyQuantityList,jzDataDefault){ var a = CompareFullData; var CompareFullDataedit = []; var HeTongTotal = 0; var data = event.detail.rows; let newData = []; let editnewDate = []; var boolean = 1; for (var i = 0; i < jzDataFixedPrice.length; i++) { var editData = {}; var flag = false; for (var j = 0; j < data.length; j++) { var id = data[j].DelectId.replace("row-", ""); if (jzDataFixedPrice[i].DelectId == id) { // editData=data[j]; editData = { Counts: '', HeTongTotal: '' }; //对象折扣 editData.Counts = data[j].Counts; //赋值 非对象折扣 editData.HeTongTotal = data[j].HeTongTotal; // editData.id=id; flag = true; } } if (flag) { var newItem = { ...jzDataFixedPrice[i], ...{} }; //价格政策数据 //计算最大次数 newItem = ComputeMaximumTimes(newItem,jzDataDefaultCopyQuantityList,jzDataDefault); console.warn('ceshi1'); if (editData.Counts != undefined) { var ifNec = true; if (newItem.recordTypeName__c == "NormalProduct") { if (newItem.ifNecessary__c) { ifNec = false; } } newItem.maxCounts = Number(newItem.maxCounts); if (newItem.maxCounts >= editData.Counts && ifNec) { if (editData.Counts == 0) { boolean = 4; } else { if (newItem.if_Contain_Nod__c) { HeTongTotal = newItem.Price_CNY__c * editData.Counts; } else { HeTongTotal = newItem.Price_CNY__c * editData.Counts + newItem.sumNoDiscount * editData.Counts; } newItem.Counts = editData.Counts; if (newItem.recordTypeName__c == "Promotion") { newItem.HeTongTotal = HeTongTotal; } newItem.determine = '改过'; a.forEach(editnum => { if (editnum.Id == newItem.Id) { editnum.num = newItem.Counts; CompareFullDataedit.push(editnum); } else { CompareFullDataedit.push(editnum); } }); CompareFullData = [].concat(CompareFullDataedit);//20230214 } } else { if (ifNec) { boolean = 3; } else { boolean = 5; } } } console.warn('ceshi2'); if (editData.HeTongTotal != undefined) { if (newItem.if_Contain_Nod__c) { HeTongTotal = newItem.Price_CNY__c * newItem.Counts; } else { HeTongTotal = newItem.Price_CNY__c * newItem.Counts + newItem.sumNoDiscount * newItem.Counts; } if (editData.HeTongTotal < HeTongTotal) { boolean = 6; } else { newItem.HeTongTotal = editData.HeTongTotal; newItem.determine = '改过'; } } newData.push(newItem); editnewDate.push(newItem); } else { newData.push({ ...{}, ...jzDataFixedPrice[i] }); } } CompareFullDataExp = CompareFullData; booleanExp = boolean; newDataExp = newData; HeTongTotalExp = HeTongTotal; return editnewDate; } export function deleteFixedPriceLogic(SelectedFnDataFixedPrice,CompareFullData){ let ids = []; var fag = true; var select = []; for (var j = 0; j < SelectedFnDataFixedPrice.length; j++) { fag = true; var PromotionHeadRecordId = SelectedFnDataFixedPrice[j].recordTypeName__c; if (PromotionHeadRecordId == "NormalProduct") { if (SelectedFnDataFixedPrice[j].ifNecessary__c) { fag = false; } else { select.push(SelectedFnDataFixedPrice[j]); } } else { select.push(SelectedFnDataFixedPrice[j]); } if (fag) { var a = CompareFullData; var compareFu = []; ids.push(SelectedFnDataFixedPrice[j].Id); a.forEach(deletId => { if (SelectedFnDataFixedPrice[j].Id != deletId.Id) { compareFu.push(deletId); } }); CompareFullData = [].concat(compareFu);//20230214 } } SelectedFnDataFixedPrice = [].concat(select);//20230214 CompareFullDataExp = CompareFullData; SelectedFnDataFixedPriceExp = SelectedFnDataFixedPrice; idsExp = ids; return fag; } export function DeleteChangesFnLogic(id,TypeName,CompareFullDataTemp,CompareFullData,jzDataFixedPrice,jzDataDiscount,jzDataProduct,jzDataDefault,jzDataDefaultNotChange){ //删除 规则数量 CompareFullData.forEach(cItem => { if (cItem.Id == id && cItem.ListName == TypeName) { } else { CompareFullDataTemp.push(cItem); } }) //删除 已选产品 var CurrentTemp = {}; if (TypeName == "价格政策") { CurrentTemp = jzDataFixedPrice.filter(fItem => { if (fItem.Id == id) { return true; } return false; })[0]; } if (TypeName == "折扣政策") { CurrentTemp = jzDataDiscount.filter(fItem => { if (fItem.Id == id) { return true; } return false; })[0]; } //匹配需要删除产品 var ProductNumsTemp = []; var NewjzDataProduct = [];; if (TypeName == "价格政策") { jzDataProduct.forEach(proItem => { if (proItem.PromotionNo__c == CurrentTemp.PromotionNo__c) { ProductNumsTemp.push({ Id: proItem.Id, num: proItem.Quantity }) } else { NewjzDataProduct.push(proItem); } }); } else if (TypeName == "折扣政策") { jzDataProduct.forEach(proItem => { if (proItem.CompareId == CurrentTemp.CompareId) { ProductNumsTemp.push({ Id: proItem.Id, num: proItem.Quantity }) } else { NewjzDataProduct.push(proItem); } }); } // 执行删除 jzDataProduct = NewjzDataProduct; // 添加数量 var newjzDataDefaults = []; var AddnumsTemp = []; jzDataDefault.forEach(defItem => { var defItemTemp = { ...{}, ...defItem }; ProductNumsTemp.forEach(pTempItem => { if (pTempItem.Id == defItem.Id) { defItemTemp.Quantity += pTempItem.num; AddnumsTemp.push(pTempItem.Id); } }); newjzDataDefaults.push(defItemTemp); }) jzDataDefault = newjzDataDefaults; //添加整条数据 var PFTempArr = ProductNumsTemp.filter(pTempItem => { var flag = true; AddnumsTemp.filter(addItem => { if (addItem == pTempItem.Id) { flag = false; } }) return flag; }) jzDataDefaultNotChange.forEach(noChangeItem => { PFTempArr.forEach(pftItem => { if (pftItem.Id == noChangeItem.Id) { let newChangeItem = { ...{}, ...noChangeItem }; newChangeItem.Quantity = pftItem.num; jzDataDefault.push(newChangeItem); } }) }) CompareFullDataTempExp = CompareFullDataTemp; jzDataFixedPriceExp = jzDataFixedPrice; jzDataDiscountExp = jzDataDiscount; jzDataDefaultExp = jzDataDefault; jzDataDefaultNotChangeExp = jzDataDefaultNotChange; return jzDataProduct; } export function deleteFixedPriceTempLogic(SelectedFnDataFixedPrice,jzDataFixedPrice,CompareFullData){ let newarr = []; for (var j = 0; j < SelectedFnDataFixedPrice.length; j++) { for (var i = 0; i < jzDataFixedPrice.length; i++) { var a = CompareFullData; var compareFu = []; a.forEach(deletId => { if (SelectedFnDataFixedPrice[j].Id != deletId.Id) { compareFu.push(deletId); } }); CompareFullData = [].concat(compareFu);//20230214 if (SelectedFnDataFixedPrice[j].Id == jzDataFixedPrice[i].Id) { jzDataFixedPrice.splice(i, 1); // 将使后面的元素依次前移,数组长度减1 i--; } } } for (var i = 0; i < jzDataFixedPrice.length; i++) { newarr.push(jzDataFixedPrice[i]); } CompareFullDataExp = CompareFullData; return newarr; } export function GetSearchProductByIdLogic(item,results,jzDataDefaultCopyQuantityList,jzDataFixedPrice){ results.forEach(itemss => { //方案关联的产品 var fl = true; if (jzDataDefaultCopyQuantityList.length == 0) { jzDataDefaultCopyQuantityList.push({ Asset_Model_No__c: itemss.Asset_Model_No__c, Quantity__c__c: itemss.Quantity__c, Id_H: item.PromotionNo__c }); } else { jzDataDefaultCopyQuantityList.forEach(jdcql => { if (itemss.Asset_Model_No__c == jdcql.Asset_Model_No__c && jdcql.Id_H == item.PromotionNo__c) { fl = false; } }); if (fl) { jzDataDefaultCopyQuantityList.push({ Asset_Model_No__c: itemss.Asset_Model_No__c, Quantity__c__c: itemss.Quantity__c, Id_H: item.PromotionNo__c }); } } }); var iflag = true; var newarrjdf = []; jzDataFixedPrice.forEach(jdf => { //价格政策 if (jdf.Id == item.Id) { iflag = false; // jdf.sumListPrice = sumListPrice; // jdf.sumNoDiscount = sumNoDiscount; newarrjdf.push(jdf); } else { newarrjdf.push(jdf); } }); iflagExp = iflag; jzDataDefaultCopyQuantityListExp = jzDataDefaultCopyQuantityList; return newarrjdf; } export function getTableDataCommonlyLogic(jzDataCommonly){ var jzDataCommonlyTemp = []; jzDataCommonly.forEach(items => { var ItemsTemp = { ...{}, ...items }; ItemsTemp.JxsType = "一般折扣"; ItemsTemp.SplitQuantity = ItemsTemp.Quantity; jzDataCommonlyTemp.push(ItemsTemp); }) return jzDataCommonlyTemp; } export function ComputeListPrice(PromotionId,jzDataProduct) { var sum = 0; jzDataProduct.forEach(jzdp => { //jzdp产品明细 if (jzdp.PromotionId == PromotionId) { sum = sum + jzdp.ListPrice * jzdp.Quantity; } }); return sum; } export function delectComputeData(item,jzDataProduct) { var sum = ComputeListPrice(item.PromotionId,jzDataProduct); var jzProductarry = [].concat(jzDataProduct); jzProductarry.forEach(japdt => { if (item.PromotionId == japdt.PromotionId) { japdt.AgencySubtotal__c = japdt.AgencySubtotal__c + item.AgencySubtotal__c * (japdt.ListPrice * japdt.Quantity / sum); japdt.AgencyUnitPrice__c = japdt.AgencySubtotal__c / japdt.Quantity; japdt.AgencySubtotal__c = Math.round(japdt.AgencySubtotal__c * 100) / 100; japdt.AgencyUnitPrice__c = Math.round(japdt.AgencyUnitPrice__c * 100) / 100; } }); jzDataProduct = [].concat(jzProductarry);//20230214 return jzDataProduct; } export function DeleteIsChangelogicExp(item,TypeName,jzDataProduct,jzDataDefault,jzDataDefaultCopy){ var jzdatas = []; var flg = true; var booleanfag = 0; jzDataProduct.forEach(proItem => { //proItem产品明细 if (TypeName == "价格政策") { var PromotionHeadRecordId = item.recordTypeName__c; if (PromotionHeadRecordId == "Promotion") { if (!item.if_Fix__c) { if (proItem.Id == item.Id && item.PromotionId == proItem.PromotionId) {} else { jzdatas.push(proItem); } } else { flg = false; booleanfag = 1; } } else if (PromotionHeadRecordId == "NormalProduct") { flg = false; booleanfag = 2; } else { jzdatas.push(proItem); } } else if (TypeName == "折扣政策") { var PromotionHeadRecordId = item.recordTypeName__c; if (PromotionHeadRecordId == "Authorizer") { if (proItem.Id == item.Id && item.PromotionId == proItem.PromotionId && item.NormalDiscount__c_Input == proItem.NormalDiscount__c_Input && item.GuaranteeDiscount__c_Input == proItem.GuaranteeDiscount__c_Input) {} else { jzdatas.push(proItem); } } else { if (proItem.Id == item.Id && item.Category__c == proItem.Category__c && item.Discount__c_Input == proItem.Discount__c_Input) {} else { jzdatas.push(proItem); } } } }); if (flg) { jzDataProduct = [].concat(jzdatas);//20230214 if (TypeName == "价格政策") { //删除价格计算 jzDataProduct = delectComputeData(item,jzDataProduct); } var fg = true; var arr = jzDataDefault; arr.forEach(jddf => { //jddf待选产品 if (jddf.Id == item.Id) { jddf.Quantity = jddf.Quantity + item.Quantity fg = false; } }); if (fg) { jzDataDefaultCopy.forEach(itm => { //itm报价行项目主数据 if (itm.Id == item.Id) { itm.Quantity = item.Quantity arr.push(itm); fg = false; } }); } jzDataDefault = [].concat(arr);//20230214 } jzDataProductExp = jzDataProduct; jzDataDefaultExp = jzDataDefault; jzDataDefaultCopyExp = jzDataDefaultCopy; return booleanfag; } export function DeleteIsChangesFnjiage(jzDataFixedPrice,jzDataProduct,falg,item){ console.warn('1111'); var arrTemp = [].concat(jzDataFixedPrice);//20230214 var TempItem = {}; arrTemp.forEach(atItem => { if (atItem.Id == item.PromotionId) { TempItem = atItem; return; } }) console.warn('2222'); jzDataProduct.forEach(ite => { //ite产品明细 if (ite.PromotionId == TempItem.Id) { falg = false; } }); falgExp = falg; console.warn('3333'); return TempItem; } export function DeleteIsChangesFnzhekou(jzDataDiscount,jzDataProduct,falg,item){ var arrTempTOName = [].concat(jzDataDiscount);//20230214 var TempItemTOName = {}; var PromotionHeadRecordId = item.recordTypeName__c; if (PromotionHeadRecordId == "Authorizer") { arrTempTOName.forEach(atItem => { if (atItem.Id == item.PromotionId && //方案Id item.NormalDiscount__c_Input == atItem.NormalDiscount__c_Input && //非对象品折扣录入 item.GuaranteeDiscount__c_Input == atItem.GuaranteeDiscount__c_Input) { //对象品折扣录入 TempItemTOName = atItem; return; } }) jzDataProduct.forEach(ite => { if (ite.PromotionId == TempItemTOName.Id && ite.NormalDiscount__c_Input == TempItemTOName.NormalDiscount__c_Input && ite.GuaranteeDiscount__c_Input == TempItemTOName.GuaranteeDiscount__c_Input) { falg = false; } }); } else { arrTempTOName.forEach(atItem => { if (item.Category__c == atItem.Category__c && item.Discount__c_Input == atItem.NormalDiscount__c_Input) { TempItemTOName = atItem; return; } }) jzDataProduct.forEach(ite => { if (ite.Category__c == TempItemTOName.Category__c && ite.Discount__c_Input == TempItemTOName.NormalDiscount__c_Input) { falg = false; } }); } falgExp = falg; return TempItemTOName; } export function delectTableDiscountTempLogic(SelectedFnDataDiscount,jzDataDiscount){ let newarr = []; for (var j = 0; j < SelectedFnDataDiscount.length; j++) { for (var i = 0; i < jzDataDiscount.length; i++) { var PromotionHeadRecordId = SelectedFnDataDiscount[j].recordTypeName__c; if (PromotionHeadRecordId == "Authorizer") { if (SelectedFnDataDiscount[j].Id == jzDataDiscount[i].Id && SelectedFnDataDiscount[j].NormalDiscount__c_Input == jzDataDiscount[i].NormalDiscount__c_Input && SelectedFnDataDiscount[j].GuaranteeDiscount__c_Input == jzDataDiscount[i].GuaranteeDiscount__c_Input) { jzDataDiscount.splice(i, 1); // 将使后面的元素依次前移,数组长度减1 i--; } } else { if (SelectedFnDataDiscount[j].Category__c == jzDataDiscount[i].Category__c && SelectedFnDataDiscount[j].NormalDiscount__c_Input == jzDataDiscount[i].NormalDiscount__c_Input) { jzDataDiscount.splice(i, 1); // 将使后面的元素依次前移,数组长度减1 i--; } } } } for (var i = 0; i < jzDataDiscount.length; i++) { newarr.push(jzDataDiscount[i]); } return newarr; } export function SelectedFnCommonlyLogic(arr){ var newArr = []; arr.forEach(item => { var TempObject = { ...{}, ...item }; TempObject.JxsType = "一般折扣"; newArr.push(TempObject); }) return newArr; } export function SaveGeneralDiscountLogic(data,jzDataCommonly){ debugger; let newData = []; let editnewDate = []; var boolean = 1; for (var i = 0; i < jzDataCommonly.length; i++) { var editData = {}; var flag = false; for (var j = 0; j < data.length; j++) { var id = data[j].Id; if (jzDataCommonly[i].Id == id) { editData = { SplitQuantity: '' }; editData.SplitQuantity = data[j].SplitQuantity; flag = true; } } if (flag) { var newItem = { ...jzDataCommonly[i], ...{} }; if (editData.SplitQuantity != undefined) { newItem.SplitQuantity = Number(editData.SplitQuantity); } newData.push(newItem); editnewDate.push(newItem); } else { newData.push({ ...{}, ...jzDataCommonly[i] }); } } var newArrs = [].concat(editnewDate);//20230214 newArrs.forEach(item => { if (item.Quantity < item.SplitQuantity) { boolean = 2; } else if (item.SplitQuantity == 0 || item.SplitQuantity == '') { boolean = 3; } }); booleanExp = boolean; return newData; } export function DeleteSchemeMatchingLogic(id,TypeName,CompareFullDataTemp,CompareFullData,jzDataFixedPrice,jzDataDiscount,jzDataProduct,jzDataDefault,jzDataDefaultNotChange){ //删除 规则数量 CompareFullData.forEach(cItem => { if (cItem.Id == id.Id && cItem.ListName == TypeName) { console.warn("CompareFullData 删除"); } else { CompareFullDataTemp.push(cItem); } }) //删除 已选产品 var CurrentTemp = {}; if (TypeName == "价格政策") { CurrentTemp = jzDataFixedPrice.filter(fItem => { if (fItem.Id == id.Id) { return true; } return false; })[0]; } if (TypeName == "折扣政策") { CurrentTemp = jzDataDiscount.filter(fItem => { var PromotionHeadRecordId = id.recordTypeName__c; if (PromotionHeadRecordId == "Authorizer") { if (fItem.Id == id.Id && //方案Id fItem.NormalDiscount__c_Input == id.NormalDiscount__c_Input && //非对象品折扣录入 fItem.GuaranteeDiscount__c_Input == id.GuaranteeDiscount__c_Input) { //对象品折扣录入 return true; } } else { if (fItem.NormalDiscount__c_Input == id.NormalDiscount__c_Input && fItem.Category__c == id.Category__c) { //折扣政策分类 return true; } } return false; })[0]; } //匹配需要删除产品 var ProductNumsTemp = []; var NewjzDataProduct = [];; if (TypeName == "价格政策") { jzDataProduct.forEach(proItem => { if (proItem.PromotionNo__c == CurrentTemp.PromotionNo__c) { ProductNumsTemp.push({ Id: proItem.Id, num: proItem.Quantity }) } else { NewjzDataProduct.push(proItem); } }); } else if (TypeName == "折扣政策") { jzDataProduct.forEach(proItem => { var PromotionHeadRecordId = id.recordTypeName__c; if (PromotionHeadRecordId == "Authorizer") { if (CurrentTemp.Id == proItem.PromotionId && //方案Id CurrentTemp.NormalDiscount__c_Input == proItem.NormalDiscount__c_Input && //非对象品折扣录入 CurrentTemp.GuaranteeDiscount__c_Input == proItem.GuaranteeDiscount__c_Input) { //对象品折扣录入 ProductNumsTemp.push({ Id: proItem.Id, num: proItem.Quantity }) } else { NewjzDataProduct.push(proItem); } } else { if (CurrentTemp.NormalDiscount__c_Input == proItem.NormalDiscount__c_Input && CurrentTemp.Category__c == proItem.Category__c) { //折扣政策分类 ProductNumsTemp.push({ Id: proItem.Id, num: proItem.Quantity }) } else { NewjzDataProduct.push(proItem); } } }); } jzDataProduct = NewjzDataProduct; var newjzDataDefaults = []; var AddnumsTemp = []; jzDataDefault.forEach(defItem => { var defItemTemp = { ...{}, ...defItem }; ProductNumsTemp.forEach(pTempItem => { if (pTempItem.Id == defItem.Id) { defItemTemp.Quantity += pTempItem.num; AddnumsTemp.push(pTempItem.Id); } }); newjzDataDefaults.push(defItemTemp); }) jzDataDefault = newjzDataDefaults; //添加整条数据 var PFTempArr = ProductNumsTemp.filter(pTempItem => { var flag = true; AddnumsTemp.filter(addItem => { if (addItem == pTempItem.Id) { flag = false; } }) return flag; }) jzDataDefaultNotChange.forEach(noChangeItem => { PFTempArr.forEach(pftItem => { if (pftItem.Id == noChangeItem.Id) { let newChangeItem = { ...{}, ...noChangeItem }; newChangeItem.Quantity = pftItem.num; jzDataDefault.push(newChangeItem); } }) }) CompareFullDataTempExp = CompareFullDataTemp; jzDataFixedPriceExp = jzDataFixedPrice; jzDataDiscountExp = jzDataDiscount; jzDataDefaultExp = jzDataDefault; jzDataDefaultNotChangeExp = jzDataDefaultNotChange; return jzDataProduct; } export function savecountLogic(jzDataFixedPrice,idStr){ var arr = [] jzDataFixedPrice.forEach(item => { //价格政策 if (idStr == item.Id) { item.maxCounts = item.Counts arr.push(item); } else { arr.push(item); } }); jzDataFixedPrice = arr; return jzDataFixedPrice; } export function ComparePushDataLogic(jzDataDefault,jzDataProduct,Asset_Model_No__c,Id,TypeName,jzDataProductParam,Quantity,num){ let addArr = []; var newss = [].concat(jzDataDefault); var newDataDefault = newss.map(item => { if (item == undefined) { console.warn("undefined!!"); } if (item.Product2.MDM_Model_No__c == Asset_Model_No__c) { let ItemTemp = { ...{}, ...item }; ItemTemp.Quantity = Quantity * num ItemTemp.PromotionNo__c = jzDataProductParam.PromotionNo__c; ItemTemp.Name = jzDataProductParam.Name; ItemTemp.TypeName = TypeName; ItemTemp.PromotionId = Id; addArr.push(ItemTemp); item.Quantity -= num * Quantity; } return item; }) jzDataProduct = jzDataProduct.concat(addArr); jzDataProductExp = jzDataProduct; return newDataDefault; } export function saveAllDataProductFnChuanshen(jzDataFixedPrice,jzDataDiscount,quoId,QuoteData,jzDataProduct,jzDataDefault,ContractPrice){ var newTemp = []; jzDataFixedPrice.forEach(item => { //价格政策 var itemTemp = { ...{}, ...item }; itemTemp.typess = "价格政策 "; newTemp.push(itemTemp); }); var newTemp2 = []; jzDataDiscount.forEach(item => { //折扣政策 var itemTemp = { ...{}, ...item }; itemTemp.typess = "折扣政策"; newTemp2.push(itemTemp); }); var data = newTemp.concat(newTemp2);//20230213 var ParamIdStr = quoId; var Trade__c = QuoteData[0].Opportunity.Trade__c; var NewData = ConsolidationScheme(data, ParamIdStr, Trade__c); var NewData1 = MergeProducts(jzDataProduct, jzDataDefault, data, ParamIdStr); var jsondatasss = JSON.stringify(NewData); var jsondatassss = JSON.stringify(NewData1); var Sales_Root__c = QuoteData[0].Opportunity.Sales_Root__c; var QuoteId = QuoteData[0].Id; var OpportunityId = QuoteData[0].OpportunityId; var dataChunanshen = { JsonStr: jsondatasss, ParamIdStr: ParamIdStr, JsonStr2: jsondatassss, QuoteId: QuoteId, SalesRootc: Sales_Root__c, ContractPrice: ContractPrice, OpportunityId: OpportunityId, DealerFinalPriceFc: QuoteData[0].Dealer_Final_Price_F__c, Agent1Agent2Pricec: QuoteData[0].Agent1_Agent2_Price__c }; newTempExp = newTemp; return dataChunanshen; } export function saveAllDataProductFnPanduan(jzDataProduct,newTemp){ var ifnull = true; var ifnunum=1; newTemp.forEach(ntp => { //价格政策 if (ntp.HeTongTotal == undefined || ntp.HeTongTotal == 0) { ifnull = false; } }); jzDataProduct.forEach(jzdp=>{ if(jzdp.AgencyUnitPrice__c<0){ ifnunum=2; return; } }); ifnullExp = ifnull; return ifnunum; } export function QTcssE(pricePolicyflag){ var QTcss = ''; if(pricePolicyflag){ QTcss="slds-button slds-button_neutral slds-button_stretch lexBorder"; }else{ QTcss="slds-button slds-button_neutral slds-button_stretch quobutton"; } return QTcss; } export function CompareDataL(list,jzDataDefault){ debugger var isChange = false; var TempsJzData = [] TempsJzData = [].concat(jzDataDefault); //待选产品 var TempsJzDataToCompare = [] TempsJzData.forEach(item => { list.forEach(element => { //促销方案主数据关联产品 if (element.Asset_Model_No__c == item.Product2.MDM_Model_No__c) { if (item.Quantity >= element.Quantity__c) { isChange = true; let CompareTemp = { item: item, element: element } TempsJzDataToCompare.push(CompareTemp); } } }); }) //add 0602 var CheckMinNum = 0; var newTempsJzDataToCompare = [] TempsJzDataToCompare.forEach(item => { //符合规则的产品 var intNum = parseInt(item.item.Quantity / item.element.Quantity__c); if (CheckMinNum == 0) { CheckMinNum = intNum; } if (intNum < CheckMinNum) { CheckMinNum = intNum; } }) TempsJzDataToCompare.forEach(item => { var newItem = { ...{}, ...item.item }; var newElement = { ...{}, ...item.element }; newItem.Quantity = item.element.Quantity__c * CheckMinNum; var newObj = {}; newObj.item = newItem; newObj.element = newElement; newTempsJzDataToCompare.push(newObj); }) TempsJzDataToCompare = [].concat(newTempsJzDataToCompare); isChangeExp = isChange; return TempsJzDataToCompare; } export function initquoT(responseObj,buttonIsShow,initDataTableFixedPrice,initDataTableDiscount,initDataTableOtherData,initDataTableCommonly){ var QuoteData = responseObj; if(QuoteData[0].Dealer_Final_Price_F__c==undefined||QuoteData[0].Dealer_Final_Price_F__c===''){ QuoteData[0].Dealer_Final_Price_F__c=0 } if(QuoteData[0].Agent1_Agent2_Price__c==undefined||QuoteData[0].Agent1_Agent2_Price__c===''){ QuoteData[0].Agent1_Agent2_Price__c=null; } debugger if (QuoteData[0].Quote_Decision__c != "√") { buttonIsShow = true; initDataTableFixedPrice.columns[7].editable = true; initDataTableFixedPrice.columns[10].editable = true; initDataTableDiscount.columns[2].editable = true; initDataTableDiscount.columns[3].editable = true; initDataTableDiscount.columns[4].editable = true; initDataTableDiscount.columns[5].editable = true; initDataTableOtherData.columns[3].editable = true; initDataTableCommonly.columns[3].editable = true; }else{ buttonIsShow = false; } buttonIsShowE = buttonIsShow; initDTFP = initDataTableFixedPrice; initDTD = initDataTableDiscount; initDTOD = initDataTableOtherData; initDTC = initDataTableCommonly; return QuoteData; } //产品需要更新的字段 export function ChangeProductData(key) { var keyArr = ['']; var flag = false; keyArr.forEach(item => { if (item == key) { flag = true; } }) return flag; } export const initDataTableProduct2 = { columns: [{ label: '产品型号', fieldName: 'Asset_Model_No__c', sortable: true, typeAttributes: { }, hideDefaultActions: true, }, { label: '产品名称', fieldName: 'Name__c', sortable: true, hideDefaultActions: true, initialWidth: 205, }, { label: '数量', fieldName: 'Quantity', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' }, initialWidth: 88 }, { label: '保修类型', fieldName: 'warrantyType__c', sortable: true, hideDefaultActions: true, }, { label: '方案代码', fieldName: 'PromotionNo__c', sortable: true, hideDefaultActions: true, }, { label: '促销方案名称/产品系列', fieldName: 'Name', sortable: true, hideDefaultActions: true, initialWidth: 124 }, { label: '主报价', fieldName: 'ListPrice', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' } }, { label: '多年保价格小计', fieldName: 'NoDiscountTotal__c', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' } }, { label: '折扣', fieldName: 'Discount__c_Input', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' } }, { label: '合同单价', fieldName: 'AgencyUnitPrice__c', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' }, typeAttributes: { minimumFractionDigits: '2', maximumFractionDigits: '2' } }, { label: '合同总价', fieldName: 'AgencySubtotal__c', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' }, typeAttributes: { minimumFractionDigits: '2', maximumFractionDigits: '2' } }, ], sortInterfaces: false, searchColumns:initSearchFormProduct } export const initSearchForm2 = [{ label: "方案代码", type: "text", name: "PromotionNo__cEqual", isInput: true }, { label: "名称", type: "text", name: "NameLike", isInput: true } ] export const initDataTable2 = { columns: [{ label: '方案代码', fieldName: 'PromotionNo__c', sortable: true, hideDefaultActions: true, // initialWidth: 100 }, { label: '名称', fieldName: 'Name', sortable: true, hideDefaultActions: true, initialWidth: 300 }, { label: '描述', fieldName: 'Description__c', sortable: true, hideDefaultActions: true, initialWidth: 300 }, { label: '促销价格', fieldName: 'Price_CNY__c', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' }, initialWidth: 140 }, { label: '是否包含多年保修价格', fieldName: 'if_Contain_Nod__c', sortable: true, type: 'boolean', hideDefaultActions: true, cellAttributes: { alignment: 'center' }, initialWidth: 170 }, { label: '是否固定数量', type: 'boolean', fieldName: 'if_Fix__c', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'center' }, initialWidth: 130 }, ], sortInterfaces: false, searchColumns: initSearchForm2 } export const initSearchFormFix2 = [{ label: "方案代码", type: "text", name: "PromotionNo__cEqual", isInput: true }, { label: "名称", type: "text", name: "NameLike", isInput: true } ] export const initDataTableFix2 = { columns: [{ label: '方案代码', fieldName: 'PromotionNo__c', sortable: true, hideDefaultActions: true }, { label: '名称', fieldName: 'Name', sortable: true, hideDefaultActions: true, initialWidth: 351 }, { label: '描述', fieldName: 'Description__c', sortable: true, hideDefaultActions: true, initialWidth: 327 }, { label: '促销价格', fieldName: 'Price_CNY__c', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' } }, { label: '是否包含多年保修价格', fieldName: 'if_Contain_Nod__c', type: 'boolean', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'center' } }, { label: '是否固定数量', fieldName: 'if_Fix__c', type: 'boolean', hideDefaultActions: true, sortable: true, cellAttributes: { alignment: 'center' } } ], sortInterfaces: false, searchColumns: initSearchFormFix2 } export const initSearchFormDefalt2 = [{ label: "产品型号", type: "text", name: "Asset_Model_No__c", isInput: true }, { label: "产品名称", type: "text", name: "Name__c", isInput: true } ] export const initDataTableDefault2 = { columns: [{ label: '产品型号', fieldName: 'Asset_Model_No__c', hideDefaultActions: true, sortable: true }, { label: '产品名称', fieldName: 'Name__c', sortable: true, hideDefaultActions: true, initialWidth: 251 }, { label: '数量', fieldName: 'Quantity', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' } }, { label: '保修类型', fieldName: 'warrantyType__c', sortable: true, hideDefaultActions: true, }, { label: '主报价', fieldName: 'ListPrice', type: 'number', hideDefaultActions: true, sortable: true, cellAttributes: { alignment: 'right' } }, { label: '多年保价格小计', fieldName: 'NoDiscountTotal__c', type: 'number', hideDefaultActions: true, sortable: true, cellAttributes: { alignment: 'right' } }, ], sortInterfaces: false, searchColumns: initSearchFormDefalt2 } export const initSearchFormFixedPrice2 = [{ label: "产品型号", type: "text", name: "Asset_Model_No__c", isInput: true }, { label: "产品名称", type: "text", name: "Name__c", isInput: true } ] export const initDataTableFixedPrice2 = { columns: [{ label: '方案代码', fieldName: 'PromotionNo__c', sortable: true, hideDefaultActions: true }, { label: '促销方案名称/产品系列', fieldName: 'Name', sortable: true, hideDefaultActions: true, initialWidth: 196 }, { label: '方案描述', fieldName: 'Description__c', sortable: true, hideDefaultActions: true, initialWidth: 105 }, { label: '分类', fieldName: 'Category__c', sortable: true, hideDefaultActions: true }, { label: '是否包含多年保修价格', fieldName: 'if_Contain_Nod__c', type: 'boolean', hideDefaultActions: true, sortable: true, cellAttributes: { alignment: 'center' } }, { label: '是否固定数量', fieldName: 'if_Fix__c', type: 'boolean', hideDefaultActions: true, sortable: true, cellAttributes: { alignment: 'center' } }, { label: '促销单价', fieldName: 'Price_CNY__c', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' } }, { label: '次数', fieldName: 'Counts', type: 'number', hideDefaultActions: true, sortable: true, cellAttributes: { class: {}, alignment: 'right' }, editable: false }, { label: '多年保价格合计', fieldName: 'sumNoDiscountTotal', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' } }, { label: '促销总价', fieldName: 'Total', type: 'number', hideDefaultActions: true, sortable: true, cellAttributes: { alignment: 'right' } }, { label: '合同价格', fieldName: 'HeTongTotal', type: 'number', hideDefaultActions: true, sortable: true, cellAttributes: { class: {}, alignment: 'right' }, editable: false, initialWidth: 100 }, ], sortInterfaces: [], searchColumns: initSearchFormFixedPrice2 } export const initSearchFormDiscount2 = [] export const initDataTableDiscount2 = { columns: [{ label: '经销商分类', fieldName: 'JxsType', sortable: true, hideDefaultActions: true }, { label: '分类', fieldName: 'Category__c', sortable: true, hideDefaultActions: true }, // { // label: '对象品折扣', // fieldName: 'GuaranteeDiscount__c', // sortable: true, // cellAttributes: { // alignment: 'center' // } // }, // { // label: '非对象品折扣', // fieldName: 'NormalDiscount__c', // sortable: true, // cellAttributes: { // alignment: 'center' // } // }, { label: '对象品折扣', fieldName: 'GuaranteeDiscount__c_Input', editable: false, hideDefaultActions: true, cellAttributes: { class: {}, alignment: 'right' }, }, { label: '对象品合同金额', fieldName: 'GuaranteeDiscount_H_Money__c', type: 'number', editable: false, hideDefaultActions: true, cellAttributes: { class: {}, alignment: 'right' }, typeAttributes: { minimumFractionDigits: '2', maximumFractionDigits: '2' } }, { label: '非对象品折扣', fieldName: 'NormalDiscount__c_Input', editable: false, hideDefaultActions: true, cellAttributes: { class: {}, alignment: 'right' }, }, { label: '非对象品合同金额', fieldName: 'NormalDiscount_H_Money__c', type: 'number', hideDefaultActions: true, editable: false, cellAttributes: { class: {}, alignment: 'right' }, typeAttributes: { minimumFractionDigits: '2', maximumFractionDigits: '2' } }, { label: '合同价格', fieldName: 'HeTongPrice', type: 'number', hideDefaultActions: true, editable: false, cellAttributes: { class: {}, alignment: 'right' }, typeAttributes: { minimumFractionDigits: '2', maximumFractionDigits: '2' } } ], sortInterfaces: [], searchColumns: initSearchFormDiscount2 } export const initSearchFormSpecial2 = [] export const initDataTableSpecial2 = { columns: [{ label: '编码', fieldName: 'PromotionNo__c', sortable: true, hideDefaultActions: true }, { label: '协议产品', fieldName: 'Department__c', sortable: true, hideDefaultActions: true }, { label: '对象品折扣', fieldName: 'GuaranteeDiscount__c', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' } }, { label: '非对象品折扣', fieldName: 'NormalDiscount__c', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' } }, { label: '协议编码', fieldName: 'Contract__c', sortable: true, hideDefaultActions: true }, { label: '经销商', fieldName: 'Agency__Name', sortable: true, hideDefaultActions: true }, ], sortInterfaces: false, searchColumns: initSearchFormSpecial2 } export const initSearchFormOtherData2 = [] export const initDataTableOtherData2 = { columns: [{ label: '产品型号', fieldName: 'Asset_Model_No__c', sortable: true, hideDefaultActions: true, typeAttributes: { }, }, { label: '产品名称', fieldName: 'Name__c', hideDefaultActions: true, sortable: true, initialWidth: 268 }, { label: '数量', fieldName: 'Quantity', type: 'number', hideDefaultActions: true, sortable: true, cellAttributes: { alignment: 'right' } }, { label: '使用数量', fieldName: 'SplitQuantity', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right', class: {} }, editable: false }, { label: '保修类型', fieldName: 'warrantyType__c', sortable: true, hideDefaultActions: true, }, { label: '主报价', fieldName: 'ListPrice', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' } }, { label: '多年保价格小计', fieldName: 'NoDiscountTotal__c', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' } }, ], sortInterfaces: false, searchColumns: initSearchFormOtherData2 } export const initSearchFormCommonly2 = [{ label: "方案代码", type: "text", name: "PromotionNo__cEqual", isInput: true }, { label: "名称", type: "text", name: "NameLike", isInput: true } ] export const initDataTableCommonly2 = { columns: [{ label: '产品型号', fieldName: 'Asset_Model_No__c', sortable: true, hideDefaultActions: true, typeAttributes: { }, }, { label: '产品名称', fieldName: 'Name__c', sortable: true, hideDefaultActions: true, initialWidth: 268 }, { label: '数量', fieldName: 'Quantity', type: 'number', hideDefaultActions: true, sortable: true, cellAttributes: { alignment: 'right' } }, { label: '使用数量', fieldName: 'SplitQuantity', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right', class: {} }, editable: false }, { label: '保修类型', fieldName: 'warrantyType__c', sortable: true, hideDefaultActions: true, }, { label: '主报价', fieldName: 'ListPrice', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' } }, { label: '多年保价格小计', fieldName: 'NoDiscountTotal__c', type: 'number', sortable: true, hideDefaultActions: true, cellAttributes: { alignment: 'right' } }, ], sortInterfaces: false, searchColumns: initSearchFormCommonly2 }