Authored by biao

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into fix/issue

... ... @@ -846,7 +846,16 @@
{
id: 1,
inValid: true, //是否是失效商品,
showCheckbox: true, //是否显示checkbox【赠品和加价购不显示】
checked: true, //是否选中
thumb: '',
isAdvanceBuy: true, //是否是加价购商品
isGift: ture, //是否是赠品
name: '',
color: '黄色',
size: 'L',
... ...
/**
* 购物车信息读取
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
* @date: 2015/12/15
*/
var info = window.cookie('cart-info');
// info 必须是 JSON 字符串
try {
info = JSON.parse(info);
} catch (e) {
info = {
deliveryId: null,
deliveryTimeId: null,
paymentTypeId: null,
yohoCoin: null,
addressId: null,
couponCode: null,
couponValue: null,
invoice: null,
invoiceText: null,
invoiceType: null,
msg: null
};
window.setCookie('cart-info', JSON.stringify(info));
}
exports.cartInfo = function(key, value) {
if (value === undefined) {
return info[key];
}
info[key] = value;
window.setCookie('cart-info', JSON.stringify(info));
};
... ... @@ -50,6 +50,10 @@ if ($('.cart-nav').length > 0) {
//trigger lazyload
$(window).trigger('scroll');
});
setTimeout(function() {
$('#presell-tip').addClass('hide');
}, 3000);
}
$('.btn-balance').on('touchend', function() {
... ...
... ... @@ -10,53 +10,42 @@
// 异步渲染的模板统一插入 #chose-panel ,兼容页面多个选择框
var $ = require('jquery'),
Handlebars = require('yoho.handlebars'),
tip = require('../plugin/tip'),
loading = require('../plugin/loading');
var panelTmpl,
$chosePanel = $('#chose-panel'),
var $chosePanel = $('#chose-panel'),
$num,
$chosed,
$imgsThumb,
// re = /\d+/,
$leftNum,
leftNum,
confirming,
hasChooseColor = false,
hasChooseSize = false,
curColorIndex,
curSizeIndex,
$curSizeRow,
$curSizeBlock = null,
$sizeRowList = $('.size-list ul');
// 读取模板
$.get('/cart/index/giftinfoTpl', function(html) {
if (!html) {
tip.show('网络错误');
return;
}
panelTmpl = Handlebars.compile(html);
}).fail(function() {
tip.show('网络错误');
});
hasChooseColor,
hasChooseSize,
$curSizeBlock,
$sizeRowList,
cbFn,
$allChoseItems,
$yohoPage = $('.yoho-page');
//初始化购物车面板显示
function init() {
var $firstRow;
//$colorList = $('.chose-panel .color-list ul>li');
//$sizeList = $('.chose-panel .size-list ul>li');
//firstColorId = $colorList.eq(0).data('id');
//$sizeList.each(function() {
// colorIndex = $(this).data('colorid');
//
// if (colorIndex === firstColorId) {
// $(this).removeClass('hide');
// }
//});
var $firstRow = $sizeRowList.eq(0);
hasChooseColor = false;
hasChooseSize = false;
$curSizeBlock = null;
$imgsThumb = $('.chose-panel').find('.thumb'),
$allChoseItems = $('.chose-items'),
$sizeRowList = $('.size-list ul'),
$leftNum = $('#left-num'),
$firstRow = $sizeRowList.eq(0);
$firstRow.toggleClass('hide');
$curSizeRow = $firstRow;
}
... ... @@ -75,34 +64,64 @@ function checkColorSizeNum() {
return true;
}
init();
function show(data) {
if (data) {
$chosePanel.html(panelTmpl(data));
function show(html, cb) {
if (html) {
$chosePanel.html(html);
init();
}
$('.chose-panel').show();
$('body').css('overflow', 'hidden');
$num = $('#good-num');
cbFn = cb;
}
////显示当前Panel
//function show() {
// $('.chose-panel').show();
//
// $('body').css('overflow', 'hidden');
// $num = $('#good-num');
//}
//隐藏当前Panel
function hide() {
$('.chose-panel').hide();
$('body').css('overflow', 'auto');
cbFn = null;
}
//修改加入购物车的文字和背景
function updateConformButtonClassAndText() {
$chosed = $allChoseItems.find('.chosed');
if (2 === $chosed.closest('.zero-stock').length) {
$('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
} else {
$('#chose-btn-sure').css('background-color', '#eb0313').html('确定');
}
}
$('.yoho-page').on('touchstart', '.chose-panel', function(e) {
//重置颜色块的库存为0的样式
function resetColorZeroStock($siblingBlock) {
var numArray = ($curSizeBlock.data('numstr') + '').split('/'),
i;
if (!hasChooseSize) {
$siblingBlock.find('ul>li').each(function() {
$(this).removeClass('zero-stock');
if ('0' === $(this).data('num')) {
$(this).addClass('zero-stock');
}
});
} else {
for (i = 0; i < numArray.length; i++) {
if ('0' === numArray[i]) {
$siblingBlock.find('.block').eq(i).addClass('zero-stock');
}
}
}
}
// 选择了颜色切换商品图片
function changeGoodImgWhenClickColor() {
if (hasChooseColor && curColorIndex) {
$imgsThumb.addClass('hide').eq(curColorIndex).removeClass('hide');
}
}
init();
$yohoPage.on('touchstart', '.chose-panel', function(e) {
var $cur = $(e.target);
if ($cur.closest('.main').length > 0) {
... ... @@ -113,12 +132,11 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
hide();
});
$('.color-list').on('touchstart', '.block', function(e) {
$yohoPage.on('touchstart', '.color-list .block', function(e) {
var $this = $(this),
$that = $(e.target).closest('.chose-items'),
index,
curSelectedSizeBlock,
$sizeChosed,
curSizeBlock,
$preSiblingBlock,
scindex,
curGoodNum;
... ... @@ -127,50 +145,46 @@ $('.color-list').on('touchstart', '.block', function(e) {
$this.siblings('.chosed').removeClass('chosed');
index = $this.index();
$sizeChosed = $siblingBlock.find('.chosed');
scindex = $sizeChosed.index();
$preSiblingBlock = $siblingBlock.find('.chosed');
scindex = $preSiblingBlock.index();
$curSizeRow = $sizeRowList.eq(index);
// 当前颜色已经是选中状态,再点击时
if ($this.hasClass('chosed')) {
//颜色原来已经是勾选时,要清空剩余件数的提示
$that.find('.num .left-num').html('');
$('#left-num').val(0);
$allChoseItems.find('.num .left-num').html('');
$leftNum.val(0);
hasChooseColor = false;
// 当前颜色不是选中状态,选中时
} else {
hasChooseColor = true;
//根据颜色切换图片
if ($this.closest('.block-list').hasClass('color-list')) {
$('.chose-panel').find('.thumb').addClass('hide').eq(index).removeClass('hide');
}
//把当前选中颜色对应的尺码那一行显示出来
$sizeRowList.addClass('hide');
$curSizeRow.removeClass('hide').addClass('show');
// 之前选中的尺码去掉勾选样式
if ($sizeChosed.length > 0) {
$sizeChosed.removeClass('chosed');
curSelectedSizeBlock = $curSizeRow.children().get(scindex);
if ($preSiblingBlock.length > 0) {
$preSiblingBlock.removeClass('chosed');
}
curSizeBlock = $curSizeRow.children().get(scindex);
// 当前选中颜色对应的尺码行,其对应的尺码加上勾选样式 (前提是要判断下这个尺码是否存在)
if (curSelectedSizeBlock) {
curGoodNum = $(curSelectedSizeBlock).data('num');
$(curSelectedSizeBlock).addClass('chosed');
if (curSizeBlock) {
curGoodNum = $(curSizeBlock).data('num');
$(curSizeBlock).addClass('chosed');
//如果当前有尺码被选中,且数量等于0,则颜色块添加数量为0的样式
if (curGoodNum > 0) {
$that.find('.num .left-num').html('剩余' + curGoodNum + '件');
$('#left-num').val(curGoodNum);
$allChoseItems.find('.num .left-num').html('剩余' + curGoodNum + '件');
$leftNum.val(curGoodNum);
} else {
$(curSelectedSizeBlock).removeClass('zero-stock').addClass('zero-stock');
$that.find('.num .left-num').html('');
$('#left-num').val(0);
$allChoseItems.find('.num .left-num').html('');
$leftNum.val(0);
}
}
}
... ... @@ -180,106 +194,31 @@ $('.color-list').on('touchstart', '.block', function(e) {
curColorIndex = index;
// 设置按钮的样式和文字
$chosed = $('.chose-items').find('.chosed');
if (2 === $chosed.closest('.zero-stock').length) {
$('#chose-btn-sure').css('background-color', '#c0c0c0');
$('#chose-btn-sure').html('已售罄');
} else {
$('#chose-btn-sure').css('background-color', '#eb0313');
$('#chose-btn-sure').html('确定');
}
/**if ($chosed.length === 0) {
$this.closest('ul>li').each(function() {
$(this).removeClass('zero-stock');
if ('0' === $(this).data('num')) {
$(this).addClass('zero-stock');
}
});
$siblingBlock.find('ul>li').each(function() {
$(this).removeClass('zero-stock');
if ('0' === $(this).data('num')) {
$(this).addClass('zero-stock');
}
});
} else if ($chosed.length === 1 && $this.hasClass('chosed')) {
$sizeList.addClass('hide');
//切换尺码信息
$sizeList.each(function() {
colorIndex = $(this).data('colorid');
if (colorIndex === $this.data('id')) {
$(this).removeClass('hide');
}
});
numArray = ($chosed.data('numstr') + '').split('/');
$siblingBlock.find('.block').removeClass('zero-stock');
for (i = 0; i < numArray.length; i++) {
if ('0' === numArray[i]) {
$siblingBlock.find('.block').eq(i).addClass('zero-stock');
}
}
} else if ($chosed.length === 1 && !$this.hasClass('chosed')) {
$('#chose-btn-sure').css('background-color', '#eb0313');
$('#chose-btn-sure').html('确定');
$siblingBlock.find('ul>li').each(function() {
$(this).removeClass('zero-stock');
if ('0' === $(this).data('num')) {
$(this).addClass('zero-stock');
}
});
$that.find('.num .left-num').html('');
} else if ($chosed.length === 2) {
$siblingBlock.find('.block').removeClass('zero-stock');
for (i = 0; i < currentNumArray.length; i++) {
if ('0' === currentNumArray[i]) {
$siblingBlock.find('.block').eq(i).addClass('zero-stock');
}
}
numArray = ($siblingBlock.find('.chosed').data('numstr') + '').split('/');
$that.find('.num .left-num').html('剩余' + numArray[index] + '件');
if (2 === $chosed.closest('.zero-stock').length) {
$('#chose-btn-sure').css('background-color', '#c0c0c0');
$('#chose-btn-sure').html('已售罄');
} else {
$('#chose-btn-sure').css('background-color', '#eb0313');
$('#chose-btn-sure').html('确定');
}
}**/
updateConformButtonClassAndText();
// 修改颜色时修改商品图片
changeGoodImgWhenClickColor();
});
$('.size-list').on('touchstart', '.block', function(e) {
$yohoPage.on('touchstart', '.size-list .block', function(e) {
var $this = $(this),
$that = $(e.target).closest('.chose-items'),
index,
$colorChosed,
curGoodNum;
var $siblingBlock = $this.closest('.block-list').siblings(':first');
$this.siblings('.chosed').removeClass('chosed');
index = $this.index();
$colorChosed = $siblingBlock.find('.chosed');
$curSizeRow = $sizeRowList.eq(index);
// 当前尺码已经是选中状态,再点击时
if ($this.hasClass('chosed')) {
//尺码原来已经是勾选时,要清空剩余件数的提示
$that.find('.num .left-num').html('');
$allChoseItems.find('.num .left-num').html('');
$('#left-num').val(0);
hasChooseSize = false;
// 去掉已经选中颜色的 数量为0的样式
if ($colorChosed.length > 0) {
$colorChosed.removeClass('zero-stock').addClass('zero-stock');
}
// 当前尺码不是选中状态,选中时
} else {
hasChooseSize = true;
... ... @@ -291,15 +230,15 @@ $('.size-list').on('touchstart', '.block', function(e) {
$curSizeBlock.removeClass('chosed');
}
// 如果当前有尺码被选中,且数量等于0,则颜色块添加数量为0的样式, 否则显示剩余件数
// 如果当前有尺码被选中,且数量等于0, 否则显示剩余件数
if (curGoodNum > 0 && hasChooseColor) {
$that.find('.num .left-num').html('剩余' + curGoodNum + '件');
$allChoseItems.find('.num .left-num').html('剩余' + curGoodNum + '件');
$('#left-num').val(curGoodNum);
} else {
$colorChosed.removeClass('zero-stock').addClass('zero-stock');
$that.find('.num .left-num').html('');
$allChoseItems.find('.num .left-num').html('');
$('#left-num').val(0);
}
}
$this.toggleClass('chosed');
... ... @@ -307,83 +246,15 @@ $('.size-list').on('touchstart', '.block', function(e) {
$curSizeBlock = $this;
// 设置按钮的样式和文字
$chosed = $('.chose-items').find('.chosed');
if (2 === $chosed.closest('.zero-stock').length) {
$('#chose-btn-sure').css('background-color', '#c0c0c0');
$('#chose-btn-sure').html('已售罄');
} else {
$('#chose-btn-sure').css('background-color', '#eb0313');
$('#chose-btn-sure').html('确定');
}
/**if ($chosed.length === 0) {
$this.closest('ul>li').each(function() {
$(this).removeClass('zero-stock');
if ('0' === $(this).data('num')) {
$(this).addClass('zero-stock');
}
});
$siblingBlock.find('ul>li').each(function() {
$(this).removeClass('zero-stock');
if ('0' === $(this).data('num')) {
$(this).addClass('zero-stock');
}
});
} else if ($chosed.length === 1 && $this.hasClass('chosed')) {
if ($this.closest('.block-list').hasClass('color-list')) {
updateConformButtonClassAndText();
$sizeList.addClass('hide');
//切换尺码信息
$sizeList.each(function() {
colorIndex = $(this).data('colorid');
if (colorIndex === $this.data('id')) {
$(this).removeClass('hide');
}
});
}
numArray = ($chosed.data('numstr') + '').split('/');
$siblingBlock.find('.block').removeClass('zero-stock');
for (i = 0; i < numArray.length; i++) {
if ('0' === numArray[i]) {
$siblingBlock.find('.block').eq(i).addClass('zero-stock');
}
}
} else if ($chosed.length === 1 && !$this.hasClass('chosed')) {
$('#chose-btn-sure').css('background-color', '#eb0313');
$('#chose-btn-sure').html('确定');
$siblingBlock.find('ul>li').each(function() {
$(this).removeClass('zero-stock');
if ('0' === $(this).data('num')) {
$(this).addClass('zero-stock');
}
});
$that.find('.num .left-num').html('');
} else if ($chosed.length === 2) {
$siblingBlock.find('.block').removeClass('zero-stock');
for (i = 0; i < currentNumArray.length; i++) {
if ('0' === currentNumArray[i]) {
$siblingBlock.find('.block').eq(i).addClass('zero-stock');
}
}
numArray = ($siblingBlock.find('.chosed').data('numstr') + '').split('/');
$that.find('.num .left-num').html('剩余' + numArray[index] + '件');
if (2 === $chosed.closest('.zero-stock').length) {
$('#chose-btn-sure').css('background-color', '#c0c0c0');
$('#chose-btn-sure').html('已售罄');
} else {
$('#chose-btn-sure').css('background-color', '#eb0313');
$('#chose-btn-sure').html('确定');
}
}**/
// 重置颜色块的样式
resetColorZeroStock($siblingBlock);
});
$('.btn-minus').on('touchstart', function() {
var num = $num.val();
$yohoPage.on('touchstart', '.btn-minus', function() {
var num = parseInt($num.val(), 10);
leftNum = $('#left-num').val();
... ... @@ -396,10 +267,8 @@ $('.btn-minus').on('touchstart', function() {
}
$num.val(num - 1);
});
$('.btn-plus').on('touchstart', function() {
var num = $num.val();
}).on('touchstart', '.btn-plus', function() {
var num = parseInt($num.val(), 10);
leftNum = $('#left-num').val();
... ... @@ -414,9 +283,7 @@ $('.btn-plus').on('touchstart', function() {
//TODO:库存数验证
$num.val(num + 1);
});
$('#chose-btn-sure').on('touchstart', function() {
}).on('touchstart', '#chose-btn-sure', function() {
var productSku,
buyNumber = $('#good-num').val() - 0,
... ... @@ -426,10 +293,12 @@ $('#chose-btn-sure').on('touchstart', function() {
numInCart = $('.num-tag').html() - 0,
num = $num.val();
//颜色尺码没有选择
if (!checkColorSizeNum()) {
return;
}
//TODO status change
if ($('#chose-btn-sure').html() === '已售罄') {
return;
}
... ... @@ -464,10 +333,13 @@ $('#chose-btn-sure').on('touchstart', function() {
}).done(function(res) {
loading.hideLoadingMask();
if (res.code === 200) {
$('.num-tag').html(numInCart + buyNumber);
$('.num-tag').removeClass('hide');
$('.num-tag').html(numInCart + buyNumber).removeClass('hide');
confirming = false;
hide();
if (cbFn) {
cbFn(res.location);
}
}
if (res.message) {
tip.show(res.message);
... ...
... ... @@ -19,19 +19,13 @@ function getProductInfo(skn, promotionId) {
$.get('/cart/index/giftinfo', {
skn: skn,
promotionId: promotionId
}).then(function(res) {
if (!res) {
}).then(function(html) {
if (!html) {
tip.show('网络错误');
return;
}
if (res.code === 200) {
chosePanel.show({
cartInfo: res.data
});
} else {
tip.show(res.message || '网络错误');
}
}).fail(function() {
chosePanel.show(html);
}, function() {
tip.show('网络错误');
}).always(function() {
loading.hideLoadingMask();
... ...
... ... @@ -10,7 +10,8 @@ var $ = require('jquery'),
lazyLoad = require('yoho.lazyload');
var dialog = require('../me/dialog'),
tip = require('../plugin/tip');
tip = require('../plugin/tip'),
orderInfo = require('./order-info').orderInfo;
var $selectAllBtn = $('.balance .checkbox'),
cartType = $('#cartType').val(),
... ... @@ -106,13 +107,14 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
autoHide: true,
fast: true
});
orderInfo('couponCode', null);
orderInfo('couponValue', null);
history.go(0);
} else {
tip.show(data.message);
}
}, function() {
dialog.showDialog({
autoHide: true,
dialogText: '网络异常'
});
tip.show('网络异常');
});
});
... ... @@ -224,5 +226,3 @@ $selectAllBtn.on('touchend', function() {
$('.down').on('touchend', function() {
chosePanel.show();
});
... ...
... ... @@ -78,7 +78,7 @@ function orderCompute() {
method: 'POST',
url: '/cart/index/orderCompute',
data: {
cartType: orderInfo('cartType'),
cartType: queryString.cartType || queryString.carttype || 'ordinary',
deliveryId: orderInfo('deliveryId'),
paymentTypeId: orderInfo('paymentTypeId'),
couponCode: orderInfo('couponCode'),
... ... @@ -89,6 +89,7 @@ function orderCompute() {
if (!res) {
tip.show('网络出错');
window.location.reload();
} else {
/*if (res.order_amount) {
res.order_amount = (+res.order_amount).toFixed(2);
... ... @@ -108,6 +109,7 @@ function orderCompute() {
}
}).fail(function() {
tip.show('网络出错');
window.location.reload();
});
}
... ...
... ... @@ -7,9 +7,20 @@
var $ = require('jquery'),
orderInfo = require('./order-info').orderInfo;
var $confim = $('.confim-mask'),
deleteId;
$('.address-item').on('touchend', function() {
orderInfo('addressId', $(this).data('address-id'));
}).on('touchend', '.edit', function() {
window.location.href = $(this).data('href');
return false;
}).on('touchend', '.del', function() {
deleteId = $(this).data('address-id');
});
$confim.on('touchend', '.confim', function() {
if (orderInfo('addressId') === deleteId) {
orderInfo('addressId', null);
}
});
... ...
... ... @@ -36,6 +36,37 @@
li:first-child span {
border-right: 1px solid #e0e0e0;
}
li:last-child {
position: relative;
}
.presell-tip {
position: absolute;
z-index: 1;
left: -2rem;
top: 1.75rem;
}
.triangle {
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
border-bottom: 12px solid #000;
margin-left: 6rem;
}
.pt-content {
position: relative;
padding: 10px;
background: #000;
color: #fff;
font-size: 20px;
@include border-radius(5px);
text-align: center;
width: 7rem;
}
}
.login-info {
... ... @@ -195,8 +226,6 @@
}
}
}
.shopping-cart-zero{
.cart-zero{
width: 100%;
height: auto;
... ...
{{> layout/header}}
<div id="mainCart" class="shopping-cart-page yoho-page">
{{# shoppingCart}}
{{#if isEmptyCart}}
<div class="shopping-cart-zero yoho-page">
<div class="cart-zero">
<i class="iconfont">&#xe62c</i>
<p>您的购物车暂无商品</p>
<a href="/product/new">随便逛逛</a>
</div>
{{> product/recommend-for-you}}
</div>
{{^}}
<div id="mainCart" class="shopping-cart-page yoho-page">
{{#if showLoginInfo}}
<p class="login-info">
<span class="iconfont">&#xe628;</span>
... ... @@ -21,6 +8,14 @@
<a class="btn btn-login" href="{{signurl}}">登录</a>
可以同步电脑和手机中的商品
</p>
{{/if}}
{{#if isEmptyCart}}
<div class="cart-zero">
<i class="iconfont">&#xe62c</i>
<p>您的购物车暂无商品</p>
<a href="/product/new">随便逛逛</a>
</div>
{{> product/recommend-for-you}}
{{^}}
{{#if cartNav}}
<ul class="cart-nav clearfix">
... ... @@ -33,10 +28,13 @@
<span>
预售商品({{presellGoodsCount}})
</span>
<div id="presell-tip" class="presell-tip">
<div class="triangle"></div>
<p class="pt-content">预售商品点这里结算哦~</p>
</div>
</li>
</ul>
{{/if}}
{{/if}}
{{# commonCart}}
<div class="cart-content common">
... ... @@ -54,12 +52,9 @@
{{> cart/cart-content}}
</div>
{{/ preSellCart}}
</div>
{{/if}}
<input id="cartType" type="hidden" value="{{cartType}}">
{{/ shoppingCart}}
{{> cart/chose-panel}}
</div>
{{> layout/footer}}
... ...
... ... @@ -65,11 +65,18 @@
</li>
<li class="coin" data-yoho-coin="{{yohoCoin}}">
<span class="title">YOHO币</span>
{{#if yohoCoin}}
<span class="desc">可抵¥{{yohoCoin}}</span>
<span class="coin-check">
<em>- ¥ {{yohoCoin}}</em>
<i class="iconfont checkbox icon-cb-checked"></i>
</span>
{{^}}
<span class="not-used coin-check">
无YOHO币可用
</span>
{{/if}}
</li>
{{#if invoice}}
... ...
<div class="shopping-cart-good clearfix" data-id={{id}}>
{{#if isSoldOut}}
<div class="shopping-cart-good clearfix" data-id="{{id}}">
{{#if inValid}}
<span class="few-tag-expire">失效</span>
{{^}}
{{#if isSelected}}
<span class="checkbox icon-cb-checked iconfont"></span>
{{^}}
<span class="checkbox icon-checkbox iconfont"></span>
{{/if}}
{{#if showCheckbox}}
<span class="checkbox{{#if checked}} icon-cb-checked{{^}} icon-checkbox{{/if}}iconfont"></span>
{{/if}}
<div class="info">
<img class="thumb lazy" data-original={{thumb}}>
<img class="thumb lazy" data-original="{{thumb}}">
{{#if isAdvanceBuy}}
<p class="few-tag plus-tag">加价购</p>
{{^}}
{{/if}}
{{#if isGift}}
<p class="few-tag gift-tag">赠品</p>
{{/if}}
{{/if}}
</a>
<div class="deps show">
<p class="name row">{{name}}</p>
... ... @@ -67,15 +63,5 @@
</p>
{{/if}}
</div>
<div class="calculate-num hide">
<div class="calculate">
<p><i class="iconfont cut">&#xe625;</i><span>{{count}}</span><i class="iconfont add">&#xe624;</i></p>
<p><span>颜色:{{color}}尺码:{{size}}{{name}}</span><i class="iconfont down">&#xe616;</i></p>
</div>
<p><span class="price"> ¥{{price}}</span></p>
<span class="count">
×{{count}}
</span>
</div>
</div>
</div>
... ...
... ... @@ -186,7 +186,7 @@ class DetailModel
// 商品的尺码列表
if (isset($value['goodsSizeBoList'])) {
foreach ($value['goodsSizeBoList'] as $size) {
$sizeList[$value['colorId']][] = array(
$sizeList[$value['productSkc']][] = array(
'id' => $size['id'],
'skuId' => $size['goodsSizeSkuId'],
'goodsId' => $size['goodsId'],
... ... @@ -196,7 +196,7 @@ class DetailModel
);
$colorStorageNum += intval($size['goodsSizeStorageNum']);
$sizeStorageStr .= $size['goodsSizeStorageNum'] . '/';
$colorStorageGroup[$size['sizeName']][$value['colorId']] = $size['goodsSizeStorageNum'];
$colorStorageGroup[$size['sizeName']][$value['productSkc']] = $size['goodsSizeStorageNum'];
}
// 颜色分组
... ... @@ -214,9 +214,9 @@ class DetailModel
$thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60));
// 添加尺码对应的各个颜色的库存量
foreach ($sizeList as $colorId => $sizeArr) {
foreach ($sizeList as $skc => $sizeArr) {
foreach ($sizeArr as $key => $value) {
$sizeList[$colorId][$key]['colorNumStr'] = implode('/', array_values($colorStorageGroup[$value['name']]));
$sizeList[$skc][$key]['colorNumStr'] = implode('/', array_values($colorStorageGroup[$value['name']]));
}
}
... ... @@ -226,7 +226,7 @@ class DetailModel
// 格式化尺码对应的各个颜色分组
foreach ($colorGroup as $value) {
$sizeGroup[]['size'] = $sizeList[ $value['id'] ];
$sizeGroup[]['size'] = $sizeList[ $value['skcId'] ];
}
// 商品图: 多个
... ...
... ... @@ -215,7 +215,9 @@ class IndexController extends AbstractAction
$result = CartModel::giftProductData($skn, $promotionId);
}
$this->_view->display('gift-info', $result);
$this->_view->display('gift-info', array(
'cartInfo' => $result['data']
));
}
/**
... ... @@ -269,7 +271,7 @@ class IndexController extends AbstractAction
$this->auditJumpLogin();
$this->setTitle('确认订单');
$this->setNavHeader('确认订单');
$this->setNavHeader('确认订单', true, false); // 不显示右上角home按钮
// 购物车商品为空跳转到购物车页面
$shoppingKey = Helpers::getShoppingKeyByCookie();
... ...