This commit is contained in:
魏啾
2024-08-03 15:42:56 +08:00
3 changed files with 425 additions and 352 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -289,12 +289,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>
@@ -393,6 +393,7 @@
this.fixedtrue = true
},
onShow() {
console.log(!uni.cache.get('token'))
if (!uni.cache.get('token')) {
uni.login({
provider: 'weixin',
@@ -506,18 +507,19 @@
* @param {Object} b
*/
shopAdd(item, index, index1, a, b) {
if (a == "+") {
if (this.skuNumber < this.skuSuit) {
this.amountcartNumber = this.amountcartNumber + (item.suit == 0 ? 1 : item.suit);
} else {
if ( a == "+" ){
if ( this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
this.amountcartNumber = this.amountcartNumber + (this.skuSuit==0?1:this.skuSuit);
}else {
this.amountcartNumber++;
}
} else {
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;
}
@@ -721,7 +723,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 //打开弹框
}
@@ -785,9 +787,12 @@
case 'sku': // sku 数量 查询这个商品的价格和数量
break;
case 'order':
this.skuidname = []
this.showCart = false
this.cartLists = msg
this.cartLists_count = 0;
this.skuidname = [];
this.cartListsdatashow = false;
this.showCart = false;
this.cartLists = msg;
this.productqueryProduct() //list 数据
break;
case 'addCart': //初始化add
this.cartLists = msg