Authored by 刘传洋

m

... ... @@ -55,7 +55,7 @@ const setShoppingCookie = (req) => {
*/
const cart = (req, res, next) => {
let uid = 8040155; // req.user.uid; // 8040155; // req.user.uid; 20422448
let uid = req.user.uid; // 8040155; // req.user.uid; 20422448
// console.log('====================> ' + uid);
let shoppingKey = helper.getShoppingKeyByCookie(req);
let cartDelList = req.cookies['cart-del-list'];
... ...
... ... @@ -385,7 +385,7 @@ const getCartData = (uid, shoppingKey, cartDelList) => {
return co(function * () {
let result = {
isEmpty: true,
isEmpty: false,
isLogin: !!uid,
searchUrl: helpers.urlFormat('', null, 'search'), // 搜索链接(再逛逛)
listUrl: helpers.urlFormat('', null, 'list'),
... ...
... ... @@ -106,7 +106,6 @@
{{#promotionInfos}}
<div data-role="promotion-wrap" >
<code class="{{#unless isReach}}order-pay-mark-white{{/unless}}">{{tag}}</code>{{promotionTitle}}
<!--<a>去换购</a>-->
{{#if isGift}}
{{#if isNotReach}}<a href="javascript:void(0);" data-role="gift-view-btn">查看赠品</a>{{/if}}
{{#if isSelected}}
... ... @@ -115,9 +114,22 @@
{{#if isReach}}<a href="javascript:void(0);" data-role="gift-sel-btn">领赠品</a>{{/if}}
{{/if}}
{{/if}}
{{#if isNotReach}}
<a class="btn-clear blue" target="_blank" href="{{promotionPageUrl}}" data-together-id="1" >去凑单&nbsp;></a>
{{#if isPriceGift}}
{{!--{{#if isNotReach}}
<a href="javascript:void(0);" data-role="gift-view-btn">查看赠品</a>
{{/if}}--}}
{{#if isSelected}}
<a href="javascript:void(0);" data-role="pg-resel-btn">重新换购</a>
{{else}}
{{#if isReach}}<a href="javascript:void(0);" data-role="pg-sel-btn">去换购</a>{{/if}}
{{/if}}
{{#if isNotReach}}
<a class="btn-clear blue" target="_blank" href="{{promotionPageUrl}}" data-together-id="1" >去凑单&nbsp;></a>
{{/if}}
{{/if}}
{{> cart-sel-gift-tpl }}
{{!--<textarea data-role="gifts-cansel" class="hide" data-promotionid="{{promotionId}}">{{{giftGoodsListStr}}}</textarea>--}}
</div>
... ...
... ... @@ -7,98 +7,24 @@
<div class="content">
<div class="detail-body">
<div class="slide-img">
<p>选赠品:<em><span
class="active">1元加价购</span><code>|</code><span>59元加价购</span><code>|</code><span>99元加价购</span></em></p>
<p>选赠品:
<em><span class="active">1元加价购</span>
<code>|</code><span>59元加价购</span>
<code>|</code><span>99元加价购</span>
</em>
</p>
<div class="side-img-dd">
<ul class="img-list">
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
</a>
</div>
</li>
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
</a>
</div>
</li>
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
</a>
</div>
</li>
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
</a>
</div>
</li>
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
</a>
</div>
</li>
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
</a>
</div>
</li>
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
</a>
</div>
</li>
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
</a>
</div>
</li>
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
</a>
</div>
</li>
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
</a>
</div>
</li>
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{url}}" target="_blank">
<img class="lazy" src="{{pic_url}}"/>
</a>
</div>
</li>
{{#each giftGoodsList}}
<li class="img-item">
<span class="hide goods-id">{{goods_id}}</span>
<div class="good">
<a href="{{link}}" target="_blank">
<img class="lazy" src="{{imgCover}}"/>
</a>
</div>
</li>
{{/each}}
</ul>
</div>
</div>
... ...
... ... @@ -53,14 +53,10 @@
<div class="goods-info-bigImg">
{{# colors}}
<div class="bigImg {{#unless focus}} hide{{/unless}}">
{{#if focus}}
{{# thumbs}}
<img class="thumb" src="{{image img 100 134}}" data-shower="{{shower}}">
{{/ thumbs}}
{{^}}
{{# thumbs}}
<img class="thumb lazy" data-original="{{img}}" data-shower="{{shower}}">
{{/ thumbs}}
{{#if pic}}
<img src="{{image pic 100 134}}" />
{{else}}
<img src="{{image ../defaultImg 100 134}}" />
{{/if}}
</div>
{{/ colors}}
... ...
... ... @@ -578,6 +578,8 @@ var Cart = {
var $this = $(this);
var index = $this.index('.dt');
var $srows = $this.closest('.goods-info').find('.choose-size .size-row');
var $bigImgs = $this.closest('.goods-choose-box').find('.goods-info-bigImg');
if ($this.hasClass('active')) return;
... ... @@ -588,6 +590,8 @@ var Cart = {
$srows.hide();
$srows.indexOf(index).show();
$bigImgs.hide();
$bigImgs.indexOf(index).show();
},
selectSize: function() {
... ... @@ -648,102 +652,22 @@ $payWapper.on('click', '.minus, .plus', Cart.modNum); // 修改购物车数量
$cartnewSum.on('click', '.clean-all-disable', Cart.cleanAllDisable);
$('.btn_account').on('click', Cart.submit); // 结算
/** 重新选择商品颜色尺码 **/
$payWapper.on('click', 'li[data-role="pitem"] .pay-pro-detail', Cart.showColorSizePanel);
$payWapper.on('click', 'li[data-role="pitem"] .button-cancel', Cart.hideColorSizePanel);
$payWapper.on('click', 'li[data-role="pitem"] .button-sure', Cart.editColorOrSize);
$payWapper.on('click', 'li[data-role="pitem"] .goods-choose-box .choose-color .dt', Cart.selectColor);
$payWapper.on('click', 'li[data-role="pitem"] .goods-choose-box .choose-size .dt', Cart.selectSize);
// / 绑定颜色尺码弹窗事件 begin
/*
oldProductSku = editTarget.find('.current').attr('data-sku');
// rebind events(Tips依赖接口数据,so 不能delegate)
editTarget.find('#confirm').click(function(e) {
e.preventDefault();
newProductSku = editTarget.find('.current-sizes .active').attr('data-sku');
// 没有重新选择颜色-尺码,则不用重新请求显示
if (!oldProductSku || !newProductSku || newProductSku === oldProductSku) {
editTarget.find('.edit-color-size').remove();
return false;
}
Util.ajax({
url: '/shopping/cart/updateProduct',
type: 'PUT',
data: {
swapData: JSON.stringify([{
buy_number: '1',
selected: 'Y',
new_product_sku: newProductSku,
old_product_sku: oldProductSku
}])
},
success: function(newCartData) {
editTarget.find('.edit-color-size').remove();
Util.refreshCart(newCartData);
setEditable();
}
});
return false;
});
editTarget.find('#cancel').click(function(e) {
e.preventDefault();
editTarget.find('.edit-color-size').remove();
setEditable();
return false;
});
editTarget.find('.edit-color-size').click(function(e) {
e.preventDefault();
return false;
});
editTarget.find('.color-item').click(function(e) {
e.preventDefault();
selectColor = $(this);
if (!selectColor.hasClass('current-color')) {
selectColor.addClass('current-color').siblings().removeClass('current-color');
selectColor.parent().siblings('.current-sizes').hide().removeClass('current-sizes');
editTarget.find('#' + selectColor.attr('data-target')).show().addClass('current-sizes')
.end()
.find('.right img').attr({
src: selectColor.attr('data-imageurl'),
title: selectColor.attr('data-title')
})
.end()
.find('.selected-color').text(selectColor.attr('data-title'));
}
return false;
});
editTarget.find('.size-item').click(function() {
var $this = $(this);
if ($this.hasClass('active') || $this.hasClass('disabled')) {
return;
}
$(this).addClass('active').siblings('.active').removeClass('active');
});
// 初始化size list选中项(其他颜色中第一个尺码)
editTarget.find('.sizes-list.mb10').each(function() {
if ($(this).find('.active').length === 0) {
$(this).find('.size-item:not(.disabled)').first().addClass('active');
}
});*/
// / 绑定颜色尺码弹窗事件 end
/** 赠品加价购弹窗 **/
// 显示赠品
var giftBtn = '[data-role=gift-view-btn],[data-role=gift-resel-btn],[data-role=gift-sel-btn]';
var giftBtn = [ '[data-role=gift-view-btn]',
'[data-role=gift-resel-btn]',
'[data-role=gift-sel-btn]',
'[data-role=pg-sel-btn]',
'[data-role=pg-resel-btn]'];
$('.shop-cart').on('click', giftBtn, function() {
$('.shop-cart').on('click', giftBtn.join(','), function() {
var $this = $(this);
var $win = $this.closest('[data-role=promotion-wrap]').find('[data-role=cart-gift-win]');
... ... @@ -752,8 +676,6 @@ $('.shop-cart').on('click', giftBtn, function() {
$win.show();
});
$('.shop-cart').on('click', '[data-role="cart-gift-win"] .close', function(){
$('.shop-cart').on('click', '[data-role="cart-gift-win"] .close', function() {
$(this).closest('[data-role="cart-gift-win"]').hide();
});
// 显示加价购
... ...
... ... @@ -142,11 +142,12 @@ $payWapper.on('click', '.cart-del-btn', function() {
// 凑单图片懒加载
var togetherDialog = {};
// var dialogTpl = require('hbs/cart/cart-togetherGoods.hbs');
lazyLoad($('#details-html img'));
//凑单 顶部 轮播
// 凑单 顶部 轮播
$('.side-img-dd').slider2({
isCircle: true,
shownum: 5
... ... @@ -176,10 +177,10 @@ function loadTogetherGoods() {
//
// $('#recommend-shop').removeClass('hide');
$('.side-img-dd').slider2({
shownum: 5,
isCircle: true
});
$('.side-img-dd').slider2({
shownum: 5,
isCircle: true
});
// } else {
// $('.individual-comment').find('.block-title .title:first-child').addClass('hide');
... ...