Commit 4fa73149 by 张立顺

功能开发

1 parent a35fba12
......@@ -38,14 +38,32 @@
:min="1"
:max="999999"></el-input-number>
</div>
<div class="tips">
{{ goodsInfo.goodsType == 1? `卷(1卷=${goodsInfo.convertedValue||30}米)`:'件' }}
</div>
</div>
<el-button @click="updateCarShopping">加入购物车</el-button>
<el-button class="carBtn"
icon="carIcon"
@click="updateCarShopping">加入购物车</el-button>
</div>
<!-- <i class="carIcon"></i> -->
</div>
<h3>产品详情</h3>
<img src=""
class="productDetailsImg"
alt="">
<div class="goodsDescList">
<div class="goodsDescItem"
v-for="(item,index) in goodsInfo.goodsDescList"
:key="index">
<img :src="item.content"
v-if="item.resType == 1"
class="productDetailsImg"
alt="">
<!-- <div class="goodsDescItem__title">{{ item.title }}</div> -->
<div v-if="item.resType ==2"
class="goodsDescItem__content"
v-html="item.content"></div>
</div>
</div>
</div>
</baseDialog>
</template>
......@@ -53,6 +71,7 @@
<script>
// import from ''
import { getProductInfo } from '@/api/product'
import { shoppingCarAdd } from '@/api/purchaseShopping'
export default {
name: 'GoodsDetailCom',
props: {
......@@ -127,24 +146,22 @@ export default {
methods: {
getGoodsDetail() {
getProductInfo({ id: this.goodsId }).then(res => {
console.log(res)
// let data = res.data
// let {goodsName,} = res
this.goodsInfo = res
// 调试用
for (let index = 0; index < 12; index++) {
this.goodsInfo.upgradeGoodsList[index] = this.goodsInfo.upgradeGoodsList[0]
}
// for (let index = 0; index < 12; index++) {
// this.goodsInfo.upgradeGoodsList[index] = this.goodsInfo.upgradeGoodsList[0]
// }
// 默认选中第一个
const item = this.goodsInfo.upgradeGoodsList[0]
item && setHandleItemInfo(item)
// console.log(item)
item && this.setHandleItemInfo(item)
})
},
setHandleItemInfo(item) {
const { upgradeGoodsId, purchasePrice } = item
this.handleItemInfo = object.assign(this.handleItemInfo, {
upgradeGoodsId,
console.log(item)
const { id, purchasePrice } = item
this.handleItemInfo = Object.assign(this.handleItemInfo, {
upgradeGoodsId: id,
purchasePrice
})
},
......@@ -152,9 +169,18 @@ export default {
},
updateCarShopping() {
// this.$emit('updateCarShopping')
this.$message.success('加入购物车成功')
this.$EventBus.$emit('updateCarShopping')
const params = {
goodsNumber: this.handleItemInfo.goodsNumber,
upgradeGoodsId: this.handleItemInfo.upgradeGoodsId
}
// 判断是否有值
params.upgradeGoodsId && shoppingCarAdd(params).then(res => {
// console.log(res)
this.$message.success('加入购物车成功')
this.$EventBus.$emit('updateCarShopping')
})
// this.$message.success('加入购物车成功')
// this.$EventBus.$emit('updateCarShopping')
}
}
}
......@@ -208,15 +234,7 @@ export default {
}
.skuCon {
display: flex;
.label {
box-sizing: border-box;
width: 60px;
height: 36px;
text-align: center;
padding-left: 18px;
line-height: 36px;
color: #666666;
}
// flex-wrap: wrap;
// align-items: center;
.itemCon {
......@@ -242,14 +260,48 @@ export default {
}
}
}
.label {
box-sizing: border-box;
width: 60px;
height: 36px;
text-align: center;
padding-left: 18px;
line-height: 36px;
color: #666666;
}
}
}
.productDetailsImg {
width: 100%;
height: 338px;
// width: 100%;
// height: 338px;
max-width: fit-content;
// min-width: fit-content;
}
.munCom {
display: flex;
margin-bottom: 20px;
.tips {
height: 36px;
line-height: 36px;
margin-left: 8px;
font-size: 12px;
color: #666666;
}
}
.carBtn {
color: #ffffff;
background-color: #185efe;
display: flex;
align-items: center;
}
</style>
<style>
.carIcon {
display: inline-block;
width: 22px;
height: 22px;
background: url(../images/shoppingCarIcon.webp) no-repeat;
background-size: 100% 100%;
margin-right: 4px;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!