From 5f43dac2f19ed47ea4cd211a4c6c7f94e8dc0c25 Mon Sep 17 00:00:00 2001
From: chenjingwu <chenjingwu@prec-tech.com>
Date: 星期四, 11 四月 2024 18:49:56 +0800
Subject: [PATCH] 123
---
force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js | 230 ++++++++++++++++++++-------------------------------------
1 files changed, 80 insertions(+), 150 deletions(-)
diff --git a/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js b/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js
index bb4d685..e5718dc 100644
--- a/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js
+++ b/force-app/main/default/lwc/lexNewQuoteEntry/lexNewQuoteEntry.js
@@ -580,6 +580,7 @@
this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
this.hidden_MultiYearWarrantyTotalPrice = MultiYearWarrantyTotalPriceExport;
this.quo.MultiYearWarrantyTotalPrice__c = toNumComma(MultiYearWarrantyTotalPriceExport);
+ this.quo.ExtendedWarrantyAmountTotalPrice__c = toNumComma(ExtendedWarrantyAmountTotalPriceExport);
}
EstimationListPrice() {
this.jzDataToBeproduct = EstimationL(this.jzDataToBeproduct,this.quo);
@@ -1462,7 +1463,9 @@
var IsQuoteTrial=this.quo.IsQuoteTrial__c;
if(!IsQuoteTrial){
var mp=this.quo.MultiYearWarrantyTotalPrice__c;
+ var ex =this.ExtendedWarrantyAmountTotalPrice__c;
mp=localParseFloat(mp);
+ ex=localParseFloat(ex);
var num=this.quo.Quote_Adjust_Calculate__c;
num=localParseFloat(num);
this.quo.Quote_Adjust_Calculate__c=toNumComma(num);
@@ -1471,7 +1474,7 @@
var rh=this.oppInfo.rate_hospital;
var ra=this.oppInfo.rate_agency1;
this.quo.Dealer_Final_Price_Page__c=toNumComma(z*rh);
- this.quo.OCM_Agent1_Price_Page__c=this.Saleslet ? toNumComma(z*num*ra+mp) : '';
+ this.quo.OCM_Agent1_Price_Page__c=this.Saleslet ? toNumComma(z*num*ra+mp+ex) : '';
this.setOCMAmount();
this.calFromContactPrice();
}
@@ -1666,6 +1669,9 @@
this.AgencyDiscountCalculation1();
}
this.updateNoDiscountPricetotal();
+ // chenjingwu
+ this.updateExPricetotal()
+ // chenjingwu
this.EstimationListPrice();
this.calUnitPriceTotal();
this.quoteTotalPrice();
@@ -1689,6 +1695,17 @@
this.jzDataToBeproduct =[].concat(this.jzDataToBeproduct);
this.hidden_MultiYearWarrantyTotalPrice=noDiscountPriceTotal;
this.quo.MultiYearWarrantyTotalPrice__c=toNumComma(noDiscountPriceTotal);
+ }
+ updateExPricetotal() {
+ var ExPricetotal=0;
+ this.jzDataToBeproduct.forEach(jzdtbt=>{
+ var exPrice=jzdtbt.exPrice;
+ exPrice=localParseFloat(exPrice);
+ var Quantity=jzdtbt.Quantity__c;
+ Quantity=localParseFloat(Quantity);
+ ExPricetotal=ExPricetotal + exPrice * Quantity;
+ });
+ this.quo.ExtendedWarrantyAmountTotalPrice__c=toNumComma(ExPricetotal);
}
handleRowAction(event){
const actionName=event.detail.row;
@@ -1767,13 +1784,23 @@
}
}else{
this.OnLoading(true);
- setProductEntry(dataChunanshen).then(reslut=>{
- debugger
+ setProductEntry(dataChunanshen).then(reslut=>{
var tempArr=reslut.split("---");
var errormessage=tempArr[0];
var quoteLineItem=JSON.parse(tempArr[1]);
quoteLineItem=InitializeProductAssignment(quoteLineItem);
this.jzDataToBeproduct=quoteLineItem;
+ // cjw
+ var idList = [];
+ console.log('123');
+ console.log(reslut);
+ console.log(this.jzDataToBeproduct);
+ this.jzDataToBeproduct.forEach(item=>{
+ idList.push(item.pageObject.Id__c);
+ });
+ addOptions({idList: idList}).then(result=>{
+ this.addOptionsLogic(result);
+ });
if(quoteLineItem.length!=num){
this.quo.IsQuoteTrial__c=false;
}
@@ -1820,7 +1847,19 @@
var errormessage = tempArr[0];
var quoteLineItem = JSON.parse(tempArr[1]);
quoteLineItem = InitializeProductAssignment(quoteLineItem);
+ this.tobeflag=false;
this.jzDataToBeproduct = quoteLineItem;
+ // cjw
+ console.log('xxx');
+ console.log(this.jzDataToBeproduct);
+ var idList = [];
+ this.jzDataToBeproduct.forEach(item=>{
+ idList.push(item.pageObject.Id__c);
+ });
+ addOptions({idList: idList}).then(result=>{
+ this.addOptionsLogic(result);
+ this.tobeflag=true;
+ });
if(quoteLineItem.length!=num){
this.quo.IsQuoteTrial__c = false;
}
@@ -1868,11 +1907,11 @@
var Listvalue = this.jzDataToBeproduct;
this.jzDataToBeproduct = additionaljzProductLogic(selectvlue,Listvalue,this.oppInfo.CurrencyIsoCode,this.quo.IsQuoteTrial__c);
var idList = [];
+ // cjw
this.jzDataToBeproduct.forEach(item=>{
- idList.push(item.pageObject.PricebookEntry.Product2Id);
+ idList.push(item.pageObject.Id__c);
});
addOptions({idList: idList}).then(result=>{
- console.log('result');
this.addOptionsLogic(result);
if(alertExp){
this.Alert(alertExp,'error');
@@ -1885,17 +1924,49 @@
this.cancelProduct();
this.SelectedNewProduct = [];
});
-
+ // cjw
}
}
+ // cjw
addOptionsLogic(result){
- console.log(result);
+ var Setmap = new Map()
+ var key = Object.keys(result)
+ key.forEach(item=>{
+ Setmap.set(item,result[item]);
+ });
+ var optionMap = new Map();
+ var map1 = Setmap.get('optionMap');
+ var key1 = Object.keys(map1)
+ key1.forEach(item=>{
+ optionMap.set(item,map1[item]);
+ });
+ var priceMap = new Map();
+ var map2 = Setmap.get('priceMap');
+ var key2 = Object.keys(map2)
+ key2.forEach(item=>{
+ priceMap.set(item,map2[item]);
+ });
+ console.log('loh');
+ console.log(this.jzDataToBeproduct);
this.jzDataToBeproduct.forEach(item=>{
- if(result.get(item.pageObject.PricebookEntry.Product2Id)){
- item.Learning_CommunityOptions = result.get(item.pageObject.PricebookEntry.Product2Id);
+ if(result){
+ item.Learning_CommunityOptions = optionMap.get(item.pageObject.Id__c);
+ item.multiYearWarrantyList = priceMap.get(item.pageObject.Id__c);
+ if(item.Learning_Community){
+ item.multiYearWarrantyList.forEach(it=>{
+ if('' + (it.AgeLimit__c) == item.Learning_Community){
+ item.exPrice = it.MultiOneYearWarrantyPrice__c;
+ }
+ });
+ if(item.exPrice == null || item.exPrice == '' || item.exPrice == undefined){
+ item.exPrice = 0;
+ }
+ }
}
});
+ console.log(this.jzDataToBeproduct);
}
+ // cjw
//鏂板鎶ヤ环浜у搧妯℃�佹鍙栨秷鎸夐挳
cancelProduct() {
this.showproductfalg = false;
@@ -2557,66 +2628,6 @@
this.IsLoading6 = false;
}, 1000);
}
- //=========淇冮攢鏂规妯℃�佹 end============
- //***************浠锋牸鏀跨瓥 end**************
-
- //********鎶樻墸鏀跨瓥 start***********
- //閫夋嫨鐗圭害鎶樻墸鎵撳紑鎸夐挳
- showModalSpecial(){
- this.QuoteData.forEach(qtd => {
- if (!qtd.Opportunity.IsAuthorized__c) {
- this.Alert("璇ヨ浠蜂笉鏄壒绾︾粡閿�鍟嗘巿鏉�",'error');
- } else {
- this.ShowSpecial = true;
- }
- });
- }
- //閫夋嫨涓�鑸姌鎵f墦寮�鎸夐挳
- 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 = "鎿嶄綔鎴愬姛"; //鎻愮ず妗嗙殑鏂囨湰
@@ -2639,87 +2650,6 @@
});
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("淇敼閿欒锛岄潪瀵硅薄鍝佹姌鎵d笉寰楀皬浜庨潪瀵硅薄鍝佹渶浣庢姌鎵�:"+NormalDiscount__cZuiXiao+"%",'error');
- } else if (boolean == 3) {
- this.Alert("淇敼閿欒锛屼竴鑸姌鎵f病鏈夊璞″搧鎶樻墸",'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);
- //涓�鑸姌鎵f洿鏀硅繃鍚堝悓浠锋牸璁$畻
- 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);
- //涓�鑸姌鎵f洿鏀硅繃鍚堝悓浠锋牸璁$畻
- 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 = [];
--
Gitblit v1.9.1