Authored by Lynnic

购物车逻辑修改

... ... @@ -5,7 +5,9 @@
* @date: 2015/10/21
*/
var $ = require('jquery');
var $ = require('jquery'),
tip = require('../plugin/tip'),
loading = require('../plugin/loading');
// Handlebars = require('yoho.handlebars');
... ... @@ -24,7 +26,6 @@ var $num,
$sizeList.each(function() {
colorIndex = $(this).data('colorid');
if (colorIndex === firstColorId) {
$(this).removeClass('hide');
}
... ... @@ -79,41 +80,44 @@ $('.yoho-page').on('touchstart', '.chose-panel', function(e) {
remove();
}).on('touchstart', '#chose-btn-sure', function() {
// var productSku,
// buyNumber = $('#good-num') - 0;
// promotionId,
// goodsType,
// isEdit;
// //确定
// $chosed = $('.block-list>ul>li.chosed');
// if (2 === $chosed.length && 2 !== $chosed.closest('.zero-stock').length) {
// if (confirm) {
// return false;
// }
// confirm = true;
// loading.showLoadingMask();
// $.ajax({
// method: 'POST',
// url: '/cart/index/add',
// data: {
// product_id: productId,
// content: content
// }
// }).done(function(res) {
// if (res.code === 200) {
// loading.hideLoadingMask();
// confirm = false;
// remove();
// }
// }).fail(function() {
// tip.show('网络出了点问题~');
// confirm = false;
// });
// }
var productSku,
buyNumber = $('#good-num') - 0;
// promotionId,
// goodsType,
// isEdit;
$chosed = $('.block-list>ul>li.chosed');
if (2 === $chosed.length && 0 === $chosed.closest('.zero-stock').length) {
productSku = $sizeList.closest('.chosed').data('skuid');
// if (confirm) {
// return false;
// }
// confirm = true;
loading.showLoadingMask();
$.ajax({
method: 'POST',
url: '/cart/index/add',
data: {
productSku: productSku,
buyNumber: buyNumber
}
}).done(function(res) {
if (res.code === 200) {
loading.hideLoadingMask();
// confirm = false;
remove();
}
}).fail(function() {
tip.show('网络出了点问题~');
// confirm = false;
});
}
}).on('touchstart', '.block', function(e) {
var $this = $(this),
... ...
... ... @@ -114,7 +114,7 @@
<div id="productDesc"> </div>
{{> product/recommend-for-you}}
{{> shopping-cart/chose-panel}}
{{> cart/chose-panel}}
{{#cartInfo}}
<div class="cart-bar">
... ...