|
|
require('product/detail/detail.page.css');
|
|
|
var $ = require('yoho-jquery');
|
|
|
var productId = $('#productId').val();
|
|
|
var goodsId = $('#goodsId').val();
|
|
|
var productSkn = $('#productSkn').val();
|
|
|
var brandId = $('#brand-id').val();
|
|
|
var bundleType = $('#bundleType').val();
|
|
|
let $ = require('yoho-jquery');
|
|
|
let productId = $('#productId').val();
|
|
|
let goodsId = $('#goodsId').val();
|
|
|
let productSkn = $('#productSkn').val();
|
|
|
let brandId = $('#brand-id').val();
|
|
|
let bundleType = $('#bundleType').val();
|
|
|
|
|
|
require('../common');
|
|
|
|
...
|
...
|
@@ -20,10 +20,10 @@ require('./detail/recommend-for-you-product-desc'); |
|
|
window.rePosFooter && window.rePosFooter();
|
|
|
|
|
|
setTimeout(() => {
|
|
|
var Swiper = require('yoho-swiper');
|
|
|
let Swiper = require('yoho-swiper');
|
|
|
|
|
|
// 顶部swiper
|
|
|
var swiper = new Swiper('.banner-swiper', {
|
|
|
let swiper = new Swiper('.banner-swiper', {
|
|
|
preloadImages: false,
|
|
|
lazyLoading: true,
|
|
|
lazyLoadingInPrevNext: true,
|
...
|
...
|
@@ -52,7 +52,7 @@ setTimeout(() => { |
|
|
return;
|
|
|
}
|
|
|
|
|
|
var dbClass = 'data-bind',
|
|
|
let dbClass = 'data-bind',
|
|
|
infoDataHbs = require('product/detail/infodata.hbs'),
|
|
|
priceDataHbs = require('product/detail/pricedata.hbs');
|
|
|
|
...
|
...
|
@@ -84,7 +84,7 @@ setTimeout(() => { |
|
|
|
|
|
if (data.isDepositAdvance === 'Y') {
|
|
|
// 定金预售商品
|
|
|
var tip = require('../plugin/tip');
|
|
|
let tip = require('../plugin/tip');
|
|
|
|
|
|
setTimeout(function() {
|
|
|
$('#addtoCart').text('立即购买').off('touchstart').on('touchstart', function() {
|
...
|
...
|
@@ -108,13 +108,13 @@ setTimeout(() => { |
|
|
},
|
|
|
success: (data) => {
|
|
|
// 如果当前是秒杀商品,且不在秒杀路径下,跳到该商品的秒杀详情页
|
|
|
var reg = /\/product\/show_([\d]+)/;
|
|
|
var regPro = /\/product\/pro_([\d]+)_([\d]+)/;
|
|
|
var regSeckill = /\/product\/seckill/;
|
|
|
let reg = /\/product\/show_([\d]+)/;
|
|
|
let regPro = /\/product\/pro_([\d]+)_([\d]+)/;
|
|
|
let regSeckill = /\/product\/seckill/;
|
|
|
|
|
|
// var regProSeckill = /\/product\/seckill\/pro_([\d]+)_([\d]+)/;
|
|
|
var thisHref = window.location.href;
|
|
|
var thisRefer = document.referrer;
|
|
|
// let regProSeckill = /\/product\/seckill\/pro_([\d]+)_([\d]+)/;
|
|
|
let thisHref = window.location.href;
|
|
|
let thisRefer = document.referrer;
|
|
|
|
|
|
if (!regSeckill.test(thisRefer)) {
|
|
|
if (data.isSecKill === 'Y' && (reg.test(thisHref) || regPro.test(thisHref))) {
|
...
|
...
|
@@ -134,8 +134,8 @@ setTimeout(() => { |
|
|
require('./detail/like');
|
|
|
|
|
|
// 设定购物bar
|
|
|
var $cartBar = $('.cart-bar');
|
|
|
var timer = setInterval(function() {
|
|
|
let $cartBar = $('.cart-bar');
|
|
|
let timer = setInterval(function() {
|
|
|
if ($cartBar) {
|
|
|
window.reMarginFooter('.cart-bar');
|
|
|
clearInterval(timer);
|
...
|
...
|
@@ -145,10 +145,37 @@ setTimeout(() => { |
|
|
}, 500);
|
|
|
|
|
|
// 限购
|
|
|
var dialog = require('../plugin/dialog');
|
|
|
let dialog = require('../plugin/dialog');
|
|
|
|
|
|
let chosePanel = require('common/chose-panel-new');
|
|
|
|
|
|
$('#addtoCart').on('touchstart', function() {
|
|
|
let productCode = $('#limitProductCode').val();
|
|
|
|
|
|
$('.cart-bar').hide();
|
|
|
// productCode && chosePanel.setLimitGoodModeWithSknId(productCode, productSkn);
|
|
|
chosePanel.show({
|
|
|
data: data,
|
|
|
buttonText: '加入购物车'
|
|
|
}).then(() => {
|
|
|
console.log('choice')
|
|
|
}, () => {
|
|
|
$('.cart-bar').show();
|
|
|
console.log('cancel')
|
|
|
});
|
|
|
|
|
|
// 统计代码:用于统计用户加入购物车的动作
|
|
|
if (window._yas && window._yas.sendCustomInfo) {
|
|
|
window._yas.sendCustomInfo({
|
|
|
pd: productId,
|
|
|
by: 1
|
|
|
}, true);
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
});
|
|
|
$('#limit-sale').on('touchend', function(e) {
|
|
|
var loginUrl = $('#loginUrl').val(),
|
|
|
let loginUrl = $('#loginUrl').val(),
|
|
|
time,
|
|
|
ifr;
|
|
|
|
...
|
...
|
@@ -163,7 +190,7 @@ setTimeout(() => { |
|
|
rightBtnText: '打开Yoho!Buy有货APP'
|
|
|
}
|
|
|
}, function() {
|
|
|
var appUrl = $('input[name="limitCodeUrl"]').val();
|
|
|
let appUrl = $('input[name="limitCodeUrl"]').val();
|
|
|
|
|
|
ifr = document.createElement('iframe');
|
|
|
ifr.src = appUrl;
|
...
|
...
|
@@ -202,15 +229,15 @@ setTimeout(() => { |
|
|
*/
|
|
|
+ (function(skn, productId, brandId) { // eslint-disable-line
|
|
|
// 模版: 促销, feedback, 店铺
|
|
|
var promotionT = require('product/detail/promotion.hbs');
|
|
|
var feedbackT = require('product/detail/feedbacks.hbs');
|
|
|
var enterStoreT = require('product/detail/enterStore.hbs');
|
|
|
var bundleT = require('product/detail/bundle.hbs');
|
|
|
let promotionT = require('product/detail/promotion.hbs');
|
|
|
let feedbackT = require('product/detail/feedbacks.hbs');
|
|
|
let enterStoreT = require('product/detail/enterStore.hbs');
|
|
|
let bundleT = require('product/detail/bundle.hbs');
|
|
|
|
|
|
// placeholder
|
|
|
var $feedbackStore = $('#placeholder-feedback-store');
|
|
|
var $promotion = $('#placeholder-promotion');
|
|
|
var $bundle = $('#placeholder-bundle');
|
|
|
let $feedbackStore = $('#placeholder-feedback-store');
|
|
|
let $promotion = $('#placeholder-promotion');
|
|
|
let $bundle = $('#placeholder-bundle');
|
|
|
|
|
|
/**
|
|
|
* 渲染 feedback, 店铺, 替换placeholder
|
...
|
...
|
@@ -221,11 +248,11 @@ setTimeout(() => { |
|
|
* @param $placeholder
|
|
|
*/
|
|
|
function renderFeedbackStore(data, $placeholder) {
|
|
|
var feedbackHtml = feedbackT({
|
|
|
let feedbackHtml = feedbackT({
|
|
|
feedbacks: data.feedbacks
|
|
|
});
|
|
|
|
|
|
var enterStoreHtml = enterStoreT({
|
|
|
let enterStoreHtml = enterStoreT({
|
|
|
enterStore: data.enterStore
|
|
|
});
|
|
|
|
...
|
...
|
@@ -242,7 +269,7 @@ setTimeout(() => { |
|
|
* @param $placeholder
|
|
|
*/
|
|
|
function renderPromotion(data, $placeholder) {
|
|
|
var promotionHtml = promotionT({
|
|
|
let promotionHtml = promotionT({
|
|
|
promotion: data.promotion
|
|
|
});
|
|
|
|
...
|
...
|
@@ -256,7 +283,7 @@ setTimeout(() => { |
|
|
* @returns {*}
|
|
|
*/
|
|
|
function renderBundle(data, $placeholder) {
|
|
|
var bundleHtml = bundleT({
|
|
|
let bundleHtml = bundleT({
|
|
|
bundleData: data.bundleData
|
|
|
});
|
|
|
|
...
|
...
|
@@ -264,10 +291,10 @@ setTimeout(() => { |
|
|
}
|
|
|
|
|
|
function promotionInit() {
|
|
|
var $goodsDiscount = $('#goodsDiscount');
|
|
|
var $discountFirstItem = $goodsDiscount.find('.first-item');
|
|
|
var $discountFolder = $goodsDiscount.find('.discount-folder');
|
|
|
var $discountArrow = $goodsDiscount.find('.first-item span');
|
|
|
let $goodsDiscount = $('#goodsDiscount');
|
|
|
let $discountFirstItem = $goodsDiscount.find('.first-item');
|
|
|
let $discountFolder = $goodsDiscount.find('.discount-folder');
|
|
|
let $discountArrow = $goodsDiscount.find('.first-item span');
|
|
|
|
|
|
// 初始化goods-discount
|
|
|
if ($discountFolder.children().length === 0) {
|
...
|
...
|
@@ -332,8 +359,8 @@ setTimeout(() => { |
|
|
|
|
|
$(document).scroll(function() {
|
|
|
if ($(document).scrollTop() >= $(document).height() - $(window).height() - 120) {
|
|
|
var top = $('.back-to-top').offset().top - $('.float-top').offset().top + ($('.back-to-top').height() - $('.float-top').height()) / 2;
|
|
|
var left = $('.back-to-top').offset().left - $('.float-top').offset().left;
|
|
|
let top = $('.back-to-top').offset().top - $('.float-top').offset().top + ($('.back-to-top').height() - $('.float-top').height()) / 2;
|
|
|
let left = $('.back-to-top').offset().left - $('.float-top').offset().left;
|
|
|
|
|
|
$('.float-top').addClass('animation').css({
|
|
|
transform: 'translate(' + left + 'px, ' + top + 'px) scale(0, 0)',
|
...
|
...
|
|