${
(function(){
const popupList = originData.popupList;
return popupList?.length && popupList.map(item => {
if(item.placement_template === "PT_POPUP_BUY_X_GET_Y"){
const parseConfig = item.parseConfig;
const shopUrl = `https://${parseConfig.button.url}`;
let modalSize = '';
if(+parseConfig.width.value <= 600){
modalSize = 'small';
} else if(+parseConfig.width.value > 600 && +parseConfig.width.value <= 800){
modalSize = 'middle';
} else {
modalSize = 'large';
}
const imagePosition = parseConfig.image.position;
const wrapHeightMap = {
small: 'min-height:360px;',
middle: 'min-height:480px;',
large: 'min-height:600px;'
};
const image_size_top_map = {
small: 'height:208px;',
middle: 'height:295px;',
large: 'height:346px;'
};
const content_size_right_map = {
small: 'padding-top: 68px;',
middle: 'padding-top: 72px;',
large: 'padding-top: 76px;'
};
const content_size_top_map = {
small: 'padding: 20px 16px;',
middle: 'padding: 40px 16px;',
large: 'padding: 40px 16px;'
};
positionMap = {
top: {
imageStyle:`width:100%;${image_size_top_map[modalSize]}`,
contentStyle:`margin-top:0;padding: 16px;${content_size_top_map[modalSize]}`,
wrapStyle: 'flex-direction:column;',
},
left: {
imageStyle:'width:50%;height:100%;',
contentStyle:`width:50%;padding:16px;${content_size_right_map[modalSize]}`,
wrapStyle: 'flex-direction:row;',
},
right: {
imageStyle:'width:50%;height:100%;',
contentStyle:'width:50%;padding:16px;margin-top:0;',
wrapStyle: 'flex-direction:row-reverse;'
},
none: {
imageStyle:'display: none',
contentStyle:'width:100%;',
wrapStyle: 'width:100%;'
}
}
const keys = ['text_title','text_content','button'];
let sortKeys = [];
parseConfig.section.forEach(item => {
if(keys.includes(item)){
sortKeys.push(item)
}
})
const maskPercent = item.parseConfig.mask.value/100;
const backgroundImgStyle = (parseConfig.background.url && parseConfig.background.upload) ? `background-image:url(//img.staticdj.com/${parseConfig.background.url});background-size: cover;background-repeat: no-repeat;background-position: center;` : '';
const backgroundColorStyle = `background-color:${parseConfig.background.color || '#ffffff'}`;
return `
`
}else{
return ''
}
}).join('');
})()
}
${sortKeys.map(key => {
if(key == 'text_title'){
return `
${parseConfig.button.text}
${parseConfig.button.text}
`
}
}).join('')}
${parseConfig.text_title.value}
`
}else if(key == 'text_content'){
return `
${parseConfig.text_content.value}
`
}else if(key == 'button'){
return `
End in
${data.dd}D
${data.hh}:
${hour}:
${data.mm}:
${data.ss}
.
${data.SSS}
${function() {
const images = data.images || [];
const selectedVariant = data.variants.find(v => (v.available && v.is_hit_discount == true)) || data.variants[0];
const selectedIndex = !!selectedVariant ? images.findIndex(img => img.src === (selectedVariant.image && selectedVariant.image.src)) : 0;
const initialSlide = selectedIndex === -1 ? 0 : selectedIndex;
return `
${images.map(image => {
const imageWidth = image.width || 450;
const imageHeight = image.height || 450;
return `
`
}).join('')}
`;
}()}
${images.map((image, index) => `
`).join('')}
${data.title || data.brief}
Add ${productData.discount_min_purchase_qty} items for discount
Promo products limited to ${limit_user_product_discount} item per person
${function() {
const currentProduct = data.product;
return (currentProduct.options || []).map((option, index) => {
const optionName = option.name || '';
const optionId = option.id || '';
const position = `option${index + 1}`;
return `
`;
}).join('')
}()}
${function() {
const value = (data.originData && data.originData.value) || data.value;
const isHasValue = value ? true : false;
return `
${value}
`
}()}
The activity inventory has been sold out, flash sale discount will not be applied
Continue Shopping