123
chenjingwu
2024-04-11 5f43dac2f19ed47ea4cd211a4c6c7f94e8dc0c25
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;
@@ -1779,7 +1796,7 @@
                console.log(reslut);
                console.log(this.jzDataToBeproduct);
                this.jzDataToBeproduct.forEach(item=>{
                    idList.push(item.pageObject.PricebookEntry.Product2Id);
                    idList.push(item.pageObject.Id__c);
                });
                addOptions({idList: idList}).then(result=>{
                    this.addOptionsLogic(result);
@@ -1830,14 +1847,18 @@
                    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.PricebookEntry.Product2Id);
                        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;
@@ -1888,7 +1909,7 @@
            var idList = [];
            // cjw
            this.jzDataToBeproduct.forEach(item=>{
                idList.push(item.pageObject.PricebookEntry.Product2Id);
                idList.push(item.pageObject.Id__c);
            });
            addOptions({idList: idList}).then(result=>{
                this.addOptionsLogic(result);
@@ -1913,11 +1934,37 @@
        key.forEach(item=>{
            Setmap.set(item,result[item]);
        });
        var optionMap = new Map();
        var map1 = Setmap.get('optionMap');
        var key1 = Object.keys(map1)
        key1.forEach(item=>{
            optionMap.set(item,map1[item]);
        });
        var priceMap = new Map();
        var map2 = Setmap.get('priceMap');
        var key2 = Object.keys(map2)
        key2.forEach(item=>{
            priceMap.set(item,map2[item]);
        });
        console.log('loh');
        console.log(this.jzDataToBeproduct);
        this.jzDataToBeproduct.forEach(item=>{
            if(result){
                item.Learning_CommunityOptions = Setmap.get(item.pageObject.PricebookEntry.Product2Id);
                item.Learning_CommunityOptions = optionMap.get(item.pageObject.Id__c);
                item.multiYearWarrantyList = priceMap.get(item.pageObject.Id__c);
                if(item.Learning_Community){
                    item.multiYearWarrantyList.forEach(it=>{
                        if('' + (it.AgeLimit__c) == item.Learning_Community){
                            item.exPrice = it.MultiOneYearWarrantyPrice__c;
                        }
                    });
                    if(item.exPrice == null || item.exPrice == '' || item.exPrice == undefined){
                        item.exPrice = 0;
                    }
                }
            }
        });
        console.log(this.jzDataToBeproduct);
    }
    // cjw
    //新增报价产品模态框取消按钮