improve: 优化

This commit is contained in:
From-wh 2023-03-24 14:55:39 +08:00
parent f220246ceb
commit cef6c368ed
5 changed files with 349 additions and 330 deletions

File diff suppressed because one or more lines are too long

View File

@ -561,6 +561,12 @@
title: that.$t(`该产品没有更多库存了`)
});
}
if (that.attr.productSelect.cart_num == 0) {
return that.$util.Tips({
title: that.$t(`不能输入0喔`)
});
}
console.log(that.attr.productSelect.cart_num, 'that.attr.productSelect.cart_num')
let q = {
product_id: id,
num: duo ? that.attr.productSelect.cart_num : 1,

View File

@ -249,14 +249,12 @@
onLoad(options) {
uni.hideTabBar()
let that = this;
if (that.isLogin == false) {
toLogin();
}
let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
let curRoute = routes[routes.length - 1].route //获取当前页面路由
this.activeRouter = '/' + curRoute
},
onShow() {
if (!this.isLogin) toLogin();
this.canShow = false
if (this.isLogin == true) {
this.hotPage = 1;
@ -701,7 +699,7 @@
that.cartList.valid[index] = item;
that.getCartNum();
that.switchSelect();
}).catch(err => {
}, () => {
item.cart_num = Number(item.cart_num) + 1
})
}
@ -724,15 +722,16 @@
that.cartList.valid[index] = item;
that.getCartNum();
that.switchSelect();
}).catch(err => {
}, () => {
item.cart_num = Number(item.cart_num) - 1
})
},
setCartNum(cartId, cartNum, successCallback) {
setCartNum(cartId, cartNum, successCallback, errorCallback) {
let that = this;
changeCartNum(cartId, cartNum).then(res => {
successCallback && successCallback(res.data);
}).catch(err => {
errorCallback && errorCallback()
return that.$util.Tips({
title: err
});

View File

@ -417,4 +417,7 @@
align-items: center;
justify-content: center;
}
.empty-box{
padding-bottom: 300rpx;
}
</style>

View File

@ -246,7 +246,7 @@
.list {
padding: 14rpx 32rpx;
margin-top: 90rpx;
margin-bottom: 140rpx;
padding-bottom: 180rpx;
}
.list .item {