...
|
...
|
@@ -38,12 +38,19 @@ var $chosePanel = $('#chose-panel'), |
|
|
$soonSoldOut = $('.soonSoldOut-tag'),
|
|
|
$yohoPage = $('.yoho-page');
|
|
|
|
|
|
//购物车编辑标相关变量
|
|
|
// 购物车编辑标相关变量
|
|
|
var isEdit,
|
|
|
isSelected,
|
|
|
oldSknId;
|
|
|
|
|
|
//初始化购物车面板显示
|
|
|
// 限购商品的商品码。只有限购商品时才会设置。
|
|
|
var limitProductCode,
|
|
|
|
|
|
// 限购商品的skn。只有限购商品时才会设置。
|
|
|
skn;
|
|
|
|
|
|
|
|
|
// 初始化购物车面板显示
|
|
|
function init() {
|
|
|
hasChooseColor = false;
|
|
|
hasChooseSize = false;
|
...
|
...
|
@@ -77,6 +84,21 @@ function setEditModeWithSknId(sknId, isThisGoodSelected) { |
|
|
isSelected = isThisGoodSelected;
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* 设置当前面板为限购商品模式
|
|
|
*
|
|
|
* @param {String} code 当前限购商品的商品码
|
|
|
*
|
|
|
* @param {String} sknId. 当前限购商品的sknId
|
|
|
*
|
|
|
* @return {undefined}
|
|
|
*/
|
|
|
function setLimitGoodModeWithSknId(code, sknId) {
|
|
|
$('#chose-btn-sure').html('结算');
|
|
|
limitProductCode = code;
|
|
|
skn = sknId;
|
|
|
}
|
|
|
|
|
|
//删除面板
|
|
|
function removePannel() {
|
|
|
var $pannel = $('.chose-panel'),
|
...
|
...
|
@@ -149,6 +171,8 @@ function updateConformButtonClassAndText() { |
|
|
$chosed = $allChoseItems.find('.chosed');
|
|
|
if (2 === $chosed.closest('.zero-stock').length) {
|
|
|
$('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
|
|
|
} else if (limitProductCode) {
|
|
|
$('#chose-btn-sure').css('background-color', '#eb0313').html('结算');
|
|
|
} else {
|
|
|
$('#chose-btn-sure').css('background-color', '#eb0313').html(isEdit ? '确认' : '加入购物车');
|
|
|
}
|
...
|
...
|
@@ -446,7 +470,16 @@ $yohoPage.on('touchstart', '.btn-minus', function() { |
|
|
|
|
|
url = '/cart/index/modify';
|
|
|
|
|
|
} else {
|
|
|
} else if (limitProductCode) {
|
|
|
|
|
|
// 当前面板选择的是限购商品
|
|
|
url = 'http://m.yohobuy.com/cart/index/orderEnsure?code=' + limitProductCode + '&&sku=' + productSku + '&&skn=' + skn + '&&buy_num=' + buyNumber;
|
|
|
|
|
|
//打开结算页面,结束函数执行。
|
|
|
window.location.href = url;
|
|
|
return false;
|
|
|
|
|
|
}else {
|
|
|
cartGoodData = {
|
|
|
productSku: productSku,
|
|
|
buyNumber: buyNumber,
|
...
|
...
|
@@ -508,4 +541,4 @@ exports.show = show; |
|
|
exports.remove = removePannel;
|
|
|
exports.setEditModeWithSknId = setEditModeWithSknId;
|
|
|
exports.disableNumEdit = disableNumEdit;
|
|
|
|
|
|
exports.setLimitGoodModeWithSknId = setLimitGoodModeWithSknId; |
...
|
...
|
|