购物车页面加载问题与选中修复

master
linzj 5 years ago
parent fc42935f7b
commit e60946e95b

@ -129,7 +129,7 @@ export default {
finalMoney: 0,
totalMoney: 0,
subtractMoney: 0,
allChecked: true
allChecked: false
};
},
@ -150,6 +150,11 @@ export default {
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.loadBasketData();
http.getCartCount(); //
},
methods: {
loadBasketData(){
uni.showLoading(); //
var params = {
@ -158,16 +163,16 @@ export default {
data: {},
callBack: res => {
if (res.length > 0) {
//
//
var shopCartItemDiscounts = res[0].shopCartItemDiscounts;
shopCartItemDiscounts.forEach(shopCartItemDiscount => {
shopCartItemDiscount.shopCartItems.forEach(shopCartItem => {
shopCartItem.checked = true;
shopCartItem.checked = false;
});
});
this.setData({
shopCartItemDiscounts: shopCartItemDiscounts,
allChecked: true
allChecked: false
});
} else {
this.setData({
@ -181,9 +186,7 @@ export default {
}
};
http.request(params);
http.getCartCount(); //
},
methods: {
/**
* 去结算
*/
@ -416,7 +419,7 @@ export default {
data: basketIds,
callBack: function (res) {
uni.hideLoading();
ths.onShow();
ths.loadBasketData();
}
};
http.request(params);

Loading…
Cancel
Save