Journalsay – ruban adhésif en PET pour aménagement paysager, série The Afternoon, boissons au café, Vintage, 45mm x 200cm

class SpzCustomDiscountFlashsale extends SPZ.BaseElement { constructor(element) { super(element); this.xhr_ = SPZServices.xhrFor(this.win); this.getFlashSaleApi = "\/api\/storefront\/promotion\/flashsale\/display_setting\/product_setting"; this.timer = null; this.variantId = "f1977306-0ce8-4936-888c-697f739c4b59"; // 促销活动数据 this.flashsaleData = {} } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } buildCallback() { this.templates_ = SPZServices.templatesForDoc(); this.viewport_ = this.getViewport(); // 挂载bind函数 解决this指向问题 this.render = this.render.bind(this); this.resize = this.resize.bind(this); this.switchVariant = this.switchVariant.bind(this); } mountCallback() { // 获取数据 this.getData(); this.element.onclick = (e) => { const cur = this.win.document.querySelector(".app_discount_flashsale_desc"); if (this.flashsaleData.product_setting.is_redirection && appDiscountUtils.inProductBody(this.element) && e.target !== cur) { this.win.open(`/promotions/discount-default/${this.flashsaleData.discount_info.id}`); } } // 绑定 this.viewport_.onResize(this.resize); // 监听子款式切换,重新渲染 this.win.document.addEventListener('dj.variantChange', this.switchVariant); } unmountCallback() { // 解绑 this.viewport_.removeResize(this.resize); this.win.document.removeEventListener('dj.variantChange', this.switchVariant); // 清除定时器 if (this.timer) { clearTimeout(this.timer); this.timer = null; } } resize() { if (this.timer) { clearTimeout(this.timer) this.timer = null; } this.timer = setTimeout(() => { this.render(); }, 200) } switchVariant(event) { const variant = event.detail.selected; if (variant.product_id == '58d30a7c-f2b3-4e36-9177-f42d0bfee501' && variant.id != this.variantId) { this.variantId = variant.id; this.getData(); } } getData() { const reqBody = { product_id: "58d30a7c-f2b3-4e36-9177-f42d0bfee501", product_type: "default", variant_id: this.variantId } this.flashsaleData = {}; this.win.fetch(this.getFlashSaleApi, { method: "POST", body: JSON.stringify(reqBody), headers: { "Content-Type": "application/json" } }).then(async (response) => { if (response.ok) { this.flashsaleData = await response.json(); this.render(); } else { this.clearDom(); } }).catch(err => { this.clearDom(); }); } clearDom() { const children = this.element.querySelector('*:not(template)'); children && SPZCore.Dom.removeElement(children); } render() { this.templates_ .findAndRenderTemplate(this.element, { isMobile: appDiscountUtils.judgeMobile(), isRTL: appDiscountUtils.judgeRTL(), inProductDetail: appDiscountUtils.inProductBody(this.element), flashsaleData: this.flashsaleData, image_domain: this.win.SHOPLAZZA.image_domain, }) .then((el) => { this.clearDom(); this.element.appendChild(el); }) } } SPZ.defineElement('spz-custom-discount-flashsale', SpzCustomDiscountFlashsale);
const TAG = "spz-custom-product-automatic"; class SpzCustomProductAutomatic extends SPZ.BaseElement { constructor(element) { super(element); this.variant_id = 'f1977306-0ce8-4936-888c-697f739c4b59'; } static deferredMount() { return false; } buildCallback() { this.action_ = SPZServices.actionServiceForDoc(this.element); this.templates_ = SPZServices.templatesForDoc(this.element); this.xhr_ = SPZServices.xhrFor(this.win); this.setupAction_(); this.viewport_ = this.getViewport(); } mountCallback() { console.log('自动折扣直出数据',{"downgrade":false,"automatic_discount_list":[{"discount_type":"DT_REBATE_CTA_OTR","discount_icon":"\/\/img.staticdj.com\/oss\/operation\/52a3d7f0a272be85092170dc93eefe81.svg","discount":[{"discount_id":"509894951778129690","discount_type":"DT_REBATE_CTA_OTR","discount_method":"DM_AUTOMATIC","config":{"text":"Buy \u20ac69.00<\/span> get \u20ac4.00<\/span> off,Buy \u20ac129.00<\/span> get \u20ac10.00<\/span> off,Buy \u20ac189.00<\/span> get \u20ac16.00<\/span> off,Buy \u20ac239.00<\/span> get \u20ac22.00<\/span> off","texts":["Buy \u20ac69.00<\/span> get \u20ac4.00<\/span> off","Buy \u20ac129.00<\/span> get \u20ac10.00<\/span> off","Buy \u20ac189.00<\/span> get \u20ac16.00<\/span> off","Buy \u20ac239.00<\/span> get \u20ac22.00<\/span> off"],"off_text":""},"product_enabled":true,"template_type":"banner","is_redirection":true,"template_config":"{\"color\":{\"text\":{\"icon_text_color\":\"#EB391B\"},\"tag\":{\"text_color\":\"#EB391B\",\"background_color\":\"rgba(235, 57, 27, 0.04)\"},\"banner\":{\"icon_text_color\":\"#EB391B\",\"background_color\":\"rgba(235, 57, 27, 0.04)\"},\"coupon\":{\"coupon_border_color\":\"#FFEFDE\",\"coupon_background_color\":\"#F8A056\",\"coupon_background_color_end\":\"#F93E37\",\"coupon_color\":\"#FFFFFF\",\"coupon_button_background_color_start\":\"#FEE7CD\",\"coupon_button_background_color_end\":\"#FFF4E7\",\"coupon_button_color\":\"#F94339\"}}}","display_type":"DTE_FOLD"}]}],"hash":"d54d9845b0fc16098dc5c82ae8834e00"}); this.init(); // 监听事件 this.bindEvent_(); } async init() { this.handleFitTheme(); const promotionComplex = {"downgrade":false,"automatic_discount_list":[{"discount_type":"DT_REBATE_CTA_OTR","discount_icon":"\/\/img.staticdj.com\/oss\/operation\/52a3d7f0a272be85092170dc93eefe81.svg","discount":[{"discount_id":"509894951778129690","discount_type":"DT_REBATE_CTA_OTR","discount_method":"DM_AUTOMATIC","config":{"text":"Buy \u20ac69.00<\/span> get \u20ac4.00<\/span> off,Buy \u20ac129.00<\/span> get \u20ac10.00<\/span> off,Buy \u20ac189.00<\/span> get \u20ac16.00<\/span> off,Buy \u20ac239.00<\/span> get \u20ac22.00<\/span> off","texts":["Buy \u20ac69.00<\/span> get \u20ac4.00<\/span> off","Buy \u20ac129.00<\/span> get \u20ac10.00<\/span> off","Buy \u20ac189.00<\/span> get \u20ac16.00<\/span> off","Buy \u20ac239.00<\/span> get \u20ac22.00<\/span> off"],"off_text":""},"product_enabled":true,"template_type":"banner","is_redirection":true,"template_config":"{\"color\":{\"text\":{\"icon_text_color\":\"#EB391B\"},\"tag\":{\"text_color\":\"#EB391B\",\"background_color\":\"rgba(235, 57, 27, 0.04)\"},\"banner\":{\"icon_text_color\":\"#EB391B\",\"background_color\":\"rgba(235, 57, 27, 0.04)\"},\"coupon\":{\"coupon_border_color\":\"#FFEFDE\",\"coupon_background_color\":\"#F8A056\",\"coupon_background_color_end\":\"#F93E37\",\"coupon_color\":\"#FFFFFF\",\"coupon_button_background_color_start\":\"#FEE7CD\",\"coupon_button_background_color_end\":\"#FFF4E7\",\"coupon_button_color\":\"#F94339\"}}}","display_type":"DTE_FOLD"}]}],"hash":"d54d9845b0fc16098dc5c82ae8834e00"}; let data = await this.getDiscountList(); if (data.hash && (data.hash !== promotionComplex.hash)) { // 兜底方案, downgrade == true; 需要降级 则要请求接口, // 但是直出数据可能存在缓存,一定会调用一次接口,直接判断hash版本,不一致就用接口的,一致就没必要重新渲染一模一样的数据了 console.log('%c 自动折扣hash不一致, 使用接口数据 ', 'background:#ffe3f4;border: 1px solid #ff4395; color: #ff4395;', data.hash); this.renderApiData_(data); } } async getDiscountList() { const productId = '58d30a7c-f2b3-4e36-9177-f42d0bfee501'; const variantId = this.variant_id; const productType = 'default'; const reqBody = { product_id: productId, variant_id: variantId, discount_method: "DM_AUTOMATIC", customer: { customer_id: window.C_SETTINGS.customer.customer_id, email: window.C_SETTINGS.customer.customer_email }, product_type: productType } const url = `/api/storefront/promotion/display_setting/text/list`; const data = await this.xhr_.fetchJson(url, { method: "post", body: reqBody }).then(res => { return res; }).catch(err => { this.setContainerDisabled(false); }) return data; } async renderApiData_(data) { const parentDiv = document.querySelector('.automatic_discount_container'); const newTplDom = await this.getRenderTemplate(data); if(parentDiv){ parentDiv.innerHTML = ''; parentDiv.appendChild(newTplDom); } } async renderDiscountList() { this.setContainerDisabled(true); const data = await this.getDiscountList(); this.setContainerDisabled(false); // 重新渲染 抖动问题处理 this.renderApiData_(data); } clearDom() { const children = this.element.querySelector('*:not(template)'); children && SPZCore.Dom.removeElement(children); } doRender_(data) { const renderData = data || {}; return this.templates_ .findAndRenderTemplate(this.element, renderData) .then((el) => { this.clearDom(); this.element.appendChild(el); }); } async getRenderTemplate(data) { const renderData = data || {}; return this.templates_ .findAndRenderTemplate(this.element, renderData) .then((el) => { this.clearDom(); return el; }); } setContainerDisabled(isDisable) { const automaticDiscountEl = document.querySelector('.automatic_discount_container'); if(isDisable) { automaticDiscountEl.setAttribute('disabled', ''); } else { automaticDiscountEl.removeAttribute('disabled'); } } // 绑定事件 bindEvent_() { window.addEventListener('click', (e) => { let containerNodes = document.querySelectorAll(".automatic-container .panel"); let bool; Array.from(containerNodes).forEach((node) => { if(node.contains(e.target)){ bool = true; } }) // 是否popover面板点击范围 if (bool) { return; } if(e.target.classList.contains('drowdown-icon') || e.target.parentNode.classList.contains('drowdown-icon')){ return; } const nodes = document.querySelectorAll('.automatic-container'); Array.from(nodes).forEach((node) => { node.classList.remove('open-dropdown'); }) // 兼容主题 this.toggleProductSticky(true); }) // 监听变体变化 document.addEventListener('dj.variantChange', async(event) => { // 重新渲染 const variant = event.detail.selected; if (variant.product_id == '58d30a7c-f2b3-4e36-9177-f42d0bfee501' && variant.id != this.variant_id) { this.variant_id = variant.id; this.renderDiscountList(); } }); } // 兼容主题 handleFitTheme() { // top 属性影响抖动 let productInfoEl = null; if (window.SHOPLAZZA.theme.merchant_theme_name === 'Wind' || window.SHOPLAZZA.theme.merchant_theme_name === 'Flash') { productInfoEl = document.querySelector('.product-info-body .product-sticky-container'); } else if (window.SHOPLAZZA.theme.merchant_theme_name === 'Hero') { productInfoEl = document.querySelector('.product__info-wrapper .properties-content'); } if(productInfoEl){ productInfoEl.classList.add('force-top-auto'); } } // 兼容 wind/flash /hero 主题 (sticky属性影响 popover 层级展示, 会被其他元素覆盖) toggleProductSticky(isSticky) { let productInfoEl = null; if (window.SHOPLAZZA.theme.merchant_theme_name === 'Wind' || window.SHOPLAZZA.theme.merchant_theme_name === 'Flash') { productInfoEl = document.querySelector('.product-info-body .product-sticky-container'); } else if (window.SHOPLAZZA.theme.merchant_theme_name === 'Hero') { productInfoEl = document.querySelector('.product__info-wrapper .properties-content'); } if(productInfoEl){ if(isSticky) { // 还原该主题原有的sticky属性值 productInfoEl.classList.remove('force-position-static'); return; } productInfoEl.classList.toggle('force-position-static'); } } setupAction_() { this.registerAction('handleDropdown', (invocation) => { const discount_id = invocation.args.discount_id; const nodes = document.querySelectorAll('.automatic-container'); Array.from(nodes).forEach((node) => { if(node.getAttribute('id') != `automatic-${discount_id}`) { node.classList.remove('open-dropdown'); } }) const $discount_item = document.querySelector(`#automatic-${discount_id}`); $discount_item && $discount_item.classList.toggle('open-dropdown'); // 兼容主题 this.toggleProductSticky(); }); } triggerEvent_(name, data) { const event = SPZUtils.Event.create(this.win, `${ TAG }.${ name }`, data || {}); this.action_.trigger(this.element, name, event); } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } } SPZ.defineElement(TAG, SpzCustomProductAutomatic);
Buy €69.00 get €4.00 off
Buy €129.00 get €10.00 off
Buy €189.00 get €16.00 off
Buy €239.00 get €22.00 off
Color:  JD-WHSF-01
€1.42
€3.08
-54%
const addToCartText = "Ajouter au panier"; SPZCore.Dom.waitForChild( document.body, () => !!document.querySelector('[data-click="addToCart"], [role="addToCart"]'), () => { const addToCartEle = window.SPZCore.Dom.scopedQuerySelector( document.body, '[data-click="addToCart"], [role="addToCart"]' ); const getContentChild_ = function(el) { if(el) { const childs = el.childNodes; for (let i = childs.length - 1; i >= 0; i--) { const child = childs[i]; if (child.getAttribute && child.getAttribute('role') === 'content') { return child; } } } return; } const changeAddToCartText = function(text) { const contentEle = getContentChild_(addToCartEle); if(contentEle){ const addToCartChilds = addToCartEle.childNodes; for (let i = addToCartChilds.length - 1; i >= 0; i--) { const child = addToCartChilds[i]; if (typeof child.getAttribute !== 'function' || (child.getAttribute('role') !== 'content' && child.getAttribute('role') !== 'loading')) { addToCartEle.removeChild(child); } } }else{ addToCartEle.innerHTML = addToCartText; } } changeAddToCartText(addToCartText); } );
const SITE = (window.C_SETTINGS && window.C_SETTINGS.routes && window.C_SETTINGS.routes.root) || ''; const PRODUCT_PLAN_INFO_URL = `${SITE}/api/storefront/selling_plans/product_plan_info/:product_id`; const { i18nProductDetail, i18nProduct } = JSON.parse( document.querySelector('#i18n-json').textContent ); const currentI18nProduct = i18nProductDetail || i18nProduct; class SpzCustomSubscription extends SPZ.BaseElement { constructor(element) { super(element); this.productPlanInfo = null; this.cycle = null; this.optionid_ = null; this.form_ = null; this.variantId_ = null; this.variantChangeData = null; this.cycleList = [1,2]; this.productId = this.element.getAttribute('productId'); this.initialCycle = this.element.getAttribute('cycles'); this.noPlanShowTitle = JSON.parse(this.element.getAttribute('noPlanShowTitle')); } get initIsCycleSubscribe() { if(this.initialCycle == 2) { return true; } if(this.initialCycle == 1) { return false; } return null; } get productInfo() { let pJson = document.querySelector('#product-json'); if (pJson) { return JSON.parse(pJson.innerHTML); }else if(typeof $ === 'function' && typeof $(document).data === 'function') { return $(document).data('djproduct'); } return null; } get hasSKU() { if(this.productPlanInfo?.sku) { return true; } return false } get hasSPU() { if(this.productPlanInfo?.spu) { return true; } return false } get originalPrice() { if(!this.variantChangeData?.selected?.price){ return ''; }; return this.variantChangeData.selected.price; } get defaultPlanData() { if (!this.productPlanInfo) { return {}; } let planInfo = {}; if(this.hasSPU && this.productPlanInfo?.spu[this.productId]) { planInfo = this.productPlanInfo.spu[this.productId]; }else if(this.hasSKU && this.productPlanInfo?.sku[this.variantId_]) { planInfo = this.productPlanInfo.sku[this.variantId_]; } return planInfo; } get defaultCycle_() { if(!this.defaultPlanData) { return null; } return this.defaultPlanData.cycles; } get defaultOption_() { if(!this.defaultPlanData) { return null; } return this.defaultPlanData.selected_selling_plan_option_id; } get isCycleSubscribe() { if(this.cycle === 2) { return true; } if(this.cycle === 1) { return false; } return null; } get currentOption_() { if(!this.isCycleSubscribe){ return null; } if(!this.optionId_) { return this.defaultOption_; } return this.optionId_; } get currentPlanData() { if(!this.defaultPlanData) { return {}; } let result = Object.assign({},this.defaultPlanData); if(result.selected_selling_plan_option_id !== this.optionId_) { result.selected_selling_plan_option_id = this.optionId_; result.selling_plan_options = result.selling_plan_options.map(item => { return { ...item, selected_enabled: item.selling_plan_option_id === result.selected_selling_plan_option_id } }) } if (result.cycles !== this.cycle) { result.cycles = this.cycle; } return result; } fetchData_(product_id) { return SPZServices.xhrFor(this.win).fetchJson(PRODUCT_PLAN_INFO_URL.replace(/:product_id/gi, product_id)) .then((data) => { this.productPlanInfo = data; } ); } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } mountCallback() { console.log('subsciption-mountCallback'); this.initVariantId(); if(!!this.variantId_) { this.track_('product_view', this.initIsCycleSubscribe); } this.getElement_(); Promise.all([this.productInfoReady_(), this.fetchData_(this.productId)]).then(() => { this.init_(); this.initActions_(); this.showPlan_(false); if(!!this.variantId_){ this.changeBuyNowText(); this.dispatchSubScribeIdChange_(); } }); } productInfoReady_() { if(this.productInfo) { return Promise.resolve(); } SPZUtils.Event.listen(document,'load',()=> { if(this.productInfo) { return Promise.resolve(); }else{ return Promise.reject(); } }) } getElement_() { this.titleEle = SPZCore.Dom.scopedQuerySelector(document.body, '[role="plugin-subscription-title"]'); this.noPlanTipsEle = SPZCore.Dom.scopedQuerySelector(this.element, '[role="plugin-subscription-plan-tips"]'); this.noPaymentTipsEle = SPZCore.Dom.scopedQuerySelector(this.element, '[role="plugin-subscription-payment-tips"]'); this.renderEle = SPZCore.Dom.scopedQuerySelector(this.element, '[role="plugin-subscription-content-render"]'); this.productEle = SPZCore.Dom.scopedQuerySelector(document.body, '[data-section-type="product"], [data-section-type="product_detail"], [data-section-type="product_club"]') this.buyNowEle = SPZCore.Dom.scopedQuerySelector(this.productEle, '[data-click="submit"], [role="buyNow"]'); this.addToCartEle = SPZCore.Dom.scopedQuerySelector(this.productEle, '[data-click="addToCart"], [role="addToCart"]'); } init_() { this.cycle = this.defaultCycle_; this.optionId_ = this.defaultOption_; this.variantChangeData = this.productInfo; } initVariantId() { const formData = this.getFormData(); if (formData) { if(formData['variant_id'] && formData['variant_id'] !== 'undefined') { this.variantId_ = formData['variant_id']; }else{ this.variantId_ = '' } }else if(this.productInfo?.selected?.id){ this.variantId_ = this.productInfo.selected.id }else{ this.variantId_ = '' } } getFormData() { this.form_ = this.element.closest('form'); if(!this.form_) { return null; } const result = { quantity: 1, }; const formData = new FormData(this.form_); const formDataKey = formData.keys(); for (const key of formDataKey) { result[key] = formData.get(key); } return result; } showPlan_(rerender = false) { if (!this.variantId_) { return this.hide_(); } if (rerender) { this.renderPlan_(); } } renderPlan_() { if (Object.keys(this.currentPlanData).length === 0) { this.showNoPlanTips_(true); this.showNoPaymentTips_(false); this.showRender_(false); if(this.noPlanShowTitle) { this.showTitle_(true); }else{ this.showTitle_(false); } return; } this.showRender_(true); this.showNoPaymentTips_(true); this.showTitle_(true); this.showNoPlanTips_(false); const selectedPlanItem = this.currentPlanData.selling_plan_options.filter((item) => item.selected_enabled === true)[0]; SPZ.whenApiDefined(this.renderEle).then((apis) => { apis.render({ ...this.currentPlanData, originalPrice: this.originalPrice, selectedPlanItem }, false); }); } showTitle_(visible = true) { if(this.titleEle) { this.titleEle.toggleAttribute('hide', !visible); } } showNoPlanTips_(visible = true) { if(this.noPlanTipsEle) { this.noPlanTipsEle.toggleAttribute('hide', !visible); } } showNoPaymentTips_(visible = true) { if(this.noPaymentTipsEle){ this.noPaymentTipsEle.toggleAttribute('hide', !visible); } } showRender_(visible = true) { if(this.renderEle){ this.renderEle.toggleAttribute('hide', !visible); } } hide_() { this.showTitle_(false); this.element.toggleAttribute('hide', true); } show_() { this.showTitle_(true); this.element.toggleAttribute('hide', false); } dispatchSubScribeIdChange_() { this.dispatchEvent_('payment_ec_refresh', { sources: 'subscription' }); } dispatchEvent_(name, data) { const event = SPZUtils.Event.create(this.win, name, data, { bubbles: true }); this.element.dispatchEvent(event); } initActions_() { this.onVariantChange_(); this.element.addEventListener('change', (e) => { if(e.target?.role === 'plugin-subscription-option-selector') { this.onOptionChange_(e.target.value); } if(e.target?.role === 'plugin-subscription-option-card') { this.changeCardOption_(e.target.value); } }); this.registerAction( 'changeCycle', (invocation) => this.onCycleChange_(invocation.args?.selectedOptions[0]) ); this.registerAction('subscribeChange', (invocation) => { this.dispatchSubScribeIdChange_(invocation.args); }); this.addToCartEle.addEventListener('click', () => { this.track_('add_to_cart'); }); this.buyNowEle.addEventListener('click', () => { this.track_('add_to_cart'); }); this.submitInterrapt(); } onVariantChange_() { SPZUtils.Event.listen(document, 'dj.variantChange', (e) => { if(this.variantId_ === e.detail?.selected?.id) { return; } if(!this.variantId_ && e.detail?.selected?.id) { this.show_(); } this.variantId_ = e.detail.selected?.id; this.optionId_ = this.defaultOption_; this.cycle = this.defaultCycle_; this.variantChangeData = Object.assign(this.variantChangeData, e.detail); this.changeBuyNowText(); this.changeAddToCartText(e.detail); this.showPlan_(true); this.track_('product_view'); }); } onOptionChange_(op, render = true) { this.optionId_ = op; this.changeBuyNowText(); if(render) { this.showPlan_(true); } } onCycleChange_(val, render = true) { const cy = Number(val); if (this.cycleList.includes(cy)) { this.cycle = cy; this.changeBuyNowText(); if(render) { this.showPlan_(true); } } } submitInterrapt() { if(!this.form_) { window.djInterceptors.request.use((config) => { if(config?.url === '/api/cart') { return this.addToCartRequestData_(config); } if(config?.url === '/api/checkout/order') { return this.checkoutOrderRequestData_(config); } }) } } addToCartRequestData_(config) { const cartConfig = { ...config }; const hasProductId = cartConfig?.body?.product_id; const hasVariantId = cartConfig?.body?.variant_id; if(cartConfig?.method == 'POST' && hasProductId && hasVariantId) { if (!cartConfig.body.properties) { cartConfig.body.properties = {}; } if(this.currentOption_) { cartConfig.body.properties = { ...cartConfig.body.properties, _selling_plan_option_id: this.currentOption_ } } } return cartConfig; } checkoutOrderRequestData_(config) { const orderConfig = { ...config }; const hasVariantId = orderConfig?.body?.line_items[0]?.variant_id; if(orderConfig?.method == 'POST' && hasVariantId) { if (!orderConfig.body.line_items[0].properties) { orderConfig.body.line_items[0].properties = {}; } if(this.currentOption_) { orderConfig.body.line_items[0].properties = { ...orderConfig.body.line_items[0].properties, _selling_plan_option_id: this.currentOption_ } } } return orderConfig; } changeCardOption_(val) { const oneTimeInputEle = document.querySelector('.one-time [role=plugin-subscription-option-card]'); if(val == 0) { this.onCycleChange_(1, true); oneTimeInputEle.toggleAttribute('disabled',true); return; } oneTimeInputEle.toggleAttribute('disabled',false); this.onCycleChange_(2, false); this.onOptionChange_(val, true); } getContentChild_(el) { if(el) { const childs = el.childNodes; for (let i = childs.length - 1; i >= 0; i--) { const child = childs[i]; if (child.getAttribute && child.getAttribute('role') === 'content') { return child; } } } return; } changeBuyNowText() { let buyNowText = currentI18nProduct.buy_now; let subscribeText = "S'abonner"; const contentEle = this.getContentChild_(this.buyNowEle); // 1. 有role="content"的元素,替换role="content"的元素 if(contentEle) { contentEle.innerHTML = this.isCycleSubscribe ? subscribeText : buyNowText; }else{ // 2. 不存在role="content"的元素,直接替换文本 this.buyNowEle.innerHTML = this.isCycleSubscribe ? this.buyNowEle.innerHTML.replace(buyNowText, subscribeText) : this.buyNowEle.innerHTML.replace(subscribeText, buyNowText); } } changeAddToCartText(data) { const contentEle = this.getContentChild_(this.addToCartEle); // 1. 有role="content"的元素,移除role不等于content和loading的元素 if(contentEle) { const addToCartChilds = this.addToCartEle.childNodes; for (let i = addToCartChilds.length - 1; i >= 0; i--) { const child = addToCartChilds[i]; // 移除元素(role不等于content和loading) if (typeof child.getAttribute !== 'function' || (child.getAttribute('role') !== 'content' && child.getAttribute('role') !== 'loading')) { this.addToCartEle.removeChild(child); } } }else{ // 2. 不存在role="content"的元素,直接替换文本 const addToCartText = this.getAddToCartText_(data); this.addToCartEle.innerHTML = addToCartText; } } getAddToCartText_(data) { const selected = data?.selected; const productAvailable = data?.product?.available; const variantAvailable = data?.selected?.available; const variantId = data?.selected?.id; let text = currentI18nProduct.add_to_cart; if (!productAvailable) { text = currentI18nProduct.sold_out; } if (selected && !variantId) { text = currentI18nProduct.unavailable; } if (productAvailable && selected && variantId && !variantAvailable) { text = currentI18nProduct.sold_out; } return text; } track_(eventName, optionSelected = this.isCycleSubscribe) { if(window && window.sa && typeof window.sa.registerExtraInfo === 'function') { window.sa.registerExtraInfo(eventName, { function_name: "product_subscription", module: "apps", option_selected: optionSelected }, optionSelected === null); } } } SPZ.defineElement('spz-custom-subscription', SpzCustomSubscription);
Options d'achat:
Achat ponctuel
€1.42
S'abonner
€1.42
Fréquence de livraison
Ignorer, modifier ou annuler à tout moment
Quantité
Expédition

La description

Ce ruban sur le thème de l'alimentation apporte un look délicieux à vos albums et journaux. Fabriqué en PET, il présente une gamme de délicieux designs alimentaires comme du café, du lait, des gâteaux, des fruits et du pain, mesurant 45 mm de large et 200 cm de long. Idéal pour créer un arrière-plan confortable sur le thème de la nourriture, parfait pour les thèmes de pâtisserie, les coins café et la journalisation culinaire.

  • Éléments alimentaires riches : comprend diverses icônes alimentaires telles que le café et le pain, créant un impact visuel dynamique
  • Parfait pour la décoration d'arrière-plan : ajoute une touche chaleureuse et appétissante aux albums et aux journaux
  • Matériau PET haute transparence : adhère parfaitement aux arrière-plans aux couleurs vives
  • Design large : 45 mm de largeur et 200 cm de longueur offrent suffisamment d'espace pour une décoration créative