feat:添加购物车

merge-requests/42/merge
张征 3 years ago
parent 83dd6c4a3f
commit fe4465369a

@ -265,7 +265,14 @@ export default {
}, },
methods: { methods: {
addCart() { addCart() {
this.$router.push(`/orderSubmit?mode=cart&ids=` + [this.detailData.id]) let ids = [this.detailData.id];
this.$router.push({
path: `/orderSubmit`,
query: {
mode: "cart",
ids,
},
});
}, },
isStock() { isStock() {
return this.skuData.some((item) => item.stock > 0); return this.skuData.some((item) => item.stock > 0);
@ -440,13 +447,13 @@ export default {
const { error, result } = await ApiPutAddCart({ const { error, result } = await ApiPutAddCart({
productSkuId: this.curSku.skuId, productSkuId: this.curSku.skuId,
productId: this.detailData.id, productId: this.detailData.id,
number : this.curBuyNum number: this.curBuyNum,
}); });
if (error) { if (error) {
this.$message.error(error.message); this.$message.error(error.message);
return false; return false;
} }
this.$message.success('加入购物车成功~'); this.$message.success("加入购物车成功~");
// this.$Router.push('/cart'); // this.$Router.push('/cart');
}, },
}, },

Loading…
Cancel
Save