|
|
/**
|
|
|
* Created by targaryen on 2016/11/28.
|
|
|
*/
|
|
|
var $ = require('yoho-jquery'),
|
|
|
tip = require('../plugin/tip');
|
|
|
require('product/bundle/detail.page.css');
|
|
|
|
|
|
require('../common');
|
|
|
let $ = require('yoho-jquery'),
|
|
|
tip = require('plugin/tip'),
|
|
|
Swiper = require('yoho-swiper');
|
|
|
|
|
|
var chosePanelRender = require('../common/chose-panel'),
|
|
|
chosePanel = require('./bundle/chose-pannel');
|
|
|
require('common');
|
|
|
let share = require('common/share');
|
|
|
|
|
|
var $selectBtn = $('.select-btn'),
|
|
|
let chosePanelRender = require('common/chose-panel'),
|
|
|
chosePanel = require('cart/chose-panel');
|
|
|
|
|
|
let $selectBtn = $('.select-btn'),
|
|
|
$buyNowBtn = $('#bundle-buy-now');
|
|
|
|
|
|
// cookie 参数
|
|
|
var actCkOpthn = {
|
|
|
let actCkOpthn = {
|
|
|
path: '/cart/index'
|
|
|
};
|
|
|
|
|
|
$(function() {
|
|
|
window.setCookie('activity-info', '', actCkOpthn);
|
|
|
if ($('#shareUrl').length) {
|
|
|
share({
|
|
|
imgUrl: $('#shareImgUrl').val(),
|
|
|
title: decodeURIComponent($('#shareTitle').val()),
|
|
|
link: $('#shareUrl').val(),
|
|
|
desc: decodeURIComponent($('#shareSubTitle').val())
|
|
|
});
|
|
|
}
|
|
|
if ($('.bundle-tabs').find('.swiper-slide').length > 3) {
|
|
|
new Swiper('.bundle-tabs', {
|
|
|
freeMode: true,
|
|
|
slidesPerView: 'auto',
|
|
|
lazyLoading: true
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
* 选择商品颜色等
|
|
|
*/
|
|
|
$selectBtn.on('touchend', function() {
|
|
|
var self = $(this);
|
|
|
let self = $(this);
|
|
|
|
|
|
$.post('/product/detail/info', {
|
|
|
id: self.data('id'),
|
|
|
productSkn: self.data('skn')
|
|
|
}, function(data) {
|
|
|
chosePanelRender(data);
|
|
|
chosePanel.init(self.data('skn'));
|
|
|
chosePanel.show();
|
|
|
chosePanel.init();
|
|
|
chosePanel.setBundleModeWithSknId(self.data('skn'));
|
|
|
chosePanel.show('', (productData) => {
|
|
|
var product = $('#gskn-' + productData.skn);
|
|
|
|
|
|
product.data('sku', productData.sku);
|
|
|
product.html('颜色:' + productData.color + ' 尺码:' + productData.size);
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$('.goods-img').on('touchend', function() {
|
|
|
var packGood = $(this).parent().find('.select-btn');
|
|
|
let packGood = $(this).parent().find('.select-btn');
|
|
|
|
|
|
if (window._yas && window._yas.sendCustomInfo) {
|
|
|
window._yas.sendCustomInfo({
|
...
|
...
|
@@ -54,11 +79,22 @@ $('.goods-img').on('touchend', function() { |
|
|
|
|
|
});
|
|
|
|
|
|
$('.bundle-tabs').on('click', '.swiper-slide', (e) => {
|
|
|
let $tab = $(e.currentTarget);
|
|
|
|
|
|
if ($tab.hasClass('selected')) {
|
|
|
return;
|
|
|
}
|
|
|
let href = $tab.data('href');
|
|
|
|
|
|
window.location.href = href;
|
|
|
});
|
|
|
|
|
|
/**
|
|
|
* 立即购买
|
|
|
*/
|
|
|
$buyNowBtn.on('click', function() {
|
|
|
var bundleGoods = [],
|
|
|
let bundleGoods = [],
|
|
|
bundleId = $('#activityId').val(),
|
|
|
gskn = $('span[id^="gskn"]'),
|
|
|
gsknSelected = false,
|
...
|
...
|
|