坎坎坷坷扩11

rr

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 = "442d5a34-530d-406e-864e-ba357bd1a3a9"; // 促销活动数据 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 == '83610a76-4fc9-4577-bf8d-8aef0a3d5930' && variant.id != this.variantId) { this.variantId = variant.id; this.getData(); } } getData() { const reqBody = { product_id: "83610a76-4fc9-4577-bf8d-8aef0a3d5930", product_type: "", 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);
$234
(Tax included)
Quantity

Description


Introducing the 234, a highly professional and rigorous product designed to meet your unique needs. With its impressive features and unparalleled performance, the 234 is the ultimate solution for anyone looking for a top-quality product that delivers exceptional results. Its advanced technology allows for seamless integration into your workflow, ensuring that you can maximize your productivity and achieve your goals with ease.

The 234 boasts an impressive array of features including 12 distinct functionalities that make it stand out from the rest. Whether you're looking for a powerful tool to streamline your processes or simply want a reliable and efficient solution for your day-to-day tasks, the 234 has everything you need. With its robust design, you can rest easy knowing that your investment is protected and that you're getting the best possible value for your money.

So why wait? Invest in the 234 today and experience the ultimate in performance and reliability. With its unparalleled features and cutting-edge technology, the 234 is the perfect solution for anyone looking to take their productivity to the next level. So don't miss out - get your hands on the 234 today and start achieving your goals like never before!

新增