fix(shoppingCart): bug#16 购物车页面缓存导致的bug修复
This commit is contained in:
parent
83621a2d03
commit
6db470a5b9
|
@ -128,9 +128,9 @@
|
||||||
:loading="isLoading"
|
:loading="isLoading"
|
||||||
:loadingText="'购买中'"
|
:loadingText="'购买中'"
|
||||||
@tap="goBuy"
|
@tap="goBuy"
|
||||||
:disabled="!(isTo > 0 && isTo < 2)"
|
:disabled="checkoutDisabled"
|
||||||
color="#FB3024"
|
color="#FB3024"
|
||||||
>{{ '去结算' }}
|
>去结算
|
||||||
</u-button>
|
</u-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -186,7 +186,6 @@ export default {
|
||||||
isSelectAll: [],
|
isSelectAll: [],
|
||||||
shopCarList: [],
|
shopCarList: [],
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isTo: 0,
|
|
||||||
goodsCheck: [],
|
goodsCheck: [],
|
||||||
totalPrice: 0,
|
totalPrice: 0,
|
||||||
totalAchive: 0,
|
totalAchive: 0,
|
||||||
|
@ -202,6 +201,11 @@ export default {
|
||||||
// content:'确认删除该商品?'
|
// content:'确认删除该商品?'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
checkoutDisabled() {
|
||||||
|
return this.shopCarList.filter(item => item.isSelected).length !== 1
|
||||||
|
}
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
selTable: {
|
selTable: {
|
||||||
handler(n, o) {
|
handler(n, o) {
|
||||||
|
@ -218,7 +222,8 @@ export default {
|
||||||
// this.getCarList()
|
// this.getCarList()
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getCarList();
|
this.getCarList()
|
||||||
|
this.initCarList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
tableTrue() {
|
tableTrue() {
|
||||||
|
@ -534,13 +539,13 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
checkArea() {
|
checkArea() {
|
||||||
let i = 0;
|
// let i = 0;
|
||||||
this.shopCarList.forEach((item) => {
|
// this.shopCarList.forEach((item) => {
|
||||||
if (item.isSelected) {
|
// if (item.isSelected) {
|
||||||
i++;
|
// i++;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
this.isTo = i;
|
// this.isTo = i;
|
||||||
let arr = [];
|
let arr = [];
|
||||||
this.shopCarList.forEach((item) => {
|
this.shopCarList.forEach((item) => {
|
||||||
item.shoppingCartList.forEach((ctem) => {
|
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() {
|
getCarList() {
|
||||||
api.getShopping().then((res) => {
|
api.getShopping().then((res) => {
|
||||||
res.data.forEach((item) => {
|
res.data.forEach((item) => {
|
||||||
|
|
Loading…
Reference in New Issue