|
|
@ -176,7 +176,7 @@ import UiMoney from "@/components/UiMoney.vue";
|
|
|
|
import UiButton from "@/components/UiButton.vue";
|
|
|
|
import UiButton from "@/components/UiButton.vue";
|
|
|
|
import UiGoodsItem from "@/components/UiGoodsItem.vue";
|
|
|
|
import UiGoodsItem from "@/components/UiGoodsItem.vue";
|
|
|
|
import BsChosen from "@/components/BsChosen.vue";
|
|
|
|
import BsChosen from "@/components/BsChosen.vue";
|
|
|
|
import {ApiPutAddCart} from "@/plugins/api/cart";
|
|
|
|
import { ApiPutAddCart } from "@/plugins/api/cart";
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
ApiGetGoodsDetail,
|
|
|
|
ApiGetGoodsDetail,
|
|
|
|
ApiGetGoodsSkus,
|
|
|
|
ApiGetGoodsSkus,
|
|
|
@ -264,8 +264,15 @@ 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);
|
|
|
@ -429,26 +436,26 @@ export default {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 加入购物车
|
|
|
|
* 加入购物车
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
async addCart(){
|
|
|
|
async addCart() {
|
|
|
|
if(!this.curSku.skuId){
|
|
|
|
if (!this.curSku.skuId) {
|
|
|
|
this.$message.error("请选择规格~");
|
|
|
|
this.$message.error("请选择规格~");
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|