Authored by 刘传洋

m

... ... @@ -277,7 +277,7 @@ const formatPriceGifts = (giftList) => {
/**
* 购物车赠品
*/
/*const formatGifts = (giftList) => {
/* const formatGifts = (giftList) => {
return formatPriceGifts(giftList);
};*/
... ... @@ -418,6 +418,7 @@ module.exports = {
transPrice,
getShoppingKeyByCookie,
formatCartGoods,
// formatGifts,
formatPriceGiftOne,
formatPriceGifts,
... ...
... ... @@ -848,17 +848,17 @@ const queryUserPromotionGift = (promotionId, uid, shoppingKey) => {
let cartDataRet = yield cartApi.cartData(uid, shoppingKey);
let selectedGift = chelper.formatCartGoods(_.get(cartDataRet, 'data.ordinary_cart_data.goods_list'));
if(promotionGifts && promotionGifts.code === 200) {
if (promotionGifts && promotionGifts.code === 200) {
promotionGifts.data = chelper.formatPriceGiftOne(promotionGifts.data);
// 处理是否选中状态
if(selectedGift && selectedGift.length) {
if (selectedGift && selectedGift.length) {
_.forEach(promotionGifts.data.goodsList, (it) => {
var isSelected = false;
_.forEach(selectedGift, sg => {
if(it.skn === sg.skn) {
if (it.skn === sg.skn) {
isSelected = true;
return true;
}
... ...
... ... @@ -311,7 +311,7 @@ function getProductByPromotionId(promotionId) {
function bindGiftWinAction($el) {
$el.on('click', '.slide-img .img-list .img-item', function(){
$el.on('click', '.slide-img .img-list .img-item', function() {
var id = $(this).data('id');
var skn = $(this).data('skn');
... ... @@ -321,7 +321,7 @@ function bindGiftWinAction($el) {
$el.find('.product-detail-info').empty().append(productInfoTpl(res));
});
});
};
}
function renderAndShowGiftWin(plist) {
... ... @@ -644,7 +644,7 @@ var Cart = {
$this.siblings('.dt').removeClass('active');
$this.addClass('active');
},
showGiftWin: function () {
showGiftWin: function() {
var $this = $(this);
var $wrap = $this.closest('[data-role="promotion-wrap"]');
... ... @@ -654,11 +654,11 @@ var Cart = {
console.log($this);
console.log($wrap);
console.log(promotionid);
if(!promotionInfo) {
if (!promotionInfo) {
getProductByPromotionId(promotionid).done(function(pinfo) {
if(!pinfo && pinfo.code !== 200) {
if (!pinfo && pinfo.code !== 200) {
return new Alert('获取商品失败,请稍后再试!').show();
}
... ... @@ -741,7 +741,7 @@ var giftBtn = ['[data-role=gift-view-btn]',
'[data-role=pg-sel-btn]',
'[data-role=pg-resel-btn]'];
$payWapper./*find('li[data-role="pitem"]').*/on('click', giftBtn.join(','), Cart.showGiftWin);
$payWapper./* find('li[data-role="pitem"]').*/on('click', giftBtn.join(','), Cart.showGiftWin);
/*
$('.shop-cart').on('click', giftBtn.join(','), function() {
... ...