Commit 4fa73149 by 张立顺

功能开发

1 parent a35fba12
...@@ -38,14 +38,32 @@ ...@@ -38,14 +38,32 @@
:min="1" :min="1"
:max="999999"></el-input-number> :max="999999"></el-input-number>
</div> </div>
<div class="tips">
{{ goodsInfo.goodsType == 1? `卷(1卷=${goodsInfo.convertedValue||30}米)`:'件' }}
</div> </div>
<el-button @click="updateCarShopping">加入购物车</el-button>
</div> </div>
<el-button class="carBtn"
icon="carIcon"
@click="updateCarShopping">加入购物车</el-button>
</div>
<!-- <i class="carIcon"></i> -->
</div> </div>
<h3>产品详情</h3> <h3>产品详情</h3>
<img src="" <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" class="productDetailsImg"
alt=""> 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> </div>
</baseDialog> </baseDialog>
</template> </template>
...@@ -53,6 +71,7 @@ ...@@ -53,6 +71,7 @@
<script> <script>
// import from '' // import from ''
import { getProductInfo } from '@/api/product' import { getProductInfo } from '@/api/product'
import { shoppingCarAdd } from '@/api/purchaseShopping'
export default { export default {
name: 'GoodsDetailCom', name: 'GoodsDetailCom',
props: { props: {
...@@ -127,24 +146,22 @@ export default { ...@@ -127,24 +146,22 @@ export default {
methods: { methods: {
getGoodsDetail() { getGoodsDetail() {
getProductInfo({ id: this.goodsId }).then(res => { getProductInfo({ id: this.goodsId }).then(res => {
console.log(res)
// let data = res.data
// let {goodsName,} = res
this.goodsInfo = res this.goodsInfo = res
// 调试用 // 调试用
for (let index = 0; index < 12; index++) { // for (let index = 0; index < 12; index++) {
this.goodsInfo.upgradeGoodsList[index] = this.goodsInfo.upgradeGoodsList[0] // this.goodsInfo.upgradeGoodsList[index] = this.goodsInfo.upgradeGoodsList[0]
} // }
// 默认选中第一个 // 默认选中第一个
const item = this.goodsInfo.upgradeGoodsList[0] const item = this.goodsInfo.upgradeGoodsList[0]
item && setHandleItemInfo(item) // console.log(item)
item && this.setHandleItemInfo(item)
}) })
}, },
setHandleItemInfo(item) { setHandleItemInfo(item) {
const { upgradeGoodsId, purchasePrice } = item console.log(item)
this.handleItemInfo = object.assign(this.handleItemInfo, { const { id, purchasePrice } = item
upgradeGoodsId, this.handleItemInfo = Object.assign(this.handleItemInfo, {
upgradeGoodsId: id,
purchasePrice purchasePrice
}) })
}, },
...@@ -152,9 +169,18 @@ export default { ...@@ -152,9 +169,18 @@ export default {
}, },
updateCarShopping() { updateCarShopping() {
// this.$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.$message.success('加入购物车成功')
this.$EventBus.$emit('updateCarShopping') this.$EventBus.$emit('updateCarShopping')
})
// this.$message.success('加入购物车成功')
// this.$EventBus.$emit('updateCarShopping')
} }
} }
} }
...@@ -208,15 +234,7 @@ export default { ...@@ -208,15 +234,7 @@ export default {
} }
.skuCon { .skuCon {
display: flex; 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; // flex-wrap: wrap;
// align-items: center; // align-items: center;
.itemCon { .itemCon {
...@@ -242,14 +260,48 @@ export default { ...@@ -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 { .productDetailsImg {
width: 100%; // width: 100%;
height: 338px; // height: 338px;
max-width: fit-content;
// min-width: fit-content;
} }
.munCom { .munCom {
display: flex; display: flex;
margin-bottom: 20px; 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> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!