|
|
var $ = require('yoho-jquery'),
|
|
|
lazyLoad = require('yoho-jquery-lazyload'),
|
|
|
Swiper = require('yoho-swiper'),
|
|
|
tip = require('../plugin/tip'),
|
|
|
chosePanel = require('../common/chose-panel'),
|
...
|
...
|
@@ -18,6 +19,11 @@ new Swiper('.banner-swiper', { |
|
|
spaceBetween: 3
|
|
|
});
|
|
|
|
|
|
var productId = $('#productId').val();
|
|
|
var goodsId = $('#goodsId').val();
|
|
|
var productSkn = $('#productSkn').val();
|
|
|
var brandId = $('#brand-id').val();
|
|
|
|
|
|
// 领券
|
|
|
require('./detail/brand-coupon');
|
|
|
|
...
|
...
|
@@ -70,9 +76,6 @@ var renderInfo = function(data) { |
|
|
|
|
|
// 动态加载数据
|
|
|
var getInfoData = function() {
|
|
|
var productId = $('#productId').val();
|
|
|
var goodsId = $('#goodsId').val();
|
|
|
var productSkn = $('#productSkn').val();
|
|
|
if (productId && (goodsId || productSkn)) {
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
...
|
...
|
@@ -91,6 +94,7 @@ var getInfoData = function() { |
|
|
// var regProSeckill = /\/product\/seckill\/pro_([\d]+)_([\d]+)/;
|
|
|
var thisHref = window.location.href;
|
|
|
var thisRefer = document.referrer;
|
|
|
|
|
|
if (!regSeckill.test(thisRefer)) {
|
|
|
if (data.isSecKill === 'Y' && (reg.test(thisHref) || regPro.test(thisHref))) {
|
|
|
window.location.replace('/product/seckill/show_' + $('#productSkn').val() + '.html');
|
...
|
...
|
@@ -165,5 +169,53 @@ var getInfoData = function() { |
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
/*
|
|
|
* 获取商品 相关数据: 1. 促销 2. feedback 3. 店铺, 并初始化
|
|
|
*/
|
|
|
+(function(skn, productId, brandId) { // eslint-disable-line
|
|
|
// 模版: 促销, feedback, 店铺
|
|
|
// var promotion = require('product/detail/promotion.hbs');
|
|
|
var feedbackT = require('product/detail/feedbacks.hbs');
|
|
|
var enterStoreT = require('product/detail/enterStore.hbs');
|
|
|
|
|
|
// placeholder
|
|
|
var $feedbackStore = $('#placeholder-feedback-store');
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 渲染 feedback, 店铺, 替换placeholder
|
|
|
* @param data
|
|
|
* {
|
|
|
* enterStore, feedback
|
|
|
* }
|
|
|
* @param $placeholder
|
|
|
*/
|
|
|
function renderFeedbackStore(data, $placeholder) {
|
|
|
var feedbackHtml = feedbackT({
|
|
|
feedbacks: data.feedbacks
|
|
|
});
|
|
|
|
|
|
var enterStoreHtml = enterStoreT({
|
|
|
enterStore: data.enterStore
|
|
|
});
|
|
|
|
|
|
return $placeholder.replaceWith([feedbackHtml, enterStoreHtml]);
|
|
|
}
|
|
|
|
|
|
|
|
|
$.get('/product/detail/sknData.json', {
|
|
|
skn: skn,
|
|
|
productId: productId,
|
|
|
brandId: brandId
|
|
|
}).done(function(info) {
|
|
|
renderFeedbackStore({
|
|
|
feedbacks: info.feedbacks,
|
|
|
enterStore: info.enterStore
|
|
|
}, $feedbackStore);
|
|
|
});
|
|
|
}(productSkn, productId, brandId));
|
|
|
|
|
|
// 初始化执行
|
|
|
getInfoData();
|
|
|
|
...
|
...
|
|