CSR-1629
CJ pixel tag event and batch event filter
This commit is contained in:
parent
933434adff
commit
e7a3008b3a
1 changed files with 47 additions and 40 deletions
|
|
@ -542,7 +542,7 @@ export default {
|
|||
let accountType = "";
|
||||
let amount = 0;
|
||||
let cjEvent = "";
|
||||
if (store.getters.applicationUser.affiliateCookies) {
|
||||
if (store.getters.applicationUser.affiliateCookies?.length > 0) {
|
||||
const affiliateCookies = store.getters.applicationUser.affiliateCookies;
|
||||
var cookieArray = [];
|
||||
affiliateCookies.forEach((item) => {
|
||||
|
|
@ -554,48 +554,55 @@ export default {
|
|||
new Date(b.timestamp.replace("/", "T")) -
|
||||
new Date(a.timestamp.replace("/", "T"))
|
||||
);
|
||||
cjEvent = sortedCookies?.[0]?.tagEvent;
|
||||
const hasSubmittedOrder = baseMixin.methods.hasSubmittedOrder();
|
||||
const submittedOrder = baseMixin.methods.getSubmittedOrder();
|
||||
const filteredCookie = sortedCookies?.find(
|
||||
(x) => x.tagEvent?.length > 0 && x.batchEvent?.length > 0
|
||||
);
|
||||
if (filteredCookie?.length > 0) {
|
||||
cjEvent = filteredCookie.tagEvent;
|
||||
const hasSubmittedOrder = baseMixin.methods.hasSubmittedOrder();
|
||||
const submittedOrder = baseMixin.methods.getSubmittedOrder();
|
||||
|
||||
if (hasSubmittedOrder) {
|
||||
repairReplace = submittedOrder.damage.isRepair ? "Repair" : "Replace";
|
||||
const promos = submittedOrder.lineItems.promos ?? [];
|
||||
if (promos.length === 0) {
|
||||
coupons = "";
|
||||
} else {
|
||||
const promoCodes = promos.map((promo) => promo.promoCode);
|
||||
const promoString = promoCodes.reduce((prev, next) => `${prev}_${next}`);
|
||||
coupons = promoString;
|
||||
}
|
||||
refSequenceNum = submittedOrder.referralSequenceNumber;
|
||||
if (hasSubmittedOrder) {
|
||||
repairReplace = submittedOrder.damage.isRepair ? "Repair" : "Replace";
|
||||
const promos = submittedOrder.lineItems.promos ?? [];
|
||||
if (promos.length === 0) {
|
||||
coupons = "";
|
||||
} else {
|
||||
const promoCodes = promos.map((promo) => promo.promoCode);
|
||||
const promoString = promoCodes.reduce(
|
||||
(prev, next) => `${prev}_${next}`
|
||||
);
|
||||
coupons = promoString;
|
||||
}
|
||||
refSequenceNum = submittedOrder.referralSequenceNumber;
|
||||
|
||||
if (isDefined(submittedOrder.payment.isInsurance)) {
|
||||
accountType = submittedOrder.payment.isInsurance ? "insurance" : "cash";
|
||||
} else {
|
||||
accountType = "";
|
||||
}
|
||||
const lineItems = submittedOrder.lineItems ?? {};
|
||||
const combinedLineItems = [
|
||||
...(lineItems.glassParts ?? []),
|
||||
...(lineItems.supportingItems ?? []),
|
||||
...(lineItems.vaps ?? []),
|
||||
...(lineItems.promos ?? []),
|
||||
];
|
||||
if (isDefined(submittedOrder.payment.isInsurance)) {
|
||||
accountType = submittedOrder.payment.isInsurance ? "insurance" : "cash";
|
||||
} else {
|
||||
accountType = "";
|
||||
}
|
||||
const lineItems = submittedOrder.lineItems ?? {};
|
||||
const combinedLineItems = [
|
||||
...(lineItems.glassParts ?? []),
|
||||
...(lineItems.supportingItems ?? []),
|
||||
...(lineItems.vaps ?? []),
|
||||
...(lineItems.promos ?? []),
|
||||
];
|
||||
|
||||
const isPricingAvailable =
|
||||
combinedLineItems.length > 0 &&
|
||||
combinedLineItems.every(
|
||||
(lineItem) =>
|
||||
isDefined(lineItem.kitPrice) &&
|
||||
isDefined(lineItem.laborAmount) &&
|
||||
isDefined(lineItem.sellingPrice)
|
||||
);
|
||||
if (accountType == "cash" && isPricingAvailable) {
|
||||
const quoteAmountWithDiscount = baseMixin.methods
|
||||
.getTotalPriceOfAllLineItemsAndChildParts(combinedLineItems, false)
|
||||
.toFixed(2);
|
||||
amount = parseFloat(quoteAmountWithDiscount);
|
||||
const isPricingAvailable =
|
||||
combinedLineItems.length > 0 &&
|
||||
combinedLineItems.every(
|
||||
(lineItem) =>
|
||||
isDefined(lineItem.kitPrice) &&
|
||||
isDefined(lineItem.laborAmount) &&
|
||||
isDefined(lineItem.sellingPrice)
|
||||
);
|
||||
if (accountType == "cash" && isPricingAvailable) {
|
||||
const quoteAmountWithDiscount = baseMixin.methods
|
||||
.getTotalPriceOfAllLineItemsAndChildParts(combinedLineItems, false)
|
||||
.toFixed(2);
|
||||
amount = parseFloat(quoteAmountWithDiscount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue