...
|
...
|
@@ -98,37 +98,20 @@ var Cart = { |
|
|
/*
|
|
|
* 根据服务端JSON,刷新购物车信息
|
|
|
* @function [refreshCart]
|
|
|
* @params { Object } data 最新购物车数据
|
|
|
* @params { Function } callback 刷新购物车后的回调函数
|
|
|
*/
|
|
|
refreshCart: function(data) {
|
|
|
var template;
|
|
|
|
|
|
hbs.registerHelper('multiple', function(num1, num2) {
|
|
|
num1 = typeof num1 === 'number' ? num1 : parseFloat(num1, 10);
|
|
|
num2 = typeof num2 === 'number' ? num2 : parseFloat(num2, 10);
|
|
|
|
|
|
if (num1 && num2) {
|
|
|
return num1 * num2;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
hbs.registerHelper('isEqual', function(v1, v2, options) {
|
|
|
if (v1 === v2) {
|
|
|
return options.fn(this);
|
|
|
refreshCart: function(callback) {
|
|
|
Util.ajax({
|
|
|
url: '/shopping/cart/data',
|
|
|
success: function(res) {
|
|
|
Util.refreshCart(res, function() {
|
|
|
Stepper.init();
|
|
|
if (callback) {
|
|
|
return callback();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
return options.inverse(this);
|
|
|
});
|
|
|
|
|
|
hbs.registerHelper('image', function(url, width, height, mode) {
|
|
|
mode = parseInt(mode, 10) ? mode : 2;
|
|
|
url = url || '';
|
|
|
return url.replace(/{width}/g, width).replace(/{height}/g, height).replace(/{mode}/g, mode);
|
|
|
});
|
|
|
|
|
|
template = hbs.compile($('#cart-content-tpl').html());
|
|
|
$('#cart_content').html(template(data));
|
|
|
|
|
|
Stepper.init();
|
|
|
},
|
|
|
|
|
|
/*
|
...
|
...
|
@@ -205,7 +188,7 @@ var Cart = { |
|
|
var dialog;
|
|
|
|
|
|
if (products.length) {
|
|
|
//Cart.showRemovedProducts(products, extraInfos);
|
|
|
// Cart.showRemovedProducts(products, extraInfos);
|
|
|
|
|
|
dialog = new _confirm({
|
|
|
content: '您确定要从购物车中删除该商品吗?',
|
...
|
...
|
|