3
0
Fork 0

fix(shoppingCart): bug#16 购物车页面缓存导致的bug修复

This commit is contained in:
ywk 2025-04-10 09:20:26 +08:00
parent 83621a2d03
commit 6db470a5b9
1 changed files with 23 additions and 11 deletions

View File

@ -128,9 +128,9 @@
:loading="isLoading"
:loadingText="'购买中'"
@tap="goBuy"
:disabled="!(isTo > 0 && isTo < 2)"
:disabled="checkoutDisabled"
color="#FB3024"
>{{ '去结算' }}
>去结算
</u-button>
</view>
</view>
@ -186,7 +186,6 @@ export default {
isSelectAll: [],
shopCarList: [],
isLoading: false,
isTo: 0,
goodsCheck: [],
totalPrice: 0,
totalAchive: 0,
@ -202,6 +201,11 @@ export default {
// content:''
};
},
computed: {
checkoutDisabled() {
return this.shopCarList.filter(item => item.isSelected).length !== 1
}
},
watch: {
selTable: {
handler(n, o) {
@ -218,7 +222,8 @@ export default {
// this.getCarList()
},
onShow() {
this.getCarList();
this.getCarList()
this.initCarList()
},
methods: {
tableTrue() {
@ -534,13 +539,13 @@ export default {
});
},
checkArea() {
let i = 0;
this.shopCarList.forEach((item) => {
if (item.isSelected) {
i++;
}
});
this.isTo = i;
// let i = 0;
// this.shopCarList.forEach((item) => {
// if (item.isSelected) {
// i++;
// }
// });
// this.isTo = i;
let arr = [];
this.shopCarList.forEach((item) => {
item.shoppingCartList.forEach((ctem) => {
@ -630,6 +635,13 @@ export default {
});
});
},
initCarList() {
this.shopCarList = []
this.goodsCheck = []
this.totalPrice = 0
this.totalAchive = 0
this.num = 0
},
getCarList() {
api.getShopping().then((res) => {
res.data.forEach((item) => {