Single Cold Vegetable Basin Faucet Round Vertical Vegetable Sink Faucet Sink Kitchen Faucet Washbasin Booster Faucet
Single Cold Vegetable Basin Faucet Round Vertical Vegetable Sink Faucet Sink Kitchen Faucet Washbasin Booster Faucet
${function() {
const variantData = data.variant || {"id":"3ecfabae-641e-43e0-8bcd-edd5c0f53d14","product_id":"cac3a6e9-c0ee-4e8a-8090-d1e72649caf2","title":"Round vertical single cold vegetable basin faucet","weight_unit":"kg","inventory_quantity":0,"sku":"-Round vertical single cold vegetable basin faucet-A001016","barcode":"","position":1,"option1":"Round vertical single cold vegetable basin faucet","option2":"","option3":"","note":"","image":{"src":"\/\/img.staticdj.com\/af59abb5997cbf5ee679409af0b6108f.jpeg","path":"af59abb5997cbf5ee679409af0b6108f.jpeg","width":802,"height":800,"alt":"","aspect_ratio":1.0025},"wholesale_price":[{"price":16,"min_quantity":1}],"weight":"0","compare_at_price":"0","price":"16","retail_price":"0","available":true,"url":"\/products\/single-cold-vegetable-basin-faucet-round-vertical-vegetable-sink-faucet-sink-kitchen-faucet-washbasin-booster-faucet?variant=3ecfabae-641e-43e0-8bcd-edd5c0f53d14","available_quantity":999999999,"options":[{"name":"Specifications","value":"Round vertical single cold vegetable basin faucet"}],"off_ratio":"0","flashsale_info":{"variant_id":"3ecfabae-641e-43e0-8bcd-edd5c0f53d14","product_id":"","quantity":0,"discount_id":"","limit_time":0,"limit_buy":0,"user_limit_buy":0,"discount_sales":0,"discount_sales_rate":"","discount_stock":0,"ends_at":0,"starts_at":0,"allow_oversold":"","allocation_method":"","price":"16","compare_at_price":"","discount_price":"16","customary_saved_price":"","customary_off_ratio":"","discount_saved_price":"","discount_off_ratio":"0","use_before_price":false,"before_price":"","title":"","properties":"","color_setting_promotional_copy":"","discount_quantity":0,"is_need_split":false},"sales":0};
const saveType = null;
const productSaveLabel = null;
return `
-
${ variantData.off_ratio }%
`; }()}
${function() {
const minInventory = parseInt('7');
const maxInventory = parseInt('10');
const randomInventory = Math.round(Math.random() * (maxInventory - minInventory)) + minInventory;
const customText = "Only {stock} item(s) left in stock!".replace(/\{stock\}/g, '' + randomInventory + '');
const barWidth = (randomInventory / maxInventory) * 100 + '%';
return `
`;
}()}
people are viewing this right now
Product was out of stock.
Enjoy free shipping on every order, delivered to your doorstep no matter where you are in the world.
Shop with confidence with our hassle-free returns policy, ensuring you love what you buy.
Designed with the planet in mind, all our products are committed to sustainable practices.
Your payment information is always protected with our advanced, encrypted checkout security.
Sku :
-Round vertical single cold vegetable basin faucet-A001016
Inventory :
999999999
${function(){
const variantData = data.variant || {"id":"3ecfabae-641e-43e0-8bcd-edd5c0f53d14","product_id":"cac3a6e9-c0ee-4e8a-8090-d1e72649caf2","title":"Round vertical single cold vegetable basin faucet","weight_unit":"kg","inventory_quantity":0,"sku":"-Round vertical single cold vegetable basin faucet-A001016","barcode":"","position":1,"option1":"Round vertical single cold vegetable basin faucet","option2":"","option3":"","note":"","image":{"src":"\/\/img.staticdj.com\/af59abb5997cbf5ee679409af0b6108f.jpeg","path":"af59abb5997cbf5ee679409af0b6108f.jpeg","width":802,"height":800,"alt":"","aspect_ratio":1.0025},"wholesale_price":[{"price":16,"min_quantity":1}],"weight":"0","compare_at_price":"0","price":"16","retail_price":"0","available":true,"url":"\/products\/single-cold-vegetable-basin-faucet-round-vertical-vegetable-sink-faucet-sink-kitchen-faucet-washbasin-booster-faucet?variant=3ecfabae-641e-43e0-8bcd-edd5c0f53d14","available_quantity":999999999,"options":[{"name":"Specifications","value":"Round vertical single cold vegetable basin faucet"}],"off_ratio":"0","flashsale_info":{"variant_id":"3ecfabae-641e-43e0-8bcd-edd5c0f53d14","product_id":"","quantity":0,"discount_id":"","limit_time":0,"limit_buy":0,"user_limit_buy":0,"discount_sales":0,"discount_sales_rate":"","discount_stock":0,"ends_at":0,"starts_at":0,"allow_oversold":"","allocation_method":"","price":"16","compare_at_price":"","discount_price":"16","customary_saved_price":"","customary_off_ratio":"","discount_saved_price":"","discount_off_ratio":"0","use_before_price":false,"before_price":"","title":"","properties":"","color_setting_promotional_copy":"","discount_quantity":0,"is_need_split":false},"sales":0};
return `
Sku :
${variantData && variantData.sku}
Inventory :
${variantData && variantData.available_quantity}
` }()}
${function(){
const isRTL = originData.isRTL;
const isMobile = originData.isMobile;
const inProductDetail = originData.inProductDetail;
if (!inProductDetail) {
return `
Flash sale cannot be displayed here. Please move it to the product detail area.
(This prompt will not be displayed on the client-side)
`;
}
const flashsaleData = originData.flashsaleData;
const image_domain = originData.image_domain;
const discount_info = flashsaleData.discount_info;
const setting = flashsaleData.product_setting;
if (!discount_info || !setting) return ``;
// 本地跳转判定(不依赖全局 appDiscountUtils,模板沙箱不可见)
// is_redirection 开启即可跳(landing 兜底);link 非法时退回 landing
const __canRedirect = (s) => !!(s && s.is_redirection);
const displayType = setting.display_type;
const banner = setting.banner;
const productDisplay = setting.product_display;
const bannerConfig = JSON.parse(banner.config);
const productDisplayConfig = JSON.parse(productDisplay.config);
const colorConfig = productDisplayConfig.color;
const countdownConfig = productDisplayConfig.countdown;
let titleIcon = ``;
let bgImg = ``;
const deg = `${isRTL ? -90 : 90}deg`;
const { banner_bg_start, banner_bg_end, banner_text } = colorConfig;
let bgStyle = `background: linear-gradient(${deg}, ${banner_bg_start} 0%, ${banner_bg_end} 100%);`;
let bannerColor = `color: ${banner_text};`
if (banner.type === "TYPE_CUSTOM") {
const { desktop, mobile, image_render } = bannerConfig;
const bgSize = image_render === "fill" ? "background-size: cover;background-position: center;" : "background-position: center;background-size: auto 100%;";
if (isMobile && mobile) {
bgStyle = `background: URL(${image_domain + mobile});${bgSize}`;
} else if (!isMobile && desktop) {
bgStyle = `background: URL(${image_domain + desktop});${bgSize}`;
}
} else {
if (banner.type === "TYPE_ONE") {
titleIcon = productDisplay.text ? `
` : "";
bgImg = ``
}
if (banner.type === "TYPE_TWO") {
titleIcon = productDisplay.text ? `
` : ""
}
}
const { sale_bar_background_color, progress_sale_bar_background_color_start, progress_sale_bar_background_color_end } = colorConfig;
const rate = discount_info.discount_sales_rate;
const progressBarStyle = `background: linear-gradient(${deg}, ${progress_sale_bar_background_color_start} 0%, ${progress_sale_bar_background_color_end} 100%);`;
const saleCount = productDisplay.sales_progress.format === "FORMAT_NUMBER" ? discount_info.discount_sales : `${rate}%`;
const progressBarDom = productDisplay.sales_progress.enabled && rate > 0 ? `
` : ``;
const { countdown_bg, countdown_text } = colorConfig;
const { end_opened, end_format } = countdownConfig;
const tempMap = {
"DD_SSS": "DD:HH:mm:ss:SSS",
"HH_SSS": "HH:mm:ss:SSS",
"DD_ss": "DD:HH:mm:ss",
"HH_ss": "HH:mm:ss"
}
const isShowDD = [tempMap.DD_SSS, tempMap.DD_ss].includes(end_format);
const isShowSSS = [tempMap.DD_SSS, tempMap.HH_SSS].includes(end_format);
const countdown = discount_info.ends_remaining_seconds;
const countdownDom = end_opened ? `
${function() {
if (banner.type === "TYPE_TWO") return `
`
return ``;
}()}
` : ``;
const flashSaleDesc = discount_info.limit_user_product_discount > -1 ? `
Promo products limited to ${discount_info.limit_user_product_discount} item per person
` : "";
return `
${bgImg}
${titleIcon}
${productDisplay.text}
${progressBarDom}
${countdownDom}
${flashSaleDesc}
`}()}
${function(){
const dd = data.dd; const hh = data.hh; const mm = data.mm; const ss = data.ss; const sss = data.SSS;
const hours = data.d * 24 + data.h;
return `
${dd}D
·
${hours}
${hh}
:
${mm}
:
${ss}
.
${sss}
`
}()}
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 = "3ecfabae-641e-43e0-8bcd-edd5c0f53d14";
// 促销活动数据
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");
const setting = this.flashsaleData.product_setting;
const landingUrl = `/promotions/discount-default/${this.flashsaleData.discount_info.id}`;
const finalUrl = appDiscountUtils.resolveDiscountHref(setting, landingUrl);
if (finalUrl && appDiscountUtils.inProductBody(this.element) && e.target !== cur) {
this.win.open(finalUrl, '_blank', 'noopener');
}
}
// 绑定
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 == 'cac3a6e9-c0ee-4e8a-8090-d1e72649caf2' && variant.id != this.variantId) {
this.variantId = variant.id;
this.getData();
}
}
getData() {
const reqBody = {
product_id: "cac3a6e9-c0ee-4e8a-8090-d1e72649caf2",
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);