Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit
Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit

Ciciful Sailor Striped Slim Fit Stretchy Crop Top Shorts Costume Suit

SKU: K580946677696159744
Price
$49.99
$31.99
Save  36%
Color
Please select a color
Size
Please select a size
Quantity
Visible only when the product is out of stock. Currently in preview mode.
Notify me when available
(function(){ function $(selector){ return document.querySelector(selector); } const EMAIL_REG = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; // 获取dom数据 const doms = { button: $('#app-arrival-reminder-button'), previewBox: $('#app-arrival-reminder-preview-box'), toast: $('#app-arrival-reminder-toast'), lightbox: $('#arrival-lightbox'), datalist: $('#app-arrival-reminder-email-list'), imgRender: $('#app-arrival-reminder-product-image-render'), productVariant: $('#app-arrival-reminder-product-variant'), emailInput: $('#app-arrival-reminder-form .reminder-email-input'), emailWarn: $('#app-arrival-reminder-form .reminder-email-warn-wrap'), emailWarnText: $('#app-arrival-reminder-form .reminder-email-warn-text'), submitButton: $('#app-arrival-reminder-submit-button') }; // 选中的sku数据 let selectedVariant = {"id":"90a8c945-8304-4e1c-b56e-21ff198b4883","product_id":"1fa6afb1-bd4c-44fb-80f7-5e855653600b","title":"Blue And White-S","weight_unit":"kg","inventory_quantity":929,"sku":"K580946677696159744","barcode":"","position":1,"option1":"Blue And White","option2":"S","option3":"","note":"","image":{"src":"\/\/img.staticdj.com\/67fd19ce96df1ea62861868ba3e3a2f2.jpeg","path":"67fd19ce96df1ea62861868ba3e3a2f2.jpeg","width":800,"height":1200,"alt":"","aspect_ratio":0.6666666666666666},"wholesale_price":[{"price":31.99,"min_quantity":1}],"weight":"0.07","compare_at_price":"49.99","price":"31.99","retail_price":"49.99","available":true,"url":"\/products\/ciciful-sailor-striped-slim-fit-stretchy-crop-top-shorts-costume-suit?variant=90a8c945-8304-4e1c-b56e-21ff198b4883","available_quantity":929,"options":[{"name":"Color","value":"Blue And White"},{"name":"Size","value":"S"}],"off_ratio":36,"flashsale_info":[],"sales":568}; // 上报 function reportData(params){ // 编辑/预览不上报 if(false){ return; } window.sa.track(params.event_name, { business_type: 'product_plugin', function_name: 'Back_in_Stock', plugin_name: "Back_in_Stock", template_name: "product", template_type: 1, module: "apps", module_type: "Back_in_Stock", event_info: JSON.stringify({ action_type: 'Back_in_Stock' }), ...params }); } // 按钮曝光上报 function buttonPVReport(){ reportData({ event_name: 'function_expose', event_type: 'expose', event_desc: '无货商品时触发' }); } // 弹窗曝光上报 function popupPVReport(){ reportData({ event_name: 'function_expose', event_type: 'popup_expose', event_desc: '弹窗曝光时触发' }); } // submit按钮点击上报 function submitClickReport(){ reportData({ event_name: 'function_click', event_type: 'popup_click', event_desc: '填入邮箱之后,点击notify 触发', event_info: JSON.stringify({ action_type: 'email_click' }), }); } // -----------------------初始化----------------- init(); // 初始化操作 function init(){ // 为确保window有后面添加的值例如window.sa 需要在DOMContentLoaded回调事件中执行逻辑 document.addEventListener("DOMContentLoaded", function() { // 设置邮件联想 setDataList(); if(!true){ // 初始无货 按钮pv事件埋点上报 buttonPVReport(); } }); } // 设置邮件联想 function setDataList(){ const customer_email = window.C_SETTINGS.customer.customer_email; if(customer_email){ const options = document.createElement('option'); options.setAttribute('value', customer_email); doms.datalist.appendChild(options); } } // -----------------------事件操作---------------- // 监听sku变化事件 document.addEventListener('dj.variantChange', variantChange); // 监听提醒按钮点击事件 doms.button.addEventListener('click', reminderButtonClick); // 监听提交按钮点击事件 doms.submitButton.addEventListener('click', submit); // 监听input元素的keydown事件 doms.emailInput.addEventListener('keydown', function(e) { // 判断是否按下了Enter键 if (e.keyCode === 13 || e.key === 'Enter') { submit(); } }); // 显示正常按钮 function showReminderButton(){ doms.button.classList.remove('app-arrival-hidden'); doms.previewBox.classList.add('app-arrival-preview-hidden'); buttonPVReport(); } // 展示预览按钮 function showPreviewButton(){ doms.button.classList.remove('app-arrival-hidden'); doms.previewBox.classList.remove('app-arrival-preview-hidden'); } // 隐藏按钮 function hiddenReminderButton(){ doms.button.classList.add('app-arrival-hidden'); doms.previewBox.classList.add('app-arrival-preview-hidden'); } // 提交数据, 请求接口 function submit(){ // 获取邮箱数据 const email = doms.emailInput.value.trim(); if(!email){ doms.emailWarnText.innerText = "Please enter your email address"; doms.emailWarn.classList.remove('app-arrival-hidden'); return; } if(!EMAIL_REG.test(email)){ doms.emailWarnText.innerText = "Please enter a valid email address"; doms.emailWarn.classList.remove('app-arrival-hidden'); return; } // 邮箱校验成功 doms.emailWarn.classList.add('app-arrival-hidden'); // 预览时不调接口 if(false){ SPZ.whenApiDefined(doms.toast).then(apis => { apis.showToast("Currently in preview mode, subscription is for testing only", 3000); }); return; } // 加入loading样式 doms.submitButton.classList.add('reminder-submit-button-loading'); // 提交数据请求接口 let quantity = 1; const quantityDom = $('#app-arrival-reminder-quantity-render ljs-quantity'); if(quantityDom){ quantity = Number(quantityDom.getAttribute('value')) || 1; } const params = { customer_email: email, product_num: quantity, product_id: selectedVariant.product_id, product_variant_id: selectedVariant.id }; fetch(`${window.C_SETTINGS.routes.root}/api/front/gobbler/v1/subscribe`, { method: 'POST', body: JSON.stringify(params), headers: { 'Content-Type': 'application/json' } }).then((res)=>res.json()).then((res)=>{ /* 后端错误提示 */ if(res.errors && res.errors.length){ SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast(res.errors[0], 3000); }); return; } /* code * 0 SUCCESS 订阅成功 * 1 PRODUCT_OFFLINE 商品下架 * 2 INVENTORY_NOT_EMPTY 商品库存不为空 * 3 REPEAT_SUBSCRIBE 重复订阅 * 4 EMAIL_EMPTY 邮件为空 * 5 EMAIL_WRONG_FORMAT 邮件格式错误 * 99999 INVALID_PARAMS 其他参数错误 */ const codeMap = { SUCCESS: ()=>{ SPZ.whenApiDefined(doms.lightbox).then(apis=>{ apis.close(); }); SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("Thank you for your subscription! We will notify you as soon as the product is back in stock!", 3000); }); }, INVENTORY_NOT_EMPTY: ()=>{ SPZ.whenApiDefined(doms.lightbox).then(apis=>{ apis.close(); }); SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("Subscription failed. Product back in stock, please proceed to checkout.", 3000); }); setTimeout(()=>{ window.location.reload(); }, 3000); }, REPEAT_SUBSCRIBE: ()=>{ SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("You've already subscribed to this product. We'll let you know as soon as it's back in stock. Feel free to explore our other products.", 3000); }); }, EMAIL_EMPTY: ()=>{ SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("Please enter your email address", 3000); }); }, EMAIL_WRONG_FORMAT: ()=>{ SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("Please enter a valid email address", 3000); }); } }; codeMap.PRODUCT_OFFLINE = codeMap.SUCCESS; codeMap[res.code] && codeMap[res.code](); }).finally(()=>{ doms.submitButton.classList.remove('reminder-submit-button-loading'); }); // submit点击上报 submitClickReport(); } // 重新渲染dialog function refreshRenderDialog(){ console.log('selectedVariant', selectedVariant); const images = selectedVariant.image || {"src":"\/\/img.staticdj.com\/67fd19ce96df1ea62861868ba3e3a2f2.jpeg","path":"67fd19ce96df1ea62861868ba3e3a2f2.jpeg","width":800,"height":1200,"alt":"","aspect_ratio":0.6666666666666666}; const imagePosition = images.aspect_ratio > 1 ? 'left top' : 'center center'; // 重新渲染图片 SPZ.whenApiDefined(doms.imgRender).then((apis)=>{ apis.render({ images, imagePosition }); }); // 邮件错误提示置空 doms.emailWarn.classList.add('app-arrival-hidden'); // 重新渲染款式说明 if(selectedVariant.title){ doms.productVariant.innerText = selectedVariant.title.split('-').join('/'); } // 表单数据置空 doms.emailInput.value = ''; } // sku变化 单一款式不会触发 function variantChange(e){ const selected = e.detail.selected; // 子款式没变不执行操作 例如数量变化 if(selected.id === selectedVariant.id){ return; } selectedVariant = selected; console.log('selectedVariant', selectedVariant); // 数量变化 if(selected.available || selected.product_id === undefined){ // 有库存 编辑时展示预览按钮 否则隐藏按钮 if(false){ showPreviewButton(); }else { hiddenReminderButton(); } }else{ // 无库存 显示正常按钮 showReminderButton(); } } // 提醒按钮点击 function reminderButtonClick(){ refreshRenderDialog(); // 弹窗曝光上报 popupPVReport(); } document.body.appendChild(doms.toast); document.body.appendChild(doms.lightbox.parentElement); })();
Free Worldwide Shipping Orders $89
Easy Returns - 30 Days Warranty
24 Hours Response
Secure Payments
        • Step into nautical-inspired fashion with this two-piece set! 🚢💙 The retro sailor collar adds a touch of nautical charm and classic style, while the stylish stripe pattern creates a timeless look. Made from stretchy and comfortable material, this set ensures a flawless fit. Pair it with sneakers for a trendy and summery ensemble.

          The item is in stock and will be shipped in 24 hours at the latest.

          FABRIC & CARE

          Outer Material: Knit, 95% polyester 5% spandex
        • Lined Fabric: NO
      • Cares: Machine Wash
          • DETAILS

            • Style:                                     
              Festival
            • Elasticity:
              High Elasticity
            • Type: 
              Set(With Tie)
            • Color:
              Blue And White
            • Sleeve Length:
              Short Sleeve
            • Applicable: 
              Festival
            • Appropriate Season: 
              Summer
          • Tips: Due to the many variations in monitors, the color in the image could look slightly different, please take physical design and color shall prevail.

Where can Ciciful deliver the package to?

 

Ciciful can ship to most countries in the world, covering North and South America, Europe, United Kingdom, Asia, Africa, Oceania, and more, over 200 countries & regions.

Countries not shipped to include:

Aland Island, Ascension, Azores, Balearic Islands, Bouvet Island, Caroline Islands, China Mainland, Eritrea, Northern Mariana Islands, Somalia, Somaliland, Spanish Territories Of N.Africa, Yemen, YUGOSLAVIA, Zaire.

  • Global
ZONE SHIPPING METHOD PROCESSING TIME DELIVERY TIME ORDERS KILOGRAMS SHIPPING FEE
Global Standard 3-8 Business Days 10-15 Business Days 0-$88.99 No limit $9.99 
Global Standard 3-8 Business Days 10-15 Business Days over $89 No limit Free

 

How does Ciciful ship your order?

 

After placing an order, you will receive a product information confirmation e-mail;

After the payment, you will receive a successful payment confirmation e-mail;

After the order is shipped, you will receive a shipping information confirmation e-mail, contains tracking number, you can check the shipping state with the tracking number in https://www.17track.net/en or http://www.track718.com/en

.

 

What shipping methods are offered? And how long does it take to ship?

 

The total time it takes to receive your parcel is described as below:

Total delivery time = Processing Time + Shipping Time

Processing time = the time between when you place an order and when we ship it;

Shipping time = the time between when your order has been shipped and delivered to you;

Processing time: within 3-8 business days

The time it takes to prepare your items to ship from our warehouse. This includes preparing your items, performing quality checks, and packing for shipment.

Shipping time:

Due to COVID-19, transportation has been restricted, which affects our ability to deliver products as quickly and efficiently as we do during normal times, international deliveries may take longer than usual.

Ciciful has partnered with major international shipping companies including but not limited to DHL, UPS, FedEx, IB, and EMS to offer three shipping methods. The following is the shipping method and corresponding shipping time:

Expedited Shipping: 5-7 business days

Standard Shipping: 10-15 business days

Flat Rate Shipping: 15-30 business days

 

What is customs tax?

 

Taxes apply for imported goods/services and is regulated by the country law. cicful is not responsible for any tax charged on its products. The amount of customs taxes are depend on policies and tax rates applied per country. Please contact local customs for clear information.

 

Important Notes:

 

1. Certain items are prohibited by some shipping carriers. If your order contains these items for the shipping carrier you selected, we will re-route your order via another carrier to ensure it arrives safely. This may require additional shipping time.

2. All estimated/typical delivery time are derived from real world data collected from past orders. They are approximate times for reference only.

3. Annual Chinese Public Holidays:

Chinese Lunar New Year (usually in February)

Labor Day (1st May to 3st May every year)

Chinese National Day (1st Oct to 7st Oct every year)

Please note that all delivery times will be affected during these times of year as the service from all our suppliers and logistics operators will be disrupted. There is often a delay of 3-4 days and sometimes even longer. We sincerely apologize for any delays caused during these periods and kindly ask our customers to be patient.

4. cicful ships all packages from our warehouse and distribution center.

Refund Policy

At ciciful.com, customer satisfaction is always our top priority. We want you to be completely satisfied with your purchase.

If for any reason you are unhappy, please contact Ciciful support at  support@ciciful.com

Welcome to ciciful.com. We pride ourselves in our product quality with strict quality control checks in place, but to provide you with maximum peace of mind, we offer a comprehensive 30 Day Returns Warranty. Buy with confidence and Enjoy a great shopping experience at Ciciful! Satisfaction guaranteed.

Cancel & Refund

Order Status Reasons for Refund Request Requirements and Notice Solution
Before shipment 1. Forget to buy sth.
2. Buy the Wrong thing
3. Just don't want it anymore
Apply cancel orders within 24 hours 100% order amount
Apply cancel orders OVER 24 hours 95% of the order amount(deduct 5% processing fee)
Pre order Failed Customer service team will contact you for solutions Customer service team will contact you for solutions
Received Lack of Items
Package Broken
Quality Issues
1. Apply within 30 Days after delivery

2. Order ID

3. Clear Photos of this item

4. Brief description about the problems of the items
Contact Customer Service Team via support@ciciful.com
Unhappy about the Clothes

Return Procedure

1. Take a clear photo of the item.
2. Contact our customer service team via support@ciciful.com.
3. Send the photos and order ID to the customer service team and tell them about your problems and the resolution you prefer. Return? Refund? Exchange? Resend?
4. The customer service team will send you the address of Ciciful's International Center, please do not send the package back to where it came from, or it would delay your refund procedure.
5. Call the post office to arrange a collection or drop off at your nearest post office.
6. Notify us the tracking number after you have returned the item(s).
7. All the exchanges or refunds will be processed within 2 working days once we have received the item(s)

NOTICE

1. The Package must be restored to the unopened state
2. Returned items must be returned in original product packaging.
3. Returned items must have no visible signs of wear or use.
4. Items returned without authorization will not be accepted.
5. The returned package must be printed and accompanied by an RMA slip.
6. The package must be sent to the address that Ciciful offers by email.
7. Customer is responsible for all return charges.
8. The original shipping fee and insurance are non-refundable.
9. The following items cannot be returned or exchanged: stockings, bodysuits, lingerie, jewelry, beauty products, underwear, event and party supplies
10. No exchange or return or amendments on promotional items or last-chance items.
11. Customer should be responsible to the delivery problems caused by the wrong address.
12. We are only responsible for returns and refunds for products from Ciciful.


*For the below circumstances, we don't accept a refund request without return. But we can offer a coupon for your next order.

(However, we can offer a coupon for your next order, please contact our customer service for details.)

1. Don't like the item;
2. Not fit as expected without any quality problems;
3. Shipping status shows delivered but the buyer didn't received;
4. Differences/misunderstanding (on products/fabric) which has already been claimed in our description/title;
5. Placed the wrong order and shipped.

    Exchanges
    Sorry for the inconvenience, we currently do not offer exchanges. However, we will advance this part as soon as possible. Stay tuned.

    Please note:

    Please contact your local post office to confirm the actual return shipping fee. We recommend you use the cheapest registered airmail method that is available.


    *If you have any other questions, please feel free to get in touch with our customer service at support@ciciful.com

     

    class SpzSmartBlockComponent extends SPZ.BaseElement { constructor(element) { super(element); this.templates_ = null; this.container_ = null; this.i18n_ = {}; this.config_ = {}; this.show_type_ = 3; this.product_resource_id_ = ''; this.collection_resource_id_ = ''; this.cart_items_ = []; this.customer_id_ = ''; this.order_id_ = ''; } static deferredMount() { return false; } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } buildCallback() { const template_type = window.SHOPLAZZA.meta.page.template_type; if (template_type === 1) { this.show_type_ = 3; this.product_resource_id_ = window.SHOPLAZZA.meta.page.resource_id; } else if (template_type === 2) { this.show_type_ = 4; this.collection_resource_id_ = window.SHOPLAZZA.meta.page.resource_id; } else if (template_type === 15){ this.show_type_ = 5; } else if (template_type === 13){ this.show_type_ = 6; } else if (template_type === 20){ this.show_type_ = 7; this.customer_id_ = window.SHOPLAZZA.customer.customer_id; } else if (template_type === 35){ this.show_type_ = 8; this.order_id_ = window.location.pathname.split('/').pop(); } this.templates_ = SPZServices.templatesForDoc(this.element); this.setAction_(); } mountCallback() { console.log('smart mounted'); const that = this; const themeName = window.SHOPLAZZA.theme.merchant_theme_name; const isGeek = /Geek/.test(themeName); this.fetchRules().then((res) => { if (res && res.rules && res.rules.length) { const blockEl = document.getElementById('smart_recommend_block'); SPZ.whenApiDefined(blockEl).then((api) => { api.render({data: res}, true).then(() => { if (isGeek && that.show_type_ === 6) { blockEl.querySelector('.plugin_container_wrpper').style.padding = '30px 0'; } const recommendStyle = document.createElement('style'); recommendStyle.innerHTML = ` .plugin__recommend_container,.app-recommend-card { display: none !important; } `; document.head.appendChild(recommendStyle); const fetchList = []; res.rules.forEach((rule) => { fetchList.push(this.fetchRuleProductList(rule.id)); }); const fetchAll = Promise.all(fetchList); fetchAll.then((p_res) => { res.rules.forEach((rule, index) => { rule.products = p_res[index] && p_res[index].products; const ruleEl = document.getElementById('smart_recommend_rule_' + rule.id); SPZ.whenApiDefined(ruleEl).then((api) => { api.render({data: rule}, true).then(() => { that.impressListen(`#smart_recommend_rule_ul_${rule.id}`, function(){ that.trackRuleImpress(rule); }); const btnElList = document.querySelectorAll(`#smart_recommend_rule_ul_${rule.id} button`); btnElList.forEach((btnEl) => { if (btnEl && rule.config && rule.config.quick_shop_button_bg_color && rule.config.quick_shop_button_text_color) { btnEl.style.backgroundColor = rule.config.quick_shop_button_bg_color; btnEl.style.color = rule.config.quick_shop_button_text_color; } }) }); }); }); }); }) }) } else { if (window.top !== window.self) { const template_type = window.SHOPLAZZA.meta.page.template_type; const holderEl = document.getElementById('smart_recommend_preview_no_data_placeholder'); SPZ.whenApiDefined(holderEl).then((api) => { api.render({data: { isCart: template_type === 13, isCollection: template_type === 2, isProduct: template_type === 1, isIndex: template_type === 15 }}, true); }); } } }); } setAction_() { this.registerAction('quickShop', (data) => { const that = this; const product_id = data.args.product_id; const productIndex = data.args.productIndex; const rule_id = data.args.rule_id; const ssp = data.args.ssp; const scm = data.args.scm; const cfb = data.args.cfb; const ifb = data.args.ifb; const modalRender = document.getElementById('smart_recommend_product_modal_render'); if (product_id) { this.fetchProductData(product_id).then((res) => { const product = res.products && res.products.length && res.products[0] || {}; product.cfb = cfb; product.ifb = ifb; SPZ.whenApiDefined(modalRender).then((api) => { api.render({product: product, productIndex: productIndex, rule_id: rule_id, ssp: ssp, scm: scm, show_type: that.show_type_}, true).then(() => { const modalEl = document.getElementById('smart_recommend_product_modal'); SPZ.whenApiDefined(modalEl).then((modal) => { that.impressListen('#smart_recommend_product_modal', function(){ that.trackQuickShop({ rule_id: rule_id, product_id: product_id }); }); modal.open(); }); const formEl = document.getElementById('smart_recommend_product_form'); SPZ.whenApiDefined(formEl).then((form) => { form.setProduct(product); }); const variantEl = document.getElementById('smart_recommend_product_variants'); SPZ.whenApiDefined(variantEl).then((variant) => { variant.handleRender(product); }); }); }) }); } }); this.registerAction('handleScroll', (data) => { this.directTo(data.args.rule_id, data.args.direction); }); this.registerAction('handleProductChange', (data) => { const variant = data.args.data.variant; const product = data.args.data.product; const imageRenderEl = document.getElementById('smart_recommend_product_image'); SPZ.whenApiDefined(imageRenderEl).then((api) => { api.render({ variant: variant, product: product }, true); }); }); this.registerAction('handleAtcSuccess', (detail) => { const data = detail.args; data.data.product = data.data.product || {}; data.data.variant = data.data.variant || {}; const product_id = data.data.product.id; const product_title = data.data.product.title; const variant_id = data.data.variant.id; const price = data.data.variant.price; const rule_id = data.rule_id; const aid = `smart_recommend.${this.show_type_}.${rule_id}`; const ifb = data.data.product.ifb; const cfb = data.data.product.cfb; const ssp = data.ssp; const scm = data.scm; const spm = `smart_recommend_${this.show_type_}.${data.spmIndex}`; const params = { id: product_id, product_id: product_id, number: 1, name: product_title, variant_id: variant_id, childrenId: variant_id, item_price: price, source: 'add_to_cart', _extra: { aid: aid, ifb: ifb, cfb: cfb, scm: scm, spm: `..${window.SHOPLAZZA.meta.page.template_name}.${spm}`, ssp: ssp, } }; this.tranckAddToCart(params); }); this.registerAction('addATCHook', (data) => { const params = data.args; const spm = `smart_recommend_${this.show_type_}.${params.spmIndex}`; this.myInterceptor_ = window.djInterceptors && window.djInterceptors.track.use({ event: 'dj.addToCart', params: { aid: `smart_recommend.${this.show_type_}.` + params.rule_id, ssp: params.ssp, scm: params.scm, cfb: params.cfb, spm: `..${window.SHOPLAZZA.meta.page.template_name}.${spm}`, }, once: true }); }); } tranckAddToCart(detail) { if (window.$) { window.$(document.body).trigger('dj.addToCart', detail); } } fetchRules() { const payload = { show_type: this.show_type_, }; let that = this; if (this.show_type_ === 6) { let line_items = []; return this.fetchCart().then((res) => { if (res && res.cart && res.cart.line_items) { line_items = res.cart.line_items.map((item) => { return { product_id: item.product_id, variant_id: item.variant_id, quantity: item.quantity, price: item.price } }); } payload.line_items = line_items; that.cart_items_ = line_items; return that.fetchRulesRequest(payload); }); } else { if (this.show_type_ === 3) { payload.line_items = [{ product_id: this.product_resource_id_ }]; } else if (this.show_type_ === 4) { payload.collection_id = this.collection_resource_id_; } else if (this.show_type_ === 7) { payload.customer_id = this.customer_id_; } else if (this.show_type_ === 8) { payload.order_id = this.order_id_; } return this.fetchRulesRequest(payload); } } fetchRulesRequest(payload) { return fetch(window.SHOPLAZZA.routes.root + "/api/possum/recommend_query", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }).then(function(res){ if(res.ok){ return res.json(); } }); } fetchCart() { return fetch(`/api/cart/cart-select?r=${Math.random().toString(36).slice(-4)}`) .then((res) => { if (res.ok) { return res.json(); } }); } fetchRuleProductList(rule_id) { const payload = { page: 1, limit: 100, fields: ["title", "url", "image", "min_price_variant.price", "min_price_variant.compare_at_price"], rule_id: rule_id, }; if (this.show_type_ === 3) { payload.line_items = [{ product_id: this.product_resource_id_ }]; } else if (this.show_type_ === 4) { payload.collection_id = this.collection_resource_id_; } else if (this.show_type_ === 6) { payload.line_items = this.cart_items_; } else if (this.show_type_ === 7) { payload.customer_id = this.customer_id_; } else if (this.show_type_ === 8) { payload.order_id = this.order_id_; } return fetch(window.SHOPLAZZA.routes.root + "/api/possum/recommend_products", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }).then(function(res){ if(res.ok){ return res.json(); } }).catch(function(err){ console.log(err); }); } fetchProductData(product_id) { return fetch(window.SHOPLAZZA.routes.root + "/api/possum/products", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ product_ids: [product_id], fields: [ "images", "options", "min_price_variant", "variants"] }) }).then(function(res){ if(res.ok){ return res.json(); } }).catch(function(err){ console.log(err); const loadingEl = document.getElementById('smart_recommend_loading'); if (loadingEl) { loadingEl.style.display = 'none'; } }); } getStyle(ele, style) { if (!ele) return; if (window.getComputedStyle) { return window.getComputedStyle(ele)[style]; } return ele.currentStyle[style]; } directTo(id, direction) { const scrollElement = document.getElementById(`smart_recommend_rule_ul_${id}`); const blockWidth = parseInt(this.getStyle(scrollElement, 'width')); const scrollLength = (blockWidth * 0.19 - 12) * 5; const scrollPoint = scrollElement.scrollWidth - scrollElement.clientWidth; if (!scrollElement) return; if (direction === 'left') { if (document.dir === 'rtl') { scrollElement.scrollTo({ left: Math.abs(scrollElement.scrollLeft) >= scrollPoint - 100 ? 0 : scrollElement.scrollLeft - scrollLength, behavior: 'smooth' }); return; } scrollElement.scrollTo({ left: Math.max(scrollElement.scrollLeft - scrollLength, 0), behavior: 'smooth' }); } else { if (document.dir === 'rtl') { scrollElement.scrollTo({ left: Math.abs(scrollElement.scrollLeft) >= scrollPoint + 100 ? 0 : scrollElement.scrollLeft + scrollLength, behavior: 'smooth' }); return; } scrollElement.scrollTo({ left: scrollElement.scrollLeft >= scrollPoint - 100 ? 0 : scrollElement.scrollLeft + scrollLength, behavior: 'smooth' }); } } trackRuleImpress(rule) { if (window.sa && window.sa.track) { window.sa.track("plugin_common", { plugin_name: "upsell", event_type: "impressions", rule_id: rule.id, ssp: rule.ssp, scm: rule.scm, show_type: this.show_type_, support_app_block: window.SHOPLAZZA.theme.support_app_block }); window.sa.track("module_impressions", { aid: `smart_recommend.${this.show_type_}.${rule.id}`, support_app_block: window.SHOPLAZZA.theme.support_app_block }); } } trackQuickShop(data) { window.sa && sa.track && sa.track("plugin_common", { plugin_name: "upsell", event_type: "quick_shop", rule_id: data.rule_id, product_id: data.product_id, show_type: this.show_type_, }); } impressListen(selector, cb) { const el = document.querySelector(selector); const onImpress = (e) => { if (e) { e.stopPropagation(); } cb(); }; if (el && !el.getAttribute('imprsd')) { el.addEventListener('impress', onImpress) } else if (el) { onImpress(); } } } SPZ.defineElement('spz-custom-smart-block', SpzSmartBlockComponent);