|
@@ -495,7 +495,7 @@
|
|
|
<Footer></Footer>
|
|
|
<!-- 规格选择 -->
|
|
|
<index-sku-dialog :skuModal.sync="skuModal" :specTemplateId="goodsDetail.specTemplateId" :isCarOrBuy="isCarOrBuy"
|
|
|
- @toShopCart='getAddCar' @togoBuy="toPayment"></index-sku-dialog>
|
|
|
+ @toShopCart='getAddCar($event)' @togoBuy="togoBuy($event)"></index-sku-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -1392,11 +1392,12 @@ export default {
|
|
|
// 判断有没有规格选择
|
|
|
if (this.goodsDetail.specTemplateId) {
|
|
|
this.isCarOrBuy = 2
|
|
|
- this.skuModal = true
|
|
|
+ // this.skuModal = true
|
|
|
+ this.getSpecDetail()
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- this.toPayment()
|
|
|
+ this.toPayment(this.goodsDetail)
|
|
|
} else {
|
|
|
this.setCurrentRouter(this.$route);
|
|
|
this.$router.push({
|
|
@@ -1405,11 +1406,15 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
},
|
|
|
- toPayment() {
|
|
|
+ togoBuy(skuItem) {
|
|
|
+ this.toPayment(skuItem)
|
|
|
+ },
|
|
|
+ toPayment(goodsDetail) {
|
|
|
if (this.goodsDetail.templateType) {
|
|
|
this.selectClassModal = true;
|
|
|
} else {
|
|
|
- let selectGoodsList = JSON.parse(JSON.stringify([this.goodsDetail]));
|
|
|
+ // let selectGoodsList = JSON.parse(JSON.stringify([this.goodsDetail]));
|
|
|
+ let selectGoodsList = JSON.parse(JSON.stringify([goodsDetail]));
|
|
|
selectGoodsList.forEach((item) => {
|
|
|
if (item.goodsType == 1) {
|
|
|
if (item.templateType == "class") {
|
|
@@ -1529,14 +1534,15 @@ export default {
|
|
|
// 判断有没有规格选择
|
|
|
if (this.goodsDetail.specTemplateId) {
|
|
|
this.isCarOrBuy = 1
|
|
|
- this.skuModal = true
|
|
|
+ // this.skuModal = true
|
|
|
+ this.getSpecDetail()
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- this.getAddCar()
|
|
|
+ this.getAddCar(this.goodsId)
|
|
|
},
|
|
|
- getAddCar() {
|
|
|
- this.$request.addCart({ goodsId: this.goodsId })
|
|
|
+ getAddCar(goodsId) {
|
|
|
+ this.$request.addCart({ goodsId: goodsId })
|
|
|
.then((res) => {
|
|
|
this.getCartCount();
|
|
|
this.$message({
|
|
@@ -1553,6 +1559,24 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ getSpecDetail() {
|
|
|
+ this.$axios({
|
|
|
+ url: `/app/common/spec/${this.goodsDetail.specTemplateId}`,
|
|
|
+ method: 'get',
|
|
|
+ noToken: true
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.data) {
|
|
|
+ this.skuModal = true
|
|
|
+ } else {
|
|
|
+ if (this.isCarOrBuy == 1) {
|
|
|
+ this.getAddCar(this.goodsId)
|
|
|
+ } else {
|
|
|
+ this.toPayment(this.goodsDetail)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
/**
|
|
|
* 获取商品详情
|
|
|
*/
|