- ${item}
1/8
${data.index + 1}/${data.total}
Description
You may also like
${data.index + 1}/${data.total}
Recently Viewed
Products list
${(function () {
return automatic_discount_list.map((item) => {
// 樔ēē±»å
const template_type = item.discount[0].template_type;
// ęÆå¦ę¾ē¤ŗčŖåØęę£
const is_show_automatic_discount = item.discount[0].product_enabled;
// ęÆå¦č·³č½¬č½å°é”µ
const is_redirection = item.discount[0].is_redirection;
// ęę£å¾ę
const discount_icon = item.discount_icon;
// 第äøäøŖčŖåØęę£
const first_automatic_discount = item.discount[0];
// ę¾ē¤ŗęå å±ē¤ŗ
const isFold = (item.discount[0].display_type || DISPLAY_TYPE.DTE_FOLD) === DISPLAY_TYPE.DTE_FOLD;
// ęę¬ę°ē»
const text_arr = item.discount[0].config.texts;
// č½å°é”µé¾ę„
const first_landing_url = `/promotions/discount-default/${first_automatic_discount.discount_id}`;
// čŖåØęę£ę»ę°
const automatic_discount_total = item.discount.length;
// ęÆå¦ę¾ē¤ŗęę£å¾ę
const isHasDiscountIcon = discount_icon ? true : false;
// ęÆå¦ę¾ē¤ŗęę£å¾ę äøęØ”ēē±»åäøäøŗtag
const isHasDiscountIconWithNoTag = (template_type != 'tag' && isHasDiscountIcon)? true : false;
// ęę¬é¢č²
let text_color = DEFAULT_CONFIG.TEXT_COLOR;
// čęÆé¢č²
const bgFn = (curBg) => template_type === "text" ? "transparent" : curBg;
let bg_color = bgFn(DEFAULT_CONFIG.BG);
// č¾¹ę”é¢č²
const borderFn = (curBorder) => template_type == "tag" ? curBorder : "initial";
let border_color = borderFn(DEFAULT_CONFIG.BORDER_COLOR);
// 樔ēé
ē½®
let template_config = first_automatic_discount.template_config;
// å
åŗę¹ę”
try {
if(template_config.length !== 0){
template_config = JSON.parse(template_config);
text_color= isHasDiscountIconWithNoTag ? template_config.color[template_type].icon_text_color : template_config.color[template_type].text_color;
bg_color = bgFn(template_config.color[template_type].background_color);
const arrayRgba = bg_color.split(",");
arrayRgba.splice(3, 1, " 1)");
border_color = borderFn(`${arrayRgba.join(",")}`);
}
} catch (error) {
console.error('template_config_error', error);
template_config = {
color: {
[template_type]: {
icon_text_color: DEFAULT_CONFIG.TEXT_COLOR,
text_color: DEFAULT_CONFIG.TEXT_COLOR,
background_color: DEFAULT_CONFIG.BG
}
}
};
}
// ę ē¾
const isTag = template_type == 'tag';
// ęåå横å¹
const isTextAndBanner = template_type == 'text' || template_type == 'banner';
// ęåę ·å¼
const textStyle = `color: ${text_color}; background-color: transparent; border: none;`;
// ę ē¾ę ·å¼
const labelStyle = `color: ${text_color};border: 1px solid ${border_color};background-color:${bg_color};padding: 4px;`;
// 横å¹
ę ·å¼
const bannerStyle = `color: ${text_color};border: none; background-color:${bg_color}`;
// å¤å±ę ·å¼åØę ē¾ę ·å¼äøäøå±ē¤ŗé¢č²é
ē½®ļ¼é¤å¼ę ē¾ē±»åļ¼é¢č²é½åÆä»„åØå¤å±č¦ē
let outerStyle = '';
if (template_type == 'text') {
outerStyle = textStyle;
} else if (template_type == 'tag') {
outerStyle = "border: none;";
} else if (template_type == 'banner') {
outerStyle = bannerStyle;
}
/**
* 1. ę ē¾äøå®ęÆåē¬ę ·å¼å±ē¤ŗē
* 2. ęå ļ¼ęØŖååøå±ļ¼ęåå横å¹
ļ¼åå¹¶ęäøč”ęę¬ļ¼ ę ē¾ļ¼åē¬ę ·å¼å¤ē
* 3. å¹³éŗļ¼ēŗµååøå±ļ¼ęåć横å¹
åę ē¾ļ¼ ę ē¾ļ¼åē¬ę ·å¼å¤ē
*/
let txtHtml = ``;
if (isFold) {
if(isTag) {
// ę ē¾
const spanText = text_arr.map((text) => {
return `${text}`;
}).join('');
txtHtml = `
`
}
})()}
${spanText}
`;
} else {
// ęåå横å¹
txtHtml = `
${first_automatic_discount.config.text}
`;
}
} else {
// ęåå横å¹
, ä½ę ē¾ęčŖå·±ēę ·å¼
const spanText = text_arr.map((text) => {
return `${text}`;
}).join('');
// é½ęÆēŗµååøå±ļ¼ę ē¾ęé“č·, å¤ę“»åØå¤å±ēŗ§ęØŖååøå±
txtHtml = `${spanText}
`;
}
/**
* ę¾ē¤ŗå¾ę ēå¤ę
*/
const discount_type = item.discount_type;
const isShowRebateIcon = ["DT_REBATE_CTQ_OTP", "DT_REBATE_CTQ_OTR", "DT_REBATE_CTA_OTP", "DT_REBATE_CTA_OTR", "DT_M_N_DISCOUNT"].includes(discount_type) && isTextAndBanner
const isShowBxgyIcon = ["DT_BUY_ONE_GET_ONE", "DT_BUY_X_GET_Y"].includes(discount_type)
const isShowBundleIcon = ["DT_CLASSIC_BUNDLE","DT_MIX_MATCH_BUNDLE"].includes(discount_type);
/**
* ęø²ęäøęę”ęę½å±ēęę£å蔨
*/
const discount_list_html = (curItem) => {
return `
${function() {
return curItem.discount.map(childItem => {
return `
`}).join('');
}()}
`;
}
return `
`;
}).join('');
})()}
${childItem.config.text}
${childItem.config.text}