...
|
...
|
@@ -78,6 +78,11 @@ class ChosePanel { |
|
|
|
|
|
this._setSelector();
|
|
|
this._initBlockStatus();
|
|
|
if (this.data.joinLimit === '2') { // 如果是普通团,则让增加数量的按钮可用
|
|
|
$goodNum.val(parseInt(this.data.saleNum, 10));
|
|
|
this.data.buyNumber = parseInt(this.data.saleNum, 10);
|
|
|
$('.btn-plus').find('.operator').removeClass('disabled');
|
|
|
}
|
|
|
innerScroll.disableScroll($choseArea);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -141,6 +146,13 @@ class ChosePanel { |
|
|
$yohoPage.on('touchstart', '#chose-btn-buynow', (e) => {
|
|
|
return this._choseBtnSureClick(e, true);
|
|
|
});
|
|
|
$yohoPage.on('touchend', '.btn-plus, .btn-minus', (e) => {
|
|
|
let button = e.currentTarget;
|
|
|
|
|
|
if (!$(button).find('.operator').hasClass('disabled')) {
|
|
|
return this._numClick(e);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -178,14 +190,26 @@ class ChosePanel { |
|
|
let buyNum;
|
|
|
|
|
|
buyNum = $(e.currentTarget).hasClass('btn-minus') ? this.data.buyNumber - 1 : this.data.buyNumber + 1;
|
|
|
if (buyNum < 1) {
|
|
|
$btnMinus.find('.operator').addClass('disabled');
|
|
|
return;
|
|
|
} else if (buyNum === 1) {
|
|
|
$btnMinus.find('.operator').addClass('disabled');
|
|
|
if (this.data.joinLimit === '2') {
|
|
|
if (buyNum < parseInt(this.data.saleNum, 10)) {
|
|
|
$btnMinus.find('.operator').addClass('disabled');
|
|
|
return;
|
|
|
} else if (buyNum === parseInt(this.data.saleNum, 10)) {
|
|
|
$btnMinus.find('.operator').addClass('disabled');
|
|
|
} else {
|
|
|
$btnMinus.find('.operator').removeClass('disabled');
|
|
|
}
|
|
|
} else {
|
|
|
$btnMinus.find('.operator').removeClass('disabled');
|
|
|
if (buyNum < 1) {
|
|
|
$btnMinus.find('.operator').addClass('disabled');
|
|
|
return;
|
|
|
} else if (buyNum === 1) {
|
|
|
$btnMinus.find('.operator').addClass('disabled');
|
|
|
} else {
|
|
|
$btnMinus.find('.operator').removeClass('disabled');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (this._checkSku(buyNum)) {
|
|
|
this.data.buyNumber = buyNum;
|
|
|
$goodNum.val(buyNum);
|
...
|
...
|
@@ -209,6 +233,11 @@ class ChosePanel { |
|
|
_choseBtnSureClick() {
|
|
|
let self = this;
|
|
|
let skuId = this._checkSku();
|
|
|
let buyNum = 1;
|
|
|
|
|
|
if (self.data.joinLimit === '2') {
|
|
|
buyNum = self.data.buyNumber;
|
|
|
}
|
|
|
|
|
|
if (skuId) {
|
|
|
$.ajax({
|
...
|
...
|
@@ -218,12 +247,13 @@ class ChosePanel { |
|
|
productSku: skuId,
|
|
|
activityId: self.data.activityId,
|
|
|
groupNo: self.data.groupNo,
|
|
|
buyNum: buyNum
|
|
|
}
|
|
|
}).then(data => {
|
|
|
if (data && data.code === 200) {
|
|
|
this._resolve && this._resolve({
|
|
|
sku: {skuId},
|
|
|
buyNum: 1, // 拼团只支持一件
|
|
|
buyNum: buyNum, // 拼团只支持一件
|
|
|
buyNow: true
|
|
|
});
|
|
|
} else {
|
...
|
...
|
@@ -286,6 +316,10 @@ class ChosePanel { |
|
|
|
|
|
$goodNum.val(1);
|
|
|
this.data.buyNumber = 1;
|
|
|
if (this.data.joinLimit === '2') {
|
|
|
$goodNum.val(parseInt(this.data.saleNum, 10));
|
|
|
this.data.buyNumber = parseInt(this.data.saleNum, 10);
|
|
|
}
|
|
|
$choseBtnSure.css('background-color', '#d0021b').text('确定');
|
|
|
}
|
|
|
|
...
|
...
|
@@ -296,6 +330,10 @@ class ChosePanel { |
|
|
} else {
|
|
|
$goodNum.val(1);
|
|
|
this.data.buyNumber = 1;
|
|
|
if (this.data.joinLimit === '2') {
|
|
|
$goodNum.val(parseInt(this.data.saleNum, 10));
|
|
|
this.data.buyNumber = parseInt(this.data.saleNum, 10);
|
|
|
}
|
|
|
$choseBtnSure.css('background-color', '#d0021b').text('确定');
|
|
|
}
|
|
|
}
|
...
|
...
|
|