商品数量修改

This commit is contained in:
GaoHao
2024-08-03 15:31:42 +08:00
parent c62ee92b86
commit 703f53c8ac
3 changed files with 417 additions and 347 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -292,12 +292,12 @@
<view class="btn"
@click="shopAdd(specifications,specifications.indexa,specifications.indexb,'-',specifications.tagSnap == null ? '单规格':'')">
<u-icon name="minus-circle-fill" color="#E9AB7A" size="40"></u-icon>
<u-icon name="minus-circle-fill" color="#E9AB7A" size="50"></u-icon>
</view>
<text class="num">{{amountcartNumber}}</text>
<view class="btn"
@click="shopAdd(specifications,specifications.indexa,specifications.indexb,'+',specifications.tagSnap == null ? '单规格':'')">
<u-icon name="plus-circle-fill" color="#E9AB7A" size="40"></u-icon>
<u-icon name="plus-circle-fill" color="#E9AB7A" size="50"></u-icon>
</view>
</view>
</view>
@@ -404,6 +404,7 @@
this.fixedtrue = true
},
onShow() {
console.log(!uni.cache.get('token'))
if (!uni.cache.get('token')) {
uni.login({
provider: 'weixin',
@@ -518,8 +519,9 @@
*/
shopAdd(item, index, index1, a, b) {
if ( a == "+" ){
if ( this.skuNumber < this.skuSuit) {
this.amountcartNumber = this.amountcartNumber + (item.suit==0?1:item.suit);
if ( this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
this.amountcartNumber = this.amountcartNumber + (this.skuSuit==0?1:this.skuSuit);
}else {
this.amountcartNumber++;
}
@@ -527,8 +529,8 @@
if (this.amountcartNumber > 0) {
console.log(item)
if ( this.skuNumber < this.skuSuit) {
this.amountcartNumber = this.amountcartNumber - (item.suit==0?1:item.suit);
if ( this.skuNumber < this.skuSuit && this.amountcartNumber <= this.skuSuit) {
this.amountcartNumber = this.amountcartNumber - (this.skuSuit==0?1:this.skuSuit);
} else {
this.amountcartNumber = this.amountcartNumber - 1;
}
@@ -732,7 +734,7 @@
this.addCart(params);
} else {
this.skuId = res.data.id;
this.skuNumber = res.data.number;
this.skuNumber = res.data.number||0;
this.skuSuit = res.data.suit;
this.showShopsku = true //打开弹框
}