优化购物车提示

This commit is contained in:
TOP糯米 2023-04-07 15:06:05 +08:00
parent ce1a13bdd0
commit 3a8c6a4361
2 changed files with 13 additions and 7 deletions

View File

@ -25,9 +25,8 @@ export default {
id: id, id: id,
} }
}).then((response) => { }).then((response) => {
prototype.$utils.toast(response.msg);
if (response.code == 1) { if (response.code == 1) {
return resolve(); return resolve(response.msg);
} }
return reject(response.msg); return reject(response.msg);
}).catch(e => { }); }).catch(e => { });
@ -43,8 +42,11 @@ export default {
data: { data: {
id: id, id: id,
} }
}).then(() => { }).then((response) => {
return resolve(); if (response.code == 1) {
return resolve(response.msg);
}
return reject(response.msg);
}).catch(e => { }); }).catch(e => { });
}); });
}, },
@ -58,8 +60,11 @@ export default {
data: { data: {
id: id, id: id,
} }
}).then(() => { }).then((response) => {
return resolve(); if (response.code == 1) {
return resolve(response.msg);
}
return reject(response.msg);
}).catch(e => { }); }).catch(e => { });
}); });
}, },

View File

@ -176,8 +176,9 @@ export default {
* 加入购物车 * 加入购物车
*/ */
addToCart() { addToCart() {
this.$models.cart.toCart(this.id).then(() => { this.$models.cart.toCart(this.id).then((msg) => {
this.$store.dispatch("cart/updateAll"); this.$store.dispatch("cart/updateAll");
this.$utils.toast(msg);
}); });
}, },
/** /**