Merge remote-tracking branch 'origin/release/5.6' into release/5.6
Showing
11 changed files
with
60 additions
and
23 deletions
@@ -296,11 +296,13 @@ const modifyProductNum = (req, res, next) => { | @@ -296,11 +296,13 @@ const modifyProductNum = (req, res, next) => { | ||
296 | let increaseNum = req.body.increaseNum || null; | 296 | let increaseNum = req.body.increaseNum || null; |
297 | let decreaseNum = req.body.decreaseNum || null; | 297 | let decreaseNum = req.body.decreaseNum || null; |
298 | let cartDelList = helper.getCartDelList(req, res); | 298 | let cartDelList = helper.getCartDelList(req, res); |
299 | + let batchNo = req.body.batch_no || null; | ||
299 | let activityId = req.body.activity_id || null; | 300 | let activityId = req.body.activity_id || null; |
300 | 301 | ||
301 | if (activityId) { | 302 | if (activityId) { |
302 | return service.bundleNumData({ | 303 | return service.bundleNumData({ |
303 | uid: uid, | 304 | uid: uid, |
305 | + batch_no: batchNo, | ||
304 | activity_id: activityId, | 306 | activity_id: activityId, |
305 | shopping_key: shoppingKey, | 307 | shopping_key: shoppingKey, |
306 | increaseNum: increaseNum, | 308 | increaseNum: increaseNum, |
@@ -38,6 +38,9 @@ const bundleNum = (params) => { | @@ -38,6 +38,9 @@ const bundleNum = (params) => { | ||
38 | params.decrease_number = parseInt(params.decreaseNum, 10); | 38 | params.decrease_number = parseInt(params.decreaseNum, 10); |
39 | } | 39 | } |
40 | 40 | ||
41 | + delete params.increaseNum; | ||
42 | + delete params.decreaseNum; | ||
43 | + | ||
41 | return api.get('', params, {code: 200}); | 44 | return api.get('', params, {code: 200}); |
42 | }; | 45 | }; |
43 | 46 |
@@ -507,8 +507,9 @@ const formatPromotionPools = (pools, selectedGiftsList, isAdvance, analysis) => | @@ -507,8 +507,9 @@ const formatPromotionPools = (pools, selectedGiftsList, isAdvance, analysis) => | ||
507 | poolId: p.pool_id, | 507 | poolId: p.pool_id, |
508 | poolTitle: p.pool_title, | 508 | poolTitle: p.pool_title, |
509 | isChecked: p.selected === 'Y', | 509 | isChecked: p.selected === 'Y', |
510 | - productNum: Number(p.pool_buy_number), | ||
511 | - storageNum: Number(p.pool_storage_number), | 510 | + batchNo: p.pool_batch_no, |
511 | + productNum: parseInt(p.pool_buy_number, 10), | ||
512 | + storageNum: parseInt(p.pool_storage_number, 10), | ||
512 | poolType: p.pool_type, | 513 | poolType: p.pool_type, |
513 | isBrandGroup: p.pool_type === 1, | 514 | isBrandGroup: p.pool_type === 1, |
514 | goodsList: formatCartGoods(p.goods_list, isAdvance, false, false, analysis), | 515 | goodsList: formatCartGoods(p.goods_list, isAdvance, false, false, analysis), |
@@ -542,18 +543,15 @@ const formatSoldOutPools = (pools, selectedGiftsList, isAdvance, analysis) => { | @@ -542,18 +543,15 @@ const formatSoldOutPools = (pools, selectedGiftsList, isAdvance, analysis) => { | ||
542 | poolId: p.pool_id, | 543 | poolId: p.pool_id, |
543 | poolTitle: p.pool_title, | 544 | poolTitle: p.pool_title, |
544 | isChecked: p.selected === 'Y', | 545 | isChecked: p.selected === 'Y', |
545 | - productNum: Number(p.pool_buy_number), | ||
546 | - storageNum: Number(p.pool_storage_number), | 546 | + batchNo: p.pool_batch_no, |
547 | + productNum: parseInt(p.pool_buy_number, 10), | ||
548 | + storageNum: parseInt(p.pool_storage_number, 10), | ||
547 | poolType: p.pool_type, | 549 | poolType: p.pool_type, |
548 | isBrandGroup: p.pool_type === 1, | 550 | isBrandGroup: p.pool_type === 1, |
549 | goodsList: formatCartGoods(p.goods_list, isAdvance, true, false, analysis), | 551 | goodsList: formatCartGoods(p.goods_list, isAdvance, true, false, analysis), |
550 | promotionInfos: formatPoolPromotionInfos(p.promotion_list, selectedGiftsList) | 552 | promotionInfos: formatPoolPromotionInfos(p.promotion_list, selectedGiftsList) |
551 | }; | 553 | }; |
552 | 554 | ||
553 | - if (p.sub_pool) { | ||
554 | - pool.subs = formatSubPromotionPools(p.sub_pool, selectedGiftsList, isAdvance, analysis); | ||
555 | - } | ||
556 | - | ||
557 | // 套餐不须要列表中有删除、收藏按钮 | 555 | // 套餐不须要列表中有删除、收藏按钮 |
558 | if (p.pool_type === 3) { | 556 | if (p.pool_type === 3) { |
559 | pool.goodsList = _disablePools(pool.goodsList, true, true); | 557 | pool.goodsList = _disablePools(pool.goodsList, true, true); |
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | 'use strict'; | 7 | 'use strict'; |
8 | 8 | ||
9 | const _ = require('lodash'); | 9 | const _ = require('lodash'); |
10 | +const cheerio = require('cheerio'); | ||
10 | 11 | ||
11 | const helpers = global.yoho.helpers; | 12 | const helpers = global.yoho.helpers; |
12 | 13 | ||
@@ -295,10 +296,14 @@ const getGlobalProductDetailData = (skn, channelNum, channel) => { | @@ -295,10 +296,14 @@ const getGlobalProductDetailData = (skn, channelNum, channel) => { | ||
295 | } | 296 | } |
296 | 297 | ||
297 | if (result.html && !_.get(result.html, 'code', '')) { | 298 | if (result.html && !_.get(result.html, 'code', '')) { |
298 | - let regContent = /<body[^>]*>([\s\S]*)<\/body>/.exec(result.html); | 299 | + let $ = cheerio.load(result.html); |
299 | 300 | ||
300 | - html = regContent[1] || ''; | ||
301 | - html = html.replace(/<script.*?>.*?<\/script>/ig, ''); | 301 | + $('script').remove(); |
302 | + html = $('body').html(); | ||
303 | + | ||
304 | + if (html) { | ||
305 | + html = html.replace(/http:/ig, ''); | ||
306 | + } | ||
302 | } | 307 | } |
303 | 308 | ||
304 | Object.assign(resData, result.header, { | 309 | Object.assign(resData, result.header, { |
@@ -18,6 +18,7 @@ | @@ -18,6 +18,7 @@ | ||
18 | data-pool-type="{{parent.poolType}}" | 18 | data-pool-type="{{parent.poolType}}" |
19 | {{#if isGift}} data-isgift="true"{{/if}} | 19 | {{#if isGift}} data-isgift="true"{{/if}} |
20 | {{#if isPriceGift}} data-ispricegift="true"{{/if}} | 20 | {{#if isPriceGift}} data-ispricegift="true"{{/if}} |
21 | + {{#if parent.batchNo}} data-batch-no="{{parent.batchNo}}"{{/if}} | ||
21 | {{#if parent.poolId}} data-pool-id="{{parent.poolId}}"{{/if}} > | 22 | {{#if parent.poolId}} data-pool-id="{{parent.poolId}}"{{/if}} > |
22 | <div class="pay-pro td {{#eq parent.poolType 3}} is-check{{/eq}}" style="width: 368px;"> | 23 | <div class="pay-pro td {{#eq parent.poolType 3}} is-check{{/eq}}" style="width: 368px;"> |
23 | {{#unless isGift}} | 24 | {{#unless isGift}} |
@@ -4,7 +4,8 @@ | @@ -4,7 +4,8 @@ | ||
4 | {{#inValid}} tr-disabled{{/inValid}} | 4 | {{#inValid}} tr-disabled{{/inValid}} |
5 | {{#isChecked}} active{{/isChecked}}" data-role="pitem" {{#if productNum}} data-productnum="{{productNum}}"{{/if}} | 5 | {{#isChecked}} active{{/isChecked}}" data-role="pitem" {{#if productNum}} data-productnum="{{productNum}}"{{/if}} |
6 | data-pool-type="{{poolType}}" | 6 | data-pool-type="{{poolType}}" |
7 | - data-pool-id="{{poolId}}"> | 7 | + data-pool-id="{{poolId}}" |
8 | + data-batch-no="{{batchNo}}"> | ||
8 | <div class="pay-pro td line-height" style="width: 516px;"> | 9 | <div class="pay-pro td line-height" style="width: 516px;"> |
9 | {{#if inValid}} | 10 | {{#if inValid}} |
10 | <i class="cart-item-disabled iconfont"></i> | 11 | <i class="cart-item-disabled iconfont"></i> |
@@ -67,6 +67,7 @@ function toggleAll(obj, roleType) { | @@ -67,6 +67,7 @@ function toggleAll(obj, roleType) { | ||
67 | $cartListWrap.find('[data-role=' + roleType + '] li[data-role=pitem]').each(function() { | 67 | $cartListWrap.find('[data-role=' + roleType + '] li[data-role=pitem]').each(function() { |
68 | var $t = $(this); | 68 | var $t = $(this); |
69 | var poolId = $t.data('pool-id'); | 69 | var poolId = $t.data('pool-id'); |
70 | + var batchNo = $t.data('batch-no'); | ||
70 | 71 | ||
71 | if ($t.find('.pay-pro').hasClass('is-check')) { | 72 | if ($t.find('.pay-pro').hasClass('is-check')) { |
72 | return true; | 73 | return true; |
@@ -81,6 +82,7 @@ function toggleAll(obj, roleType) { | @@ -81,6 +82,7 @@ function toggleAll(obj, roleType) { | ||
81 | selectArray.push({ | 82 | selectArray.push({ |
82 | selected: selected, | 83 | selected: selected, |
83 | activity_id: poolId, | 84 | activity_id: poolId, |
85 | + batch_no: batchNo, | ||
84 | product_sku: $(this).data('id'), | 86 | product_sku: $(this).data('id'), |
85 | buy_number: $(this).data('productnum'), | 87 | buy_number: $(this).data('productnum'), |
86 | promotion_id: $(this).data('promotionid') || 0 | 88 | promotion_id: $(this).data('promotionid') || 0 |
@@ -120,6 +122,7 @@ Cart = { | @@ -120,6 +122,7 @@ Cart = { | ||
120 | var $pitem = $this.closest('li[data-role="pitem"]'); | 122 | var $pitem = $this.closest('li[data-role="pitem"]'); |
121 | var item = []; | 123 | var item = []; |
122 | var poolId = $pitem.data('pool-id'); | 124 | var poolId = $pitem.data('pool-id'); |
125 | + var batchNo = $pitem.data('batch-no'); | ||
123 | var isTipnostore = true; | 126 | var isTipnostore = true; |
124 | 127 | ||
125 | // 套餐-单选 | 128 | // 套餐-单选 |
@@ -139,6 +142,7 @@ Cart = { | @@ -139,6 +142,7 @@ Cart = { | ||
139 | 142 | ||
140 | item.push({ | 143 | item.push({ |
141 | selected: $this.hasClass('cart-item-checked') ? 'N' : 'Y', // 'Y' : 'N', | 144 | selected: $this.hasClass('cart-item-checked') ? 'N' : 'Y', // 'Y' : 'N', |
145 | + batch_no: batchNo, | ||
142 | activity_id: poolId, | 146 | activity_id: poolId, |
143 | product_sku: $(this).data('id'), | 147 | product_sku: $(this).data('id'), |
144 | buy_number: $(this).data('productnum'), | 148 | buy_number: $(this).data('productnum'), |
@@ -180,6 +184,7 @@ Cart = { | @@ -180,6 +184,7 @@ Cart = { | ||
180 | var content = '<div><i class="iconfont"></i>删除商品</div><p>确定要从购物车中删除该商品?</p>'; | 184 | var content = '<div><i class="iconfont"></i>删除商品</div><p>确定要从购物车中删除该商品?</p>'; |
181 | var countJSON = []; | 185 | var countJSON = []; |
182 | var poolId = $item.data('pool-id'); | 186 | var poolId = $item.data('pool-id'); |
187 | + var batchNo = $item.data('batch-no'); | ||
183 | 188 | ||
184 | // 套餐删除 | 189 | // 套餐删除 |
185 | if (poolId && parseInt($item.data('pool-type'), 10) === 3) { | 190 | if (poolId && parseInt($item.data('pool-type'), 10) === 3) { |
@@ -189,6 +194,7 @@ Cart = { | @@ -189,6 +194,7 @@ Cart = { | ||
189 | } | 194 | } |
190 | 195 | ||
191 | selectArray.push({ | 196 | selectArray.push({ |
197 | + batch_no: batchNo, | ||
192 | activity_id: poolId, | 198 | activity_id: poolId, |
193 | product_sku: $(this).data('id'), | 199 | product_sku: $(this).data('id'), |
194 | buy_number: $(this).data('productnum'), | 200 | buy_number: $(this).data('productnum'), |
@@ -229,6 +235,7 @@ Cart = { | @@ -229,6 +235,7 @@ Cart = { | ||
229 | var $chk = $(this); | 235 | var $chk = $(this); |
230 | var $item = $chk.closest('[data-role=pitem]'); | 236 | var $item = $chk.closest('[data-role=pitem]'); |
231 | var poolId = $item.data('pool-id'); | 237 | var poolId = $item.data('pool-id'); |
238 | + var batchNo = $item.data('batch-no'); | ||
232 | 239 | ||
233 | if (!$chk.hasClass('cart-item-checked') || $chk.find('.pay-pro').hasClass('is-check')) { | 240 | if (!$chk.hasClass('cart-item-checked') || $chk.find('.pay-pro').hasClass('is-check')) { |
234 | return true; | 241 | return true; |
@@ -242,6 +249,7 @@ Cart = { | @@ -242,6 +249,7 @@ Cart = { | ||
242 | } | 249 | } |
243 | 250 | ||
244 | selectArray.push({ | 251 | selectArray.push({ |
252 | + batch_no: batchNo, | ||
245 | activity_id: poolId, | 253 | activity_id: poolId, |
246 | product_sku: $(this).data('id'), | 254 | product_sku: $(this).data('id'), |
247 | buy_number: $(this).data('productnum'), | 255 | buy_number: $(this).data('productnum'), |
@@ -285,7 +293,9 @@ Cart = { | @@ -285,7 +293,9 @@ Cart = { | ||
285 | 293 | ||
286 | var $item = $(this); | 294 | var $item = $(this); |
287 | var poolId = $item.data('pool-id'); | 295 | var poolId = $item.data('pool-id'); |
296 | + var batchNo = $item.data('batch-no'); | ||
288 | 297 | ||
298 | + // 过滤套餐商品列表数据 | ||
289 | if ($item.find('.pay-pro').hasClass('is-check')) { | 299 | if ($item.find('.pay-pro').hasClass('is-check')) { |
290 | return true; | 300 | return true; |
291 | } | 301 | } |
@@ -298,6 +308,7 @@ Cart = { | @@ -298,6 +308,7 @@ Cart = { | ||
298 | } | 308 | } |
299 | 309 | ||
300 | selectArray.push({ | 310 | selectArray.push({ |
311 | + batch_no: batchNo, | ||
301 | activity_id: poolId, | 312 | activity_id: poolId, |
302 | product_sku: $(this).data('id'), | 313 | product_sku: $(this).data('id'), |
303 | buy_number: $(this).data('productnum'), | 314 | buy_number: $(this).data('productnum'), |
@@ -405,7 +416,8 @@ Cart = { | @@ -405,7 +416,8 @@ Cart = { | ||
405 | 416 | ||
406 | capi.cartItemNumChg($.extend(countJSON, { | 417 | capi.cartItemNumChg($.extend(countJSON, { |
407 | sku: $item.data('id'), | 418 | sku: $item.data('id'), |
408 | - activity_id: $item.data('pool-id') | 419 | + batch_no: $item.data('batch-no'), |
420 | + activity_id: $item.data('pool-id'), | ||
409 | })); | 421 | })); |
410 | 422 | ||
411 | if (!$btn.hasClass('cart-item-checked')) { | 423 | if (!$btn.hasClass('cart-item-checked')) { |
@@ -361,18 +361,13 @@ function parseProductInfo(productInfo, defaultInfo) { | @@ -361,18 +361,13 @@ function parseProductInfo(productInfo, defaultInfo) { | ||
361 | }; | 361 | }; |
362 | } | 362 | } |
363 | 363 | ||
364 | -function updateCartItem(newSku, oldSku) { | 364 | +function updateCartItem(swapData) { |
365 | 365 | ||
366 | return $.ajax({ | 366 | return $.ajax({ |
367 | type: 'POST', | 367 | type: 'POST', |
368 | url: '/cart/cart/updateProduct', | 368 | url: '/cart/cart/updateProduct', |
369 | data: { | 369 | data: { |
370 | - swapData: JSON.stringify([{ | ||
371 | - buy_number: '1', | ||
372 | - selected: 'Y', | ||
373 | - new_product_sku: newSku, | ||
374 | - old_product_sku: oldSku | ||
375 | - }]) | 370 | + swapData: JSON.stringify([swapData]) |
376 | } | 371 | } |
377 | }).then(function(d) { | 372 | }).then(function(d) { |
378 | if (d.code === 200) { | 373 | if (d.code === 200) { |
@@ -75,11 +75,14 @@ ColorPanelAction = { | @@ -75,11 +75,14 @@ ColorPanelAction = { | ||
75 | var $item = $this.closest('li[data-role="pitem"]'); | 75 | var $item = $this.closest('li[data-role="pitem"]'); |
76 | 76 | ||
77 | // var pid = $item.data('pid'); | 77 | // var pid = $item.data('pid'); |
78 | + var swapData = {}; | ||
78 | var oldSku = $item.data('id'); | 79 | var oldSku = $item.data('id'); |
79 | var $size = $this.closest('.goods-choose-box').find('.choose-size .dt.active'); | 80 | var $size = $this.closest('.goods-choose-box').find('.choose-size .dt.active'); |
80 | var newSku = $size.data('sku'); | 81 | var newSku = $size.data('sku'); |
81 | var newSkn = $this.closest('.goods-info').data('skn'); | 82 | var newSkn = $this.closest('.goods-info').data('skn'); |
82 | var promotionId = $item.data('promotionid'); | 83 | var promotionId = $item.data('promotionid'); |
84 | + var poolId = $item.data('pool-id'); | ||
85 | + var batchNo = $item.data('batch-no'); | ||
83 | 86 | ||
84 | // 没有重新选择颜色-尺码,则不用重新请求显示 | 87 | // 没有重新选择颜色-尺码,则不用重新请求显示 |
85 | if (!oldSku || !newSku || oldSku === newSku) { | 88 | if (!oldSku || !newSku || oldSku === newSku) { |
@@ -91,7 +94,23 @@ ColorPanelAction = { | @@ -91,7 +94,23 @@ ColorPanelAction = { | ||
91 | if ($item.data('isgift') || $item.data('ispricegift')) { | 94 | if ($item.data('isgift') || $item.data('ispricegift')) { |
92 | return capi.updateCartGiftItem(promotionId, newSkn, newSku); | 95 | return capi.updateCartGiftItem(promotionId, newSkn, newSku); |
93 | } | 96 | } |
94 | - capi.updateCartItem(newSku, oldSku); | 97 | + |
98 | + swapData = { | ||
99 | + buy_number: '1', | ||
100 | + selected: 'Y', | ||
101 | + new_product_sku: newSku, | ||
102 | + old_product_sku: oldSku | ||
103 | + } | ||
104 | + | ||
105 | + // 套餐编辑尺码 | ||
106 | + if (poolId) { | ||
107 | + $.extend(swapData, { | ||
108 | + activity_id: poolId, | ||
109 | + batch_no: batchNo | ||
110 | + }); | ||
111 | + } | ||
112 | + | ||
113 | + capi.updateCartItem(swapData); | ||
95 | }, | 114 | }, |
96 | _hideColorSizePanel: function($item) { | 115 | _hideColorSizePanel: function($item) { |
97 | $item.find('.goods-choose-box').hide(); | 116 | $item.find('.goods-choose-box').hide(); |
@@ -158,7 +158,8 @@ exports.processProductList = (list, options) => { | @@ -158,7 +158,8 @@ exports.processProductList = (list, options) => { | ||
158 | }], | 158 | }], |
159 | sales_price: product.orign_price, | 159 | sales_price: product.orign_price, |
160 | market_price: null, | 160 | market_price: null, |
161 | - tbl_country_name: product.country_name | 161 | + tbl_country_name: product.country_name, |
162 | + tbl_brand_id: product.brand_id | ||
162 | }); | 163 | }); |
163 | } | 164 | } |
164 | 165 |
-
Please register or login to post a comment