|
@@ -16,7 +16,7 @@
|
|
{{ prodData.prodName }}
|
|
{{ prodData.prodName }}
|
|
</van-col>
|
|
</van-col>
|
|
<van-col span="6" class="prod-title-icon">
|
|
<van-col span="6" class="prod-title-icon">
|
|
- <div>
|
|
|
|
|
|
+ <div @click="addOrCancel">
|
|
<van-icon v-if="!isCollection" name="like-o" size="20" />
|
|
<van-icon v-if="!isCollection" name="like-o" size="20" />
|
|
<van-icon v-if="isCollection" style="color:red" name="like" size="20" />
|
|
<van-icon v-if="isCollection" style="color:red" name="like" size="20" />
|
|
<span> 收藏</span>
|
|
<span> 收藏</span>
|
|
@@ -72,10 +72,9 @@
|
|
<!-- 购物提示框 -->
|
|
<!-- 购物提示框 -->
|
|
<van-action-sheet v-model="showDesc">
|
|
<van-action-sheet v-model="showDesc">
|
|
<div style="height: 1rem;"></div>
|
|
<div style="height: 1rem;"></div>
|
|
- <van-card :num="confirm.orderItem.prodCount"
|
|
|
|
- :price="defaultSku.price ? defaultSku.price : prodData.price"
|
|
|
|
- :desc="prodData.brief" :title="defaultSku.skuName ? defaultSku.skuName : prodData.prodName "
|
|
|
|
- :thumb="defaultSku.pic ? defaultSku.pic : prodData.pic ">
|
|
|
|
|
|
+ <van-card :num="confirm.orderItem.prodCount" :price="defaultSku.price ? defaultSku.price : prodData.price"
|
|
|
|
+ :desc="prodData.brief" :title="defaultSku.skuName ? defaultSku.skuName : prodData.prodName"
|
|
|
|
+ :thumb="defaultSku.pic ? defaultSku.pic : prodData.pic">
|
|
<template #tags>
|
|
<template #tags>
|
|
</template>
|
|
</template>
|
|
<template #footer>
|
|
<template #footer>
|
|
@@ -97,9 +96,9 @@
|
|
|
|
|
|
<div class="shopcart-button">
|
|
<div class="shopcart-button">
|
|
<van-button class="left" :disabled="defaultSku.price ? false : true" type="danger"
|
|
<van-button class="left" :disabled="defaultSku.price ? false : true" type="danger"
|
|
- @click="shopcartAdd">加入购物车</van-button>
|
|
|
|
|
|
+ @click="shopcartAdd">加入购物车</van-button>
|
|
<van-button class="right" :disabled="defaultSku.price ? false : true" type="danger"
|
|
<van-button class="right" :disabled="defaultSku.price ? false : true" type="danger"
|
|
- @click="buynow">立即购买</van-button>
|
|
|
|
|
|
+ @click="buynow">立即购买</van-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</van-action-sheet>
|
|
</van-action-sheet>
|
|
@@ -123,7 +122,6 @@
|
|
</div>
|
|
</div>
|
|
</van-action-sheet>
|
|
</van-action-sheet>
|
|
<van-goods-action>
|
|
<van-goods-action>
|
|
- <van-goods-action-icon icon="chat-o" text="客服" />
|
|
|
|
<van-goods-action-icon icon="cart-o" @click="$router.push('/shopCart')" text="购物车" />
|
|
<van-goods-action-icon icon="cart-o" @click="$router.push('/shopCart')" text="购物车" />
|
|
<van-goods-action-icon icon="shop-o" text="店铺" />
|
|
<van-goods-action-icon icon="shop-o" text="店铺" />
|
|
<van-goods-action-button type="danger" text="立即购买" @click="showDesc = true" />
|
|
<van-goods-action-button type="danger" text="立即购买" @click="showDesc = true" />
|
|
@@ -132,10 +130,10 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
-import { prodInfo, prodCommData, isCollection, changeItem, confirm, submit }
|
|
|
|
|
|
+import { prodInfo, prodCommData, isCollection, changeItem, confirm, addOrCancel }
|
|
from '../api/prodinfo'
|
|
from '../api/prodinfo'
|
|
import { formatHtml } from '../utils/util'
|
|
import { formatHtml } from '../utils/util'
|
|
-import { Toast } from 'vant'
|
|
|
|
|
|
+import { Toast } from 'vant'
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -157,7 +155,7 @@ export default {
|
|
show: false,
|
|
show: false,
|
|
tags: {},
|
|
tags: {},
|
|
confirm: {
|
|
confirm: {
|
|
- basketIds: [],
|
|
|
|
|
|
+ basketIds: [],
|
|
orderItem: {
|
|
orderItem: {
|
|
prodId: 0,
|
|
prodId: 0,
|
|
skuId: 0,
|
|
skuId: 0,
|
|
@@ -179,45 +177,42 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- async created() {
|
|
|
|
- const prod = await prodInfo({ prodId: this.$route.query.prodId })
|
|
|
|
- this.skuList = prod.skuList
|
|
|
|
- this.transport = prod.transport
|
|
|
|
- prod.imgs = prod.imgs.split(",")
|
|
|
|
- this.prodData = prod
|
|
|
|
- this.commData = await prodCommData({ prodId: prod.prodId })
|
|
|
|
- this.isCollection = await isCollection({ prodId: prod.prodId })
|
|
|
|
- this.init(this.skuList)
|
|
|
|
|
|
+ created() {
|
|
|
|
+ this.loadData()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- buynow(){
|
|
|
|
|
|
+ async loadData() {
|
|
|
|
+ const prod = await prodInfo({ prodId: this.$route.query.prodId })
|
|
|
|
+ this.skuList = prod.skuList
|
|
|
|
+ this.transport = prod.transport
|
|
|
|
+ prod.imgs = prod.imgs.split(",")
|
|
|
|
+ this.prodData = prod
|
|
|
|
+ this.commData = await prodCommData({ prodId: prod.prodId })
|
|
|
|
+ this.isCollection = await isCollection({ prodId: prod.prodId })
|
|
|
|
+ this.init(this.skuList)
|
|
|
|
+ },
|
|
|
|
+ async addOrCancel() {
|
|
|
|
+ await addOrCancel(this.prodData.prodId)
|
|
|
|
+ this.isCollection = await isCollection({ prodId: this.prodData.prodId })
|
|
|
|
+ },
|
|
|
|
+ buynow() {
|
|
this.confirm.orderItem.prodId = this.prodData.prodId
|
|
this.confirm.orderItem.prodId = this.prodData.prodId
|
|
this.confirm.orderItem.skuId = this.defaultSku.skuId
|
|
this.confirm.orderItem.skuId = this.defaultSku.skuId
|
|
this.confirm.orderItem.shopId = this.prodData.shopId
|
|
this.confirm.orderItem.shopId = this.prodData.shopId
|
|
this.confirm.orderItem.distributionCardNo = ""
|
|
this.confirm.orderItem.distributionCardNo = ""
|
|
- confirm(this.confirm).then(r=>{
|
|
|
|
- submit( {
|
|
|
|
- orderShopParam: [
|
|
|
|
- {
|
|
|
|
- shopId: this.prodData.shopId,
|
|
|
|
- remarks:""
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
- })
|
|
|
|
- }).catch(e=>{
|
|
|
|
- console.log(e)
|
|
|
|
- })
|
|
|
|
|
|
+ sessionStorage.setItem("confirm", JSON.stringify(this.confirm) )
|
|
|
|
+ this.$router.push("/submitinfo")
|
|
},
|
|
},
|
|
- shopcartAdd(){
|
|
|
|
|
|
+ shopcartAdd() {
|
|
this.shopcart.basketId = 0
|
|
this.shopcart.basketId = 0
|
|
this.shopcart.prodId = this.prodData.prodId
|
|
this.shopcart.prodId = this.prodData.prodId
|
|
this.shopcart.skuId = this.defaultSku.skuId
|
|
this.shopcart.skuId = this.defaultSku.skuId
|
|
this.shopcart.shopId = this.prodData.shopId
|
|
this.shopcart.shopId = this.prodData.shopId
|
|
this.shopcart.count = this.confirm.orderItem.prodCount
|
|
this.shopcart.count = this.confirm.orderItem.prodCount
|
|
- changeItem(this.shopcart).then(r=>{
|
|
|
|
|
|
+ changeItem(this.shopcart).then(r => {
|
|
Toast("添加成功!")
|
|
Toast("添加成功!")
|
|
this.showDesc = false
|
|
this.showDesc = false
|
|
- }).catch(e=>{
|
|
|
|
|
|
+ }).catch(e => {
|
|
console.log(e)
|
|
console.log(e)
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -234,7 +229,7 @@ export default {
|
|
if (defaultArr.length === 0) {
|
|
if (defaultArr.length === 0) {
|
|
defaultArr = propArr
|
|
defaultArr = propArr
|
|
this.defaultSku = sku[i]
|
|
this.defaultSku = sku[i]
|
|
- if ( sku.length === 1 ) return ;
|
|
|
|
|
|
+ if (sku.length === 1) return;
|
|
}
|
|
}
|
|
for (let n = 0; n < propArr.length; n++) {
|
|
for (let n = 0; n < propArr.length; n++) {
|
|
const valueStr = propArr[n];
|
|
const valueStr = propArr[n];
|
|
@@ -276,16 +271,18 @@ export default {
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
<style scoped lang="less">
|
|
<style scoped lang="less">
|
|
-.shopcart-button{
|
|
|
|
- .left{
|
|
|
|
|
|
+.shopcart-button {
|
|
|
|
+ .left {
|
|
width: 50%;
|
|
width: 50%;
|
|
background-color: #595959;
|
|
background-color: #595959;
|
|
border: 1px solid #595959;
|
|
border: 1px solid #595959;
|
|
}
|
|
}
|
|
|
|
+
|
|
.right {
|
|
.right {
|
|
width: 50%;
|
|
width: 50%;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
.prop-selected {
|
|
.prop-selected {
|
|
color: #FFF !important;
|
|
color: #FFF !important;
|
|
background-color: red !important;
|
|
background-color: red !important;
|
|
@@ -374,4 +371,5 @@ export default {
|
|
padding-right: 1rem;
|
|
padding-right: 1rem;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}</style>
|
|
|
|
|
|
+}
|
|
|
|
+</style>
|