${function(){
let finishCallback = `loyalty-paid-benefit-modal.open;`;
if (!!data.status) {
finishCallback = `loyalty-global-toast-render.rerender(data='LOYALTY_SERVER_UNAUTHORIZED', redo=true);loyalty-panel-event-bus.emit(eventName='loyalty.refresh', origin='global');loyalty-global-loading.hide;`;
}
return `
${function(){
const iconMap = {
PAID_BENEFITS_1: "//app-assets.staticdj.com/apps/apployalty/paid_benefits_icon-b3f05972.svg",
POINT_ICON_1: "//app-assets.staticdj.com/apps/apployalty/point_icon_1-2de57b3f.svg",
POINT_ICON_2: "//app-assets.staticdj.com/apps/apployalty/point_icon_2-42f85bf2.svg",
CUSTOM_ICON_1: "//app-assets.staticdj.com/apps/apployalty/custom_icon_1-84f40f10.svg",
CUSTOM_ICON_2: "//app-assets.staticdj.com/apps/apployalty/custom_icon_2-94c8cfe9.svg",
FREE_SHIPPING_ICON_1: "//app-assets.staticdj.com/apps/apployalty/free_shipping_icon_2-03171771.svg",
FREE_SHIPPING_ICON_2: "//app-assets.staticdj.com/apps/apployalty/free_shipping_icon_2-03171771.svg",
ORDER_DISCOUNT_ICON_1: "//app-assets.staticdj.com/apps/apployalty/order_discount_icon_1-af2765d4.svg",
ORDER_DISCOUNT_ICON_2: "//app-assets.staticdj.com/apps/apployalty/order_discount_icon_2-1b28dd73.svg",
PRODUCT_DISCOUNT_ICON_1: "//app-assets.staticdj.com/apps/apployalty/product_discount_icon_1-843ecc47.svg",
PRODUCT_DISCOUNT_ICON_2: "//app-assets.staticdj.com/apps/apployalty/product_discount_icon_2-24233960.svg",
BUY_X_GET_Y_ICON_1: "//app-assets.staticdj.com/apps/apployalty/buy_x_get_y_icon_1-dcdd028e.svg",
BUY_X_GET_Y_ICON_2: "//app-assets.staticdj.com/apps/apployalty/buy_x_get_y_icon_2-f5630e76.svg"
};
const currentIcon = iconMap[benefit.icon] || benefit.icon;
return `
`;
}()}
${data.benefit.name}
${data.benefit.desc}
${function(){
if (!data.status) {
return `
${data.benefit.reward.point_value}
${function(){
const { discount_code_activity } = data.benefit?.reward || {};
const { discount_type, obtain_product, discount_value } = discount_code_activity || {};
if (discount_type === 'fixed_amount') {
return `
`
}
if (discount_type === 'percentage') {
return `
${parseInt(discount_value)}% ํ ์ธ
`
}
if (discount_type === 'free_shipping') {
return `
๋ฌด๋ฃ ๋ฐฐ์ก
`
}
return '';
}()}
${function(){
const {discount_type, prerequisite_value, prerequisite_type, obtain_product} = data.benefit?.reward.discount_code_activity || {};
if (discount_type === 'buy_x_get_y') {
const x = prerequisite_value;
const y = obtain_product.product_count;
const obtain_value = obtain_product.obtain_value;
if(obtain_product.obtain_type === 'free') {
if (prerequisite_type === 'quantity') {
return `๊ตฌ๋งค ${x} ๊ฐ, ๋ฌด๋ฃ ${y} ๊ฐ ์ ๊ณต`;
} else if (prerequisite_type === 'subtotal') {
return `๊ตฌ๋งค ๊ฐ, ๋ฌด๋ฃ ${y} ๊ฐ ์ ๊ณต`;
}
}
if(obtain_product.obtain_type === 'percentage') {
if (prerequisite_type === 'quantity') {
return `๊ตฌ๋งค ${x} , ${y} ๊ฐ ${obtain_value}% ํ ์ธ ์ ๊ณต`;
} else if (prerequisite_type === 'subtotal') {
return `๊ตฌ๋งค , ${y} ๊ฐ ${obtain_value}% ํ ์ธ ์ ๊ณต`;
}
}
if(obtain_product.obtain_type === 'fixed_amount') {
if (prerequisite_type === 'quantity') {
return `๊ตฌ๋งค ${x} ๊ฐ, ๊ฐ๊ฐ ํ ์ธ ์ ๊ณต`;
} else if (prerequisite_type === 'subtotal') {
return `๊ตฌ๋งค ๊ฐ, ๊ฐ๊ฐ ํ ์ธ ์ ๊ณต`;
}
}
}
return '';
}()}
${function(){
const { prerequisite_type, prerequisite_value, discount_type, obtain_product, max_free_shipping } = data.benefit?.reward.discount_code_activity || {};
if (prerequisite_type === 'none' && discount_type === 'free_shipping' && max_free_shipping !== -1) {
return `์ต๋ ๊น์ง, ๊ธฐ์ค ์์`;
}
if (prerequisite_type === 'quantity' && discount_type === 'free_shipping' && max_free_shipping !== -1) {
return `์ต๋ ๊น์ง, ${parseInt(prerequisite_value)} ํญ๋ชฉ์ ํฌํจํ ์ฃผ๋ฌธ ์ ์ ํจ`;
}
if (prerequisite_type === 'subtotal' && discount_type === 'free_shipping' && max_free_shipping !== -1) {
return `์ต๋ ๊น์ง, ์ฃผ๋ฌธ ๊ธ์ก์ด ๋ฅผ ์ด๊ณผํด์ผ ์ ํจ`;
}
if (prerequisite_type === 'none') {
return `๊ธฐ์ค ์์`;
}
if (prerequisite_type === 'quantity') {
return `์ฃผ๋ฌธ์ ${parseInt(prerequisite_value)} ํญ๋ชฉ์ด ํฌํจ๋์ด์ผ ์ ํจ`;
}
if (prerequisite_type === 'subtotal') {
return `์ฃผ๋ฌธ ๊ธ์ก์ด ๋ฅผ ์ด๊ณผํด์ผ ์ ํจ`;
}
return '';
}()}
${function(){
if (data.discount_code?.available_times === -1) {
return `์ฌ์ฉ ๊ฐ๋ฅ`;
} else if (data.discount_code?.available_times > 0) {
return `${data.discount_code?.available_times}ํ ์ฌ์ฉ ๊ฐ๋ฅ`;
}
return '์์ง๋จ';
}()}
`;
}
return '';
}()}
${function(){
const {execution_schedule, trigger_type} = data.benefit.benefit_config;
const { type, date } = execution_schedule || {};
if (data.benefit.type === 'point') {
if (trigger_type === 'onetime') {
return `ํํ ํจํค์ง ๊ตฌ๋งค๊ฐ ์๋ฃ๋๋ฉด ๊ณ์ ์ผ๋ก ์ฆ์ ๋ฐ๊ธ๋ฉ๋๋ค.`;
} else if (trigger_type === 'periodic') {
if (type === 'monthly') {
return `ํํ ํจํค์ง ๊ตฌ๋งค๊ฐ ์๋ฃ๋๋ฉด ๋งค์ ์๋์ผ๋ก ๊ณ์ ์ ๋ฐ๊ธ๋ฉ๋๋ค.`;
} else if (type === 'weekly') {
return `ํํ ํจํค์ง ๊ตฌ๋งค๊ฐ ์๋ฃ๋๋ฉด ๋งค์ฃผ ์๋์ผ๋ก ๊ณ์ ์ ๋ฐ๊ธ๋ฉ๋๋ค.`;
} else if (type === 'cycle') {
return `ํํ ํจํค์ง ๊ตฌ๋งค๊ฐ ์๋ฃ๋๋ฉด ${execution_schedule.days[0]}์ผ๋ง๋ค ์๋์ผ๋ก ๊ณ์ ์ ๋ฐ๊ธ๋ฉ๋๋ค.`;
}
} else if (type === 'specific_date') {
return `ํํ์ ๋งค๋
${ date }์ ๊ณ์ ์ผ๋ก ๋ฐ๊ธ๋ฉ๋๋ค.`;
}
} else {
if (trigger_type === 'onetime') {
return `ํํ ํจํค์ง ๊ตฌ๋งค๊ฐ ์๋ฃ๋๋ฉด ๊ณ์ ์ผ๋ก ์ฆ์ ๋ฐ๊ธ๋ฉ๋๋ค.`;
} else if (trigger_type === 'periodic') {
if (type === 'monthly') {
return `ํํ ํจํค์ง ๊ตฌ๋งค๊ฐ ์๋ฃ๋๋ฉด ํ ์ธ ์ฝ๋๊ฐ ๋งค์ ์๋์ผ๋ก ๊ฐฑ์ ๋ฉ๋๋ค.`;
} else if (type === 'weekly') {
return `ํํ ํจํค์ง ๊ตฌ๋งค๊ฐ ์๋ฃ๋๋ฉด ํ ์ธ ์ฝ๋๊ฐ ๋งค์ฃผ ์๋์ผ๋ก ๊ฐฑ์ ๋ฉ๋๋ค.`;
} else if (type === 'cycle') {
return `ํํ ํจํค์ง ๊ตฌ๋งค๊ฐ ์๋ฃ๋๋ฉด ${execution_schedule.days[0]}์ผ๋ง๋ค ์๋์ผ๋ก ๊ณ์ ์ ๋ฐ๊ธ๋ฉ๋๋ค.`;
}
} else if (type === 'specific_date') {
return `ํํ์ ๋งค๋
${ date }์ ๊ณ์ ์ผ๋ก ๋ฐ๊ธ๋ฉ๋๋ค.`;
}
}
}()}
${data.discount_code?.discount_code}
๋ณต์ฌ
${function(){
const {execution_schedule, trigger_type} = data.benefit.benefit_config;
const { type, date } = execution_schedule || {};
if (data.benefit.type === 'point') {
if (trigger_type === 'periodic') {
if (type === 'monthly') {
if (data.had_reward) {
return `์ด๋ฒ ๋ฌ ํํ์ด ๊ณ์ ์ ๋ฐ๊ธ๋์์ต๋๋ค. ๋ค์ ๋ฐ๊ธ์
ํ์
๋๋ค.`;
} else {
return `๋ค์ ์๋ก ๊ณ ์นจ ์๊ฐ:
`;
}
} else if (type === 'weekly') {
if (data.had_reward) {
return `์ด๋ฒ ์ฃผ ํํ์ด ๊ณ์ ์ ๋ฐ๊ธ๋์์ต๋๋ค. ๋ค์ ๋ฐ๊ธ์
ํ์
๋๋ค.`;
} else {
return `๋ค์ ์๋ก ๊ณ ์นจ ์๊ฐ:
`;
}
}
}
if (trigger_type === 'onetime') {
if (data.had_reward) {
return `ํํ์ด ๊ณ์ ์ ๋ฐ๊ธ๋์์ต๋๋ค.`;
} else {
return `๋ค์ ์๋ก ๊ณ ์นจ ์๊ฐ:
`;
}
}
if (data.had_reward) {
return `ํํ์ด ๊ณ์ ์ ๋ฐ๊ธ๋์์ต๋๋ค. ๋ค์ ๋ฐ๊ธ์
ํ์
๋๋ค.`;
} else {
return `๋ค์ ์๋ก ๊ณ ์นจ ์๊ฐ:
`;
}
} else {
return `๋ค์ ์๋ก ๊ณ ์นจ ์๊ฐ:
`;
}
}()}