Authored by 刘传洋

m

... ... @@ -74,7 +74,7 @@ const cart = (req, res, next) => {
.then(ret => {
if (req.query.json === '1') {
return res.send(ret);
return res.send(Object.assign({user: req.user}, ret));
}
if (req.query.page === '1') {
... ... @@ -92,7 +92,7 @@ const cart = (req, res, next) => {
module: 'cart',
page: 'cart',
stepper: stepper,
simpleHeader: simpleHeaderModel.setSimpleHeaderData(),
simpleHeader: simpleHeaderModel.setSimpleHeaderData(req.user),
uid: uid,
cart: ret
});
... ...
... ... @@ -10,7 +10,7 @@ let helpers = global.yoho.helpers;
/**
* 获取简单头部数据
*/
const setSimpleHeaderData = () => {
const setSimpleHeaderData = (user) => {
let time = Date.now();
let simpleHeader = {
... ... @@ -29,6 +29,15 @@ const setSimpleHeaderData = () => {
}
};
if (user && user.uid) {
Object.assign(simpleHeader.tool, {
loginHref: false,
registerHref: false,
user: user.name,
isLogin: true
});
}
return simpleHeader;
};
... ...
... ... @@ -28,23 +28,26 @@
<a href="{{.}}">[免费注册]</a>
{{/ registerHref}}
</li>
<li class="tool-options">
<span><a href="{{userCenter}}">MY有货</a></span>
<i class="options-icon down iconfont">&#xe610;</i>
<i class="options-icon up iconfont">&#xe615;</i>
<div class="tool-select">
<a href="{{favoriteHref}}">我的收藏</a>
<a href="{{couponHref}}">优惠券</a>
</div>
</li>
<li>
{{#isLogin}}
<li class="tool-options">
<span><a href="{{userCenter}}">MY有货</a></span>
<i class="options-icon down iconfont">&#xe610;</i>
<i class="options-icon up iconfont">&#xe615;</i>
<div class="tool-select">
<a href="{{favoriteHref}}">我的收藏</a>
<a href="{{couponHref}}">优惠券</a>
</div>
</li>
{{/isLogin}}
<li>
<a href="{{orderHref}}">订单中心</a>
</li>
<li>
<li>
<a href="{{helpHref}}">帮助中心</a>
</li>
{{/ tool}}
</ul>
</div>
</div>
{{/ simpleHeader}}
\ No newline at end of file
{{/ simpleHeader}}
... ...
... ... @@ -4,12 +4,11 @@
var $ = require('yoho-jquery');
var dialog = require('../common/dialog');
var Dialog = dialog.Dialog;
var Alert = dialog.Alert;
var Confirm = dialog.Confirm;
var rDialog = require('./rdialog');
var RConfirm = rDialog.RConfirm;
var RAlert = rDialog.RAlert;
var Cart;
var $cartnewTips = $('.cartnew-tips'),
$payWapper = $('.pay-wapper'),
... ... @@ -22,7 +21,7 @@ $cartnewTips.find('.btn_close').click(function() {
});
// 滚动到第一个选中的商品
function scrollToFirst() {
/*function scrollToFirst() {
var $selected = $payWapper.find('li[data-role="pitem"] .cart-item-check.cart-item-checked:eq(0)');
var top = 0;
... ... @@ -32,7 +31,7 @@ function scrollToFirst() {
}
return false;
}
}*/
function toastNoStore(parent) {
... ... @@ -45,10 +44,10 @@ function toastNoStore(parent) {
}, 2000);
}
var Cart = {
addToCart: function(params) {
Cart = {
/* addToCart: function(params) {
},
},*/
toggleSelectOne: function() { // 单选
var $this = $(this);
... ... @@ -143,6 +142,7 @@ var Cart = {
var $chk = $(this);
var $item = $chk.closest('[data-role=pitem]');
if ($chk.hasClass('cart-item-checked')) {
if ($item.data('id')) {
... ... @@ -240,6 +240,7 @@ var Cart = {
var $item = $(this);
var $chk = $item.find('.cart-item-check');
if ($chk.hasClass('cart-item-checked')) {
if ($item.data('id')) {
... ... @@ -301,9 +302,13 @@ var Cart = {
if ($('[data-role="gift-sel-btn"]').length) {
alert('还有赠品未领取!');
}
capi.showMDialog('#Y_CartSelectDialog');
// $('.cart-preSell-dialog').show();
// $('.cart-togetherGoods').show();
... ...
... ... @@ -5,17 +5,17 @@
*/
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload'),
dialog = require('../common/dialog'),
$sellBox = $('.cart-table .pre-sell-box');
require('../plugins/slider');
require('../common/center-slider');
require('../common');
require('../simple-header');
function isCheckAll() {
var isAllCheck = true;
$('[data-role=pitem] [data-role=cart-item-check]').each(function() {
// 有一个没选中,跳出循环
... ... @@ -81,7 +81,7 @@ $(function() {
$(this).removeClass('active').children('ul').addClass('none');
});
$('.side-img-dd').each(function(){
$('.side-img-dd').each(function() {
$(this).slider2({
shownum: 5,
isCircle: true
... ...