| New file |
| | |
| | | import { LightningElement,wire,track,api} from 'lwc'; |
| | | import { ShowToastEvent } from 'lightning/platformShowToastEvent'; |
| | | import Quoto_No from '@salesforce/label/c.Quoto_No'; |
| | | import Quoto_Name from '@salesforce/label/c.Quoto_Name'; |
| | | import HP_Name from '@salesforce/label/c.HP_Name'; |
| | | import Department_Name from '@salesforce/label/c.Department_Name'; |
| | | import Currency from '@salesforce/label/c.Currency'; |
| | | import Total_Price from '@salesforce/label/c.Total_Price'; |
| | | import Contact_Price from '@salesforce/label/c.Contact_Price'; |
| | | import Forecast_Amounts from '@salesforce/label/c.Forecast_Amounts'; |
| | | import Sales_Root from '@salesforce/label/c.Sales_Root'; |
| | | import Status_Update from '@salesforce/label/c.Status_Update'; |
| | | import Set_Product from '@salesforce/label/c.Set_Product'; |
| | | import Excel_Import from '@salesforce/label/c.Excel_Import'; |
| | | import deleteLabel from '@salesforce/label/c.deleteLabel'; |
| | | import Cost from '@salesforce/label/c.Cost'; |
| | | import Calculate from '@salesforce/label/c.Calculate'; |
| | | import AdjustAmount from '@salesforce/label/c.AdjustAmount'; |
| | | import Quote_Adjustment from '@salesforce/label/c.Quote_Adjustment'; |
| | | import Amount from '@salesforce/label/c.Amount'; |
| | | import Sales_Profit from '@salesforce/label/c.Sales_Profit'; |
| | | import Percent from '@salesforce/label/c.Percent'; |
| | | import Sales_Name1 from '@salesforce/label/c.Sales_Name1'; |
| | | import Sales_Name2 from '@salesforce/label/c.Sales_Name2'; |
| | | import Error_Message33 from '@salesforce/label/c.Error_Message33'; |
| | | import Opp_Button from '@salesforce/label/c.Opp_Button'; |
| | | import QuoteDecision_Button from '@salesforce/label/c.QuoteDecision_Button'; |
| | | import Copy_Detail from '@salesforce/label/c.Copy_Detail'; |
| | | import Quote_Print from '@salesforce/label/c.Quote_Print'; |
| | | import Detail_Price from '@salesforce/label/c.Detail_Price'; |
| | | import Detail_Sum from '@salesforce/label/c.Detail_Sum'; |
| | | import Total_Discount_Percent from '@salesforce/label/c.Total_Discount_Percent'; |
| | | import Total_Discount_Amount from '@salesforce/label/c.Total_Discount_Amount'; |
| | | import Row_Total_Sum from '@salesforce/label/c.Row_Total_Sum'; |
| | | import Contract_Breakdown from '@salesforce/label/c.Contract_Breakdown'; |
| | | import Print_HPName from '@salesforce/label/c.Print_HPName'; |
| | | import Print_Button from '@salesforce/label/c.Print_Button'; |
| | | import { loadStyle } from "lightning/platformResourceLoader"; |
| | | import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable"; |
| | | import QuoteEntryMaxLine2 from '@salesforce/label/c.QuoteEntryMaxLine2'; |
| | | import Sales_Outlet from '@salesforce/label/c.Sales_Outlet'; |
| | | import OCM_Direct from '@salesforce/label/c.OCM_Direct'; |
| | | import Price_Valid_Period from '@salesforce/label/c.Price_Valid_Period'; |
| | | import Message_001 from '@salesforce/label/c.Message_001'; |
| | | import ImportText from '@salesforce/label/c.ImportText'; |
| | | import Tab_Text from '@salesforce/label/c.Tab_Text'; |
| | | import Paste_IE from '@salesforce/label/c.Paste_IE'; |
| | | import { CurrentPageReference } from "lightning/navigation"; |
| | | import selectQuoteById from '@salesforce/apex/lexNewQuoteEntryController.selectQuoteById'; |
| | | import selectQuoteListLineItemCount from '@salesforce/apex/lexNewQuoteEntryController.selectQuoteListLineItemCount'; |
| | | import selectQuoteLineItem from '@salesforce/apex/lexNewQuoteEntryController.selectQuoteLineItem'; |
| | | import selecUser from '@salesforce/apex/lexNewQuoteEntryController.selecUser'; |
| | | import QuotCalfagAss from '@salesforce/apex/lexNewQuoteEntryController.QuotCalfagAss'; |
| | | import selectOpportunityById from '@salesforce/apex/lexNewQuoteEntryController.selectOpportunityById'; |
| | | import selectAccountById from '@salesforce/apex/lexNewQuoteEntryController.selectAccountById'; |
| | | import getPicklistValues from '@salesforce/apex/lexNewQuoteEntryController.getPicklistValues'; |
| | | import SaveQuote from '@salesforce/apex/lexNewQuoteEntryController.SaveQuote'; |
| | | import Print from '@salesforce/apex/lexNewQuoteEntryController.Print'; |
| | | import QuoteDecision from '@salesforce/apex/lexNewQuoteEntryController.QuoteDecision'; |
| | | import serContact from '@salesforce/apex/lexNewQuoteEntryController.serContact' |
| | | import serSetContact from '@salesforce/apex/lexNewQuoteEntryController.serSetContact' |
| | | import setProductEntry from '@salesforce/apex/lexNewQuoteEntryController.setProductEntry' |
| | | import excelImport from '@salesforce/apex/lexNewQuoteEntryController.excelImport' |
| | | import getModulus from '@salesforce/apex/lexNewQuoteEntryController.getModulus' |
| | | import getquoDes from '@salesforce/apex/lexNewQuoteEntryController.getquoDes' |
| | | import selectOppLItem from '@salesforce/apex/lexNewQuoteEntryController.selectOppLItem' |
| | | import addOptions from '@salesforce/apex/lexNewQuoteEntryController.addOptions' |
| | | import getProduct2 from '@salesforce/apex/NewQuoteEntryWebService.getProduct2'; |
| | | import updateOTCodeweb from '@salesforce/apex/NewQuoteEntryWebService.updateOTCode'; |
| | | import getQuoteLineItem from '@salesforce/apex/NewQuoteEntryWebService.getQuoteLineItem'; |
| | | import Message_Please_Save_Quote from '@salesforce/label/c.Please_Save_Quote'; |
| | | import yy from '@salesforce/label/c.yingYanAssetModel'; |
| | | import Message_Check_Your_Clipboard from '@salesforce/label/c.Check_Your_Clipboard'; |
| | | import SelectAllDataDiscount from '@salesforce/apex/QuoteTrialController.selectAllDataDiscount'; |
| | | import GetPromotionDefalut from '@salesforce/apex/QuoteTrialController.GetPromotionDefalut'; |
| | | import GetPromotionPromotionSearch from '@salesforce/apex/QuoteTrialController.GetPromotionPromotionSearch'; |
| | | import GetNormalProductSearch from '@salesforce/apex/QuoteTrialController.GetNormalProductSearch'; |
| | | import GetAuthorizerSearch from '@salesforce/apex/QuoteTrialController.GetAuthorizerSearch'; |
| | | import GetSearchProductById from '@salesforce/apex/QuoteTrialController.GetSearchProductById'; |
| | | import saveAllDataProduct from '@salesforce/apex/QuoteTrialController.saveAllDataProduct'; |
| | | import SelectAllDataProduct from '@salesforce/apex/QuoteTrialController.selectAllDataProduct'; |
| | | import GetQuoteData from '@salesforce/apex/QuoteTrialController.GetQuoteData'; |
| | | import GetAgencyRName from '@salesforce/apex/QuoteTrialController.GetAgencyRName'; |
| | | 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, |
| | | 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, |
| | | productStatusUpdatedExp,initQuoteLineItemcheck,MarkRed,quoteAgencyTotalPriceActionLogic,calPriceAllLogic,QuoteAdjustLogic,quoExp,AgencyDiscountCalculation1Logic,onsaveToBeproductLoc,fagExp,PrintButtonLoc,alertExp,decisionlol, |
| | | saverebackloc,DisCalculationfunctionLoc,quoteTotalPriceLoc,calUnitPriceTotalLoc,ListPriceTotalExp,unitPriceTotalExp,pageArrangeLoc,openQuotePage,errorflg,StrExp,quoteinit,IsQuoteTrialExp,setOCMAmountc,DisAmountfunctionc} from "./lexNexQuoteEntryUtil.js"; |
| | | import {arrTempsss,arrProductTempsss,initDataTableProduct2,initDataTable2,initSearchForm2,getQueryVariable,ChangeFiexedData,GetUUID,initDataTableDefault2, |
| | | initSearchFormDefalt2,QTcssE,initDataTableFixedPrice2,initDataTableDiscount2,initDataTableSpecial2,initSearchFormFix2,initDataTableFix2,CompareDataL,isChangeExp, |
| | | initDataTableOtherData2,initDataTableCommonly2,ProductAssignmentSelect,ProductSelected,UnselectedScheme,SelectedScheme,commonlyDiscountLogic,ChangeProductData, |
| | | PriceConsolidation,ReplacementUnitPriceLogic,ConsolidatedDiscountDetailsLogic,ConsolidatedDiscountPolicyLogic, |
| | | addOfferLogic,ReverseCalculationModifyDiscountLogic,HeTongPriceComputeLogic,InverseCalculationTiShi,ContractPriceComputeLogic,GeneralDiscountContractSummaryLogic,handleSaveFixedPriceLogic, |
| | | SpecialSavesChangePartLogic,NewDefaultDatass,AddProductDatass,jzDataFixedPriceTemps,jzDataDiscountTemps,updatesNumsLogic,updateCDLogic,DeftCopyQtyLists,initquoT,buttonIsShowE,initDTFP,initDTD,initDTOD,initDTC , |
| | | countListAndNodLogic,jzDataDefaultExp,jzDataProductExp,jzDataFixedPriceExp,jzDataDiscountExp,comparisonUniqueKeyLogic,SearchProductByIdLogic,jzDataDefaultCopyQuantityListExp,AddNumsLogic,CompareFullDataExp,SelectedFnCommonlyLogic, |
| | | ComputeDataPromotionLogic,newArrsTemp3Exp,newArrsTemp4Exp,jzDataDefaultCopyExp,ComputeDataNormalProductLogic,ComputeDiscountAuthorizerLogic,newArrsTempExp,newArrsTemp2Exp,MergeDuplicateSchemesLogic,delectTableDiscountTempLogic, |
| | | handleSaveDiscountLogic,booleanExp,boolean2Exp,boolean3Exp,newDataExp,newData2Exp,newData3Exp,editnewDateExp,GuaranteeDiscount__cZuiXiaoExp,NormalDiscount__cZuiXiaoExp,HeTongTotalExp,SelectedFnDataFixedPriceExp,deleteFixedPriceLogic, |
| | | CompareFullDataTempExp,jzDataDefaultNotChangeExp,DeleteChangesFnLogic,deleteFixedPriceTempLogic,GetSearchProductByIdLogic,iflagExp,getTableDataCommonlyLogic,idsExp,DeleteIsChangelogicExp,DeleteIsChangesFnjiage,falgExp, |
| | | DeleteIsChangesFnzhekou,SaveGeneralDiscountLogic,DeleteSchemeMatchingLogic,savecountLogic,ComparePushDataLogic,newTempExp,saveAllDataProductFnChuanshen,saveAllDataProductFnPanduan,ifnullExp} from "./lexquoteTrialUtil.js"; |
| | | |
| | | export default class LexNewQuoteEntry extends LightningElement { |
| | | @wire(CurrentPageReference) |
| | | getStateParameters(currentPageReference) { |
| | | if (currentPageReference) { |
| | | const urlValue = currentPageReference.state.fragment; |
| | | if (urlValue) { |
| | | this.location = urlValue; |
| | | } |
| | | } |
| | | } |
| | | location = ''; |
| | | @track |
| | | pricePolicyflag1 = false; |
| | | @track |
| | | ImportText = ImportText; |
| | | @track |
| | | Tab_Text = Tab_Text; |
| | | @track |
| | | Paste_IE = Paste_IE; |
| | | @track |
| | | QuotoNo = Quoto_No; |
| | | @track |
| | | QuotoName = Quoto_Name; |
| | | @track |
| | | HPName = HP_Name; |
| | | @track |
| | | DepartmentName = Department_Name; |
| | | @track |
| | | Currency = Currency; |
| | | @track |
| | | TotalPrice = Total_Price; |
| | | @track |
| | | ContactPrice = Contact_Price; |
| | | @track |
| | | ForecastAmounts = Forecast_Amounts; |
| | | @track |
| | | SalesRoot = Sales_Root; |
| | | @track |
| | | StatusUpdate = Status_Update; |
| | | @track |
| | | SetProduct = Set_Product; |
| | | @track |
| | | ExcelImport = Excel_Import; |
| | | @track |
| | | deleteLabel = deleteLabel; |
| | | @track |
| | | Cost = Cost; |
| | | @track |
| | | Calculate = Calculate; |
| | | @track |
| | | AdjustAmount = AdjustAmount; |
| | | @track |
| | | QuoteAdjustment = Quote_Adjustment; |
| | | @track |
| | | Amount = Amount; |
| | | @track |
| | | SalesProfit = Sales_Profit; |
| | | @track |
| | | Percent = Percent; |
| | | @track |
| | | SalesName1 = Sales_Name1; |
| | | @track |
| | | Sales_Name2 = Sales_Name2; |
| | | @track |
| | | Opp_Button = Opp_Button; |
| | | @track |
| | | QuoteDecision_Button = QuoteDecision_Button; |
| | | @track |
| | | Copy_Detail = Copy_Detail; |
| | | |
| | | @track |
| | | Quote_Print = Quote_Print; |
| | | @track |
| | | Detail_Price = Detail_Price; |
| | | @track |
| | | Detail_Sum = Detail_Sum; |
| | | @track |
| | | Total_Discount_Percent = Total_Discount_Percent; |
| | | @track |
| | | Total_Discount_Amount = Total_Discount_Amount; |
| | | @track |
| | | Row_Total_Sum = Row_Total_Sum; |
| | | @track |
| | | Contract_Breakdown = Contract_Breakdown; |
| | | @track |
| | | Print_HPName = Print_HPName; |
| | | @track |
| | | Print_Button = Print_Button; |
| | | @track |
| | | QuotCalfag = false; |
| | | |
| | | quoteEntryMaxLine = QuoteEntryMaxLine2; |
| | | @track |
| | | IsLoading = false; |
| | | OnLoading(flag) { |
| | | this.IsLoading = flag; |
| | | } |
| | | stylesLoaded = false; |
| | | renderedCallback(){ |
| | | if (!this.stylesLoaded) { |
| | | Promise.all([loadStyle(this, WrappedHeaderTable)]) |
| | | .then(() => { |
| | | this.stylesLoaded = true; |
| | | }) |
| | | .catch((error) => { |
| | | }); |
| | | } |
| | | Promise.all([ |
| | | loadStyle(this, lwcCSS) |
| | | ]); |
| | | } |
| | | //报价对象 |
| | | @track |
| | | quo = {Installation_location__c:'',QuotationChange__c:''}; |
| | | //询价对象 |
| | | @track |
| | | oppInfo ={}; |
| | | //自定义结构 |
| | | @track |
| | | qb = {}; |
| | | @track |
| | | hidden = false; |
| | | //成本 |
| | | hidden_Stocking_Price = ''; |
| | | //询价Id |
| | | oppId = ''; |
| | | //报价Id |
| | | quoId = ''; |
| | | //是否跳过报价计算标识 |
| | | SkipQuotefilg; |
| | | //复制报价Id |
| | | copyid = ''; |
| | | //内外贸 |
| | | trade = ''; |
| | | //直销经销商标识 |
| | | enableSales; |
| | | //判断特殊经销商价格显示权限标识 |
| | | displayFlg; |
| | | //特殊经销商价格显示权限 |
| | | viewSpecialAgencyAmout |
| | | //当前登录用户 |
| | | User; |
| | | //报价修改权限标识 |
| | | verified; |
| | | //上传订单权限标识 |
| | | specialAuthority; |
| | | //询价产品成本参照权限标识 |
| | | displayCost; |
| | | //init查询询价相关标识 start |
| | | QuoteDecision; |
| | | QuoteDecide; |
| | | QuoteSapSented; |
| | | QuoteCorrect; |
| | | @track |
| | | enableContract; |
| | | productStatusUpdated =false; |
| | | //init查询询价相关标识 end |
| | | //合同保修期(年)全局 |
| | | quoteGurantee_Period; |
| | | //取消市场多年保修全局 |
| | | quotemultiYearWarranty; |
| | | //经销商初始化时备份 start |
| | | agency1Name; |
| | | agency2Name; |
| | | Saleslet = false; |
| | | //经销商初始化时备份 end |
| | | //数据是否发生变化标识 |
| | | newQuoteFlag = false; |
| | | //状态更新 |
| | | productStatusUpdated = false; |
| | | //查询询价获取客户Id |
| | | accountid; |
| | | //打印标识 |
| | | print_buttonflg = false; |
| | | //decide按钮标识 |
| | | Decision_button = false; |
| | | sap_button; |
| | | //save和decide按钮标识 |
| | | Save_button = false; |
| | | Decisiontag = false; |
| | | //经销商一利润显示 |
| | | Salesprofit1value; |
| | | //经销商二利润显示 |
| | | Salesprofit2value; |
| | | //经销商一百分比显示 |
| | | SalesCalculation1value |
| | | //经销商二百分比显示 |
| | | SalesCalculation2value |
| | | //隐藏多年保修价格合计 |
| | | hidden_MultiYearWarrantyTotalPrice |
| | | //经销商折扣 |
| | | WinOrDecideAlert; |
| | | //备份初始化时的报价行项目 |
| | | CheckItem; |
| | | //初始化方法 |
| | | ifquocom = false; |
| | | acts = false; |
| | | actL = []; |
| | | connectedCallback() { |
| | | this.tobeflag = false; |
| | | this.quoteEntryMaxLine = Number(this.quoteEntryMaxLine); |
| | | debugger |
| | | this.SkipQuotefilg = false; |
| | | var quoteflg = true; |
| | | this.displayFlg = true; |
| | | this.WinOrDecideAlert = false; |
| | | this.OnLoading(true); |
| | | if(this.quoId == ''){ |
| | | this.quoId = getQueryVariable('Id',this.location); |
| | | } |
| | | if(this.copyid == ''){ |
| | | this.copyid = getQueryVariable('copyid',this.location); |
| | | } |
| | | if(this.oppId == ''){ |
| | | this.oppId = getQueryVariable('oppid',this.location); |
| | | } |
| | | this.nafg = resultFlag(this.nafg,''); |
| | | selectQuoteListLineItemCount({quoId:this.quoId,oppId:this.oppId,copyid:this.copyid}).then(quoteByopp=>{ |
| | | if(this.oppId){ |
| | | if(this.copyid){ |
| | | this.quoId = this.copyid; |
| | | } |
| | | } |
| | | if(quoteByopp.length > 0){ |
| | | if (!this.oppId) { |
| | | this.oppId = quoteByopp[0].OpportunityId; |
| | | }else if(!this.copyid){ |
| | | quoteflg = true; |
| | | } |
| | | }else if(!this.copyid && this.oppId){ |
| | | quoteflg = false; |
| | | } |
| | | selecUser().then(Userobj=>{ |
| | | this.User = Userobj; |
| | | if(JSON.stringify(Userobj) != "{}"){ |
| | | this.verified =this.User.Quote_Correct__c; |
| | | this.specialAuthority = this.User.Quote_Special_Operation__c; |
| | | this.displayCost = this.User.Cost_Referable__c; |
| | | this.viewSpecialAgencyAmout = this.User.ViewSpecialAgencyAmout__c; |
| | | } |
| | | selectOpportunityById({oppId:this.oppId}).then(oppobj=>{ |
| | | this.oppInfo = oppobj; |
| | | var oppvalue = JSON.stringify(oppobj); |
| | | getModulus({oppInfoc:oppvalue}).then(rtn=>{ |
| | | this.oppInfo.rate_hospital = rtn.rate_hospital; |
| | | this.oppInfo.rate_agency1 = rtn.rate_agency1; |
| | | if(!this.quoId){ |
| | | if(!quoteflg){ |
| | | selectOppLItem({oppId:this.oppId}).then(res=>{ |
| | | var resItem = JSON.parse(res); |
| | | if(resItem.length > 0){ |
| | | resItem = InitializeProductAssignment(resItem); |
| | | this.jzDataToBeproduct =[].concat(resItem); |
| | | this.productStatusUpdated = true; |
| | | this.init(); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | this.trade = '外貿'; |
| | | if(JSON.stringify(oppobj) != "{}"){ |
| | | this.trade = oppobj.Trade__c; |
| | | this.QuoteDecision = oppobj.Estimation_Decision__c; |
| | | this.QuoteDecide = this.QuoteDecision; |
| | | this.QuoteSapSented = oppobj.SAP_Send_OK__c; |
| | | this.QuoteCorrect = oppobj.New_Opportunity__c; |
| | | this.enableSales = false; |
| | | this.oppInfo.Wholesale_Price__c = toNumComma(oppobj.Wholesale_Price__c); |
| | | if (this.oppInfo.Sales_Root__c != null) { |
| | | if (oppobj.Sales_Root__c == '販売店') { |
| | | this.enableSales = true; |
| | | this.oppInfo.Sales_Root__c = Sales_Outlet; |
| | | this.Saleslet = true; |
| | | } else { |
| | | this.enableSales = false; |
| | | this.oppInfo.Sales_Root__c = OCM_Direct; |
| | | } |
| | | } |
| | | this.accountid = this.oppInfo.AccountId; |
| | | debugger |
| | | if (this.QuoteDecision) { |
| | | this.enableContract = true; |
| | | } else { |
| | | this.enableContract = false; |
| | | } |
| | | this.oppInfo.SAP_Send_OK__c = true; |
| | | if (!this.oppInfo.SAP_Send_OK__c) { |
| | | this.displayFlg = true; |
| | | } else { |
| | | if(this.oppInfo.Agency1__r == undefined){ |
| | | this.oppInfo.Agency1__r = {}; |
| | | } |
| | | if(this.oppInfo.Agency2__r == undefined){ |
| | | this.oppInfo.Agency2__r = {}; |
| | | } |
| | | if(this.oppInfo.Account == undefined){ |
| | | this.oppInfo.Account = {}; |
| | | }else{ |
| | | if(this.oppInfo.Account.Parent == undefined){ |
| | | this.oppInfo.Account.Parent = {}; |
| | | } |
| | | } |
| | | if (this.oppInfo.Agency1__r.Special__c || this.oppInfo.Agency2__r.Special__c || this.oppInfo.Account.Parent.Special__c) { |
| | | if (this.viewSpecialAgencyAmout) { |
| | | this.displayFlg = true; |
| | | } else { |
| | | this.displayFlg = false; |
| | | } |
| | | } else { |
| | | this.displayFlg = true; |
| | | } |
| | | } |
| | | } |
| | | if (!this.QuoteCorrect) { |
| | | this.print_buttonflg = true; |
| | | } else if (!this.verified) { |
| | | this.print_buttonflg = true; |
| | | } else { |
| | | this.print_buttonflg = false; |
| | | } |
| | | if (this.QuoteDecision == false) { |
| | | this.sap_button = true; |
| | | } else if (this.specialAuthority == false) { |
| | | this.sap_button = true; |
| | | } else { |
| | | this.sap_button = false; |
| | | } |
| | | if (this.verified) { |
| | | this.Decision_button = false; |
| | | } else if (!this.QuoteCorrect) { |
| | | this.Decision_button = true; |
| | | } else if (this.QuoteDecision) { |
| | | this.Decision_button = true; |
| | | } else { |
| | | this.Decision_button = false; |
| | | } |
| | | if (this.QuoteSapSented || this.QuoteDecision) { |
| | | this.Decision_button = true; |
| | | } |
| | | if (this.QuoteDecision) { |
| | | this.Save_button = true; |
| | | this.Decisiontag = true; |
| | | var lg = this.template.querySelectorAll('c-jzlookuplightning2'); |
| | | lg.forEach(l=>{ |
| | | l.todisabled(); |
| | | }) |
| | | } else { |
| | | this.Save_button = false; |
| | | this.Decisiontag = false; |
| | | this.initDataTableToBeproduct.columns[4].editable = true; |
| | | } |
| | | this.tobeflag = true; |
| | | this.OnLoading(false); |
| | | }); |
| | | }); |
| | | getquoDes().then(it=>{ |
| | | QuotCalfagAss().then(r=>{ |
| | | if(this.quoId !=''){ |
| | | selectQuoteById({quoId:this.quoId}).then(quote=>{ |
| | | this.quo=quote; |
| | | selectQuoteLineItem({quoId:this.quoId,copyid:this.copyid}).then(result=>{ |
| | | var tempArr = result.split("---"); |
| | | var quoteLineItem = JSON.parse(tempArr[0]); |
| | | this.CheckItem = JSON.parse(tempArr[1]); |
| | | if(JSON.stringify(quote) != "{}"){ |
| | | if(this.copyid == ''){ |
| | | this.quo = initquoassignment(quote,this.quo,it); |
| | | this.hidden = this.quo.rtn; |
| | | this.QuotCalfag = (r&&this.hidden); |
| | | this.quoteGurantee_Period = quote.Gurantee_Period__c; |
| | | this.quotemultiYearWarranty = quote.multiYearWarranty__c; |
| | | this.agency1Name = quote.Agency1__c; |
| | | this.agency2Name = quote.Agency2__c; |
| | | this.Salesprofit1value = quote.Agency1_Profit__c; |
| | | this.Salesprofit2value = quote.Agency2_Profit__c; |
| | | this.SalesCalculation1value = quote.Agency1_Profit_Rate__c; |
| | | this.SalesCalculation2value = quote.Agency2_Profit_Rate__c; |
| | | this.hidden_MultiYearWarrantyTotalPrice = quote.MultiYearWarrantyTotalPrice__c; |
| | | this.template.querySelector('[data-parent-id="Agency1Id"]').setvalue(this.quo.Agency1__c); |
| | | this.template.querySelector('[data-parent-id="Agency2Id"]').setvalue(this.quo.Agency2__c); |
| | | }else{ |
| | | this.hidden_MultiYearWarrantyTotalPrice = quote.MultiYearWarrantyTotalPrice__c; |
| | | this.quo = initquoassignmentcopy(quote,this.quo,it); |
| | | this.hidden = this.quo.rtn; |
| | | this.QuotCalfag = (r&&this.hidden); |
| | | this.template.querySelector('[data-parent-id="Agency1Id"]').setvalue(this.quo.Agency1__c); |
| | | this.template.querySelector('[data-parent-id="Agency2Id"]').setvalue(this.quo.Agency2__c); |
| | | |
| | | } |
| | | } |
| | | if(quoteLineItem.length > 0 && !this.QuoteDecision){ |
| | | this.productStatusUpdated = false; |
| | | quoteLineItem = initQuoteLineItemcheck(quoteLineItem,this.productStatusUpdated); |
| | | this.newQuoteFlag = newQuoteFlagExp; |
| | | this.productStatusUpdated = productStatusUpdatedExp; |
| | | } |
| | | if(quoteLineItem.length > 0){ |
| | | quoteLineItem = InitializeProductAssignment(quoteLineItem); |
| | | if(this.acts){ |
| | | quoteLineItem = actState(this.actL,quoteLineItem); |
| | | } |
| | | this.jzDataToBeproduct =[].concat(quoteLineItem); |
| | | } |
| | | this.pageArrange(); |
| | | this.init(); |
| | | if(this.copyid){ |
| | | this.quoId = ''; |
| | | this.SkipQuotefilg = true; |
| | | } |
| | | }); |
| | | this.quo = quoteinit(this.quo); |
| | | this.HiddenGurantee_Period = this.quo.Gurantee_Period__c; |
| | | }); |
| | | }else{ |
| | | this.quo = quoteinit(this.quo); |
| | | this.HiddenGurantee_Period = this.quo.Gurantee_Period__c; |
| | | this.quo.multiYearWarranty__c = false; |
| | | this.pageArrange(); |
| | | this.hidden = it; |
| | | this.QuotCalfag = (r&&it); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | }); |
| | | //Add DTT - Hua Jian 20231018 Start |
| | | const inputAlignright = document.createElement('style'); |
| | | inputAlignright .innerText = `.input-text-align_right input{ text-align: right!important; }`; |
| | | document.body.appendChild(inputAlignright); |
| | | //Add DTT - Hua Jian 20231018 End |
| | | } |
| | | pageArrange(){ |
| | | this.quo = pageArrangeLoc(this.quo); |
| | | } |
| | | init(){ |
| | | if (this.productStatusUpdated) { |
| | | this.calPriceAll(); |
| | | this.setOCMAmount(); |
| | | this.OnLoading(false); |
| | | } else { |
| | | this.EstimationListPrice(); |
| | | this.calUnitPriceTotal(); |
| | | this.setCostTatal(); |
| | | this.checkProductStatusValidPeriod(); |
| | | } |
| | | var IsQuoteTrial =this.quo.IsQuoteTrial__c; |
| | | this.ifquocom = IsQuoteTrial; |
| | | var s = this.quo.OCM_Agent1_Price_Page__c; |
| | | var id = this.quoId; |
| | | // if(!id){ |
| | | if(!s){ |
| | | var IsQuoteTrial =this.quo.IsQuoteTrial__c; |
| | | if(!IsQuoteTrial){ |
| | | this.quo = Agent1comput(this.quo,this.Saleslet,this.oppInfo); |
| | | this.setOCMAmount() |
| | | this.calFromContactPrice(); |
| | | } |
| | | } |
| | | this.OnLoading(false); |
| | | // } |
| | | } |
| | | calPriceAll() { |
| | | this.calGuranteeAllFields(); |
| | | this.jzDataToBeproduct = calPriceAllLogic(this.jzDataToBeproduct); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.EstimationListPrice(); |
| | | this.calUnitPriceTotal(); |
| | | this.quoteTotalPrice(); |
| | | this.quoteAgencyTotalPriceAction(); |
| | | this.AgencyDiscountCalculation1(); |
| | | } |
| | | // |
| | | calGuranteeAllFields() { |
| | | this.jzDataToBeproduct = calGuranteeAllFieldsLogic(this.jzDataToBeproduct,this.quo); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.hidden_MultiYearWarrantyTotalPrice = MultiYearWarrantyTotalPriceExport; |
| | | this.quo.MultiYearWarrantyTotalPrice__c = toNumComma(MultiYearWarrantyTotalPriceExport); |
| | | } |
| | | EstimationListPrice() { |
| | | this.jzDataToBeproduct = EstimationL(this.jzDataToBeproduct,this.quo); |
| | | this.quo = quoExp; |
| | | } |
| | | |
| | | ListPriceTotalhidden = 0; |
| | | UnitPriceTotalhidden = 0; |
| | | calUnitPriceTotal() { |
| | | this.jzDataToBeproduct = calUnitPriceTotalLoc(this.jzDataToBeproduct); |
| | | this.ListPriceTotalhidden = ListPriceTotalExp; |
| | | this.UnitPriceTotalhidden = unitPriceTotalExp; |
| | | } |
| | | |
| | | quoteTotalPrice() { |
| | | var result = quoteTotalPriceLoc(this.jzDataToBeproduct,this.quo,this.quoId,this.oppInfo,this.Saleslet); |
| | | this.quo = quoExp; |
| | | this.jzDataToBeproduct =[].concat(result); |
| | | var id = this.quoId; |
| | | // if(!id){ |
| | | var IsQuoteTrial =this.quo.IsQuoteTrial__c; |
| | | if(!IsQuoteTrial){ |
| | | this.setOCMAmount(); |
| | | this.calFromContactPrice(); |
| | | } |
| | | // } |
| | | this.DisAmountfunction(); |
| | | this.QuoteAdjust(); |
| | | this.salesProfit2(); |
| | | this.setCostTatal(); |
| | | } |
| | | setOCMAmount() { |
| | | this.oppInfo = setOCMAmountc(this.enableSales,this.quo,this.oppInfo); |
| | | this.quo = quoExp; |
| | | } |
| | | /* |
| | | 医院的合同金额 格式化为 带分位符的字段; |
| | | */ |
| | | calFromContactPrice() { |
| | | var x = 0; |
| | | x = this.quo.Dealer_Final_Price_Page__c; |
| | | x = localParseFloat(x); |
| | | this.quo.Dealer_Final_Price_Page__c = toNumComma(x); |
| | | this.DisAmountfunction(); |
| | | this.salesProfit1(); |
| | | this.salesProfit2(); |
| | | this.setCostTatal(); |
| | | } |
| | | |
| | | DisAmountfunction() { |
| | | this.quo = DisAmountfunctionc(this.quo); |
| | | this.DisCalculationfunction(); |
| | | } |
| | | DisCalculationfunction() { |
| | | this.quo = DisCalculationfunctionLoc(this.quo); |
| | | } |
| | | salesProfit1() { |
| | | this.Salesprofit1value = salesProfit1Logic(this.quo,this.Salesprofit1value); |
| | | this.quo = quoExp; |
| | | this.salesCalculation1(); |
| | | } |
| | | salesCalculation1() { |
| | | this.SalesCalculation1value = salesCalculation1Logic(this.quo,this.Salesprofit1value,this.SalesCalculation1value); |
| | | this.quo = quoExp; |
| | | } |
| | | salesProfit2() { |
| | | this.Salesprofit2value = salesProfit2Logic(this.quo,this.Salesprofit2value); |
| | | this.quo = quoExp; |
| | | this.salesCalculation2(); |
| | | this.salesProfit1(); |
| | | } |
| | | |
| | | salesCalculation2() { |
| | | this.SalesCalculation2value = salesCalculation2Logic(this.quo,this.Salesprofit2value,this.SalesCalculation2value) |
| | | this.quo = quoExp; |
| | | } |
| | | setCostTatal() { |
| | | var z = 0; |
| | | this.jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var s = 0; |
| | | s = localParseFloat(jzdtbt.Cost_Subtotal_c); |
| | | if (!isNaN(s)) { |
| | | z = z + s; |
| | | } |
| | | }); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.hidden_Stocking_Price = toNum(z); |
| | | if (this.displayCost) { |
| | | this.quo.Stocking_Price__c = toNumComma(z); |
| | | } |
| | | } |
| | | QuoteAdjust() { |
| | | this.jzDataToBeproduct = QuoteAdjustLogic(this.jzDataToBeproduct,this.quo,this.hidden_MultiYearWarrantyTotalPrice,this.QuoteDecision_Button); |
| | | this.quo = quoExp; |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | } |
| | | |
| | | quoteAgencyTotalPriceAction() { |
| | | this.jzDataToBeproduct = quoteAgencyTotalPriceActionLogic(this.jzDataToBeproduct,this.quo,this.oppInfo,this.QuoteDecision_Button,this.hidden_MultiYearWarrantyTotalPrice); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | } |
| | | AgencyDiscountCalculation1() { |
| | | this.jzDataToBeproduct = AgencyDiscountCalculation1Logic(this.quo,this.jzDataToBeproduct,this.QuoteDecision_Button,this.hidden_MultiYearWarrantyTotalPrice); |
| | | this.quo = quoExp; |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | } |
| | | Confirm_PriceRefresh = '报价作成后'+Price_Valid_Period+'天,还没有更新过价格,需要执行'+Status_Update+'?'; |
| | | checkProductStatusValidPeriod() { |
| | | var period = this.quo.PriceRefreshPeriod; |
| | | if (parseInt(period) > parseInt(Price_Valid_Period) && this.QuoteDecide != true) { |
| | | if (confirm(this.Confirm_PriceRefresh)) { |
| | | this.productCompare(); |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | productCompare() { |
| | | try { |
| | | var returnflg; |
| | | var b = true; |
| | | var t = this.trade; |
| | | var ids = new Array(); |
| | | this.jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var id =jzdtbt.pageObject.Id__c; |
| | | if (id != '') { |
| | | ids.push(jzdtbt.pageObject.Id__c); |
| | | } |
| | | }); |
| | | getProduct2({ids:ids}).then(results=>{ |
| | | var id2Product = new Object(); |
| | | for (var j = 0; j < results.length; j++) { |
| | | id2Product[results[j].Id] = results[j]; |
| | | } |
| | | var reslut = productCompareLogic(this.jzDataToBeproduct,id2Product,t,b); |
| | | b = bflag; |
| | | this.jzDataToBeproduct =[].concat(reslut); |
| | | if (b == false) { |
| | | if (window.confirm(Message_001)) { |
| | | this.PriceStatusUpdate(); |
| | | this.OnLoading(false); |
| | | this.productStatusUpdated = true; |
| | | this.WinOrDecideAlert = false; |
| | | returnflg = true; |
| | | } else { |
| | | returnflg = false; |
| | | } |
| | | } else { |
| | | this.Alert("价格状态没有变化。",'warning'); |
| | | this.productStatusUpdated = true; |
| | | returnflg = false; |
| | | } |
| | | }); |
| | | return returnflg; |
| | | } catch (e) { |
| | | this.Alert(e,'error'); |
| | | } |
| | | |
| | | } |
| | | //替换产品otcode |
| | | updateOtcode() { |
| | | this.OnLoading(true); |
| | | var id = this.quoId; |
| | | var nmpa = checkNMPA(this.jzDataToBeproduct); |
| | | if (nmpa) { |
| | | updateOTCodeweb({tempQuoId: id}).then(results=>{ |
| | | if (results) { |
| | | this.Alert('产品otcode替换完成!','success'); |
| | | window.location.reload(); |
| | | } else { |
| | | this.Alert('产品otcode替换失败,请联系管理员!','error'); |
| | | } |
| | | this.OnLoading(false); |
| | | }); |
| | | } else { |
| | | this.OnLoading(false); |
| | | this.Alert('报价行项目没有NMPA状态为停止的产品,无法替换!','error'); |
| | | } |
| | | } |
| | | PriceStatusUpdate(){ |
| | | this.setOppFromOppInfo(); |
| | | //全件洗い替えします。 |
| | | if (this.jzDataToBeproduct.length > 0) { |
| | | this.jzDataToBeproduct = PriceStatusUpdateLogic(this.jzDataToBeproduct,this.newQuoteFlag); |
| | | this.newQuoteFlag = newQuoteFlagex; |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.productStatusUpdated = true; |
| | | } |
| | | this.pageArrange(); |
| | | this.calPriceAll(); |
| | | this.Alert('更新完毕!','success'); |
| | | } |
| | | setOppFromOppInfo() { |
| | | this.oppInfo.Agency1__c = this.quo.Agency1__c; |
| | | this.oppInfo.Agency2__c = this.quo.Agency2__c; |
| | | } |
| | | |
| | | quoteAgencyTotalPriceAction1(str) { |
| | | var Sales_Root = this.oppInfo.Sales_Root__c; |
| | | Sales_Root = Sales_Root + ''; |
| | | Sales_Root = Sales_Root.replace(/\s+/g, ""); |
| | | if (str == Sales_Root) { |
| | | this.quoteAgencyTotalPriceAction(); |
| | | } |
| | | } |
| | | //报价名称赋值 |
| | | QuoteNameAssignment(event){ |
| | | this.quo.QuoteName__c = event.target.value; |
| | | } |
| | | //最终客户成交价Change事件 |
| | | DealerFinalPricePageChange(event){ |
| | | this.quo.Dealer_Final_Price_Page__c = event.target.value; |
| | | this.calFromContactPrice(); |
| | | this.setOCMAmount(); |
| | | this.quoteAgencyTotalPriceAction1('OCM直接销售'); |
| | | } |
| | | //计算%的change |
| | | QuoteAdjustCalculateChange(event){ |
| | | if(this.quo.Quote_Adjust_Calculate__c !== event.target.value){ |
| | | this.quo.Quote_Adjust_Calculate__c = event.target.value; |
| | | this.UnitPriceUpdate(); |
| | | event.target.value = this.quo.Quote_Adjust_Calculate__c; |
| | | } |
| | | } |
| | | //调整金额的change |
| | | QuoteAdjustAmountPageChange(event){ |
| | | if(this.quo.Quote_Adjust_Amount_Page__c !== event.target.value){ |
| | | this.quo.Quote_Adjust_Amount_Page__c = event.target.value; |
| | | this.calFromQuoAmont() |
| | | event.target.value = this.quo.Quote_Adjust_Amount_Page__c; |
| | | } |
| | | } |
| | | //经销商一合同金额change |
| | | OCMAgent1PricePageonChange(event){ |
| | | this.quo.OCM_Agent1_Price_Page__c = event.target.value; |
| | | this.salesProfit1(); |
| | | this.setOCMAmount(); |
| | | this.quoteAgencyTotalPriceAction1('经销商'); |
| | | this.AgencyDiscountCalculation1(); |
| | | } |
| | | //经销商二合同金额change |
| | | Agent1Agent2PricePageChange(event){ |
| | | this.quo.Agent1_Agent2_Price_Page__c = event.target.value; |
| | | this.salesProfit2(); |
| | | } |
| | | |
| | | copyToClipboardNewQuoteEntry() { |
| | | var QuoteId = this.quoId; |
| | | if (QuoteId == null || QuoteId == '') { |
| | | this.Alert(Message_Please_Save_Quote,'error'); |
| | | return null; |
| | | } |
| | | var records; |
| | | var x; |
| | | var targetString = tStringe; |
| | | try { |
| | | getQuoteLineItem({ |
| | | quoId: QuoteId |
| | | }).then(reslut=>{ |
| | | NewQcopyLogic(Message_Check_Your_Clipboard,records,x,targetString,reslut,this.displayCost,this.oppInfo.CurrencyIsoCode); |
| | | if(alfExp){ |
| | | this.Alert(alertExp,'success'); |
| | | }else{ |
| | | this.Alert(alertExp,'error'); |
| | | } |
| | | }); |
| | | } catch (e) { |
| | | this.Alert(e.faultcode + ',' + e.faultstring,'error'); |
| | | } |
| | | } |
| | | @track |
| | | nafg={}; |
| | | //保存报价按钮 |
| | | savebuttonClick(){ |
| | | if(!this.yyEvent()) return; |
| | | this.OnLoading(true); |
| | | this.checkchangedAfterPrint('sa'); |
| | | if(this.fg){ |
| | | this.sal(); |
| | | } |
| | | } |
| | | sal(){ |
| | | this.tobeflag=false; |
| | | var shut = AlertForCFDA(this.jzDataToBeproduct); |
| | | if (shut == true) { |
| | | this.Alert('提示:包含重新申请CFDA的产品,不可进行订货。','error'); |
| | | } |
| | | var cost = CheckForCost(this.jzDataToBeproduct); |
| | | if (cost) { |
| | | this.Alert('产品成本为空时不可报价!','error'); |
| | | this.OnLoading(false); |
| | | this.tobeflag=true; |
| | | } else { |
| | | var er = ''; |
| | | var listPrice = CheckForListPrice(this.jzDataToBeproduct); |
| | | if (listPrice) { |
| | | er = '目前产品定价未确定,请于产品本部联系确认!'; |
| | | } |
| | | var SaveQuotecan = saveQuotel(this.quo,this.oppInfo,this.jzDataToBeproduct,this.CheckItem,this.WinOrDecideAlert,this.productStatusUpdated,this.enableSales, |
| | | this.oppId,this.quoId,this.newQuoteFlag,this.changedAfterPrint,this.quoteGurantee_Period,this.quotemultiYearWarranty,this.selection_hp,this.SkipQuotefilg,this.quoteflg,this.agency1Name); |
| | | debugger |
| | | SaveQuote(SaveQuotecan).then(resaut=>{ |
| | | var Setmap = new Map() |
| | | var key = Object.keys(resaut) |
| | | key.forEach(item=>{ |
| | | Setmap.set(item,resaut[item]); |
| | | }); |
| | | if(Setmap.has('errormessage')){ |
| | | er += Setmap.get('errormessage'); |
| | | this.quoteflg = false; |
| | | }else{ |
| | | if(this.Sback){ |
| | | window.open('/' +this.oppId, '_self'); |
| | | }else{ |
| | | if(Setmap.has('QuoteNo')){ |
| | | this.quo.Quote_No__c = Setmap.get('QuoteNo'); |
| | | } |
| | | this.agency1Name =this.quo.Agency1__c; |
| | | if(this.quoteflg){ |
| | | if(Setmap.has('warn')){ |
| | | this.Alert(Setmap.get('warn'),'warning'); |
| | | } |
| | | if(Setmap.has('quoId')){ |
| | | this.quoId = Setmap.get('quoId'); |
| | | this.quo.IsQuoteTrial__c = false; |
| | | this.ifquocom = false; |
| | | this.quoteGurantee_Period = this.quo.Gurantee_Period__c; |
| | | this.quotemultiYearWarranty = this.quo.multiYearWarranty__c; |
| | | } |
| | | this.pricePolicyflag = true; |
| | | }else{ |
| | | if(Setmap.has('warn')){ |
| | | this.Alert(Setmap.get('warn'),'warning'); |
| | | this.jzDataToBeproduct = actState(Setmap.get('act'),this.jzDataToBeproduct); |
| | | this.acts = true; |
| | | this.actL = Setmap.get('act'); |
| | | }else{ |
| | | this.Alert(Setmap.get('success'),'success'); |
| | | } |
| | | if(Setmap.has('quoId')){ |
| | | this.quoId = Setmap.get('quoId'); |
| | | window.open('/lightning/n/lexNewQuoteEntry#Id=' + Setmap.get('quoId'), '_top'); |
| | | this.location = 'Id='+ Setmap.get('quoId'); |
| | | this.copyid = ''; |
| | | this.oppId = ''; |
| | | this.connectedCallback(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | this.nafg = resultFlag(this.nafg,Setmap); |
| | | if(er){ |
| | | this.Alert(er,'error'); |
| | | } |
| | | this.tobeflag=true; |
| | | this.OnLoading(false); |
| | | }); |
| | | return true; |
| | | } |
| | | } |
| | | //价格政策表单开关标识符 |
| | | jzDataTableFixedPriceIsShow = false; |
| | | //报价计算初始化 |
| | | quoteTrialInit(){ |
| | | this.OnLoadSavesDatas(); |
| | | this.OnLoadQuoteData(this.quoId); |
| | | var event = { |
| | | page: 1, |
| | | pageLimit: 10, |
| | | search: "", |
| | | sortOrder: "asc", |
| | | sortPlus: undefined, |
| | | fag: true |
| | | }; |
| | | setTimeout(() => { |
| | | this.getTableDataFix(event); |
| | | this.getTableData(event); |
| | | }, 1000); |
| | | } |
| | | OnLoadProduct = []; //未选择产品 |
| | | OnLoadSaveProduct = []; //已选择产品 |
| | | OnLoadDiscount = []; //折扣政策 |
| | | OnLoadFixDiscount = []; //价格政策 |
| | | flagall = false; |
| | | OnLoadSavesDatas() { |
| | | SelectAllDataDiscount({ |
| | | ParamIdStr: this.quoId |
| | | }).then(result => { |
| | | result.forEach(item => { |
| | | if (item.ismatch__c == "0") { |
| | | item = ProductAssignmentSelect(item); |
| | | this.OnLoadProduct.push(item); |
| | | } else if (item.ismatch__c == "1") { |
| | | item = ProductSelected(item); |
| | | this.OnLoadSaveProduct.push(item); |
| | | } |
| | | }) |
| | | var arrss = [].concat(this.OnLoadSaveProduct); |
| | | this.addOffer(arrss); |
| | | this.comparisonUniqueKey(); |
| | | if (this.OnLoadProduct != undefined && this.OnLoadProduct.length > 0) { |
| | | this.flagall = true; |
| | | this.jzDataDefault = this.OnLoadProduct; |
| | | if (this.jzDataDefault != undefined && this.jzDataDefault.length > 0) { |
| | | this.UpdateSaveDataQuoteLineItemSelectByID(0); |
| | | } |
| | | } |
| | | if (this.OnLoadSaveProduct != undefined && this.OnLoadSaveProduct.length > 0) { |
| | | this.flagall = true; |
| | | this.jzDataProduct = this.OnLoadSaveProduct; |
| | | if (this.jzDataProduct != undefined && this.jzDataProduct.length > 0) { |
| | | this.UpdateSaveDataQuoteLineItemSelectByID(1); |
| | | } |
| | | this.updateIdStr("1"); |
| | | this.ContractPriceCompute(); |
| | | } |
| | | }) |
| | | SelectAllDataProduct({ |
| | | ParamIdStr: this.quoId |
| | | }).then(result => { |
| | | result.forEach(items => { |
| | | if (items.typess__c == "折扣政策") { |
| | | items = UnselectedScheme(items); |
| | | this.OnLoadDiscount.push(items); |
| | | } else if (items.typess__c == "价格政策") { |
| | | items = SelectedScheme(items) |
| | | this.OnLoadFixDiscount.push(items); |
| | | } |
| | | }) |
| | | this.comparisonUniqueKey(); |
| | | if (this.OnLoadFixDiscount != undefined && this.OnLoadFixDiscount.length > 0) { |
| | | this.jzDataFixedPrice = this.OnLoadFixDiscount; |
| | | if (this.jzDataFixedPrice != undefined && this.jzDataFixedPrice.length > 0) { |
| | | this.UpdateSaveDataFixedPriceSelectByID(); |
| | | } |
| | | } |
| | | if (this.OnLoadDiscount != undefined && this.OnLoadDiscount.length > 0) { |
| | | this.jzDataDiscount = this.OnLoadDiscount; |
| | | this.updateIdStr("2"); |
| | | } |
| | | }) |
| | | } |
| | | //合并上一次的报价行 |
| | | lastQuotation = []; |
| | | addOffer(TrialLine) { |
| | | this.lastQuotation = [].concat(addOfferLogic(TrialLine)); |
| | | } |
| | | index = 3; |
| | | comparisonUniqueKey() { |
| | | this.index--; |
| | | if (this.index == 0) { |
| | | comparisonUniqueKeyLogic(this.index,this.flagall,this.jzDataDefaultCopy,this.jzDataDefault,this.jzDataProduct,this.jzDataFixedPrice,this.jzDataDiscount,this.lastQuotation); |
| | | this.jzDataDefault = jzDataDefaultExp; |
| | | this.jzDataProduct = jzDataProductExp; |
| | | this.jzDataFixedPrice = jzDataFixedPriceExp; |
| | | this.jzDataDiscount = jzDataDiscountExp; |
| | | this.ContractPriceCompute() |
| | | } |
| | | } |
| | | Complate = false; |
| | | //从数据库更新已保存的数据 产品 UpdateBy 2021 06 29 |
| | | UpdateSaveDataQuoteLineItemSelectByID(flag) { |
| | | if (flag == 0) { |
| | | var idArr = []; |
| | | this.jzDataDefault.forEach(item => { |
| | | idArr.push(item.QuiteLineitem__c); |
| | | }) |
| | | selectUpdateQuoteLineItemData({ |
| | | ItemId: idArr |
| | | }).then(result => { |
| | | var newArr = []; |
| | | this.jzDataDefault.forEach(dp => { |
| | | var temp = { |
| | | ...{}, |
| | | ...dp |
| | | }; |
| | | result.forEach(item => { |
| | | if (item.Id == temp.QuiteLineitem__c) { |
| | | var keys = Object.keys(temp); |
| | | keys.forEach(k => { |
| | | var flag = ChangeProductData(k); |
| | | if (flag && item[k] != undefined && item[k] != temp[k]) { |
| | | this.Complate = true; |
| | | temp[k] = item[k]; |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | newArr.push(temp); |
| | | }) |
| | | this.jzDataDefault = newArr; |
| | | }) |
| | | } |
| | | if (flag == 1) { |
| | | var idArrPro = []; |
| | | this.jzDataProduct.forEach(item => { |
| | | idArrPro.push(item.QuiteLineitem__c); |
| | | }) |
| | | selectUpdateQuoteLineItemData({ |
| | | ItemId: idArrPro |
| | | }).then(result => { |
| | | var newArr = []; |
| | | this.jzDataProduct.forEach(dp => { |
| | | var temp = { |
| | | ...{}, |
| | | ...dp |
| | | }; |
| | | result.forEach(item => { |
| | | if (item.Id == temp.QuiteLineitem__c) { |
| | | var keys = Object.keys(temp); |
| | | keys.forEach(k => { |
| | | var flag = ChangeProductData(k); |
| | | if (flag && item[k] != undefined && item[k] != temp[k]) { |
| | | this.Complate = true; |
| | | temp[k] = item[k]; |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | newArr.push(temp); |
| | | }) |
| | | this.jzDataProduct = newArr; |
| | | this.updateIdStr("1"); |
| | | this.ContractPriceCompute(); |
| | | }) |
| | | } |
| | | } |
| | | //删除时需要用的唯一id的添加 |
| | | updateIdStr(str) { |
| | | var newArr = []; |
| | | var indexNum = 0; |
| | | var jzdpdc = []; |
| | | if (str == "1") { |
| | | jzdpdc = [].concat(this.jzDataProduct); |
| | | } else if (str == "2") { |
| | | jzdpdc = [].concat(this.jzDataDiscount); |
| | | } else if (str == "3") { |
| | | jzdpdc = [].concat(this.jzDataFixedPrice); |
| | | } |
| | | jzdpdc.forEach(item => { |
| | | indexNum++; |
| | | var temp = { |
| | | ...item |
| | | }; |
| | | temp.DelectId = indexNum; |
| | | newArr.push(temp); |
| | | }) |
| | | if (str == "1") { |
| | | this.jzDataProduct = [].concat(newArr); |
| | | } else if (str == "2") { |
| | | this.jzDataDiscount = [].concat(newArr); |
| | | } else if (str == "3") { |
| | | this.jzDataFixedPrice = [].concat(newArr); |
| | | } |
| | | } |
| | | //合同价格汇总 |
| | | ContractPrice = 0; |
| | | ContractPriceCompute() { |
| | | this.HeTongPriceCompute(); |
| | | this.ContractPrice = 0; |
| | | var sum = this.ContractPrice; |
| | | sum = parseFloat(sum); |
| | | sum=ContractPriceComputeLogic(sum,this.jzDataProduct,this.jzDataDiscount,this.jzDataFixedPrice); |
| | | this.ContractPrice = sum; |
| | | } |
| | | HeTongPriceCompute() { |
| | | var HeTongPriceList = []; |
| | | HeTongPriceList=HeTongPriceComputeLogic(this.jzDataDiscount,this.jzDataProduct); |
| | | if (HeTongPriceList.length > 0) { |
| | | this.jzDataDiscount = HeTongPriceList; |
| | | } |
| | | } |
| | | //从数据库更新已保存的数据 方案 UpdateBy 2021 06 29 |
| | | UpdateSaveDataFixedPriceSelectByID() { |
| | | var idArr = []; |
| | | this.jzDataFixedPrice.forEach(item => { |
| | | idArr.push(item.Id); |
| | | }) |
| | | selectUpdateFiexedpriceData({ |
| | | ProId: idArr |
| | | }).then(result => { |
| | | var newArr = []; |
| | | this.jzDataFixedPrice.forEach(dp => { |
| | | var temp = { |
| | | ...{}, |
| | | ...dp |
| | | }; |
| | | result.forEach(item => { |
| | | if (item.Id == temp.Id) { |
| | | var keys = Object.keys(temp); |
| | | keys.forEach(k => { |
| | | var flag = ChangeFiexedData(k); |
| | | if (flag && item[k] != undefined && item[k] != temp[k]) { |
| | | temp[k] = item[k]; |
| | | this.Complate = true; |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | newArr.push(temp); |
| | | }) |
| | | this.jzDataFixedPrice = newArr; |
| | | this.updateIdStr("3"); |
| | | }) |
| | | } |
| | | //加载报价数据 |
| | | QuoteData = []; |
| | | OnLoadQuoteData(idStr) { |
| | | GetQuoteData({ |
| | | QuoteID: idStr |
| | | }).then(result => { |
| | | var responseObj = JSON.parse(result); |
| | | this.QuoteData = initquoT(responseObj,this.buttonIsShow,this.initDataTableFixedPrice,this.initDataTableDiscount,this.initDataTableOtherData,this.initDataTableCommonly); |
| | | this.buttonIsShow = buttonIsShowE; |
| | | this.initDataTableFixedPrice = initDTFP; |
| | | this.initDataTableDiscount = initDTD; |
| | | this.initDataTableOtherData = initDTOD; |
| | | this.initDataTableCommonly = initDTC; |
| | | this.jzDataTableFixedPriceIsShow = true; |
| | | this.jzDataTableDiscountIsShow = true; |
| | | this.QTcss = QTcssE(this.pricePolicyflag); |
| | | this.pricePolicyflag = true; |
| | | if(!this.QuoteDecision){ |
| | | this.Save_button = true; |
| | | this.Decision_button = true; |
| | | } |
| | | }) |
| | | } |
| | | //打印按钮 |
| | | PrintButton(){ |
| | | if(!this.yyEvent()) return; |
| | | var id = this.quoId; |
| | | if (id == null || id == '') { |
| | | this.Alert(Error_Message33,'error'); |
| | | return false; |
| | | } |
| | | return this.chkEstimation_Entry_Possibility(id); |
| | | } |
| | | chkEstimation_Entry_Possibility(q) { |
| | | try { |
| | | this.OnLoading(true); |
| | | var dataChun = PrintButtonLoc(this.quo,this.oppInfo,this.jzDataToBeproduct,this.CheckItem,this.WinOrDecideAlert, |
| | | this.productStatusUpdated,this.enableSales,this.oppId,this.quoId,this.newQuoteFlag,this.changedAfterPrint,this.quoteGurantee_Period, |
| | | this.quotemultiYearWarranty,this.selection_hp,this.SkipQuotefilg,this.QuoteDecision,this.agency1Name) |
| | | Print(dataChun).then(resaut=>{ |
| | | this.quoId = saverebackloc(resaut,this.quoId,this.nafg); |
| | | this.OnLoading(false); |
| | | if(errorflg){ |
| | | this.Alert(alertExp,'error'); |
| | | this.nafg = nafgExp; |
| | | }else{ |
| | | if(errorflgw){ |
| | | this.Alert(alertExp,'warning'); |
| | | } |
| | | this.agency1Name =this.quo.Agency1__c; |
| | | } |
| | | if(flg){ |
| | | this.location = 'Id='+ this.quoId; |
| | | this.copyid = ''; |
| | | this.oppId = ''; |
| | | this.connectedCallback(); |
| | | } |
| | | openQuotePage(this.quo.Contract__c,errorflg,this.quoId); |
| | | }); |
| | | } catch (e) { |
| | | this.Alert(e,'error'); |
| | | } |
| | | } |
| | | //不保存返回按钮 |
| | | noSaveback(){ |
| | | window.open('/' +this.oppId, '_self'); |
| | | } |
| | | Sback = false; |
| | | //保存并返回 |
| | | Saveandback(){ |
| | | this.Sback = true; |
| | | this.savebuttonClick(); |
| | | } |
| | | //decide报价按钮 |
| | | decisionbuttonClick(){ |
| | | if(!this.yyEvent()) return; |
| | | this.checkchangedAfterPrint('de'); |
| | | if(this.fg){ |
| | | this.decisionlo(); |
| | | } |
| | | } |
| | | decisionlo(){ |
| | | var ff = decisionlol(this.jzDataToBeproduct,this.oppInfo,this.QuotationCalculationFag); |
| | | if(ff){ |
| | | this.Alert(alertExp,'error'); |
| | | }else{ |
| | | this.chkSalesPossibilityDecision(); |
| | | } |
| | | } |
| | | chkSalesPossibilityDecision() { |
| | | try { |
| | | this.tobeflag=false; |
| | | var quoc = saveEvoluationLogic(this.quo,this.oppInfo,this.jzDataToBeproduct); |
| | | var oppInfoc = oppInfosave; |
| | | var quoLineItemc = quoLineItemsave; |
| | | var quoLineItemCan = JSON.stringify(quoLineItemc); |
| | | var CheckItemCan = JSON.stringify(this.CheckItem); |
| | | var oppInfoCan = JSON.stringify(oppInfoc); |
| | | var quoCan = JSON.stringify(quoc); |
| | | this.OnLoading(true); |
| | | if(this.WinOrDecideAlert &&(!this.productStatusUpdated)){ |
| | | this.PriceStatusUpdate(); |
| | | } |
| | | QuoteDecision({activitiesCan:quoLineItemCan, |
| | | CheckItemCan:CheckItemCan, |
| | | WinOrDecideAlertc:this.WinOrDecideAlert, |
| | | productStatusUpdatedc:this.productStatusUpdated, |
| | | oppInfoc:oppInfoCan, |
| | | quoc:quoCan, |
| | | enableSalesc:this.enableSales, |
| | | oppIdc:this.oppId, |
| | | quoIdc:this.quoId, |
| | | newQuoteFlagc:this.newQuoteFlag, |
| | | changedAfterPrintc:this.changedAfterPrint, |
| | | quoteGurantee_Periodc:this.quoteGurantee_Period, |
| | | quotemultiYearWarrantyc:this.quotemultiYearWarranty, |
| | | selection_hpc:this.selection_hp, |
| | | SkipQuotefilgc:this.SkipQuotefilg, |
| | | agency1Namec:this.agency1Name |
| | | }).then(resaut=>{ |
| | | var Setmap = new Map() |
| | | var key = Object.keys(resaut) |
| | | key.forEach(item=>{ |
| | | Setmap.set(item,resaut[item]); |
| | | }); |
| | | if(Setmap.has('errormessage')){ |
| | | this.Alert(Setmap.get('errormessage'),'error'); |
| | | if(Setmap.get('act')){ |
| | | this.jzDataToBeproduct = actState(Setmap.get('act'),this.jzDataToBeproduct); |
| | | this.acts = true; |
| | | this.actL = Setmap.get('act'); |
| | | } |
| | | }else{ |
| | | this.agency1Name =this.quo.Agency1__c; |
| | | if(Setmap.has('warn')){ |
| | | this.Alert(Setmap.get('warn'),'warning'); |
| | | this.jzDataToBeproduct = actState(Setmap.get('act'),this.jzDataToBeproduct); |
| | | this.acts = true; |
| | | this.actL = Setmap.get('act'); |
| | | }else{ |
| | | this.Alert(Setmap.get('success'),'success'); |
| | | } |
| | | this.QuoteDecision = true; |
| | | this.enableContract = true; |
| | | this.Save_button = true; |
| | | this.Decisiontag = true; |
| | | var lg = this.template.querySelectorAll('c-jzlookuplightning2'); |
| | | lg.forEach(l=>{ |
| | | l.todisabled(); |
| | | }) |
| | | this.initDataTableToBeproduct.columns[4].editable = false; |
| | | if (this.QuoteDecision == false) { |
| | | this.sap_button = true; |
| | | } else if (this.specialAuthority == false) { |
| | | this.sap_button = true; |
| | | } else { |
| | | this.sap_button = false; |
| | | } |
| | | this.Decision_button = true; |
| | | } |
| | | if(Setmap.has('quoId')){ |
| | | window.open('/lightning/n/lexNewQuoteEntry#Id=' + Setmap.get('quoId'), '_self'); |
| | | this.location = 'Id='+ Setmap.get('quoId'); |
| | | this.copyid = ''; |
| | | this.oppId = ''; |
| | | this.quoId = ''; |
| | | this.connectedCallback(); |
| | | } |
| | | this.nafg = resultFlag(this.nafg,Setmap); |
| | | this.tobeflag=true; |
| | | this.OnLoading(false); |
| | | }); |
| | | return true; |
| | | } catch (e) { |
| | | this.Alert(e,'error'); |
| | | } |
| | | } |
| | | //保存判断是否生成新报价标识 |
| | | fg = true; |
| | | changedAfterPrint = false; |
| | | QuotationCalculationFag = false; |
| | | @track SPFlag = false; |
| | | SPcheck(){ |
| | | var maps=checkch(this.jzDataToBeproduct); |
| | | var flag=maps.get('flag'); |
| | | console.log(this.jzDataToBeproduct); |
| | | if(flag){ |
| | | this.SPFlag=flag; |
| | | }else{ |
| | | this.decisionbuttonClick(); |
| | | } |
| | | |
| | | } |
| | | checkchangedAfterPrint(dec) { |
| | | this.fg = true; |
| | | var id = this.quoId; |
| | | this.changedAfterPrint = false; |
| | | var detailChanged = false; |
| | | if (!id) { |
| | | return; |
| | | }else{ |
| | | this.fg = false; |
| | | } |
| | | // cjw |
| | | var maps = checkch(this.jzDataToBeproduct); |
| | | var activities=maps.get('activities'); |
| | | // cjw |
| | | getQuoteLineItem({ |
| | | quoId: id |
| | | }).then(results=>{ |
| | | var quote_Date__c = null; |
| | | if (results.length > 0) { |
| | | quote_Date__c = results[0]['Quote']['Quote_Date__c']; |
| | | } |
| | | if (!detailChanged) { |
| | | if (activities.length != results.length) { |
| | | detailChanged = true; |
| | | } |
| | | } |
| | | if (!detailChanged) { |
| | | for (var j = 0; j < results.length; j++) { |
| | | if (results[j].PricebookEntryId != activities[j].PricebookEntryId || |
| | | results[j].SFDA_Status__c != activities[j].SFDA_Status__c || |
| | | results[j].UnitPrice__c != activities[j].UnitPrice__c || |
| | | results[j].ListPrice__c != activities[j].ListPrice__c || |
| | | results[j].Quantity != activities[j].Quantity |
| | | ) { |
| | | detailChanged = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | if (detailChanged) { |
| | | this.changedAfterPrint = true; |
| | | } |
| | | if(detailChanged && !this.changedAfterPrint){ |
| | | this.QuotationCalculationFag= true; |
| | | }else{ |
| | | this.QuotationCalculationFag= false; |
| | | } |
| | | if(dec === 'de'){ |
| | | this.decisionlo(); |
| | | }else if(dec === 'sa'){ |
| | | this.sal(); |
| | | } |
| | | }); |
| | | return; |
| | | } |
| | | handleCloseChange(){ |
| | | this.SPFlag = false; |
| | | } |
| | | handleSPChange(event){ |
| | | console.log(event); |
| | | this.jzDataToBeproduct=event.detail; |
| | | this.SPFlag = false; |
| | | this.decisionbuttonClick(); |
| | | } |
| | | calFromQuoAmont() { |
| | | var x=0, |
| | | y=0; |
| | | x=this.quo.hidden_Estimation_List; |
| | | x = localParseFloat(x); |
| | | y=this.quo.Quote_Adjust_Amount_Page__c; |
| | | this.quo.Quote_Adjust_Amount_Page__c = toNumComma(y); |
| | | y=localParseFloat(y); |
| | | var noDiscountPriceTotal = this.hidden_MultiYearWarrantyTotalPrice; |
| | | noDiscountPriceTotal=localParseFloat(noDiscountPriceTotal); |
| | | this.quo.QuoteTotal_Page__c=toNumComma(y + x + noDiscountPriceTotal); |
| | | 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; |
| | | mp=localParseFloat(mp); |
| | | var num=this.quo.Quote_Adjust_Calculate__c; |
| | | num=localParseFloat(num); |
| | | this.quo.Quote_Adjust_Calculate__c=toNumComma(num); |
| | | num=(100 + num) / 100; |
| | | z=localParseFloat(z); |
| | | 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.setOCMAmount(); |
| | | this.calFromContactPrice(); |
| | | } |
| | | // } |
| | | if (y == 0) { |
| | | this.quo.Quote_Adjust_Calculate__c=0; |
| | | this.UnitPriceUpdate(); |
| | | } else { |
| | | this.quoteTotalPriceAction(); |
| | | } |
| | | } |
| | | UnitPriceUpdate() { |
| | | this.jzDataToBeproduct = UnitPriceUpdateLogic(this.quo,this.jzDataToBeproduct,this.QuoteDecision_Button); |
| | | this.quo = quoExp; |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.Subtotalupdate(); |
| | | this.calUnitPriceTotal(); |
| | | this.quoteTotalPrice(); |
| | | } |
| | | Subtotalupdate() { |
| | | this.jzDataToBeproduct=SubtotalupdateLogic(this.jzDataToBeproduct); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | } |
| | | quoteTotalPriceAction() { |
| | | this.jzDataToBeproduct=quoteTotalPriceActionLogic(this.quo,this.jzDataToBeproduct,this.hidden_MultiYearWarrantyTotalPrice,this.QuoteDecision_Button); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.quo=quoExp; |
| | | this.calUnitPriceTotal(); |
| | | this.QuoteAdjust(); |
| | | this.DisAmountfunction(); |
| | | } |
| | | |
| | | multiYearWarrantyChange(event){ |
| | | this.quo.multiYearWarranty__c=event.detail.checked; |
| | | this.calPriceAll(); |
| | | } |
| | | //主机不带监视器台车change事件 |
| | | MainEngineWithoutMonitorChange(event){ |
| | | this.quo.MainEngineWithoutMonitor__c=event.detail.checked; |
| | | } |
| | | //跨科室change事件 |
| | | InterdepartmentalChange(event){ |
| | | this.quo.Interdepartmental__c=event.detail.checked; |
| | | this.calPriceAll(); |
| | | } |
| | | //单价change事件 |
| | | UnitPriceChange(event){ |
| | | this.quo.Unit_Price__c=event.detail.checked; |
| | | } |
| | | //报价金额change事件 |
| | | OfferAmountChange(event){ |
| | | this.quo.Offer_Amount__c=event.detail.checked; |
| | | } |
| | | //报价总额change事件 |
| | | TOTALChange(event){ |
| | | this.quo.TOTAL__c=event.detail.checked; |
| | | } |
| | | //优惠折扣change事件 |
| | | DiscountChange(event){ |
| | | this.quo.Discount__c=event.detail.checked; |
| | | } |
| | | //优惠价格change事件 |
| | | PricingChange(event){ |
| | | this.quo.Pricing__c=event.detail.checked; |
| | | } |
| | | //优惠成交价change事件 |
| | | PreferentialTradingPriceChange(event){ |
| | | this.quo.Preferential_Trading_Price__c=event.detail.checked; |
| | | } |
| | | //保修年限change事件 |
| | | PreferentialGuranteePeriodChange(event){ |
| | | this.quo.Preferential_Gurantee_Period__c=event.detail.checked; |
| | | } |
| | | //合同配置change事件 |
| | | ContractcChange(event){ |
| | | this.quo.Contract__c=event.detail.checked; |
| | | } |
| | | |
| | | //主机装机地 optionList |
| | | HostInstallationLocationoptionsvalue=[]; |
| | | get HostInstallationLocationoptions() { |
| | | if(this.HostInstallationLocationoptionsvalue.length<=0){ |
| | | getPicklistValues({objstr:'Quote',fld:'Installation_location__c',ifempty:true}).then(keyvalue=>{ |
| | | this.HostInstallationLocationoptionsvalue=keyvalue; |
| | | }); |
| | | }else{ |
| | | return this.HostInstallationLocationoptionsvalue |
| | | } |
| | | } |
| | | |
| | | HostInstallationLocationhandleChange(event) { |
| | | this.quo.Installation_location__c=event.detail.value; |
| | | } |
| | | |
| | | //合同保修期(年)start |
| | | ContractWarrantyPeriodYearOptionsvalue=[]; |
| | | get ContractWarrantyPeriodYearOptions() { |
| | | if(this.ContractWarrantyPeriodYearOptionsvalue.length<=0){ |
| | | getPicklistValues({objstr:'Quote',fld:'Gurantee_Period__c',ifempty:false}).then(keyvalue=>{ |
| | | this.ContractWarrantyPeriodYearOptionsvalue=keyvalue; |
| | | }); |
| | | }else{ |
| | | return this.ContractWarrantyPeriodYearOptionsvalue |
| | | } |
| | | } |
| | | |
| | | ContractWarrantyPeriodYearHandleChange(event) { |
| | | this.quo.Gurantee_Period__c=event.detail.value; |
| | | this.calGuranteePeriod(); |
| | | } |
| | | // 更新多年保修 保修期 |
| | | //隐藏合同保修期(年) |
| | | HiddenGurantee_Period; |
| | | calGuranteePeriod() { |
| | | var AllGurantee_Period=this.quo.Gurantee_Period__c; |
| | | this.HiddenGurantee_Period=AllGurantee_Period; |
| | | this.jzDataToBeproduct=calGuranteePeriodLogic(this.jzDataToBeproduct,AllGurantee_Period); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | } |
| | | |
| | | //报价变化 start |
| | | QuotationChangesOptionsvalue=[]; |
| | | get QuotationChangesOptions() { |
| | | if(this.QuotationChangesOptionsvalue.length<=0){ |
| | | getPicklistValues({objstr:'Quote',fld:'QuotationChange__c',ifempty:true}).then(keyvalue=>{ |
| | | this.QuotationChangesOptionsvalue=keyvalue; |
| | | }); |
| | | }else{ |
| | | return this.QuotationChangesOptionsvalue |
| | | } |
| | | } |
| | | |
| | | QuotationChangesHandleChange(event) { |
| | | this.quo.QuotationChange__c=event.detail.value; |
| | | } |
| | | // 经销商一名称输入框 start |
| | | onsearchchange1(event){ |
| | | this.quo.Agency1__c=event.detail.value; |
| | | } |
| | | // 经销商二名称输入框 start |
| | | onsearchchange2(event){ |
| | | this.quo.Agency2__c=event.detail.value; |
| | | } |
| | | //报价产品选中数据 |
| | | @track |
| | | selectjzDataTableToBeproduct=[]; |
| | | SelectedToBeproduct(event) { |
| | | let arr=event.detail.rows; |
| | | this.selectjzDataTableToBeproduct=arr; |
| | | } |
| | | //删除报价产品按钮 |
| | | deletejzDataToBeproduct(){ |
| | | var delFlag=false; |
| | | var num=this.jzDataToBeproduct.length; |
| | | for (var j=0; j < this.selectjzDataTableToBeproduct.length; j++) { |
| | | for (var i=0; i < this.jzDataToBeproduct.length; i++) { |
| | | if (this.selectjzDataTableToBeproduct[j].lineNo == this.jzDataToBeproduct[i].lineNo) { |
| | | this.jzDataToBeproduct.splice(i, 1); |
| | | i--; |
| | | delFlag=true; |
| | | } |
| | | } |
| | | } |
| | | var ItemL=MarkRed(this.jzDataToBeproduct); |
| | | this.jzDataToBeproduct =[].concat(ItemL); |
| | | if(this.jzDataToBeproduct.length!=num){ |
| | | this.quo.IsQuoteTrial__c=false; |
| | | } |
| | | if(!delFlag){ |
| | | this.Alert("请选择可以操作的行",'error'); |
| | | } |
| | | console.warn(this.jzDataToBeproduct.length); |
| | | this.calPriceAll(); |
| | | } |
| | | getTableDataToBeproduct(event) { |
| | | } |
| | | @track jzDataToBeproduct=[]; |
| | | @track tableIsLodingToBeproduct=false; |
| | | @track |
| | | initDataTableToBeproduct=initDataTableToBeproductConfig; |
| | | @track |
| | | tobeflag=true |
| | | //报价产品编辑列 |
| | | onsaveToBeproduct(event){ |
| | | this.tobeflag=false |
| | | var data=event.detail.rows; |
| | | console.log('data==>> ' + JSON.stringify(data)); |
| | | this.jzDataToBeproduct=onsaveToBeproductLoc(data,this.jzDataToBeproduct); |
| | | if(fagExp){ |
| | | this.quo.IsQuoteTrial__c=false; |
| | | this.quoteAgencyTotalPriceAction(); |
| | | this.AgencyDiscountCalculation1(); |
| | | } |
| | | this.updateNoDiscountPricetotal(); |
| | | this.EstimationListPrice(); |
| | | this.calUnitPriceTotal(); |
| | | this.quoteTotalPrice(); |
| | | setTimeout(() => { |
| | | this.tobeflag=true; |
| | | },1); |
| | | } |
| | | // 计算 No Discount Price合计 |
| | | updateNoDiscountPricetotal() { |
| | | var noDiscountPriceTotal=0; |
| | | this.jzDataToBeproduct.forEach(jzdtbt=>{ |
| | | var noDiscountPrice=jzdtbt.pageObject.ServicePrice__c; |
| | | noDiscountPrice=localParseFloat(noDiscountPrice); |
| | | var Quantity=jzdtbt.Quantity__c; |
| | | Quantity=localParseFloat(Quantity); |
| | | noDiscountPriceTotal=noDiscountPriceTotal + noDiscountPrice * Quantity; |
| | | if (jzdtbt.NoDiscountTotal__c) { |
| | | jzdtbt.NoDiscountTotal__c=toNumComma(noDiscountPrice * Quantity); |
| | | } |
| | | }); |
| | | this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct); |
| | | this.hidden_MultiYearWarrantyTotalPrice=noDiscountPriceTotal; |
| | | this.quo.MultiYearWarrantyTotalPrice__c=toNumComma(noDiscountPriceTotal); |
| | | } |
| | | handleRowAction(event){ |
| | | const actionName=event.detail.row; |
| | | } |
| | | //打开产品配套模态框开关 |
| | | @track |
| | | showSetProductfalg=false; |
| | | //产品配套按钮 |
| | | openSetProduct(event){ |
| | | this.showSetProductfalg=true; |
| | | } |
| | | //产品配套 optionList |
| | | get listViewOptions() { |
| | | return filterNameoptionList(); |
| | | } |
| | | // 产品配套模态框关闭 |
| | | cancelsetProduct(){ |
| | | this.showSetProductfalg=false; |
| | | this.jzSetProductData=[]; |
| | | } |
| | | // 适用科室 |
| | | filterName; |
| | | // 适用科室Change事件 |
| | | filterNameChange(event){ |
| | | this.filterName=event.target.value; |
| | | } |
| | | // 产品配套名 |
| | | setSearchName; |
| | | //产品配套名Change事件 |
| | | jzSearchNameChange(event){ |
| | | this.setSearchName=event.target.value; |
| | | } |
| | | //产品配套编码 |
| | | SearchCode; |
| | | //产品配套编码Change事件 |
| | | jzSearchCodeChange(event){ |
| | | this.SearchCode=event.target.value; |
| | | } |
| | | initDataSetProductTable=initDataSetProductTablefig; |
| | | @track |
| | | jzSetProductData=[]; |
| | | @track |
| | | tableIsSetProductLoding=false; |
| | | @track |
| | | IsLoadingjdspt=false; |
| | | //产品配套搜索 |
| | | jzsetProductsearchbutton(){ |
| | | this.IsLoadingjdspt=true; |
| | | let SearchCode=this.SearchCode; |
| | | let filterName=this.filterName; |
| | | let setSearchName=this.setSearchName; |
| | | serSetContact({SearchName:setSearchName,SearchCode:SearchCode,filterName:filterName}).then(result=>{ |
| | | this.jzSetProductData=result; |
| | | this.IsLoadingjdspt=false; |
| | | }); |
| | | } |
| | | //产品配套选中数据 |
| | | SelectedNewsetProduct=[] |
| | | //产品配套选中数据 |
| | | SelectedSetProductFn(event){ |
| | | let arr=event.detail.rows; |
| | | this.SelectedNewsetProduct=arr; |
| | | } |
| | | //追加产品配套搜索 |
| | | additionaljzsetProductbutton(){ |
| | | var dataChunanshen=additionabuttonLoc(this.SelectedNewsetProduct,this.quo,this.oppInfo,this.jzDataToBeproduct) |
| | | var num=this.jzDataToBeproduct.length; |
| | | var isPrepared=DataStatus; |
| | | var Str=StrExp; |
| | | if(isPrepared!='Fin'){ |
| | | confirm(isPrepared); |
| | | }else if(!Str){ |
| | | if(confirm("您尚未选取任何产品配套,确认完成么?")){ |
| | | this.cancelsetProduct(); |
| | | }else{ |
| | | } |
| | | }else{ |
| | | this.OnLoading(true); |
| | | setProductEntry(dataChunanshen).then(reslut=>{ |
| | | debugger |
| | | var tempArr=reslut.split("---"); |
| | | var errormessage=tempArr[0]; |
| | | var quoteLineItem=JSON.parse(tempArr[1]); |
| | | quoteLineItem=InitializeProductAssignment(quoteLineItem); |
| | | 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.cancelsetProduct(); |
| | | } |
| | | this.SelectedNewsetProduct=[]; |
| | | } |
| | | |
| | | getTableSetProductData(event) { |
| | | this.tableIsproductLoding=false; |
| | | } |
| | | @track |
| | | showQuoteExcelImport=false; |
| | | openQuoteExcelImport(event){ |
| | | this.showQuoteExcelImport=true; |
| | | } |
| | | cancelQuoteExcelImport(){ |
| | | this.showQuoteExcelImport=false; |
| | | this.exceltextvalue=''; |
| | | } |
| | | SavesSQuoteExcelImport(){ |
| | | let Str=this.exceltextvalue; |
| | | var num=this.jzDataToBeproduct.length; |
| | | var quoc=saveEvoluationLogic(this.quo,this.oppInfo,this.jzDataToBeproduct); |
| | | var oppInfoc=oppInfosave; |
| | | var quoLineItemc=quoLineItemsave; |
| | | var quoLineItemCan=JSON.stringify(quoLineItemc); |
| | | var oppInfoCan=JSON.stringify(oppInfoc); |
| | | var quoCan=JSON.stringify(quoc); |
| | | this.OnLoading(true); |
| | | excelImport({excel_text:Str, |
| | | activitiesCan:quoLineItemCan, |
| | | oppInfoc:oppInfoCan, |
| | | quoc:quoCan}).then(reslut=>{ |
| | | var tempArr=reslut.split("---"); |
| | | var errormessage = tempArr[0]; |
| | | var quoteLineItem = JSON.parse(tempArr[1]); |
| | | quoteLineItem = InitializeProductAssignment(quoteLineItem); |
| | | 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(); |
| | | }); |
| | | } |
| | | @track |
| | | exceltextvalue; |
| | | exceltextChange(event){ |
| | | let value = event.detail.value; |
| | | this.exceltextvalue = value; |
| | | } |
| | | //打开新建产品模态框开关 |
| | | showproductfalg = false; |
| | | //新增报价产品按钮 |
| | | NewQuotationProducts(event){ |
| | | this.showproductfalg = true; |
| | | } |
| | | @track |
| | | IsLoadingjdpt = false; |
| | | //选择数据 |
| | | SelectedNewProduct = []; |
| | | //新增报价产品列表选事件 |
| | | SelectedProductFn(event) { |
| | | let arr = event.detail.rows; |
| | | this.SelectedNewProduct = arr; |
| | | } |
| | | //追加新增产品按钮 |
| | | additionaljzProductbutton(){ |
| | | if(this.SelectedNewProduct.length == 0){ |
| | | if(confirm("您尚未选取任何产品,确认完成么?")){ |
| | | this.cancelProduct(); |
| | | } |
| | | }else{ |
| | | this.tobeflag = false |
| | | var selectvlue = this.SelectedNewProduct; |
| | | var Listvalue = this.jzDataToBeproduct; |
| | | this.jzDataToBeproduct = additionaljzProductLogic(selectvlue,Listvalue,this.oppInfo.CurrencyIsoCode,this.quo.IsQuoteTrial__c); |
| | | var jzDataToBeproductStr = JSON.stringify(this.jzDataToBeproduct); |
| | | addOptions({str: jzDataToBeproductStr}).then(result=>{ |
| | | console.log('before'); |
| | | console.log(jzDataToBeproductStr); |
| | | this.jzDataToBeproduct = JSON.parse(result); |
| | | console.log('after123'); |
| | | console.log(result); |
| | | if(alertExp){ |
| | | this.Alert(alertExp,'error'); |
| | | } |
| | | setTimeout(() => { |
| | | this.tobeflag = true; |
| | | },1); |
| | | this.quo.IsQuoteTrial__c = IsQuoteTrialExp; |
| | | this.calPriceAll(); |
| | | this.cancelProduct(); |
| | | this.SelectedNewProduct = []; |
| | | }); |
| | | |
| | | } |
| | | } |
| | | //新增报价产品模态框取消按钮 |
| | | cancelProduct() { |
| | | this.showproductfalg = false; |
| | | this.jzProductData = []; |
| | | } |
| | | //新增报价产品检索条件 |
| | | @track |
| | | SearchName = ''; |
| | | jzProductsearchChange(event){ |
| | | if(this.SearchName != event.target.value){ |
| | | this.SearchName = event.target.value; |
| | | } |
| | | } |
| | | //新增报价产品检索按钮 |
| | | jzProductsearchbutton(event){ |
| | | this.IsLoadingjdpt = true; |
| | | let tradec = this.oppInfo.CurrencyIsoCode; |
| | | let celon = this.oppInfo.CelonOpportunity__c; |
| | | let SearchName = this.SearchName; |
| | | serContact({tradec:tradec,SearchName:SearchName,celon:celon}).then(result=>{ |
| | | this.jzProductData = jzProductsearchLogic(result); |
| | | this.IsLoadingjdpt = false; |
| | | }); |
| | | } |
| | | //新增报价产品列表加载数据 |
| | | getTableProductData(event) { |
| | | this.tableIsproductLoding = false; |
| | | } |
| | | //新增报价产品列表数据 |
| | | @track jzProductData = []; |
| | | //新增报价产品列表加载动图标识 |
| | | @track tableIsproductLoding = true; |
| | | // 新增报价产品列表列配置 |
| | | @track |
| | | initDataProductTable = initDataProductTablefig; |
| | | |
| | | //打开报价计算标识 |
| | | quoteflg = false; |
| | | @track |
| | | QTcss="slds-button slds-button_neutral slds-button_stretch lexBorder"; |
| | | showQuotationCalculation(event){ |
| | | if(!this.yyEvent()) return; |
| | | if(this.pricePolicyflag){ |
| | | this.QTcss = QTcssE(this.pricePolicyflag); |
| | | this.pricePolicyflag = false; |
| | | this.quoteflg = false; |
| | | this.OnLoadProduct = []; |
| | | this.jzDataDefault = []; |
| | | this.OnLoadSaveProduct = []; |
| | | this.jzDataProduct = []; |
| | | this.OnLoadDiscount = []; |
| | | this.jzDataDiscount = []; |
| | | this.OnLoadFixDiscount = []; |
| | | this.jzDataFixedPrice = []; |
| | | this.ContractPriceCompute(); |
| | | if(!this.QuoteDecision){ |
| | | this.Save_button = false; |
| | | this.Decision_button = false; |
| | | } |
| | | }else{ |
| | | this.quoteflg = true; |
| | | if(this.QuoteDecision){ |
| | | this.pricePolicyflag = true; |
| | | }else{ |
| | | this.savebuttonClick(); |
| | | } |
| | | } |
| | | } |
| | | //报价计算区域展开标识 |
| | | pricePolicyflag = false; |
| | | //报价计算按钮展开标识 |
| | | buttonIsShow = false; |
| | | //合同总价 |
| | | ContractPrice = 0; |
| | | ifFTip=true; |
| | | dealerfinalchange(event){ |
| | | var target = {value :event.detail.value}; |
| | | var events = {target:target} |
| | | this.DealerFinalPricePageChange(events); |
| | | } |
| | | isloadingchange(event){ |
| | | this.IsLoading=event.detail.IsLoading; |
| | | } |
| | | QTcsschange(event){ |
| | | debugger |
| | | this.QTcss = event.detail.qtcss; |
| | | } |
| | | //保存报价计算结果按钮方法 |
| | | saveAllDataProductFn(event) { |
| | | debugger |
| | | var ContractPrice = event.detail.contractrice; |
| | | this.IsLoading=false; |
| | | this.quo.IsQuoteTrial__c = true; |
| | | this.SkipQuotefilg = false; |
| | | this.ifquocom = true; |
| | | if(this.oppInfo.Sales_Root__c == Sales_Outlet){ |
| | | var target = {value :ContractPrice} |
| | | var event = {target:target} |
| | | this.OCMAgent1PricePageonChange(event); |
| | | }else{ |
| | | this.quo.Dealer_Final_Price_Page__c = toNumComma(ContractPrice); |
| | | var target = {value :ContractPrice} |
| | | var event = {target:target} |
| | | this.DealerFinalPricePageChange(event); |
| | | } |
| | | this.Alert("数据已保存", 'success'); |
| | | } |
| | | //报价计算打开按钮 end |
| | | SelectedFnDefault(rows) { |
| | | let arr = rows; |
| | | } |
| | | //获取待选择产品列表数据 |
| | | UniqueKey = new Map(); |
| | | getTableDataDefault(event) { |
| | | let data = []; |
| | | //todu10 |
| | | GetPromotionDefalut({ |
| | | IdParam: this.quoId |
| | | }).then(result => { |
| | | this.jzDataDefaultNotChange = []; |
| | | this.jzDataDefaultCopy = []; |
| | | var i = 1; |
| | | result.forEach(rItem => { |
| | | rItem.ListPrice = rItem.ListPrice__c; |
| | | rItem.HangHao = i++; |
| | | rItem.Id = rItem.Product2Id; |
| | | let tempS = { |
| | | ...{}, |
| | | ...rItem |
| | | }; |
| | | this.jzDataDefaultNotChange.push(tempS); |
| | | this.jzDataDefaultCopy.push(tempS); |
| | | }); |
| | | this.getschemedetails(); |
| | | if (this.flagall) { |
| | | //cjw start |
| | | this.jzDataDefault = qwe(this.OnLoadProduct,result); |
| | | //cjw end |
| | | this.tableIsLodingDefault = false; |
| | | this.comparisonUniqueKey(); |
| | | return; |
| | | } else { |
| | | result.forEach(rItems => { |
| | | rItems.ListPrice = rItems.ListPrice__c; |
| | | }); |
| | | this.jzDataDefault = result; |
| | | this.tableIsLodingDefault = false; |
| | | var event = { |
| | | page: 1, |
| | | pageLimit: 10, |
| | | search: "", |
| | | sortOrder: "asc", |
| | | sortPlus: undefined, |
| | | fag: true |
| | | }; |
| | | this.getTableDataFix(event); |
| | | } |
| | | }) |
| | | this.tableIsLodingDefault = false; |
| | | } |
| | | //查询价格政策方案关联产品明细 |
| | | //算出的合计 |
| | | sumTotal = []; |
| | | getschemedetails() { |
| | | this.jzDataFixedPrice.forEach(jdfp => { |
| | | var SeachData = { |
| | | SearchId: jdfp.Id |
| | | }; |
| | | GetSearchProductById(SeachData).then(result => { |
| | | var tempObject = { |
| | | ...{}, |
| | | ...jdfp |
| | | } |
| | | jdfp = this.countListAndNod(tempObject, result); |
| | | this.sumTotal.push(jdfp); |
| | | }); |
| | | }); |
| | | } |
| | | @track jzDataDefault = []; //数据 待选择产品数据据 |
| | | jzDataDefaultNotChange = []; |
| | | jzDataDefaultCopy = []; |
| | | @track tableIsLodingDefault = true; |
| | | @track |
| | | initSearchFormDefalt = initSearchFormDefalt2; |
| | | @track |
| | | initDataTableDefault = initDataTableDefault2; |
| | | @track |
| | | show = false |
| | | //选择促销方案打开按钮 |
| | | showModal(){ |
| | | this.show = true; |
| | | let inputFields=this.template.querySelectorAll('c-jz-data-table'); |
| | | console.log("=====show======"); |
| | | console.log(JSON.parse(JSON.stringify(inputFields))); |
| | | inputFields.forEach(field => { |
| | | console.log(JSON.parse(JSON.stringify(field.name))); |
| | | }); |
| | | } |
| | | //选择促销方案模态框取消按钮 |
| | | cancel() { |
| | | this.show = false |
| | | } |
| | | @track ShowFix; |
| | | showModalFix() { |
| | | this.ShowFix = true |
| | | } |
| | | cancelFix() { |
| | | this.ShowFix = false |
| | | } |
| | | @track |
| | | initSearchFormFix = initSearchFormFix2; |
| | | @track |
| | | initDataTableFix = initDataTableFix2; |
| | | |
| | | @track jzDataFix = []; |
| | | @track tableIsLodingFix = true; |
| | | // 点击搜索触发 |
| | | searchDataFix(event) { |
| | | let searchParams = event.detail.searchParams || {}; |
| | | this.template.querySelector('[data-parent-id="parent-div-idFix"]').refreshDataTable({ |
| | | searchParams: searchParams |
| | | }); |
| | | } |
| | | deleteFixedPrice(){ |
| | | var fag = deleteFixedPriceLogic(this.SelectedFnDataFixedPrice,this.CompareFullData); |
| | | this.SelectedFnDataFixedPrice = SelectedFnDataFixedPriceExp; |
| | | this.CompareFullData = CompareFullDataExp; |
| | | var ids = idsExp; |
| | | if (fag) { |
| | | //删除所选方案匹配的产品 |
| | | this.DeleteChangesFn(ids, "价格政策"); |
| | | //调用删除价格政策 |
| | | this.deleteFixedPriceTemp(); |
| | | this.ContractPriceCompute(); |
| | | }else{ |
| | | this.Alert("一般产品为强制匹配,不可删除",'error'); |
| | | } |
| | | } |
| | | // 删除所选方案匹配的产品 |
| | | DeleteChangesFn(ids, TypeName) { |
| | | var CompareFullDataTemp = []; |
| | | ids.forEach(id => { |
| | | this.jzDataProduct = DeleteChangesFnLogic(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; |
| | | } |
| | | //删除价格政策 |
| | | deleteFixedPriceTemp() { |
| | | this.jzDataFixedPrice = deleteFixedPriceTempLogic(this.SelectedFnDataFixedPrice,this.jzDataFixedPrice,this.CompareFullData); |
| | | this.CompareFullData = CompareFullDataExp; |
| | | this.SelectedFnDataFixedPrice = []; |
| | | } |
| | | //价格政策列表选中的数据 |
| | | @track SelectedFnDataFixedPrice = []; |
| | | SelectedFnFixedPrice(event) { |
| | | let arr = event.detail.rows; |
| | | this.SelectedFnDataFixedPrice = arr; |
| | | } |
| | | @track |
| | | initDataTableFixedPrice = initDataTableFixedPrice2; |
| | | //价格政策加载数据方法 |
| | | getTableDataFixedPrice(event) { |
| | | this.tableIsLodingFixedPrice = false; |
| | | } |
| | | //价格政策数据 |
| | | @track jzDataFixedPrice = []; |
| | | //价格政策列表loding |
| | | @track tableIsLodingFixedPrice = true; |
| | | //价格政策列表展示标识 |
| | | @track jzshows3 = true; |
| | | //对比价格政策赋值 |
| | | comparativeAssignment() { |
| | | this.jzDataFixedPrice.forEach(jdfp => { |
| | | this.sumTotal.forEach(stl => { |
| | | if (jdfp.Id == stl.Id) { |
| | | if (stl.sumListPrice != undefined && stl.sumNoDiscount != undefined) { |
| | | jdfp.sumListPrice = stl.sumListPrice; |
| | | jdfp.sumNoDiscount = stl.sumNoDiscount; |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | //保存价格政策编辑列方法 |
| | | handleSaveFixedPrice(event) { |
| | | this.comparativeAssignment(); |
| | | let editnewDate = []; |
| | | editnewDate = handleSaveFixedPriceLogic(this.CompareFullData,event,this.jzDataFixedPrice,this.jzDataDefaultCopyQuantityList,this.jzDataDefault); |
| | | this.CompareFullData = CompareFullDataExp; |
| | | var HeTongTotal = HeTongTotalExp; |
| | | let newData = newDataExp; |
| | | var boolean = booleanExp; |
| | | var newArrs = [].concat(editnewDate); |
| | | if (boolean == 1) { |
| | | this.jzDataFixedPrice = newData; |
| | | newArrs.forEach(item => { |
| | | this.ComputeData(item.Id, '价格政策'); |
| | | this.Alert("数据修改成功", 'success'); |
| | | }); |
| | | this.jzDataProduct = this.newArrsTemp3.concat(this.newArrsTemp4); |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | } else if (boolean == 3) { |
| | | this.Alert("修改错误,次数已经超过最大值,不可增加",'error'); |
| | | } else if (boolean == 4) { |
| | | this.Alert("修改错误,次数不可以为0",'error'); |
| | | } else if (boolean == 5) { |
| | | this.Alert("该方案为强制匹配,次数不可修改!",'error'); |
| | | } else if (boolean == 6) { |
| | | var str1 = String(HeTongTotal); |
| | | var str = "修改错误,合同价格不得小于"; |
| | | var str3 = str + str1; |
| | | this.Alert(str3,'error'); |
| | | } |
| | | //刷新 |
| | | this.jzshows3 = false; |
| | | this.IsLoading3 = true; |
| | | setTimeout(() => { |
| | | this.IsLoading3 = false; |
| | | this.jzshows3 = true; |
| | | }, 800); |
| | | } |
| | | newArrsTemp3 = []; |
| | | newArrsTemp4 = []; |
| | | //========促销方案模态框 start========= |
| | | // 促销方案搜索框搜索按钮方法 |
| | | searchData(event) { |
| | | let searchParams = event.detail.searchParams || {}; |
| | | let temp = this.template; |
| | | this.template.querySelector('[data-parent-id="parent-div-id"]').refreshDataTable({ |
| | | searchParams: searchParams |
| | | }); |
| | | } |
| | | // 促销方案搜索框配置列 |
| | | @track |
| | | initSearchForm = initSearchForm2; |
| | | //促销方案列表选事件 |
| | | SelectedFn(event) { |
| | | let arr = event.detail.rows; |
| | | if (arr.length > 1) { |
| | | this.Alert("价格政策只可选择一个方案",'error'); |
| | | } else { |
| | | this.ifqianpi = true; |
| | | this.GetSearchProductByIdFn(arr[0].Id, arr[0], "价格政策", [], arr); |
| | | } |
| | | this.cancel(); |
| | | } |
| | | //促销方案列表加载数据 |
| | | // 后台交互,获取列表数据 |
| | | getTableData(event) { |
| | | let listQuery = event; |
| | | if (event.fag == undefined) { |
| | | listQuery = event.detail.listQuery; |
| | | } |
| | | GetPromotionPromotionSearch(listQuery).then(result => { //促销方案查询结果 |
| | | var responseObj = JSON.parse(result); |
| | | responseObj.records.forEach(item => { |
| | | var SeachData = { |
| | | SearchId: item.Id |
| | | }; |
| | | GetSearchProductById(SeachData).then(result => { //方案关联的产品 |
| | | var newarrjdf = SearchProductByIdLogic(result,this.jzDataFixedPrice,this.jzDataDefaultCopyQuantityList,item); |
| | | this.jzDataDefaultCopyQuantityList = jzDataDefaultCopyQuantityListExp; |
| | | this.jzDataFixedPrice = [].concat(newarrjdf); |
| | | }); |
| | | }); |
| | | this.jzData = [].concat(responseObj.records); |
| | | this.tableIsLoding = false; |
| | | }) |
| | | } |
| | | jzDataDefaultCopyQuantityList = []; |
| | | // 后台交互,获取一般产品列表数据 |
| | | ifqianpi = true; |
| | | getTableDataFix(event) { |
| | | let listQuery = event; |
| | | if (event.fag) { |
| | | this.ifqianpi = false; |
| | | } else { |
| | | listQuery = event.detail.listQuery; |
| | | } |
| | | listQuery.pageLimit = 200; |
| | | GetNormalProductSearch(listQuery).then(result => { |
| | | //BBBB |
| | | var tempArr = result.split("--"); |
| | | var responseObj = JSON.parse(tempArr[0]); |
| | | var responseObjAll = JSON.parse(tempArr[1]); |
| | | //排序 |
| | | var newArrs = new Array; |
| | | responseObjAll.forEach(item => { |
| | | newArrs.push(item); |
| | | }) |
| | | newArrs.sort((a, b) => { |
| | | return a.OrderNo__c - b.OrderNo__c; |
| | | }) |
| | | newArrs.forEach(item => { //排序后的一般产品主数据 |
| | | var SeachData = { |
| | | SearchId: item.Id |
| | | }; |
| | | GetSearchProductById(SeachData).then(results => { |
| | | var newarrjdf = GetSearchProductByIdLogic(item,results,this.jzDataDefaultCopyQuantityList,this.jzDataFixedPrice); |
| | | this.jzDataFixedPrice = [].concat(newarrjdf); |
| | | var iflag = iflagExp; |
| | | this.jzDataDefaultCopyQuantityList = jzDataDefaultCopyQuantityListExp; |
| | | if (event.fag && iflag) { |
| | | var newArr = []; |
| | | newArr.push(item); |
| | | this.ifqianpi = false; |
| | | this.GetSearchProductByIdFn(item.Id, item, "价格政策", [], newArr, false); |
| | | } |
| | | }); |
| | | }); |
| | | var respons = []; |
| | | responseObj.records.forEach(rrds => { //查出的前十条 |
| | | responseObjAll.forEach(rsja => { //查出的所有一般产品数据 |
| | | if (rrds.Id == rsja.Id) { |
| | | respons.push(rsja); |
| | | } |
| | | }) |
| | | }) |
| | | this.jzDataFix = [].concat(respons); |
| | | this.tableIsLodingFix = false; |
| | | }) |
| | | } |
| | | SelectedFnFix(event) { |
| | | let arr = event.detail.rows; |
| | | this.ifqianpi = true; |
| | | if (arr.length > 1) { |
| | | this.Alert("价格政策只可选择一个方案",'error'); |
| | | } else { |
| | | //获取数据 |
| | | this.GetSearchProductByIdFn(arr[0].Id, arr[0], "价格政策", [], arr); |
| | | } |
| | | this.cancelFix(); |
| | | } |
| | | //价格政策匹配 |
| | | GetSearchProductByIdFn(idStr, jzDataProductParam, TypeName, jzDataDefaultToTemps, arrData, isShow = true) { |
| | | //dddd |
| | | var SeachData = { |
| | | SearchId: idStr |
| | | }; |
| | | GetSearchProductById(SeachData).then(result => { |
| | | var tempObject = { |
| | | ...{}, |
| | | ...jzDataProductParam |
| | | } |
| | | jzDataProductParam = this.countListAndNod(tempObject, result); |
| | | arrData = [].concat(jzDataProductParam); |
| | | //返回数据比较规则 |
| | | this.CompareData(result, idStr, jzDataProductParam, TypeName, jzDataDefaultToTemps, arrData, isShow); |
| | | }) |
| | | } |
| | | //计算listPrice的和以及nod和 |
| | | countListAndNod(item, result) { |
| | | var ifTrade = this.QuoteData[0].Opportunity.Trade__c; //内外贸信息 |
| | | var copydate=this.jzDataDefaultCopy; |
| | | var DeftCopyQtyList = this.jzDataDefaultCopyQuantityList; |
| | | //计算list和nod合计逻辑 |
| | | item=countListAndNodLogic(ifTrade,copydate,item,result,DeftCopyQtyList); |
| | | this.jzDataDefaultCopyQuantityList=DeftCopyQtyLists; |
| | | var arr = { |
| | | ...{}, |
| | | ...item |
| | | }; |
| | | return arr; |
| | | } |
| | | //匹配价格政策时数据比较规则 |
| | | CompareData(list, idStr, jzDataProductParam, TypeName, jzDataDefaultToTemps, arrData, isShow) { |
| | | var TempsJzDataToCompare = CompareDataL(list,this.jzDataDefault); |
| | | var isChange = isChangeExp; |
| | | //End |
| | | if (TempsJzDataToCompare.length == list.length&&list.length!=0) { |
| | | TempsJzDataToCompare.forEach(TempsItems => { |
| | | this.ComparePushData(TempsItems.item.Quantity, TempsItems.element.Quantity__c, TempsItems.element.Asset_Model_No__c, idStr, jzDataProductParam, TypeName); |
| | | }); |
| | | //判断是否显示 提示框 |
| | | if (isShow) { |
| | | if (this.ifqianpi) { |
| | | this.Alert("促销方案选择完成", 'success'); |
| | | } |
| | | } |
| | | } else { |
| | | if (isShow) { |
| | | if (this.ifqianpi) { |
| | | this.Alert("促销方案不满足,请重新选择",'error'); |
| | | } |
| | | } |
| | | return; |
| | | } |
| | | if (isChange) { |
| | | this.ChangeNumZeroTrueChanges(); |
| | | } |
| | | var temps = this.CompareFullData; |
| | | //添加 |
| | | this.UpdateJZData(arrData); |
| | | //更新次数 |
| | | this.updatesNums(); |
| | | //合并重复价格政策方案 |
| | | var jzarr = [].concat(this.jzDataFixedPrice);; |
| | | this.MergeDuplicateSchemes(jzarr); |
| | | //保存最大次数 |
| | | this.savecount(idStr); |
| | | //计算价格 |
| | | this.ComputeData(idStr, '价格政策'); |
| | | } |
| | | ComparePushData(length, Quantity, Asset_Model_No__c, Id, jzDataProductParam, TypeName) { |
| | | //修改 产品明细 |
| | | let num = parseInt(length / Quantity); |
| | | var newDataDefault = ComparePushDataLogic(this.jzDataDefault,this.jzDataProduct,Asset_Model_No__c,Id,TypeName,jzDataProductParam,Quantity,num); |
| | | this.jzDataProduct = jzDataProductExp; |
| | | this.ContractPriceCompute(); |
| | | this.jzDataDefault = newDataDefault; |
| | | this.ChangeNumZeroTrue(); |
| | | this.AddNums(TypeName, Asset_Model_No__c, num, Id); |
| | | } |
| | | ChangeNumZeroTrueChanges() { |
| | | if (this.jzDataDefault.length != this.ChangeNumZeroTrueData) { |
| | | this.jzDataDefault = this.ChangeNumZeroTrueData; |
| | | } |
| | | } |
| | | UpdateJZData(arrs) { //arrs 选中的数据集合 |
| | | if (this.jzDataFixedPrice == null || this.jzDataFixedPrice.length <= 0) { |
| | | this.jzDataFixedPrice = arrs; |
| | | } else { |
| | | this.jzDataFixedPrice = this.jzDataFixedPrice.concat(arrs); |
| | | }; |
| | | } |
| | | // =======更新促销方案次数数据 |
| | | updatesNums() { |
| | | var jzDataFixedPriceTemp = [].concat(this.jzDataFixedPrice); |
| | | var jzDataDiscountTemp = [].concat(this.jzDataDiscount); |
| | | var CompareFullData = this.CompareFullData; |
| | | updatesNumsLogic(jzDataFixedPriceTemp,jzDataDiscountTemp,CompareFullData); |
| | | this.jzDataFixedPrice = jzDataFixedPriceTemps; |
| | | this.jzDataDiscount = jzDataDiscountTemps; |
| | | } |
| | | //合并重复价格政策方案 |
| | | MergeDuplicateSchemes(SchemeSet) { |
| | | var arr = []; |
| | | arr = MergeDuplicateSchemesLogic(this.CompareFullData,SchemeSet); |
| | | this.CompareFullData = CompareFullDataExp; |
| | | this.jzDataFixedPrice = [].concat(arr); |
| | | this.ConsolidationProgramProducts(arr); |
| | | } |
| | | //计算价格政策价格 |
| | | ComputeData(id, category) { //id 选中的数据ID category 方案类型 |
| | | //调用替换listprice单价 |
| | | this.ReplacementUnitPrice(); |
| | | //数据 |
| | | this.updateIdStr("3"); |
| | | var arrTemp = this.jzDataFixedPrice; // id 价格政策 |
| | | this.updateIdStr("1"); |
| | | var arrProductTemp = this.jzDataProduct; // PromotionId 产品明细 |
| | | var arrTemp2 = this.jzDataDefault; //待选产品 |
| | | if (category == '价格政策') { |
| | | arrTemp.forEach(item => { // item价格政策 |
| | | if (id == item.Id) { |
| | | item.Total = item.Counts * item.Price_CNY__c; |
| | | item.sumNoDiscountTotal = item.sumNoDiscount * item.Counts; |
| | | //计算促销总价&& item.HeTongTotal == undefined |
| | | if (item.Price_CNY__c != undefined) { |
| | | if (item.determine != '改过') { |
| | | if (item.if_Contain_Nod__c) { |
| | | item.HeTongTotal = item.Total; |
| | | } else { |
| | | item.HeTongTotal = item.Total + item.sumNoDiscountTotal; |
| | | } |
| | | } |
| | | } |
| | | //计算选择促销政策的经销商单价和小计 |
| | | var PromotionHeadRecordId = item.recordTypeName__c; |
| | | if (PromotionHeadRecordId == "Promotion") { //促销方案 |
| | | arrProductTemp = ComputeDataPromotionLogic(this.newArrsTemp3,this.newArrsTemp4,this.jzDataDefaultCopyQuantityList,this.jzDataDefaultCopy,this.QuoteData,arrProductTemp,item,arrTemp2,this.jzDataDefault); |
| | | this.newArrsTemp3 = newArrsTemp3Exp; |
| | | this.newArrsTemp4 = newArrsTemp4Exp; |
| | | this.jzDataDefault = jzDataDefaultExp; |
| | | this.jzDataDefaultCopy = jzDataDefaultCopyExp; |
| | | this.jzDataProduct = arrProductTemp; |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | } else if (PromotionHeadRecordId == "NormalProduct") { //一般产品 |
| | | //todu3 |
| | | arrProductTemp = ComputeDataNormalProductLogic(this.newArrsTemp3,this.newArrsTemp4,this.jzDataDefaultCopyQuantityList,this.jzDataDefaultCopy,this.QuoteData,arrProductTemp,item,arrTemp2,this.jzDataDefault); |
| | | this.newArrsTemp3 = newArrsTemp3Exp; |
| | | this.newArrsTemp4 = newArrsTemp4Exp; |
| | | this.jzDataDefault = jzDataDefaultExp; |
| | | this.jzDataDefaultCopy = jzDataDefaultCopyExp; |
| | | this.jzDataProduct = arrProductTemp; |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | } |
| | | } |
| | | }); |
| | | this.jzDataFixedPrice = [].concat(arrTemp); |
| | | } |
| | | } |
| | | ReplacementUnitPrice() { |
| | | var ifTrade = this.QuoteData[0].Opportunity.Trade__c; //内外贸 |
| | | var arr = [].concat(this.jzDataProduct);//20230214 |
| | | this.jzDataProduct = [].concat(ReplacementUnitPriceLogic(arr, ifTrade));//20230214 |
| | | this.ContractPriceCompute(); |
| | | } |
| | | //保存最大次数 |
| | | savecount(idStr) { //idStr 选中的数据ID |
| | | this.jzDataFixedPrice = savecountLogic(this.jzDataFixedPrice,idStr); |
| | | } |
| | | ChangeNumZeroTrueData = [] |
| | | ChangeNumZeroTrue() { |
| | | this.ChangeNumZeroTrueData = [].concat(this.jzDataDefault); |
| | | var newJzDataDefault = this.ChangeNumZeroTrueData.filter(item => { |
| | | if (item.Quantity > 0) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | }) |
| | | this.ChangeNumZeroTrueData = newJzDataDefault; |
| | | } |
| | | //用于填充次数 |
| | | CompareFullData = [] |
| | | AddNums(ListName, Asset_Model_No__c, addNums, Id) { |
| | | this.CompareFullData = AddNumsLogic(ListName, Asset_Model_No__c, addNums, Id,this.CompareFullData); |
| | | } |
| | | //归并相同价格政策方案的产品 |
| | | ConsolidationProgramProducts(arrSchemes) { |
| | | var jzdataList = [].concat(this.jzDataProduct); |
| | | this.jzDataProduct = PriceConsolidation(arrSchemes, jzdataList); |
| | | } |
| | | //促销方案列表数据 |
| | | @track jzData = []; |
| | | //促销方案列表加载动图标识 |
| | | @track tableIsLoding = true; |
| | | // 促销方案列表列配置 |
| | | @track |
| | | initDataTable =initDataTable2; |
| | | jzdateflag=true; |
| | | IsLoading6 = false; |
| | | //促销方案列表编辑列保存 |
| | | savejzData(event){ |
| | | var data = event.detail.rows; |
| | | for (var i = 0; i < this.jzData.length; i++) { |
| | | for (var j = 0; j < data.length; j++) { |
| | | var id = data[j].Id.replace("row-", ""); |
| | | if (this.jzData[i].Id == id) { |
| | | this.jzData[i].Quantity__c=data[j].Quantity__c; |
| | | } |
| | | } |
| | | } |
| | | this.jzdateflag = false; |
| | | this.IsLoading6 = true; |
| | | setTimeout(() => { |
| | | this.jzdateflag = true; |
| | | 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 = "操作成功"; //提示框的文本 |
| | | TongzhiIcon = 'standard:account' //提示框的图标 |
| | | IsLeftStyle = "" //提示框的样式 |
| | | BgColorStyle = "" |
| | | //弹框提示 content 内容 error 是否是错误提示框 left 是否居左 |
| | | Alert(msg,type) { |
| | | if(type == 'success'){ |
| | | const event = new ShowToastEvent({ |
| | | message: msg, |
| | | variant: type, |
| | | }); |
| | | this.dispatchEvent(event); |
| | | }else{ |
| | | const event = new ShowToastEvent({ |
| | | message: msg, |
| | | variant: type, |
| | | mode: 'sticky' |
| | | }); |
| | | 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 = []; |
| | | //计算一般折扣非对象品折扣 |
| | | ComouteProductDiscount(Id,Category__c,GuaranteeDiscount__c_Input, NormalDiscount__c_Input,GuaranteeDiscount_H_Money__c, NormalDiscount_H_Money__c, item) { |
| | | //todu12 |
| | | this.updateIdStr("2"); |
| | | this.updateIdStr("1"); |
| | | var reslut=ReverseCalculationModifyDiscountLogic(this.jzDataDiscount,this.jzDataProduct,Id,Category__c,GuaranteeDiscount__c_Input, NormalDiscount__c_Input,GuaranteeDiscount_H_Money__c, NormalDiscount_H_Money__c, item); |
| | | this.jzDataDiscount=[].concat(arrTempsss); |
| | | this.jzDataProduct=[].concat(arrProductTempsss);//20230214 |
| | | return reslut; |
| | | } |
| | | //一般折扣更改过合同价格计算 |
| | | updateCommonlyDiscountLogic(Id,JxsType,GuaranteeDiscount__c_Input,NormalDiscount__c_Input,Category__c,jzDataDiscount) { |
| | | //todu13 |
| | | this.updateIdStr("1"); |
| | | this.jzDataProduct=updateCDLogic(Id,JxsType,GuaranteeDiscount__c_Input,NormalDiscount__c_Input,Category__c,jzDataDiscount,this.jzDataProduct); |
| | | this.GeneralDiscountContractSummary(); |
| | | } |
| | | //更改一般折扣合同价格计算合同总价 |
| | | GeneralDiscountContractSummary(){ |
| | | this.ContractPrice = 0; |
| | | var sum = this.ContractPrice; |
| | | sum = parseFloat(sum); |
| | | sum=GeneralDiscountContractSummaryLogic(sum,this.jzDataDiscount,this.jzDataFixedPrice); |
| | | this.ContractPrice = sum; |
| | | } |
| | | //折扣政策列表展示标识 |
| | | jzshows2 = true; |
| | | ///特约折扣待选方案列表选择数据 |
| | | @track SelectedFnDataSpecial = []; |
| | | //特约折扣模态框错误提示开关 |
| | | ShowSpecialIsError = false; |
| | | //特约折扣待选方案列表选中方法 |
| | | SelectedFnSpecial(event) { |
| | | let arr = event.detail.rows; |
| | | if (event.detail.rows.length > 1) { |
| | | this.ShowSpecialIsError = true; |
| | | } else { |
| | | this.ShowSpecialIsError = false; |
| | | } |
| | | var TempArr = []; |
| | | TempArr.push(arr[0]) |
| | | var tempObject = { |
| | | ...{}, |
| | | ...TempArr[0] |
| | | } |
| | | tempObject.CompareId = GetUUID(); |
| | | this.SelectedFnDataSpecial = [tempObject]; |
| | | } |
| | | //特约折扣待选方案列表加载方法 |
| | | getTableDataSpecial(event) { |
| | | let listQuery = event.detail.listQuery; |
| | | var Agency1__c = this.QuoteData[0].Agency1__c; |
| | | listQuery.pageLimit = 40; |
| | | listQuery.Agency1c = Agency1__c; |
| | | GetAuthorizerSearch(listQuery).then(result => { |
| | | var responseObj = JSON.parse(result); |
| | | this.jzDataSpecial = responseObj.records; |
| | | this.jzDataSpecial.forEach(element => { |
| | | element.JxsType = "特约折扣"; |
| | | element.NormalDiscount__c = element.NormalDiscount__c+"%"; |
| | | element.GuaranteeDiscount__c = element.GuaranteeDiscount__c+'%'; |
| | | }); |
| | | GetAgencyRName().then(gar => { |
| | | var a = JSON.parse(gar); |
| | | a.forEach(ga => { |
| | | if (ga.Agency__r != undefined) { |
| | | var arr = []; |
| | | this.jzDataSpecial.forEach(jzdsc => { |
| | | if (ga.Agency__c == jzdsc.Agency__c) { |
| | | jzdsc.Agency__Name = ga.Agency__r.Name; |
| | | arr.push(jzdsc); |
| | | } else { |
| | | arr.push(jzdsc); |
| | | } |
| | | }); |
| | | this.jzDataSpecial = [].concat(arr); |
| | | } |
| | | }); |
| | | }) |
| | | this.tableIsLodingSpecial = false; |
| | | }) |
| | | } |
| | | //特约折扣待选方案列表列配置 |
| | | @track |
| | | initDataTableSpecial = initDataTableSpecial2; |
| | | //特约折扣待选方案列表数据 |
| | | @track jzDataSpecial = []; |
| | | //特约折扣待选方案列表加载动图标识 |
| | | @track tableIsLodingSpecial = true; |
| | | //特约折扣待选产品列表选择数据 |
| | | @track SelectedOtherDataArr = []; |
| | | //特约折扣待选产品列表选中方法 |
| | | SelectedFnOtherData(event) { |
| | | let arr = event.detail.rows; |
| | | this.SelectedOtherDataArr = arr; |
| | | } |
| | | //特约折扣待选产品列表列配置 |
| | | @track |
| | | initDataTableOtherData = initDataTableOtherData2; |
| | | @track jzDataOtherData = []; |
| | | @track tableIsLodingOtherData = true; |
| | | //特约折扣模开关 |
| | | @track ShowSpecial; |
| | | //特约折扣待选产品列表加载方法 |
| | | getTableDataOtherData(event) { |
| | | if (!this.IsLoadingFlag1) { |
| | | return |
| | | }; |
| | | this.jzDataOtherData = this.jzDataDefault; |
| | | var jzDataOtherDataTemp = []; |
| | | this.jzDataOtherData.forEach(jzdod => { |
| | | var ItemsTemp = { |
| | | ...{}, |
| | | ...jzdod |
| | | }; |
| | | ItemsTemp.SplitQuantity = ItemsTemp.Quantity; |
| | | jzDataOtherDataTemp.push(ItemsTemp); |
| | | }) |
| | | this.jzDataOtherData = jzDataOtherDataTemp; |
| | | this.tableIsLodingOtherData = false; |
| | | } |
| | | //特约折扣待选产品列表外加载动图标识 |
| | | IsLoading5 = false; |
| | | //特约折扣待选产品展示标识 |
| | | jzshows5 = true; |
| | | // |
| | | IsLoadingFlag1 = true; |
| | | //特约折扣待选产品编辑列保存方法 |
| | | SaveSpecialDiscount(event) { |
| | | var data = event.detail.rows; |
| | | let newData = []; |
| | | let editnewDate = []; |
| | | var boolean = 1; |
| | | for (var i = 0; i < this.jzDataOtherData.length; i++) { |
| | | var editData = {}; |
| | | var flag = false; |
| | | for (var j = 0; j < data.length; j++) { |
| | | var id = data[j].Id; |
| | | if (this.jzDataOtherData[i].Id == id) { |
| | | editData = { |
| | | SplitQuantity: '' |
| | | }; |
| | | //拆分次数 |
| | | editData.SplitQuantity = data[j].SplitQuantity; |
| | | flag = true; |
| | | } |
| | | } |
| | | if (flag) { |
| | | var newItem = { |
| | | ...this.jzDataOtherData[i], |
| | | ...{} |
| | | }; |
| | | if (editData.SplitQuantity != undefined) { |
| | | newItem.SplitQuantity = Number(editData.SplitQuantity); |
| | | } |
| | | newData.push(newItem); |
| | | editnewDate.push(newItem); |
| | | } else { |
| | | newData.push({ |
| | | ...{}, |
| | | ...this.jzDataOtherData[i] |
| | | }); |
| | | } |
| | | } |
| | | var newArrs = [].concat(editnewDate); |
| | | newArrs.forEach(item => { |
| | | if (item.Quantity < item.SplitQuantity) { |
| | | boolean = 2; |
| | | } else if (item.SplitQuantity == 0 || item.SplitQuantity == '') { |
| | | boolean = 3; |
| | | } |
| | | }); |
| | | if (boolean == 1) { |
| | | this.jzDataOtherData = newData; |
| | | this.ShowSpecialIsError = false; |
| | | } else if (boolean == 2) { |
| | | this.errorTiShi("修改错误,使用数量不得大于数量"); |
| | | } else if (boolean == 3) { |
| | | this.errorTiShi("修改错误,使用数量不得为0或为空"); |
| | | } |
| | | |
| | | this.jzshows5 = false; |
| | | this.IsLoading5 = true; |
| | | this.IsLoadingFlag1 = false; |
| | | setTimeout(() => { |
| | | this.SelectedOtherDataArr = []; |
| | | this.IsLoading5 = false; |
| | | this.jzshows5 = true; |
| | | }, 1000); |
| | | setTimeout(() => { |
| | | this.IsLoadingFlag1 = true; |
| | | }, 2000); |
| | | } |
| | | //特约错误提示 |
| | | errorTiShi(str){ |
| | | this.ShowSpecialIsError = true; |
| | | this.ShowSpecial = true; |
| | | this.ShowSpecialError = str; |
| | | } |
| | | //特约折扣模态框取消按钮方法 |
| | | cancelSpecial() { |
| | | this.ShowSpecial = false |
| | | this.ShowSpecialIsError = false; |
| | | this.SelectedFnDataSpecial = []; |
| | | this.SelectedOtherDataArr = []; |
| | | } |
| | | //特约折扣模态框保存按钮方法 |
| | | SavesSpecial() { |
| | | this.ShowSpecialIsError = false; |
| | | this.ShowSpecial = false; |
| | | var ItempTempData = { |
| | | ...{}, |
| | | ...this.SelectedFnDataSpecial[0] |
| | | }; |
| | | if (this.SelectedOtherDataArr.length == 0 && this.SelectedFnDataSpecial.length != 0) { |
| | | this.errorTiShi("请选择特约折扣产品!"); |
| | | } else if (this.SelectedFnDataSpecial.length == 0 && this.SelectedOtherDataArr.length != 0) { |
| | | this.errorTiShi("请选择特约折扣方案!"); |
| | | } else if (this.SelectedFnDataSpecial.length == 0 && this.SelectedOtherDataArr.length == 0) { |
| | | this.errorTiShi("请选择特约折扣方案和产品!"); |
| | | } else { |
| | | ItempTempData.itemss = this.SelectedOtherDataArr; |
| | | ItempTempData.IsTempItems = true; |
| | | ItempTempData.NormalDiscount__c_Input = ItempTempData.NormalDiscount__c; |
| | | ItempTempData.GuaranteeDiscount__c_Input = ItempTempData.GuaranteeDiscount__c; |
| | | this.SelectedFnDataSpecial[0] = ItempTempData; |
| | | this.UpdateDiscountData(this.SelectedFnDataSpecial); |
| | | this.SpecialSavesChange("特约折扣", ItempTempData, this.SelectedFnDataSpecial[0].Id, this.SelectedFnDataSpecial[0].CompareId); |
| | | this.Alert("特约折扣选择完成", 'success'); |
| | | this.ConsolidatedDiscountPolicy(this.jzDataDiscount); |
| | | this.ComputeDiscount(ItempTempData.Id, ItempTempData.NormalDiscount__c, ItempTempData.GuaranteeDiscount__c, ItempTempData.Category__c, ItempTempData.JxsType); |
| | | this.SelectedFnDataSpecial = []; |
| | | this.SelectedOtherDataArr = []; |
| | | } |
| | | } |
| | | //计算折扣政策 |
| | | ComputeDiscount(id, NormalDiscount__c_Input, GuaranteeDiscount__c_Input, Category__c, JxsType) { |
| | | this.updateIdStr("1"); |
| | | var arrProductTemp = this.jzDataProduct; |
| | | this.updateIdStr("2"); |
| | | var arrTemp1 = this.jzDataDiscount; |
| | | arrTemp1.forEach(item => { |
| | | if (JxsType == '特约折扣') { |
| | | if (item.JxsType == '特约折扣') { |
| | | if (id == item.Id) { |
| | | if (item.iftrue != "改过" && |
| | | item.GuaranteeDiscount__c_Input == undefined && |
| | | item.NormalDiscount__c_Input == undefined) { |
| | | item.GuaranteeDiscount__c_Input = item.GuaranteeDiscount__c; |
| | | item.NormalDiscount__c_Input = item.NormalDiscount__c; |
| | | } |
| | | if (NormalDiscount__c_Input == item.NormalDiscount__c_Input && |
| | | GuaranteeDiscount__c_Input == item.GuaranteeDiscount__c_Input) { |
| | | arrProductTemp = ComputeDiscountAuthorizerLogic(this.newArrsTemp,this.newArrsTemp2,item,arrProductTemp); |
| | | this.newArrsTemp = newArrsTempExp; |
| | | this.newArrsTemp2 = newArrsTemp2Exp; |
| | | this.jzDataProduct = arrProductTemp; |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | } |
| | | } |
| | | } |
| | | } else if (JxsType == '一般折扣') { |
| | | if (item.JxsType == '一般折扣') { |
| | | if (NormalDiscount__c_Input == item.NormalDiscount__c_Input && |
| | | Category__c == item.Category__c) { |
| | | this.newArrsTemp = []; |
| | | this.newArrsTemp2 = []; |
| | | arrProductTemp.forEach(itemss => { |
| | | if (itemss.NormalDiscount__c_Input == item.NormalDiscount__c_Input && |
| | | itemss.Category__c == item.Category__c) { |
| | | itemss = commonlyDiscountLogic(itemss, item); //一般折扣计算逻辑 |
| | | this.newArrsTemp.push(itemss); |
| | | } else if (itemss.Category__c != item.Category__c || |
| | | itemss.NormalDiscount__c_Input != item.NormalDiscount__c_Input) { |
| | | this.newArrsTemp2.push(itemss); |
| | | } |
| | | }); |
| | | this.jzDataProduct = arrProductTemp; |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | this.jzDataDiscount = [].concat(arrTemp1); |
| | | } |
| | | //折扣政策匹配规则 |
| | | SpecialSavesChange(SaveName, SelectedData, IdStr, CompareId) { |
| | | var newDicountData = []; |
| | | newDicountData=SpecialSavesChangePartLogic(this.jzDataDefault,SaveName, SelectedData, IdStr, CompareId,0,newDicountData,this.jzDataDiscount); |
| | | this.jzDataDefault = NewDefaultDatass; |
| | | this.jzDataProduct =this.jzDataProduct.concat(AddProductDatass); |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | this.jzDataDiscount = newDicountData; |
| | | } |
| | | //合并折扣政策重复方案 |
| | | ConsolidatedDiscountPolicy(SchemeSet) { |
| | | var arr = []; |
| | | arr = ConsolidatedDiscountPolicyLogic(SchemeSet, arr); |
| | | this.jzDataDiscount = [].concat(arr); |
| | | this.ConsolidatedDiscountDetails(arr); |
| | | } |
| | | //合并折扣政策产品明细 |
| | | ConsolidatedDiscountDetails(arrSchemes) { |
| | | var jzdataList = [].concat(this.jzDataProduct); |
| | | this.jzDataProduct = ConsolidatedDiscountDetailsLogic(arrSchemes, jzdataList); |
| | | } |
| | | //==========特约折扣模态框 end============= |
| | | //=========一般折扣模态框 start=========== |
| | | //一般折扣模态框开关 |
| | | @track ShowCommonly; |
| | | //一般折扣待选产品列表外加载动图标识 |
| | | IsLoading4 = false; |
| | | //一般折扣待选产品展示标识 |
| | | jzshows4 = true; |
| | | // |
| | | IsLoadingFlag = true; |
| | | //一般折扣待选产品编辑列保存方法 |
| | | SaveGeneralDiscount(event) { |
| | | var data = event.detail.rows; |
| | | let newData = SaveGeneralDiscountLogic(data,this.jzDataCommonly); |
| | | var boolean = booleanExp; |
| | | if (boolean == 1) { |
| | | this.jzDataCommonly = newData; |
| | | this.ShowCommonlyIsError = false; |
| | | } else if (boolean == 2) { |
| | | this.ShowCommonlyIsError = true; |
| | | this.ShowCommonlyError = "修改错误,使用数量不得大于数量"; |
| | | } else if (boolean == 3) { |
| | | this.ShowCommonlyIsError = true; |
| | | this.ShowCommonlyError = "修改错误,使用数量不得为0或为空"; |
| | | } |
| | | this.jzshows4 = false; |
| | | this.IsLoading4 = true; |
| | | this.IsLoadingFlag = false; |
| | | setTimeout(() => { |
| | | this.SelectedFnCommonlyData = []; |
| | | this.IsLoading4 = false; |
| | | this.jzshows4 = true; |
| | | }, 1000); |
| | | setTimeout(() => { |
| | | this.IsLoadingFlag = true; |
| | | }, 2000); |
| | | } |
| | | //一般折扣模态框取消按钮方法 |
| | | cancelCommonly() { |
| | | this.ShowCommonly = false; |
| | | this.ShowCommonlyIsError = false; |
| | | this.SelectedFnCommonlyData = []; |
| | | this.SaveLb = ''; |
| | | this.SaveZk = ''; |
| | | } |
| | | //一般折扣待选产品列表列配置 |
| | | @track |
| | | initDataTableCommonly = initDataTableCommonly2; |
| | | //一般折扣待选产品列表数据 |
| | | @track jzDataCommonly = []; |
| | | //一般折扣待选产品列表加载动图标识 |
| | | @track tableIsLodingCommonly = true; |
| | | //一般折扣待选方案列表加载方法 |
| | | getTableDataCommonly(event) { |
| | | if (!this.IsLoadingFlag) { |
| | | return |
| | | }; |
| | | this.jzDataCommonly = this.jzDataDefault; |
| | | this.jzDataCommonly = getTableDataCommonlyLogic(this.jzDataCommonly); |
| | | this.tableIsLodingCommonly = false; |
| | | } |
| | | //一般折扣待选产品列表选择数据 |
| | | SelectedFnCommonlyData = []; |
| | | //一般折扣待选产品列表选中方法 |
| | | SelectedFnCommonly(event) { |
| | | let arr = event.detail.rows; |
| | | this.SelectedFnCommonlyData = SelectedFnCommonlyLogic(arr); |
| | | } |
| | | //产品系列数据 |
| | | SaveLb = ''; |
| | | //使用折扣数据 |
| | | SaveZk = ''; |
| | | //产品系列方法 |
| | | handleChangeLb(event) { |
| | | this.SaveLb = event.target.value; |
| | | } |
| | | //使用折扣方法 |
| | | handleChangeZk(event) { |
| | | if (event.target.value !== '') { |
| | | event.target.value = parseFloat(event.target.value) + "%"; |
| | | } |
| | | this.SaveZk = event.target.value; |
| | | } |
| | | //一般折扣模态框错误提示方法 |
| | | errorTiShiYi(str){ |
| | | this.ShowCommonlyIsError = true; |
| | | this.ShowCommonlyError = str; |
| | | } |
| | | //一般折扣模态框错误提示默认内容 |
| | | ShowCommonlyError = "请选择一般产品!"; |
| | | //一般折扣模态框错误提示开关 |
| | | ShowCommonlyIsError = false; |
| | | //一般折扣模态框取消按钮方法 |
| | | cancelSaveCommonly() { |
| | | //处理数据 |
| | | var arr = this.SelectedFnCommonlyData; |
| | | this.ShowCommonlyIsError = false; |
| | | if (this.SelectedFnCommonlyData.length != 0) { |
| | | var ItempTempData = {}; |
| | | ItempTempData.Id = GetUUID(); |
| | | ItempTempData.CompareId = GetUUID(); |
| | | ItempTempData.Name = '一般折扣'; |
| | | ItempTempData.JxsType = "一般折扣"; |
| | | ItempTempData.itemss = arr; |
| | | if (this.SaveLb == '' || this.SaveZk == '') { |
| | | if (this.SaveLb == '' && this.SaveZk != '') { |
| | | this.errorTiShiYi("请选择产品类别!"); |
| | | } else if (this.SaveZk == '' && this.SaveLb != '') { |
| | | this.errorTiShiYi("请输入使用折扣!"); |
| | | } else if (this.SaveZk == '' && this.SaveLb == '') { |
| | | this.errorTiShiYi("请输入使用折扣和产品类别!"); |
| | | } |
| | | } else { |
| | | ItempTempData.Category__c = this.SaveLb; |
| | | ItempTempData.NormalDiscount__c_Input = this.SaveZk; |
| | | ItempTempData.if_Contain_Nod__c = false; |
| | | var TempList = []; |
| | | TempList.push(ItempTempData); |
| | | this.UpdateDiscountData(TempList); |
| | | this.SpecialSavesChange("一般折扣", ItempTempData, ItempTempData.Id, ItempTempData.CompareId); |
| | | this.cancelCommonly(); |
| | | this.Alert("一般折扣选择完成", 'success'); |
| | | this.ConsolidatedDiscountPolicy(this.jzDataDiscount); |
| | | //计算折扣政策价格 |
| | | this.ComputeDiscount(ItempTempData.Id, ItempTempData.NormalDiscount__c_Input, ItempTempData.GuaranteeDiscount__c, ItempTempData.Category__c, ItempTempData.JxsType); |
| | | } |
| | | } else { |
| | | this.errorTiShiYi("请选择一般产品!"); |
| | | } |
| | | } |
| | | //将产品与方案匹配 |
| | | UpdateDiscountData(arrs) { |
| | | if (this.jzDataDiscount == null || this.jzDataDiscount.length <= 0) { |
| | | this.jzDataDiscount = arrs; |
| | | } else { |
| | | this.jzDataDiscount = this.jzDataDiscount.concat(arrs); |
| | | } |
| | | } |
| | | //=========一般折扣模态框 end========= |
| | | //*********折扣政策 end********* |
| | | |
| | | //************产品明细 start*********** |
| | | //产品明细删除方法 |
| | | delectTableProduct(){ |
| | | this.DeleteIsChangesFnSingle(this.SelectedFnProductData); |
| | | } |
| | | DeleteIsChangesFnSingle(list) { |
| | | let num = 0; |
| | | list.forEach(item => { |
| | | num++; |
| | | var falg = true; |
| | | if (item.TypeName == "价格政策") { |
| | | this.DeleteIsChangelogic(item, item.TypeName, num, list); |
| | | var TempItem = DeleteIsChangesFnjiage(this.jzDataFixedPrice,this.jzDataProduct,falg,item); |
| | | falg = falgExp; |
| | | if (TempItem && falg) { |
| | | this.SelectedFnDataFixedPrice.push(TempItem); |
| | | this.deleteFixedPriceTemp(); |
| | | } |
| | | } else if (item.TypeName == "折扣政策") { |
| | | this.DeleteIsChangelogic(item, item.TypeName, num, list); |
| | | var TempItemTOName = DeleteIsChangesFnzhekou(this.jzDataDiscount,this.jzDataProduct,falg,item); |
| | | falg = falgExp; |
| | | if (TempItemTOName != undefined && falg) { |
| | | this.SelectedFnDataDiscount.push(TempItemTOName); |
| | | this.delectTableDiscountTemp(); |
| | | } |
| | | } |
| | | this.ContractPriceCompute(); |
| | | }) |
| | | } |
| | | DeleteIsChangelogic(item, TypeName, num, list) { |
| | | var boofag = DeleteIsChangelogicExp(item,TypeName,this.jzDataProduct,this.jzDataDefault,this.jzDataDefaultCopy); |
| | | this.jzDataProduct = jzDataProductExp; |
| | | this.jzDataDefault = jzDataDefaultExp; |
| | | this.jzDataDefaultCopy = jzDataDefaultCopyExp; |
| | | if(boofag == 1){ |
| | | this.Alert("促销方案内产品型号,数量固定,不可删除明细",'error'); |
| | | }else if(boofag == 2){ |
| | | this.Alert("该产品为一般产品,不可删除明细",'error'); |
| | | } |
| | | //合同价格汇总 |
| | | this.ContractPriceCompute(); |
| | | } |
| | | delectTableDiscountTemp() { |
| | | this.jzDataDiscount = delectTableDiscountTempLogic(this.SelectedFnDataDiscount,this.jzDataDiscount); |
| | | this.SelectedFnDataDiscount = []; |
| | | } |
| | | //产品明细列表数据加载方法 |
| | | getTableDataProduct(event) { |
| | | this.tableIsLodingProduct = false; |
| | | } |
| | | //产品明细选中列表数据 |
| | | @track SelectedFnProductData = []; |
| | | //产品明细选中列表方法 |
| | | SelectedFnProduct(event) { |
| | | let arr = event.detail.rows; |
| | | this.SelectedFnProductData = arr; |
| | | } |
| | | //产品明细列表列配置 |
| | | @track |
| | | initDataTableProduct = initDataTableProduct2; |
| | | //产品明细列表数据 |
| | | @track jzDataProduct = []; |
| | | //产品明细列表加载动图标识 |
| | | @track tableIsLodingProduct = true; |
| | | //产品明细列表展示标识 |
| | | jzshows= true; |
| | | //*********产品明细 end********** |
| | | //打印客户名称 start |
| | | selection_hp = ''; |
| | | options_hp = []; |
| | | options_hpflg = true; |
| | | get PrintCustomerNameoptions() { |
| | | if (this.accountid) { |
| | | if(this.options_hpflg){ |
| | | selectAccountById({accountid : this.accountid}).then(accs =>{ |
| | | this.options_hp = PrintCustomerNameoptionsvlue(this.options_hp,this.selection_hp,this.quo,this.options_hpflg,accs); |
| | | this.selection_hp = selection_hpExp; |
| | | this.options_hpflg = options_hpflgExp; |
| | | }); |
| | | }else{ |
| | | return this.options_hp; |
| | | } |
| | | }else{ |
| | | return this.options_hp; |
| | | } |
| | | } |
| | | PrintCustomerNamehandleChange(event) { |
| | | this.selection_hp = event.detail.value; |
| | | } |
| | | // cjw start |
| | | a(){ |
| | | var jzDataToBeproduct1=this.jzDataToBeproduct; |
| | | var selectjzDataTableToBeproduct1 = this.selectjzDataTableToBeproduct; |
| | | var jzDataToBeproduct2=lineUp(jzDataToBeproduct1,selectjzDataTableToBeproduct1); |
| | | this.jzDataToBeproduct=[].concat(jzDataToBeproduct2); |
| | | } |
| | | b(){ |
| | | var jzDataToBeproduct1 = this.jzDataToBeproduct; |
| | | var selectjzDataTableToBeproduct1 = this.selectjzDataTableToBeproduct; |
| | | var jzDataToBeproduct2=lineDown(jzDataToBeproduct1,selectjzDataTableToBeproduct1); |
| | | this.jzDataToBeproduct=[].concat(jzDataToBeproduct2); |
| | | } |
| | | yyEvent(){ |
| | | if(!yingYanCheck(this.jzDataToBeproduct,yy) || (yingYanCheck(this.jzDataToBeproduct,yy) && confirm('鹰眼产品必须三个一起下单,包含型号EC01-01,EC00-01,EP01'))){ |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | // cjw end |
| | | } |