Authored by htoooth

Merge remote-tracking branch 'origin/release/5.6' into release/5.6

... ... @@ -296,11 +296,13 @@ const modifyProductNum = (req, res, next) => {
let increaseNum = req.body.increaseNum || null;
let decreaseNum = req.body.decreaseNum || null;
let cartDelList = helper.getCartDelList(req, res);
let batchNo = req.body.batch_no || null;
let activityId = req.body.activity_id || null;
if (activityId) {
return service.bundleNumData({
uid: uid,
batch_no: batchNo,
activity_id: activityId,
shopping_key: shoppingKey,
increaseNum: increaseNum,
... ...
... ... @@ -38,6 +38,9 @@ const bundleNum = (params) => {
params.decrease_number = parseInt(params.decreaseNum, 10);
}
delete params.increaseNum;
delete params.decreaseNum;
return api.get('', params, {code: 200});
};
... ...
... ... @@ -507,8 +507,9 @@ const formatPromotionPools = (pools, selectedGiftsList, isAdvance, analysis) =>
poolId: p.pool_id,
poolTitle: p.pool_title,
isChecked: p.selected === 'Y',
productNum: Number(p.pool_buy_number),
storageNum: Number(p.pool_storage_number),
batchNo: p.pool_batch_no,
productNum: parseInt(p.pool_buy_number, 10),
storageNum: parseInt(p.pool_storage_number, 10),
poolType: p.pool_type,
isBrandGroup: p.pool_type === 1,
goodsList: formatCartGoods(p.goods_list, isAdvance, false, false, analysis),
... ... @@ -542,18 +543,15 @@ const formatSoldOutPools = (pools, selectedGiftsList, isAdvance, analysis) => {
poolId: p.pool_id,
poolTitle: p.pool_title,
isChecked: p.selected === 'Y',
productNum: Number(p.pool_buy_number),
storageNum: Number(p.pool_storage_number),
batchNo: p.pool_batch_no,
productNum: parseInt(p.pool_buy_number, 10),
storageNum: parseInt(p.pool_storage_number, 10),
poolType: p.pool_type,
isBrandGroup: p.pool_type === 1,
goodsList: formatCartGoods(p.goods_list, isAdvance, true, false, analysis),
promotionInfos: formatPoolPromotionInfos(p.promotion_list, selectedGiftsList)
};
if (p.sub_pool) {
pool.subs = formatSubPromotionPools(p.sub_pool, selectedGiftsList, isAdvance, analysis);
}
// 套餐不须要列表中有删除、收藏按钮
if (p.pool_type === 3) {
pool.goodsList = _disablePools(pool.goodsList, true, true);
... ...
... ... @@ -7,6 +7,7 @@
'use strict';
const _ = require('lodash');
const cheerio = require('cheerio');
const helpers = global.yoho.helpers;
... ... @@ -295,10 +296,14 @@ const getGlobalProductDetailData = (skn, channelNum, channel) => {
}
if (result.html && !_.get(result.html, 'code', '')) {
let regContent = /<body[^>]*>([\s\S]*)<\/body>/.exec(result.html);
let $ = cheerio.load(result.html);
html = regContent[1] || '';
html = html.replace(/<script.*?>.*?<\/script>/ig, '');
$('script').remove();
html = $('body').html();
if (html) {
html = html.replace(/http:/ig, '');
}
}
Object.assign(resData, result.header, {
... ...
... ... @@ -18,6 +18,7 @@
data-pool-type="{{parent.poolType}}"
{{#if isGift}} data-isgift="true"{{/if}}
{{#if isPriceGift}} data-ispricegift="true"{{/if}}
{{#if parent.batchNo}} data-batch-no="{{parent.batchNo}}"{{/if}}
{{#if parent.poolId}} data-pool-id="{{parent.poolId}}"{{/if}} >
<div class="pay-pro td {{#eq parent.poolType 3}} is-check{{/eq}}" style="width: 368px;">
{{#unless isGift}}
... ...
... ... @@ -4,7 +4,8 @@
{{#inValid}} tr-disabled{{/inValid}}
{{#isChecked}} active{{/isChecked}}" data-role="pitem" {{#if productNum}} data-productnum="{{productNum}}"{{/if}}
data-pool-type="{{poolType}}"
data-pool-id="{{poolId}}">
data-pool-id="{{poolId}}"
data-batch-no="{{batchNo}}">
<div class="pay-pro td line-height" style="width: 516px;">
{{#if inValid}}
<i class="cart-item-disabled iconfont"></i>
... ...
... ... @@ -67,6 +67,7 @@ function toggleAll(obj, roleType) {
$cartListWrap.find('[data-role=' + roleType + '] li[data-role=pitem]').each(function() {
var $t = $(this);
var poolId = $t.data('pool-id');
var batchNo = $t.data('batch-no');
if ($t.find('.pay-pro').hasClass('is-check')) {
return true;
... ... @@ -81,6 +82,7 @@ function toggleAll(obj, roleType) {
selectArray.push({
selected: selected,
activity_id: poolId,
batch_no: batchNo,
product_sku: $(this).data('id'),
buy_number: $(this).data('productnum'),
promotion_id: $(this).data('promotionid') || 0
... ... @@ -120,6 +122,7 @@ Cart = {
var $pitem = $this.closest('li[data-role="pitem"]');
var item = [];
var poolId = $pitem.data('pool-id');
var batchNo = $pitem.data('batch-no');
var isTipnostore = true;
// 套餐-单选
... ... @@ -139,6 +142,7 @@ Cart = {
item.push({
selected: $this.hasClass('cart-item-checked') ? 'N' : 'Y', // 'Y' : 'N',
batch_no: batchNo,
activity_id: poolId,
product_sku: $(this).data('id'),
buy_number: $(this).data('productnum'),
... ... @@ -180,6 +184,7 @@ Cart = {
var content = '<div><i class="iconfont">&#xe684;</i>删除商品</div><p>确定要从购物车中删除该商品?</p>';
var countJSON = [];
var poolId = $item.data('pool-id');
var batchNo = $item.data('batch-no');
// 套餐删除
if (poolId && parseInt($item.data('pool-type'), 10) === 3) {
... ... @@ -189,6 +194,7 @@ Cart = {
}
selectArray.push({
batch_no: batchNo,
activity_id: poolId,
product_sku: $(this).data('id'),
buy_number: $(this).data('productnum'),
... ... @@ -229,6 +235,7 @@ Cart = {
var $chk = $(this);
var $item = $chk.closest('[data-role=pitem]');
var poolId = $item.data('pool-id');
var batchNo = $item.data('batch-no');
if (!$chk.hasClass('cart-item-checked') || $chk.find('.pay-pro').hasClass('is-check')) {
return true;
... ... @@ -242,6 +249,7 @@ Cart = {
}
selectArray.push({
batch_no: batchNo,
activity_id: poolId,
product_sku: $(this).data('id'),
buy_number: $(this).data('productnum'),
... ... @@ -285,7 +293,9 @@ Cart = {
var $item = $(this);
var poolId = $item.data('pool-id');
var batchNo = $item.data('batch-no');
// 过滤套餐商品列表数据
if ($item.find('.pay-pro').hasClass('is-check')) {
return true;
}
... ... @@ -298,6 +308,7 @@ Cart = {
}
selectArray.push({
batch_no: batchNo,
activity_id: poolId,
product_sku: $(this).data('id'),
buy_number: $(this).data('productnum'),
... ... @@ -405,7 +416,8 @@ Cart = {
capi.cartItemNumChg($.extend(countJSON, {
sku: $item.data('id'),
activity_id: $item.data('pool-id')
batch_no: $item.data('batch-no'),
activity_id: $item.data('pool-id'),
}));
if (!$btn.hasClass('cart-item-checked')) {
... ...
... ... @@ -361,18 +361,13 @@ function parseProductInfo(productInfo, defaultInfo) {
};
}
function updateCartItem(newSku, oldSku) {
function updateCartItem(swapData) {
return $.ajax({
type: 'POST',
url: '/cart/cart/updateProduct',
data: {
swapData: JSON.stringify([{
buy_number: '1',
selected: 'Y',
new_product_sku: newSku,
old_product_sku: oldSku
}])
swapData: JSON.stringify([swapData])
}
}).then(function(d) {
if (d.code === 200) {
... ...
... ... @@ -75,11 +75,14 @@ ColorPanelAction = {
var $item = $this.closest('li[data-role="pitem"]');
// var pid = $item.data('pid');
var swapData = {};
var oldSku = $item.data('id');
var $size = $this.closest('.goods-choose-box').find('.choose-size .dt.active');
var newSku = $size.data('sku');
var newSkn = $this.closest('.goods-info').data('skn');
var promotionId = $item.data('promotionid');
var poolId = $item.data('pool-id');
var batchNo = $item.data('batch-no');
// 没有重新选择颜色-尺码,则不用重新请求显示
if (!oldSku || !newSku || oldSku === newSku) {
... ... @@ -91,7 +94,23 @@ ColorPanelAction = {
if ($item.data('isgift') || $item.data('ispricegift')) {
return capi.updateCartGiftItem(promotionId, newSkn, newSku);
}
capi.updateCartItem(newSku, oldSku);
swapData = {
buy_number: '1',
selected: 'Y',
new_product_sku: newSku,
old_product_sku: oldSku
}
// 套餐编辑尺码
if (poolId) {
$.extend(swapData, {
activity_id: poolId,
batch_no: batchNo
});
}
capi.updateCartItem(swapData);
},
_hideColorSizePanel: function($item) {
$item.find('.goods-choose-box').hide();
... ...
... ... @@ -302,7 +302,7 @@
}
}
.is-check i {
.is-check i.cart-item-check {
visibility: hidden !important;
}
... ...
... ... @@ -158,7 +158,8 @@ exports.processProductList = (list, options) => {
}],
sales_price: product.orign_price,
market_price: null,
tbl_country_name: product.country_name
tbl_country_name: product.country_name,
tbl_brand_id: product.brand_id
});
}
... ...