| | |
| | | import selectUpdateFiexedpriceData from '@salesforce/apex/QuoteTrialController.selectUpdateFiexedpriceData'; |
| | | import selectUpdateQuoteLineItemData from '@salesforce/apex/QuoteTrialController.selectUpdateQuoteLineItemData'; |
| | | import lwcCSS from '@salesforce/resourceUrl/lwcCSS'; |
| | | import {yingYanCheck,qwe,lineDown,lineUp,localParseInt,toNum,initDataTableToBeproductConfig,saveEvoluationLogic,oppInfosave,quoLineItemsave,filterNameoptionList,initDataSetProductTablefig,quoteTotalPriceActionLogic,CheckForCost,actState,tStringe,Agent1comput, |
| | | import {ExtendedWarrantyAmountTotalPriceExport,yingYanCheck,qwe,lineDown,lineUp,localParseInt,toNum,initDataTableToBeproductConfig,saveEvoluationLogic,oppInfosave,quoLineItemsave,filterNameoptionList,initDataSetProductTablefig,quoteTotalPriceActionLogic,CheckForCost,actState,tStringe,Agent1comput, |
| | | toNumComma,localParseFloat,NewQcopyLogic,productCompareLogic,bflag,jzProductsearchLogic,additionaljzProductLogic,initDataProductTablefig,checkNMPA,saveQuotel,CheckForListPrice,calGuranteePeriodLogic,EstimationL,checkch, |
| | | additionabuttonLoc,DataStatus,InitializeProductAssignment,PriceStatusUpdateLogic,newQuoteFlagex,calGuranteeAllFieldsLogic,MultiYearWarrantyTotalPriceExport,newQuoteFlagExp,AlertForCFDA,UnitPriceUpdateLogic,nafgExp,flg,errorflgw, |
| | | PrintCustomerNameoptionsvlue,selection_hpExp,options_hpflgExp,initquoassignment,initquoassignmentcopy,salesProfit1Logic,salesCalculation1Logic,salesProfit2Logic,salesCalculation2Logic,SubtotalupdateLogic,alfExp,resultFlag, |
| | |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.hidden_MultiYearWarrantyTotalPrice = MultiYearWarrantyTotalPriceExport; |
| | | this.quo.MultiYearWarrantyTotalPrice__c = toNumComma(MultiYearWarrantyTotalPriceExport); |
| | | this.quo.ExtendedWarrantyAmountTotalPrice__c = toNumComma(ExtendedWarrantyAmountTotalPriceExport); |
| | | } |
| | | EstimationListPrice() { |
| | | this.jzDataToBeproduct = EstimationL(this.jzDataToBeproduct,this.quo); |
| | |
| | | this.quo.Quote_Adjust_Amount_Page__c = toNumComma(y); |
| | | y=localParseFloat(y); |
| | | var noDiscountPriceTotal = this.hidden_MultiYearWarrantyTotalPrice; |
| | | var exPriceTotal = this.quo.ExtendedWarrantyAmountTotalPrice__c; |
| | | noDiscountPriceTotal=localParseFloat(noDiscountPriceTotal); |
| | | this.quo.QuoteTotal_Page__c=toNumComma(y + x + noDiscountPriceTotal); |
| | | exPriceTotal = localParseFloat(exPriceTotal); |
| | | this.quo.QuoteTotal_Page__c=toNumComma(y + x + noDiscountPriceTotal + exPriceTotal); |
| | | var z=this.quo.Estimation_List_Price__c; |
| | | var id=this.quoId; |
| | | // if(!id){ |
| | | var IsQuoteTrial=this.quo.IsQuoteTrial__c; |
| | | if(!IsQuoteTrial){ |
| | | var mp=this.quo.MultiYearWarrantyTotalPrice__c; |
| | | var ex =this.ExtendedWarrantyAmountTotalPrice__c; |
| | | mp=localParseFloat(mp); |
| | | ex=localParseFloat(ex); |
| | | var num=this.quo.Quote_Adjust_Calculate__c; |
| | | num=localParseFloat(num); |
| | | this.quo.Quote_Adjust_Calculate__c=toNumComma(num); |
| | |
| | | var rh=this.oppInfo.rate_hospital; |
| | | var ra=this.oppInfo.rate_agency1; |
| | | this.quo.Dealer_Final_Price_Page__c=toNumComma(z*rh); |
| | | this.quo.OCM_Agent1_Price_Page__c=this.Saleslet ? toNumComma(z*num*ra+mp) : ''; |
| | | this.quo.OCM_Agent1_Price_Page__c=this.Saleslet ? toNumComma(z*num*ra+mp+ex) : ''; |
| | | this.setOCMAmount(); |
| | | this.calFromContactPrice(); |
| | | } |
| | |
| | | var data=event.detail.rows; |
| | | console.log('data==>> ' + JSON.stringify(data)); |
| | | this.jzDataToBeproduct=onsaveToBeproductLoc(data,this.jzDataToBeproduct); |
| | | debugger |
| | | if(fagExp){ |
| | | this.quo.IsQuoteTrial__c=false; |
| | | this.quoteAgencyTotalPriceAction(); |
| | | this.AgencyDiscountCalculation1(); |
| | | } |
| | | this.updateNoDiscountPricetotal(); |
| | | // chenjingwu |
| | | this.updateExPricetotal() |
| | | // chenjingwu |
| | | this.EstimationListPrice(); |
| | | this.calUnitPriceTotal(); |
| | | this.quoteTotalPrice(); |
| | |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.hidden_MultiYearWarrantyTotalPrice=noDiscountPriceTotal; |
| | | this.quo.MultiYearWarrantyTotalPrice__c=toNumComma(noDiscountPriceTotal); |
| | | } |
| | | updateExPricetotal() { |
| | | var ExPricetotal=0; |
| | | this.jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var exPrice=jzdtbt.exPrice; |
| | | exPrice=localParseFloat(exPrice); |
| | | var Quantity=jzdtbt.Quantity__c; |
| | | Quantity=localParseFloat(Quantity); |
| | | ExPricetotal=ExPricetotal + exPrice * Quantity; |
| | | }); |
| | | this.quo.ExtendedWarrantyAmountTotalPrice__c=toNumComma(ExPricetotal); |
| | | } |
| | | handleRowAction(event){ |
| | | const actionName=event.detail.row; |
| | |
| | | } |
| | | }else{ |
| | | this.OnLoading(true); |
| | | setProductEntry(dataChunanshen).then(reslut=>{ |
| | | debugger |
| | | setProductEntry(dataChunanshen).then(reslut=>{ |
| | | var tempArr=reslut.split("---"); |
| | | var errormessage=tempArr[0]; |
| | | var quoteLineItem=JSON.parse(tempArr[1]); |
| | | quoteLineItem=InitializeProductAssignment(quoteLineItem); |
| | | this.jzDataToBeproduct=quoteLineItem; |
| | | // cjw |
| | | var idList = []; |
| | | console.log('123'); |
| | | console.log(reslut); |
| | | console.log(this.jzDataToBeproduct); |
| | | this.jzDataToBeproduct.forEach(item=>{ |
| | | idList.push(item.pageObject.PricebookEntry.Product2Id); |
| | | idList.push(item.pageObject.Id__c); |
| | | }); |
| | | addOptions({idList: idList}).then(result=>{ |
| | | this.addOptionsLogic(result); |
| | | if(quoteLineItem.length!=num){ |
| | | this.quo.IsQuoteTrial__c=false; |
| | | } |
| | | this.calPriceAll(); |
| | | if(errormessage.indexOf('成功') >= 0){ |
| | | this.Alert(errormessage,'success'); |
| | | }else{ |
| | | this.Alert(errormessage,'error'); |
| | | } |
| | | this.OnLoading(false); |
| | | }); |
| | | if(quoteLineItem.length!=num){ |
| | | this.quo.IsQuoteTrial__c=false; |
| | | } |
| | | this.calPriceAll(); |
| | | if(errormessage.indexOf('成功') >= 0){ |
| | | this.Alert(errormessage,'success'); |
| | | }else{ |
| | | this.Alert(errormessage,'error'); |
| | | } |
| | | this.OnLoading(false); |
| | | }); |
| | | this.cancelsetProduct(); |
| | | } |
| | |
| | | var errormessage = tempArr[0]; |
| | | var quoteLineItem = JSON.parse(tempArr[1]); |
| | | quoteLineItem = InitializeProductAssignment(quoteLineItem); |
| | | this.tobeflag=false; |
| | | this.jzDataToBeproduct = quoteLineItem; |
| | | if(quoteLineItem.length!=num){ |
| | | this.quo.IsQuoteTrial__c = false; |
| | | } |
| | | this.calPriceAll(); |
| | | if(errormessage.indexOf('成功') >= 0){ |
| | | this.Alert(errormessage,'success'); |
| | | }else{ |
| | | this.Alert(errormessage,'error'); |
| | | } |
| | | |
| | | this.OnLoading(false); |
| | | this.cancelQuoteExcelImport(); |
| | | // cjw |
| | | console.log('xxx'); |
| | | console.log(this.jzDataToBeproduct); |
| | | var idList = []; |
| | | this.jzDataToBeproduct.forEach(item=>{ |
| | | idList.push(item.pageObject.Id__c); |
| | | }); |
| | | addOptions({idList: idList}).then(result=>{ |
| | | this.addOptionsLogic(result); |
| | | if(quoteLineItem.length!=num){ |
| | | this.quo.IsQuoteTrial__c = false; |
| | | } |
| | | this.calPriceAll(); |
| | | if(errormessage.indexOf('成功') >= 0){ |
| | | this.Alert(errormessage,'success'); |
| | | }else{ |
| | | this.Alert(errormessage,'error'); |
| | | } |
| | | |
| | | this.OnLoading(false); |
| | | this.cancelQuoteExcelImport(); |
| | | this.tobeflag=true; |
| | | }); |
| | | }); |
| | | } |
| | | @track |
| | |
| | | var idList = []; |
| | | // cjw |
| | | this.jzDataToBeproduct.forEach(item=>{ |
| | | idList.push(item.pageObject.PricebookEntry.Product2Id); |
| | | idList.push(item.pageObject.Id__c); |
| | | }); |
| | | addOptions({idList: idList}).then(result=>{ |
| | | this.addOptionsLogic(result); |
| | |
| | | key.forEach(item=>{ |
| | | Setmap.set(item,result[item]); |
| | | }); |
| | | var optionMap = new Map(); |
| | | var map1 = Setmap.get('optionMap'); |
| | | var key1 = Object.keys(map1) |
| | | key1.forEach(item=>{ |
| | | optionMap.set(item,map1[item]); |
| | | }); |
| | | var priceMap = new Map(); |
| | | var map2 = Setmap.get('priceMap'); |
| | | var key2 = Object.keys(map2) |
| | | key2.forEach(item=>{ |
| | | priceMap.set(item,map2[item]); |
| | | }); |
| | | console.log('loh'); |
| | | console.log(this.jzDataToBeproduct); |
| | | this.jzDataToBeproduct.forEach(item=>{ |
| | | if(result){ |
| | | item.Learning_CommunityOptions = Setmap.get(item.pageObject.PricebookEntry.Product2Id); |
| | | item.Learning_CommunityOptions = optionMap.get(item.pageObject.Id__c); |
| | | item.multiYearWarrantyList = priceMap.get(item.pageObject.Id__c); |
| | | if(item.Learning_Community){ |
| | | item.multiYearWarrantyList.forEach(it=>{ |
| | | if('' + (it.AgeLimit__c) == item.Learning_Community){ |
| | | item.exPrice = it.MultiOneYearWarrantyPrice__c; |
| | | } |
| | | }); |
| | | if(item.exPrice == null || item.exPrice == '' || item.exPrice == undefined){ |
| | | item.exPrice = 0; |
| | | } |
| | | }else{ |
| | | item.Learning_Community = item.multiYearWarrantyList[item.multiYearWarrantyList.length -1].AgeLimit__c; |
| | | item.exPrice = item.multiYearWarrantyList[item.multiYearWarrantyList.length -1].MultiOneYearWarrantyPrice__c; |
| | | } |
| | | } |
| | | }); |
| | | console.log(this.jzDataToBeproduct); |
| | | } |
| | | // cjw |
| | | //新增报价产品模态框取消按钮 |
| | |
| | | this.IsLoading6 = false; |
| | | }, 1000); |
| | | } |
| | | //=========促销方案模态框 end============ |
| | | //***************价格政策 end************** |
| | | |
| | | //********折扣政策 start*********** |
| | | //选择特约折扣打开按钮 |
| | | showModalSpecial(){ |
| | | this.QuoteData.forEach(qtd => { |
| | | if (!qtd.Opportunity.IsAuthorized__c) { |
| | | this.Alert("该询价不是特约经销商授权",'error'); |
| | | } else { |
| | | this.ShowSpecial = true; |
| | | } |
| | | }); |
| | | } |
| | | //选择一般折扣打开按钮 |
| | | showModalCommonly(){ |
| | | this.ShowCommonly = true |
| | | } |
| | | //折扣政策删除按钮事件 |
| | | delectTableDiscount(){ |
| | | let ids = []; |
| | | for (var j = 0; j < this.SelectedFnDataDiscount.length; j++) { |
| | | ids.push(this.SelectedFnDataDiscount[j].Id); |
| | | } |
| | | this.DeleteSchemeMatching(this.SelectedFnDataDiscount, "折扣政策"); |
| | | this.delectTableDiscountTemp(); |
| | | this.ContractPriceCompute(); |
| | | } |
| | | DeleteSchemeMatching(ids, TypeName) { |
| | | var CompareFullDataTemp = []; |
| | | ids.forEach(id => { |
| | | this.jzDataProduct = DeleteSchemeMatchingLogic(id,TypeName,CompareFullDataTemp,this.CompareFullData,this.jzDataFixedPrice,this.jzDataDiscount,this.jzDataProduct,this.jzDataDefault,this.jzDataDefaultNotChange); |
| | | CompareFullDataTemp = CompareFullDataTempExp; |
| | | this.jzDataFixedPrice = jzDataFixedPriceExp; |
| | | this.jzDataDiscount = jzDataDiscountExp; |
| | | this.jzDataDefault = jzDataDefaultExp; |
| | | this.jzDataDefaultNotChange = jzDataDefaultNotChangeExp; |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | }); |
| | | this.CompareFullData = CompareFullDataTemp; |
| | | } |
| | | //折扣政策选中列表数据 |
| | | @track SelectedFnDataDiscount = [] |
| | | //折扣政策选择事件 |
| | | SelectedFnDiscount(event) { |
| | | let arr = event.detail.rows; |
| | | this.SelectedFnDataDiscount = arr; |
| | | } |
| | | //折扣政策列表数据 |
| | | @track jzDataDiscount = []; |
| | | //折扣政策列表加载动图标识 |
| | | @track tableIsLodingDiscount = true; |
| | | //折扣政策列表列配置 |
| | | @track |
| | | initDataTableDiscount = initDataTableDiscount2; |
| | | //折扣政策列表列加载方法 |
| | | getTableDataDiscount(event) { |
| | | this.tableIsLodingDiscount = false; |
| | | } |
| | | @track |
| | | Tongzhishow = false; //提示显示的标识 |
| | | SaveShowText = "操作成功"; //提示框的文本 |
| | |
| | | }); |
| | | this.dispatchEvent(event); |
| | | } |
| | | } |
| | | //折扣政策编辑列保存方法 |
| | | handleSaveDiscount(event) { |
| | | this.jzDataDiscount = handleSaveDiscountLogic(this.jzDataDiscount,this.jzDataProduct,event); |
| | | var boolean = booleanExp; |
| | | var boolean2 = boolean2Exp; |
| | | var boolean3 = boolean3Exp; |
| | | let newData = newDataExp; |
| | | let newData2 = newData2Exp; |
| | | let newData3 = newData3Exp; |
| | | let editnewDate = editnewDateExp; |
| | | var GuaranteeDiscount__cZuiXiao = GuaranteeDiscount__cZuiXiaoExp; |
| | | var NormalDiscount__cZuiXiao = NormalDiscount__cZuiXiaoExp; |
| | | this.jzDataProduct = jzDataProductExp; |
| | | //haha2 |
| | | if (boolean == 0) { |
| | | this.jzDataDiscount = newData; |
| | | var newArrs = [].concat(editnewDate);//20230214 |
| | | newArrs.forEach(item => { |
| | | //合并折扣政策重复方案 |
| | | this.ConsolidatedDiscountPolicy(this.jzDataDiscount); |
| | | this.ComputeDiscount(item.Id, item.NormalDiscount__c_Input, item.GuaranteeDiscount__c_Input, item.Category__c, item.JxsType); |
| | | }); |
| | | this.jzDataProduct = this.newArrsTemp2.concat(this.newArrsTemp);//20230213 |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | this.Alert("数据修改成功", 'success'); |
| | | } else if (boolean == 1) { |
| | | this.Alert("修改错误,对象品折扣不得小于对象品最低折扣:"+GuaranteeDiscount__cZuiXiao+"%",'error'); |
| | | } else if (boolean == 2) { |
| | | this.Alert("修改错误,非对象品折扣不得小于非对象品最低折扣:"+NormalDiscount__cZuiXiao+"%",'error'); |
| | | } else if (boolean == 3) { |
| | | this.Alert("修改错误,一般折扣没有对象品折扣",'error'); |
| | | } else if (boolean == 5) { |
| | | this.Alert("非对象品折扣不可以为空或小于0",'error'); |
| | | } else if (boolean == 4) { |
| | | this.jzDataDiscount = newData; |
| | | var ffgg=0; |
| | | if(boolean3){ |
| | | newData2.forEach(HeTo => { |
| | | //根据合同价格计算一般折扣 |
| | | HeTo = this.ComouteProductDiscount(HeTo.Id,HeTo.Category__c,HeTo.GuaranteeDiscount__c_Input, HeTo.NormalDiscount__c_Input, HeTo.GuaranteeDiscount_H_Money__c,HeTo.NormalDiscount_H_Money__c, HeTo); |
| | | if(HeTo==1||HeTo==2||HeTo==12||HeTo==3){ |
| | | ffgg=HeTo; |
| | | return ; |
| | | } |
| | | //合并折扣政策重复方案 |
| | | let jzDataDiscountx = [].concat(this.jzDataDiscount);//20230214 |
| | | this.ConsolidatedDiscountPolicy(jzDataDiscountx); |
| | | //一般折扣更改过合同价格计算 |
| | | this.updateCommonlyDiscountLogic(HeTo.Id,HeTo.JxsType,HeTo.GuaranteeDiscount__c_Input,HeTo.NormalDiscount__c_Input,HeTo.Category__c,this.jzDataDiscount); |
| | | }); |
| | | } |
| | | if(boolean2&&ffgg==0){ |
| | | newData3.forEach(TeYue=>{ |
| | | //根据合同价格计算特约折扣 |
| | | GuaranteeDiscount__cZuiXiao=parseFloat(TeYue.GuaranteeDiscount__c); |
| | | NormalDiscount__cZuiXiao=parseFloat(TeYue.NormalDiscount__c); |
| | | TeYue=this.ComouteProductDiscount(TeYue.Id,TeYue.Category__c,TeYue.GuaranteeDiscount__c_Input, TeYue.NormalDiscount__c_Input, TeYue.GuaranteeDiscount_H_Money__c,TeYue.NormalDiscount_H_Money__c, TeYue); |
| | | if(TeYue==1||TeYue==2||TeYue==12||TeYue==3){ |
| | | ffgg=TeYue; |
| | | return ; |
| | | }else{ |
| | | //合并折扣政策重复方案 |
| | | this.ConsolidatedDiscountPolicy(this.jzDataDiscount); |
| | | //一般折扣更改过合同价格计算 |
| | | this.updateCommonlyDiscountLogic(TeYue.Id,TeYue.JxsType,TeYue.GuaranteeDiscount__c_Input,TeYue.NormalDiscount__c_Input,TeYue.Category__c,this.jzDataDiscount); |
| | | } |
| | | }); |
| | | } |
| | | if(ffgg==1||ffgg==2||ffgg==12||ffgg==3){ |
| | | this.Alert(InverseCalculationTiShi(ffgg,GuaranteeDiscount__cZuiXiao,NormalDiscount__cZuiXiao),'error'); |
| | | }else{ |
| | | this.Alert("数据修改成功", 'success'); |
| | | } |
| | | } |
| | | //刷新 |
| | | this.jzshows2 = false; |
| | | setTimeout(() => { |
| | | this.jzshows2 = true; |
| | | }, 800) |
| | | } |
| | | newArrsTemp = []; |
| | | newArrsTemp2 = []; |