Authored by 梁志锋

购物车修改

... ... @@ -14,6 +14,7 @@ var chosePanel = require('./chose-panel'),
var $cartContent = $('.cart-content');
var navHammer,
$advanceBuy = $('.advance-buy'),
cartType = $('#cartType').val();
var hasChecked = $('.cart-goods .icon-cb-checked').length > 0 ? true : false; //是否有选中商品
... ... @@ -56,6 +57,10 @@ if ($('.cart-nav').length > 0) {
}, 3000);
}
$('.advance-buy').on('touchend', function() {
window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
});
$('.btn-balance').on('touchend', function() {
if (hasChecked) {
window.location.href = '/cart/index/orderEnsure?cartType=' + cartType;
... ...
... ... @@ -17,9 +17,6 @@ var $chosePanel = $('#chose-panel'),
$num,
$chosed,
$imgsThumb,
// re = /\d+/,
$leftNum,
leftNum,
confirming,
... ... @@ -31,6 +28,7 @@ var $chosePanel = $('#chose-panel'),
$curSizeBlock,
$sizeRowList,
cbFn,
cartType,
$allChoseItems,
$yohoPage = $('.yoho-page');
... ... @@ -41,10 +39,10 @@ function init() {
hasChooseColor = false;
hasChooseSize = false;
$curSizeBlock = null;
$imgsThumb = $('.chose-panel').find('.thumb'),
$allChoseItems = $('.chose-items'),
$sizeRowList = $('.size-list ul'),
$leftNum = $('#left-num'),
$imgsThumb = $('.chose-panel').find('.thumb');
$allChoseItems = $('.chose-items');
$sizeRowList = $('.size-list ul');
$leftNum = $('#left-num');
$firstRow = $sizeRowList.eq(0);
$firstRow.toggleClass('hide');
$curSizeRow = $firstRow;
... ... @@ -77,7 +75,7 @@ function show(html, cb) {
//隐藏当前Panel
function hide() {
$('.chose-panel').hide();
cbFn = null;
//cbFn = null;
}
//修改加入购物车的文字和背景
... ... @@ -168,7 +166,6 @@ $yohoPage.on('touchstart', '.color-list .block', function(e) {
// 之前选中的尺码去掉勾选样式
if ($preSiblingBlock.length > 0) {
$preSiblingBlock.removeClass('chosed');
}
curSizeBlock = $curSizeRow.children().get(scindex);
... ... @@ -328,7 +325,8 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
productSku: productSku,
buyNumber: buyNumber,
promotionId: promotionId,
isEdit: isEdit
isEdit: isEdit,
cartType: cartType
}
}).done(function(res) {
loading.hideLoadingMask();
... ... @@ -338,7 +336,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
hide();
if (cbFn) {
cbFn(res.location);
cbFn();
}
}
if (res.message) {
... ...
... ... @@ -10,7 +10,8 @@ var $ = require('jquery'),
loading = require('../plugin/loading'),
chosePanel = require('./chose-panel');
var $page = $('.gift-advance-page');
var $page = $('.gift-advance-page'),
queryString = $.queryString();
lazyLoad($('.lazy'));
... ... @@ -24,7 +25,9 @@ function getProductInfo(skn, promotionId) {
tip.show('网络错误');
return;
}
chosePanel.show(html);
chosePanel.show(html, function(){
window.location.href = '/cart/index/orderEnsure?cartType=' + queryString.cartType;
});
}, function() {
tip.show('网络错误');
}).always(function() {
... ...
... ... @@ -25,7 +25,7 @@
<li class="advance-buy">
<span class="iconfont">&#xe61b;</span>
加价购
<a href="/cart/index/advanceBuy">
<a href="">
<span class="count">{{advanceBuyCount}}</span>
<span class="iconfont icon-right-arrow">&#xe614;</span>
</a>
... ...
... ... @@ -37,7 +37,7 @@
<ul class="size-row clearfix hide">
{{# size}}
<li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id={{id}} data-colorid="{{colorId}}" data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{goodsId}}">
<li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id="{{id}}" data-colorid="{{colorId}}" data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{goodsId}}">
{{name}}
</li>
{{/ size}}
... ...