Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4fa73149
authored
Feb 15, 2023
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
功能开发
1 parent
a35fba12
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
29 deletions
src/views/purchase/components/goodsDetailCom.vue
src/views/purchase/components/goodsDetailCom.vue
View file @
4fa7314
...
@@ -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>
<
/div>
<el-button
@
click=
"updateCarShopping"
>
加入购物车
</el-button>
<
el
-
button
class
=
"carBtn"
icon
=
"carIcon"
@
click
=
"updateCarShopping"
>
加入购物车
<
/el-button>
<
/div>
<
/div>
<!--
<
i
class
=
"carIcon"
><
/i> -->
<
/div>
<
/div>
<
h3
>
产品详情
<
/h3>
<
h3
>
产品详情
<
/h3>
<img
src=
""
<
div
class
=
"goodsDescList"
>
class=
"productDetailsImg"
<
div
class
=
"goodsDescItem"
alt=
""
>
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>
<
/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
=
{
this
.
$message
.
success
(
'加入购物车成功'
)
goodsNumber
:
this
.
handleItemInfo
.
goodsNumber
,
this
.
$EventBus
.
$emit
(
'updateCarShopping'
)
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 {
...
@@ -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
:
60
px
;
height
:
36
px
;
text
-
align
:
center
;
padding
-
left
:
18
px
;
line
-
height
:
36
px
;
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
:
20
px
;
margin
-
bottom
:
20
px
;
.
tips
{
height
:
36
px
;
line
-
height
:
36
px
;
margin
-
left
:
8
px
;
font
-
size
:
12
px
;
color
:
#
666666
;
}
}
.
carBtn
{
color
:
#
ffffff
;
background
-
color
:
#
185
efe
;
display
:
flex
;
align
-
items
:
center
;
}
<
/style>
<
style
>
.
carIcon
{
display
:
inline
-
block
;
width
:
22
px
;
height
:
22
px
;
background
:
url
(..
/
images
/
shoppingCarIcon
.
webp
)
no
-
repeat
;
background
-
size
:
100
%
100
%
;
margin
-
right
:
4
px
;
}
}
<
/style>
<
/style>
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment