...
|
...
|
@@ -16,6 +16,9 @@ var dialog = require('../me/dialog'), |
|
|
var $selectAllBtn = $('.balance .checkbox'),
|
|
|
requesting = false;
|
|
|
|
|
|
//上次编辑的商品skn
|
|
|
var previousEditSkn;
|
|
|
|
|
|
ellipsis.init();
|
|
|
|
|
|
lazyLoad({
|
...
|
...
|
@@ -86,11 +89,12 @@ $('.cart-goods').on('touchstart', '.checkbox', function() { |
|
|
*
|
|
|
* @param {Bool} isSelected. 所要编辑的商品是否被选中
|
|
|
*
|
|
|
* @return false;
|
|
|
* @param {Bool} isEditNum. 所要编辑的商品是否被选中
|
|
|
*
|
|
|
* @return false or undefined
|
|
|
*
|
|
|
*/
|
|
|
function showEditPannelWithSku(html, id, isSelected) {
|
|
|
|
|
|
function showEditPannelWithSku(html, id, isSelected, isEditNum) {
|
|
|
if (html.length < 2) {
|
|
|
tip.show('出错啦!');
|
|
|
return false;
|
...
|
...
|
@@ -100,22 +104,48 @@ function showEditPannelWithSku(html, id, isSelected) { |
|
|
chosePanel.remove();
|
|
|
|
|
|
$(html).appendTo('#mainCart');
|
|
|
|
|
|
|
|
|
chosePanel.init();
|
|
|
chosePanel.setEditModeWithSknId(id, isSelected);
|
|
|
chosePanel.show();
|
|
|
|
|
|
return false;
|
|
|
if (!isEditNum) {
|
|
|
chosePanel.disableNumEdit();
|
|
|
}
|
|
|
|
|
|
chosePanel.show();
|
|
|
}
|
|
|
|
|
|
|
|
|
$('.icon-edit').on('touchstart', function(e) {
|
|
|
var $this = $(this),
|
|
|
skn = $this.closest('.shopping-cart-good').data('skn');
|
|
|
|
|
|
var $checkBox,
|
|
|
$tag;
|
|
|
|
|
|
var id,
|
|
|
count,
|
|
|
canEditNum;
|
|
|
|
|
|
//如果点击的是上次编辑的商品,直接显示chose-pannel
|
|
|
if (skn === previousEditSkn) {
|
|
|
chosePanel.show();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
previousEditSkn = skn;
|
|
|
|
|
|
|
|
|
$checkBox = $this.closest('.info').siblings('.checkbox');
|
|
|
$tag = $this.closest('.deps').siblings('.few-tag');
|
|
|
|
|
|
var skn = $this.closest('.shopping-cart-good').data('skn'),
|
|
|
id = $this.closest('.shopping-cart-good').data('id'),
|
|
|
id = $this.closest('.shopping-cart-good').data('id');
|
|
|
count = $this.data('count');
|
|
|
|
|
|
//加价购或者赠品不能编辑数量
|
|
|
canEditNum = $tag.hasClass('gift-tag') || $tag.hasClass('plus-tag') ? false : true;
|
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
loading.showLoadingMask();
|
...
|
...
|
@@ -128,7 +158,7 @@ $('.icon-edit').on('touchstart', function(e) { |
|
|
buy_num: count
|
|
|
},
|
|
|
success: function(res) {
|
|
|
showEditPannelWithSku(res, id, $checkBox.hasClass('icon-cb-checked'));
|
|
|
showEditPannelWithSku(res, id, $checkBox.hasClass('icon-cb-checked'), canEditNum);
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络异常');
|
...
|
...
|
|