Showing
11 changed files
with
271 additions
and
81 deletions
@@ -29,12 +29,17 @@ const detail = (params) => { | @@ -29,12 +29,17 @@ const detail = (params) => { | ||
29 | if (!params.skn) { | 29 | if (!params.skn) { |
30 | return Promise.resolve({}); | 30 | return Promise.resolve({}); |
31 | } | 31 | } |
32 | + let bundleIndex = (params.index || 1); | ||
32 | 33 | ||
34 | + --bundleIndex; | ||
33 | return getBundleBySkn(params.skn).then(result => { | 35 | return getBundleBySkn(params.skn).then(result => { |
34 | - return { | ||
35 | - bundleInfo: _.get(result, 'data.bundleInfo', {}), | ||
36 | - productList: productProcess.processProductList(_.get(result, 'data.productList', [])) | ||
37 | - }; | 36 | + if (_.has(result, `data[${bundleIndex}]`)) { |
37 | + return { | ||
38 | + bundleInfo: _.get(result, `data[${bundleIndex}].bundleInfo`, {}), | ||
39 | + productList: productProcess.processProductList(_.get(result, `data[${bundleIndex}].productList`, [])) | ||
40 | + }; | ||
41 | + } | ||
42 | + return {}; | ||
38 | }); | 43 | }); |
39 | }; | 44 | }; |
40 | 45 |
@@ -223,12 +223,12 @@ const tool = { | @@ -223,12 +223,12 @@ const tool = { | ||
223 | * @param skn | 223 | * @param skn |
224 | * @returns {{}} | 224 | * @returns {{}} |
225 | */ | 225 | */ |
226 | - processBundle(bundleData, skn, gid) { | 226 | + processBundle(bundleData, skn, gid, index) { |
227 | let subPrice = _.get(bundleData, 'bundleInfo.subPrice', 0); | 227 | let subPrice = _.get(bundleData, 'bundleInfo.subPrice', 0); |
228 | 228 | ||
229 | return { | 229 | return { |
230 | title: '优惠套装', | 230 | title: '优惠套装', |
231 | - href: helpers.urlFormat('/product/bundle/detail', {skn: skn, gid: gid}), | 231 | + href: helpers.urlFormat('/product/bundle/detail', {skn: skn, gid: gid, index: index}), |
232 | description: subPrice ? '立省¥' + subPrice : 0, | 232 | description: subPrice ? '立省¥' + subPrice : 0, |
233 | productList: productProcess.processProductList(bundleData && bundleData.productList) | 233 | productList: productProcess.processProductList(bundleData && bundleData.productList) |
234 | }; | 234 | }; |
@@ -330,16 +330,15 @@ const newDetail = { | @@ -330,16 +330,15 @@ const newDetail = { | ||
330 | userConsult: info[3] | 330 | userConsult: info[3] |
331 | }, productId); | 331 | }, productId); |
332 | 332 | ||
333 | - let bundleData = _.get(info[5], 'data', null); | ||
334 | - | ||
335 | - /* 套装 */ | ||
336 | - if (bundleData && _.get(bundleData, 'bundleInfo.discountType', null) === 1) { | ||
337 | - finalResult.bundleData = tool.processBundle(bundleData, skn, gid); | ||
338 | - } | 333 | + let bundleDatas = _.get(info[5], 'data', []); |
339 | 334 | ||
340 | /* 量贩 */ | 335 | /* 量贩 */ |
341 | - if (bundleData && _.get(bundleData, 'bundleInfo.discountType', null) === 2) { | ||
342 | - tool.processDiscount(finalResult, bundleData); | 336 | + if (_.some(bundleDatas, data => data.discountType === 2)) { |
337 | + tool.processDiscount(finalResult, _.find(bundleDatas, data => data.discountType === 2)); | ||
338 | + } else { /* 套装 */ | ||
339 | + finalResult.bundleDatas = _.map(bundleDatas, (data, index) => { | ||
340 | + return tool.processBundle(data, skn, gid, ++index); | ||
341 | + }); | ||
343 | } | 342 | } |
344 | 343 | ||
345 | return finalResult; | 344 | return finalResult; |
@@ -10,7 +10,7 @@ const isProduction = process.env.NODE_ENV === 'production'; | @@ -10,7 +10,7 @@ const isProduction = process.env.NODE_ENV === 'production'; | ||
10 | const isTest = process.env.NODE_ENV === 'test'; | 10 | const isTest = process.env.NODE_ENV === 'test'; |
11 | 11 | ||
12 | const domains = { | 12 | const domains = { |
13 | - api: 'http://api-test3.yohops.com:9999/', | 13 | + api: 'http://dev-api.yohops.com:9999/', |
14 | service: 'http://service-test3.yohops.com:9999/', | 14 | service: 'http://service-test3.yohops.com:9999/', |
15 | liveApi: 'http://testapi.live.yohops.com:9999/', | 15 | liveApi: 'http://testapi.live.yohops.com:9999/', |
16 | singleApi: 'http://api-test3.yohops.com:9999/', | 16 | singleApi: 'http://api-test3.yohops.com:9999/', |
@@ -27,7 +27,7 @@ const domains = { | @@ -27,7 +27,7 @@ const domains = { | ||
27 | 27 | ||
28 | module.exports = { | 28 | module.exports = { |
29 | app: 'h5', | 29 | app: 'h5', |
30 | - appVersion: '5.4.1', // 调用api的版本 | 30 | + appVersion: '5.5.0', // 调用api的版本 |
31 | port: 6001, | 31 | port: 6001, |
32 | siteUrl: '//m.yohobuy.com', | 32 | siteUrl: '//m.yohobuy.com', |
33 | assetUrl: '//127.0.0.1:5001', | 33 | assetUrl: '//127.0.0.1:5001', |
public/hbs/product/detail/bundle-content.hbs
0 → 100644
1 | +{{# bundleData}} | ||
2 | +<div class="bundle-nav"> | ||
3 | + <div class="bundle-title">{{title}}</div> | ||
4 | + <div class="bundle-right"> | ||
5 | + <a href="{{href}}"> | ||
6 | + {{#if description}} | ||
7 | + <span class="bundle-desc">{{description}}</span> | ||
8 | + {{/if}} | ||
9 | + <span class="iconfont"></span> | ||
10 | + </a> | ||
11 | + </div> | ||
12 | +</div> | ||
13 | +<div class="bundle-product"> | ||
14 | + <div class="swiper-wrapper"> | ||
15 | + {{# productList}} | ||
16 | + <div class="swiper-slide plus plus-{{@index}}"><span class="iconfont"></span></div> | ||
17 | + <div class="swiper-slide product-box"> | ||
18 | + <a href="{{@root.bundleData.href}}"><img src="{{image default_images 155 206}}" alt="{{product_name}}"></a> | ||
19 | + <div class="bundle-price">{{format_sales_price}}</div> | ||
20 | + </div> | ||
21 | + {{/ productList}} | ||
22 | + </div> | ||
23 | +</div> | ||
24 | +{{/ bundleData}} |
1 | -{{# bundleData}} | 1 | +{{#if bundleDatas.length}} |
2 | <div class="bundle"> | 2 | <div class="bundle"> |
3 | - <div class="bundle-nav"> | ||
4 | - <div class="bundle-title">{{title}}</div> | ||
5 | - <div class="bundle-right"> | ||
6 | - <a href="{{href}}"> | ||
7 | - {{#if description}} | ||
8 | - <span class="bundle-desc">{{description}}</span> | ||
9 | - {{/if}} | ||
10 | - <span class="iconfont"></span> | ||
11 | - </a> | ||
12 | - </div> | ||
13 | - </div> | ||
14 | - <div class="bundle-product"> | 3 | + <div class="bundle-tabs any"> |
15 | <div class="swiper-wrapper"> | 4 | <div class="swiper-wrapper"> |
16 | - {{# productList}} | ||
17 | - <div class="swiper-slide plus plus-{{@index}}"><span class="iconfont"></span></div> | ||
18 | - <div class="swiper-slide product-box"> | ||
19 | - <a href="{{@root.bundleData.href}}"><img src="{{image default_images 155 206}}" alt="{{product_name}}"></a> | ||
20 | - <div class="bundle-price">{{format_sales_price}}</div> | ||
21 | - </div> | ||
22 | - {{/ productList}} | 5 | + {{# bundleDatas}} |
6 | + <div class="swiper-slide{{#if @first}} selected{{/if}}" data-index="{{@index}}"> | ||
7 | + <span>{{title}}</span> | ||
8 | + <div class="line"></div> | ||
9 | + </div> | ||
10 | + {{/ bundleDatas}} | ||
23 | </div> | 11 | </div> |
24 | </div> | 12 | </div> |
13 | + <div class="bundle-content"> | ||
14 | + {{> ./bundle-content}} | ||
15 | + </div> | ||
25 | </div> | 16 | </div> |
26 | -{{/ bundleData}} | ||
17 | +{{/if}} |
@@ -60,6 +60,9 @@ var limitProductCode, | @@ -60,6 +60,9 @@ var limitProductCode, | ||
60 | // 限购商品的skn。只有限购商品时才会设置。 | 60 | // 限购商品的skn。只有限购商品时才会设置。 |
61 | skn; | 61 | skn; |
62 | 62 | ||
63 | +// 套餐模式 | ||
64 | +var budnleMode; | ||
65 | + | ||
63 | // 量贩商品 | 66 | // 量贩商品 |
64 | var discountNum = $('#mnum').val() - 0, | 67 | var discountNum = $('#mnum').val() - 0, |
65 | discountLimit = false; | 68 | discountLimit = false; |
@@ -140,6 +143,21 @@ function setLimitGoodModeWithSknId(code, sknId) { | @@ -140,6 +143,21 @@ function setLimitGoodModeWithSknId(code, sknId) { | ||
140 | skn = sknId; | 143 | skn = sknId; |
141 | } | 144 | } |
142 | 145 | ||
146 | +/* | ||
147 | + * 设置当前面板为套餐商品选择模式 | ||
148 | + * | ||
149 | + * @param {String} sknId. 当前限购商品的sknId | ||
150 | + * | ||
151 | + * @return {undefined} | ||
152 | + */ | ||
153 | +function setBundleModeWithSknId(sknId) { | ||
154 | + disableNumEdit(); | ||
155 | + isEdit = 1; | ||
156 | + skn = sknId; | ||
157 | + $('#chose-btn-sure').html('确认'); | ||
158 | + budnleMode = true; | ||
159 | +} | ||
160 | + | ||
143 | // 删除面板 | 161 | // 删除面板 |
144 | function removePannel() { | 162 | function removePannel() { |
145 | var $pannel = $('.chose-panel'), | 163 | var $pannel = $('.chose-panel'), |
@@ -709,6 +727,23 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | @@ -709,6 +727,23 @@ $yohoPage.on('touchstart', '.btn-minus', function() { | ||
709 | return; | 727 | return; |
710 | } | 728 | } |
711 | 729 | ||
730 | + if (budnleMode && cbFn) { | ||
731 | + let sizeChose = $('.size-list').find('.chosed'), | ||
732 | + sku = sizeChose.data('skuid'), | ||
733 | + color = $('.color-list').find('.chosed').html().substring(0, 4) + '...', | ||
734 | + size = sizeChose.html(); | ||
735 | + | ||
736 | + cbFn({ | ||
737 | + skn, | ||
738 | + sku, | ||
739 | + color, | ||
740 | + size | ||
741 | + }); | ||
742 | + confirming = false; | ||
743 | + hide(); | ||
744 | + return; | ||
745 | + } | ||
746 | + | ||
712 | // 针对是否处于编辑模式设置不同的url和需要post的数据 | 747 | // 针对是否处于编辑模式设置不同的url和需要post的数据 |
713 | if (isEdit) { | 748 | if (isEdit) { |
714 | cartGoodData = { | 749 | cartGoodData = { |
@@ -851,3 +886,4 @@ exports.remove = removePannel; | @@ -851,3 +886,4 @@ exports.remove = removePannel; | ||
851 | exports.setEditModeWithSknId = setEditModeWithSknId; | 886 | exports.setEditModeWithSknId = setEditModeWithSknId; |
852 | exports.disableNumEdit = disableNumEdit; | 887 | exports.disableNumEdit = disableNumEdit; |
853 | exports.setLimitGoodModeWithSknId = setLimitGoodModeWithSknId; | 888 | exports.setLimitGoodModeWithSknId = setLimitGoodModeWithSknId; |
889 | +exports.setBundleModeWithSknId = setBundleModeWithSknId; |
1 | /** | 1 | /** |
2 | * Created by targaryen on 2016/11/28. | 2 | * Created by targaryen on 2016/11/28. |
3 | */ | 3 | */ |
4 | -var $ = require('yoho-jquery'), | ||
5 | - tip = require('../plugin/tip'); | 4 | +let $ = require('yoho-jquery'), |
5 | + tip = require('plugin/tip'); | ||
6 | 6 | ||
7 | -require('../common'); | 7 | +require('common'); |
8 | +let share = require('common/share'); | ||
8 | 9 | ||
9 | -var chosePanelRender = require('../common/chose-panel'), | ||
10 | - chosePanel = require('./bundle/chose-pannel'); | 10 | +let chosePanelRender = require('common/chose-panel'), |
11 | + chosePanel = require('cart/chose-panel'); | ||
11 | 12 | ||
12 | -var $selectBtn = $('.select-btn'), | 13 | +let $selectBtn = $('.select-btn'), |
13 | $buyNowBtn = $('#bundle-buy-now'); | 14 | $buyNowBtn = $('#bundle-buy-now'); |
14 | 15 | ||
15 | // cookie 参数 | 16 | // cookie 参数 |
16 | -var actCkOpthn = { | 17 | +let actCkOpthn = { |
17 | path: '/cart/index' | 18 | path: '/cart/index' |
18 | }; | 19 | }; |
19 | 20 | ||
20 | $(function() { | 21 | $(function() { |
21 | window.setCookie('activity-info', '', actCkOpthn); | 22 | window.setCookie('activity-info', '', actCkOpthn); |
23 | + share({ | ||
24 | + imgUrl: 'https://feature.yoho.cn/300x300.png', | ||
25 | + title: '会搭是成为潮流ICON的第一步,搭配购买还有优惠折扣!', | ||
26 | + link: window.location.href, | ||
27 | + desc: '超高性价比,开启省钱大作战!' | ||
28 | + }); | ||
22 | }); | 29 | }); |
23 | 30 | ||
24 | /** | 31 | /** |
25 | * 选择商品颜色等 | 32 | * 选择商品颜色等 |
26 | */ | 33 | */ |
27 | $selectBtn.on('touchend', function() { | 34 | $selectBtn.on('touchend', function() { |
28 | - var self = $(this); | 35 | + let self = $(this); |
29 | 36 | ||
30 | $.post('/product/detail/info', { | 37 | $.post('/product/detail/info', { |
31 | id: self.data('id'), | 38 | id: self.data('id'), |
32 | productSkn: self.data('skn') | 39 | productSkn: self.data('skn') |
33 | }, function(data) { | 40 | }, function(data) { |
34 | chosePanelRender(data); | 41 | chosePanelRender(data); |
35 | - chosePanel.init(self.data('skn')); | ||
36 | - chosePanel.show(); | 42 | + chosePanel.init(); |
43 | + chosePanel.setBundleModeWithSknId(self.data('skn')); | ||
44 | + chosePanel.show('', (productData) => { | ||
45 | + var product = $('#gskn-' + productData.skn); | ||
46 | + | ||
47 | + product.data('sku', productData.sku); | ||
48 | + product.html('颜色:' + productData.color + ' 尺码:' + productData.size); | ||
49 | + }); | ||
37 | }); | 50 | }); |
38 | }); | 51 | }); |
39 | 52 | ||
40 | $('.goods-img').on('touchend', function() { | 53 | $('.goods-img').on('touchend', function() { |
41 | - var packGood = $(this).parent().find('.select-btn'); | 54 | + let packGood = $(this).parent().find('.select-btn'); |
42 | 55 | ||
43 | if (window._yas && window._yas.sendCustomInfo) { | 56 | if (window._yas && window._yas.sendCustomInfo) { |
44 | window._yas.sendCustomInfo({ | 57 | window._yas.sendCustomInfo({ |
@@ -58,7 +71,7 @@ $('.goods-img').on('touchend', function() { | @@ -58,7 +71,7 @@ $('.goods-img').on('touchend', function() { | ||
58 | * 立即购买 | 71 | * 立即购买 |
59 | */ | 72 | */ |
60 | $buyNowBtn.on('click', function() { | 73 | $buyNowBtn.on('click', function() { |
61 | - var bundleGoods = [], | 74 | + let bundleGoods = [], |
62 | bundleId = $('#activityId').val(), | 75 | bundleId = $('#activityId').val(), |
63 | gskn = $('span[id^="gskn"]'), | 76 | gskn = $('span[id^="gskn"]'), |
64 | gsknSelected = false, | 77 | gsknSelected = false, |
@@ -36,7 +36,8 @@ var $chosePanel = $('.chose-panel'), | @@ -36,7 +36,8 @@ var $chosePanel = $('.chose-panel'), | ||
36 | $cartBar, | 36 | $cartBar, |
37 | $soonSoldOut = $('.soonSoldOut-tag'), | 37 | $soonSoldOut = $('.soonSoldOut-tag'), |
38 | $yohoPage = $('.yoho-page'), | 38 | $yohoPage = $('.yoho-page'), |
39 | - single = $('#single').val() || 0; | 39 | + single = $('#single').val() || 0, |
40 | + $thumbImg; | ||
40 | 41 | ||
41 | var productSkn; | 42 | var productSkn; |
42 | 43 | ||
@@ -73,6 +74,7 @@ function init(sknId) { | @@ -73,6 +74,7 @@ function init(sknId) { | ||
73 | curSizeIndex = 0; | 74 | curSizeIndex = 0; |
74 | productSkn = sknId; | 75 | productSkn = sknId; |
75 | disableShowNum(); | 76 | disableShowNum(); |
77 | + $thumbImg = $('.thumb-img'); | ||
76 | } | 78 | } |
77 | 79 | ||
78 | // 删除面板 | 80 | // 删除面板 |
@@ -424,7 +426,18 @@ $yohoPage.on('touchstart', '.btn-minus', function () { | @@ -424,7 +426,18 @@ $yohoPage.on('touchstart', '.btn-minus', function () { | ||
424 | ); | 426 | ); |
425 | } | 427 | } |
426 | }); | 428 | }); |
429 | +$yohoPage.on('click', '.close', function() { | ||
430 | + hide(); | ||
431 | +}); | ||
432 | + | ||
433 | +$yohoPage.on('touchstart', '.thumb-img', function() { | ||
427 | 434 | ||
435 | + if ($thumbImg.hasClass('hover')) { | ||
436 | + $thumbImg.removeClass('hover'); | ||
437 | + } else { | ||
438 | + $thumbImg.addClass('hover'); | ||
439 | + } | ||
440 | +}); | ||
428 | exports.init = init; | 441 | exports.init = init; |
429 | exports.show = show; | 442 | exports.show = show; |
430 | exports.remove = removePannel; | 443 | exports.remove = removePannel; |
@@ -2,13 +2,85 @@ | @@ -2,13 +2,85 @@ | ||
2 | * Created by targaryen on 2016/11/25. | 2 | * Created by targaryen on 2016/11/25. |
3 | */ | 3 | */ |
4 | 4 | ||
5 | -var $ = require('yoho-jquery'), | 5 | +let $ = require('yoho-jquery'), |
6 | Swiper = require('yoho-swiper'); | 6 | Swiper = require('yoho-swiper'); |
7 | +let $bundle = $('#placeholder-bundle'); | ||
8 | +let bundleT = require('product/detail/bundle.hbs'); | ||
9 | +let bundleContentT = require('product/detail/bundle-content.hbs'); | ||
7 | 10 | ||
8 | -$(function() { | ||
9 | - new Swiper('.bundle-product', { | ||
10 | - freeMode: true, | ||
11 | - slidesPerView: 5, | ||
12 | - lazyLoading: true | ||
13 | - }); | ||
14 | -}); | 11 | +let bundleObj = { |
12 | + bundles: [], | ||
13 | + bundleIndex: 0, | ||
14 | + init(bundles) { | ||
15 | + let self = this; | ||
16 | + | ||
17 | + self.bundles = bundles; | ||
18 | + try { | ||
19 | + self.render(); | ||
20 | + self.regTabsSwiper(); | ||
21 | + self.regProductSwiper(); | ||
22 | + self.regEvent(); | ||
23 | + } catch (e) { | ||
24 | + console.error(e); | ||
25 | + } | ||
26 | + }, | ||
27 | + render() { | ||
28 | + let self = this; | ||
29 | + | ||
30 | + var bundleHtml = bundleT({ | ||
31 | + bundleDatas: self.bundles, | ||
32 | + bundleData: self.bundles[self.bundleIndex], | ||
33 | + bundleIndex: self.bundleIndex | ||
34 | + }); | ||
35 | + | ||
36 | + return $bundle.replaceWith(bundleHtml); | ||
37 | + }, | ||
38 | + renderProduct() { | ||
39 | + let self = this; | ||
40 | + | ||
41 | + var bundleHtml = bundleContentT({ | ||
42 | + bundleData: self.bundles[self.bundleIndex], | ||
43 | + }); | ||
44 | + | ||
45 | + $('.bundle-content').html(bundleHtml); | ||
46 | + self.regProductSwiper(); | ||
47 | + }, | ||
48 | + regEvent() { | ||
49 | + let self = this; | ||
50 | + | ||
51 | + $('.bundle-tabs').on('click', '.swiper-slide', (e) => { | ||
52 | + let index = $(e.currentTarget).data('index'); | ||
53 | + | ||
54 | + if (self.bundleIndex !== index) { | ||
55 | + $(e.currentTarget).addClass('selected').siblings().removeClass('selected'); | ||
56 | + self.bundleIndex = index; | ||
57 | + self.renderProduct(); | ||
58 | + } | ||
59 | + }); | ||
60 | + }, | ||
61 | + regProductSwiper() { | ||
62 | + let self = this; | ||
63 | + | ||
64 | + if (self.bundles[self.bundleIndex].productList.length > 3) { | ||
65 | + new Swiper('.bundle-product', { | ||
66 | + freeMode: true, | ||
67 | + slidesPerView: 'auto', | ||
68 | + lazyLoading: true | ||
69 | + }); | ||
70 | + } | ||
71 | + }, | ||
72 | + regTabsSwiper() { | ||
73 | + let self = this; | ||
74 | + | ||
75 | + if (self.bundles.length > 3) { | ||
76 | + $('.bundle-tabs').removeClass('any'); | ||
77 | + new Swiper('.bundle-tabs', { | ||
78 | + freeMode: true, | ||
79 | + slidesPerView: 'auto', | ||
80 | + lazyLoading: true | ||
81 | + }); | ||
82 | + } | ||
83 | + } | ||
84 | +}; | ||
85 | + | ||
86 | +module.exports = bundleObj; |
@@ -205,12 +205,10 @@ setTimeout(() => { | @@ -205,12 +205,10 @@ setTimeout(() => { | ||
205 | var promotionT = require('product/detail/promotion.hbs'); | 205 | var promotionT = require('product/detail/promotion.hbs'); |
206 | var feedbackT = require('product/detail/feedbacks.hbs'); | 206 | var feedbackT = require('product/detail/feedbacks.hbs'); |
207 | var enterStoreT = require('product/detail/enterStore.hbs'); | 207 | var enterStoreT = require('product/detail/enterStore.hbs'); |
208 | - var bundleT = require('product/detail/bundle.hbs'); | ||
209 | 208 | ||
210 | // placeholder | 209 | // placeholder |
211 | var $feedbackStore = $('#placeholder-feedback-store'); | 210 | var $feedbackStore = $('#placeholder-feedback-store'); |
212 | var $promotion = $('#placeholder-promotion'); | 211 | var $promotion = $('#placeholder-promotion'); |
213 | - var $bundle = $('#placeholder-bundle'); | ||
214 | 212 | ||
215 | /** | 213 | /** |
216 | * 渲染 feedback, 店铺, 替换placeholder | 214 | * 渲染 feedback, 店铺, 替换placeholder |
@@ -249,19 +247,6 @@ setTimeout(() => { | @@ -249,19 +247,6 @@ setTimeout(() => { | ||
249 | return $placeholder.replaceWith(promotionHtml); | 247 | return $placeholder.replaceWith(promotionHtml); |
250 | } | 248 | } |
251 | 249 | ||
252 | - /** | ||
253 | - * 渲染 套装,替换placeholder | ||
254 | - * @param data | ||
255 | - * @param $placeholder | ||
256 | - * @returns {*} | ||
257 | - */ | ||
258 | - function renderBundle(data, $placeholder) { | ||
259 | - var bundleHtml = bundleT({ | ||
260 | - bundleData: data.bundleData | ||
261 | - }); | ||
262 | - | ||
263 | - return $placeholder.replaceWith(bundleHtml); | ||
264 | - } | ||
265 | 250 | ||
266 | function promotionInit() { | 251 | function promotionInit() { |
267 | var $goodsDiscount = $('#goodsDiscount'); | 252 | var $goodsDiscount = $('#goodsDiscount'); |
@@ -304,8 +289,8 @@ setTimeout(() => { | @@ -304,8 +289,8 @@ setTimeout(() => { | ||
304 | renderFeedbackStore(info, $feedbackStore); | 289 | renderFeedbackStore(info, $feedbackStore); |
305 | renderPromotion(info, $promotion); | 290 | renderPromotion(info, $promotion); |
306 | 291 | ||
307 | - if (info.bundleData) { | ||
308 | - renderBundle(info, $bundle); | 292 | + if (info.bundleDatas && info.bundleDatas.length) { |
293 | + require('./detail/bundle').init(info.bundleDatas); | ||
309 | $('.bundle').on('touchstart', function() { | 294 | $('.bundle').on('touchstart', function() { |
310 | if (window._yas && window._yas.sendCustomInfo) { | 295 | if (window._yas && window._yas.sendCustomInfo) { |
311 | window._yas.sendCustomInfo({ | 296 | window._yas.sendCustomInfo({ |
@@ -322,7 +307,6 @@ setTimeout(() => { | @@ -322,7 +307,6 @@ setTimeout(() => { | ||
322 | // step2: init js | 307 | // step2: init js |
323 | require('./detail/comments-consults'); | 308 | require('./detail/comments-consults'); |
324 | require('./detail/consultform'); // TODO | 309 | require('./detail/consultform'); // TODO |
325 | - require('./detail/bundle'); | ||
326 | promotionInit(); | 310 | promotionInit(); |
327 | window.rePosFooter && window.rePosFooter(); | 311 | window.rePosFooter && window.rePosFooter(); |
328 | }); | 312 | }); |
1 | .bundle { | 1 | .bundle { |
2 | - height: 344px; | 2 | + height: 420px; |
3 | overflow: hidden; | 3 | overflow: hidden; |
4 | background-color: #fff; | 4 | background-color: #fff; |
5 | margin-bottom: 30px; | 5 | margin-bottom: 30px; |
6 | border-bottom: 1px solid #e0e0e0; | 6 | border-bottom: 1px solid #e0e0e0; |
7 | border-top: 1px solid #e0e0e0; | 7 | border-top: 1px solid #e0e0e0; |
8 | 8 | ||
9 | + .bundle-tabs { | ||
10 | + padding-left: 23px; | ||
11 | + padding-right: 23px; | ||
12 | + height: 76px; | ||
13 | + border-bottom: solid 1PX #ddd; | ||
14 | + | ||
15 | + &.any { | ||
16 | + padding: 0; | ||
17 | + | ||
18 | + .swiper-slide { | ||
19 | + width: auto; | ||
20 | + flex: 1; | ||
21 | + } | ||
22 | + } | ||
23 | + | ||
24 | + .swiper-slide { | ||
25 | + width: 168px; | ||
26 | + text-align: center; | ||
27 | + position: relative; | ||
28 | + | ||
29 | + &:first-child { | ||
30 | + .line { | ||
31 | + display: none; | ||
32 | + } | ||
33 | + } | ||
34 | + | ||
35 | + &.selected { | ||
36 | + span { | ||
37 | + color: #454545; | ||
38 | + border-bottom: solid 2PX #454545; | ||
39 | + } | ||
40 | + } | ||
41 | + | ||
42 | + .line { | ||
43 | + width: 1px; | ||
44 | + height: 28px; | ||
45 | + margin-top: 24px; | ||
46 | + float: left; | ||
47 | + border-left: solid 1PX #ddd; | ||
48 | + } | ||
49 | + | ||
50 | + span { | ||
51 | + display: inline-block; | ||
52 | + min-width: 103px; | ||
53 | + line-height: 76px; | ||
54 | + height: 76px; | ||
55 | + color: #b2b2b2; | ||
56 | + font-size: 28px; | ||
57 | + } | ||
58 | + } | ||
59 | + } | ||
60 | + | ||
9 | .bundle-nav { | 61 | .bundle-nav { |
10 | overflow: hidden; | 62 | overflow: hidden; |
11 | padding: 0 30px; | 63 | padding: 0 30px; |
12 | - line-height: 88px; | ||
13 | - border-bottom: 1px solid #e0e0e0; | 64 | + line-height: 70px; |
14 | 65 | ||
15 | .bundle-title { | 66 | .bundle-title { |
16 | float: left; | 67 | float: left; |
@@ -22,10 +73,11 @@ | @@ -22,10 +73,11 @@ | ||
22 | float: right; | 73 | float: right; |
23 | 74 | ||
24 | .bundle-desc { | 75 | .bundle-desc { |
25 | - padding: 3px 5px; | 76 | + padding: 0 10px; |
26 | border: 1px #d0021b solid; | 77 | border: 1px #d0021b solid; |
27 | border-radius: 5px; | 78 | border-radius: 5px; |
28 | color: #d0021b; | 79 | color: #d0021b; |
80 | + font-size: 12PX; | ||
29 | } | 81 | } |
30 | 82 | ||
31 | .iconfont { | 83 | .iconfont { |
@@ -35,8 +87,8 @@ | @@ -35,8 +87,8 @@ | ||
35 | } | 87 | } |
36 | 88 | ||
37 | .bundle-product { | 89 | .bundle-product { |
38 | - margin-top: 30px; | ||
39 | width: 100%; | 90 | width: 100%; |
91 | + margin-top: 10px; | ||
40 | 92 | ||
41 | .swiper-wrapper { | 93 | .swiper-wrapper { |
42 | .plus { | 94 | .plus { |
@@ -50,6 +102,7 @@ | @@ -50,6 +102,7 @@ | ||
50 | 102 | ||
51 | .plus-0 { | 103 | .plus-0 { |
52 | visibility: hidden; | 104 | visibility: hidden; |
105 | + margin: 0; | ||
53 | } | 106 | } |
54 | 107 | ||
55 | .product-box { | 108 | .product-box { |
-
Please register or login to post a comment