|
|
@ -9,10 +9,10 @@
|
|
|
|
<Swiper :banner="banner" />
|
|
|
|
<Swiper :banner="banner" />
|
|
|
|
|
|
|
|
|
|
|
|
<Overview
|
|
|
|
<Overview
|
|
|
|
:title="overview.name"
|
|
|
|
:title="info.name"
|
|
|
|
:desc="overview.brief"
|
|
|
|
:desc="info.brief"
|
|
|
|
:price="overview.retailPrice"
|
|
|
|
:price="info.retailPrice"
|
|
|
|
:discount="overview.counterPrice"
|
|
|
|
:discount="info.counterPrice"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
<Section @input="isSkuShow = $event" />
|
|
|
|
<Section @input="isSkuShow = $event" />
|
|
|
@ -21,7 +21,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
<Description :description="description" />
|
|
|
|
<Description :description="description" />
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <Sku :skudata="skudata" :goods="goods" v-model="isSkuShow" /> -->
|
|
|
|
<Sku :skuData="skuData" :goods="skuGoods" v-model="isSkuShow" />
|
|
|
|
|
|
|
|
|
|
|
|
<Tabbar @input="isSkuShow = $event" />
|
|
|
|
<Tabbar @input="isSkuShow = $event" />
|
|
|
|
<back-top />
|
|
|
|
<back-top />
|
|
|
@ -40,6 +40,7 @@ import Description from './modules/Description'
|
|
|
|
import Tabbar from './modules/Tabbar'
|
|
|
|
import Tabbar from './modules/Tabbar'
|
|
|
|
import Sku from './modules/Sku'
|
|
|
|
import Sku from './modules/Sku'
|
|
|
|
import Skeleton from './modules/Skeleton'
|
|
|
|
import Skeleton from './modules/Skeleton'
|
|
|
|
|
|
|
|
import _ from 'lodash'
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
name: 'Detail',
|
|
|
|
name: 'Detail',
|
|
|
@ -58,11 +59,12 @@ export default {
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
banner: [],
|
|
|
|
banner: [],
|
|
|
|
overview: {},
|
|
|
|
goods: {},
|
|
|
|
|
|
|
|
info: {},
|
|
|
|
comment: {},
|
|
|
|
comment: {},
|
|
|
|
description: '',
|
|
|
|
description: '',
|
|
|
|
skudata: {},
|
|
|
|
skuData: {},
|
|
|
|
goods: {},
|
|
|
|
skuGoods: {},
|
|
|
|
isSkuShow: false,
|
|
|
|
isSkuShow: false,
|
|
|
|
isSkeletonShow: true
|
|
|
|
isSkeletonShow: true
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -75,12 +77,83 @@ export default {
|
|
|
|
getDetail({
|
|
|
|
getDetail({
|
|
|
|
goodsId: this.goodsId
|
|
|
|
goodsId: this.goodsId
|
|
|
|
}).then(res => {
|
|
|
|
}).then(res => {
|
|
|
|
const { data: overview } = res.map
|
|
|
|
const goods = res.map
|
|
|
|
this.overview = overview
|
|
|
|
this.goods = goods
|
|
|
|
this.banner = overview.gallery
|
|
|
|
this.info = goods.info
|
|
|
|
this.description = overview.picUrl
|
|
|
|
this.banner = goods.info.gallery
|
|
|
|
|
|
|
|
this.description = goods.info.picUrl
|
|
|
|
|
|
|
|
this.skuAdapter()
|
|
|
|
this.isSkeletonShow = false
|
|
|
|
this.isSkeletonShow = false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
skuAdapter() {
|
|
|
|
|
|
|
|
const tree = this.setSkuTree()
|
|
|
|
|
|
|
|
const list = this.setSkuList()
|
|
|
|
|
|
|
|
const skuInfo = {
|
|
|
|
|
|
|
|
price: parseInt(this.goods.info.retailPrice), // 未选择规格时的价格
|
|
|
|
|
|
|
|
stock_num: 0, // TODO 总库存
|
|
|
|
|
|
|
|
collection_id: '', // 无规格商品skuId取collection_id,否则取所选sku组合对应的id
|
|
|
|
|
|
|
|
none_sku: false, // 是否无规格商品
|
|
|
|
|
|
|
|
hide_stock: true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.skuData = {
|
|
|
|
|
|
|
|
tree,
|
|
|
|
|
|
|
|
list,
|
|
|
|
|
|
|
|
...skuInfo
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.skuGoods = {
|
|
|
|
|
|
|
|
title: this.goods.info.name,
|
|
|
|
|
|
|
|
picture: this.goods.info.picUrl
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
setSkuTree() {
|
|
|
|
|
|
|
|
const specifications = []
|
|
|
|
|
|
|
|
_.each(this.goods.specificationList, (v, k) => {
|
|
|
|
|
|
|
|
const values = []
|
|
|
|
|
|
|
|
_.each(v.valueList, vv => {
|
|
|
|
|
|
|
|
vv.name = vv.value
|
|
|
|
|
|
|
|
values.push({
|
|
|
|
|
|
|
|
id: vv.id,
|
|
|
|
|
|
|
|
name: vv.value,
|
|
|
|
|
|
|
|
imUrl: vv.picUrl
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
specifications.push({
|
|
|
|
|
|
|
|
k: v.name,
|
|
|
|
|
|
|
|
v: values,
|
|
|
|
|
|
|
|
k_s: 's' + (~~k + 1)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return specifications
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
setSkuList() {
|
|
|
|
|
|
|
|
const skuList = []
|
|
|
|
|
|
|
|
_.each(this.goods.productList, v => {
|
|
|
|
|
|
|
|
var skuListObj = {}
|
|
|
|
|
|
|
|
_.each(v.specifications, (specificationName, index) => {
|
|
|
|
|
|
|
|
skuListObj['s' + (~~index + 1)] = this.findSpecValueIdByName(specificationName)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skuListObj.price = v.price * 100
|
|
|
|
|
|
|
|
skuListObj.stock_num = v.number
|
|
|
|
|
|
|
|
skuList.push(skuListObj)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
return skuList
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
findSpecValueIdByName(name) {
|
|
|
|
|
|
|
|
let id = 0
|
|
|
|
|
|
|
|
_.each(this.goods.specificationList, specification => {
|
|
|
|
|
|
|
|
_.each(specification.valueList, specValue => {
|
|
|
|
|
|
|
|
if (specValue.value === name) {
|
|
|
|
|
|
|
|
id = specValue.id
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
if (id !== 0) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
return id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|