Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-business
/
develop-platform
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 ffb03ed1
authored
Nov 17, 2020
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
关联商品-升级商品
1 parent
de93ab8e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
11 deletions
src/components/d2-form/image/relateIcon.png
src/components/d2-form/index.vue
src/views/goods/editCommodity.vue
src/components/d2-form/image/relateIcon.png
0 → 100644
View file @
ffb03ed
632 Bytes
src/components/d2-form/index.vue
View file @
ffb03ed
...
@@ -120,6 +120,10 @@
...
@@ -120,6 +120,10 @@
>
×
</span>
>
×
</span>
</p>
</p>
<p>
<p>
<img
src=
"./image/relateIcon.png"
alt=
"关联"
/>
配置分账规则
订单最大可分配比例
配置分账规则
订单最大可分配比例
<el-input
<el-input
class=
"pro-item"
class=
"pro-item"
...
@@ -155,7 +159,7 @@
...
@@ -155,7 +159,7 @@
{{
formData
.
upgradeGoods
[
0
].
profitValue
}}
{{
formData
.
upgradeGoods
[
0
].
profitValue
}}
</el-form-item>
-->
</el-form-item>
-->
</div>
</div>
<el-button
@
click=
"handleAddPro"
>
新增关联商品
</el-button>
<el-button
@
click=
"handleAddPro
(item)
"
>
新增关联商品
</el-button>
</
template
>
</
template
>
<
template
v-else-if=
"item.type === 'photo'"
>
<
template
v-else-if=
"item.type === 'photo'"
>
<p
class=
"photo-top-tips"
>
{{
item
.
topTips
}}
</p>
<p
class=
"photo-top-tips"
>
{{
item
.
topTips
}}
</p>
...
@@ -396,16 +400,24 @@ export default {
...
@@ -396,16 +400,24 @@ export default {
// value && (this.formData[item.attrName] = item.optionList.find(i => i[item.optionId] === this.formData[item.name])[item.optionLabel])
// value && (this.formData[item.attrName] = item.optionList.find(i => i[item.optionId] === this.formData[item.name])[item.optionLabel])
// }
// }
},
},
handleAddPro
()
{
handleAddPro
(
targetItem
)
{
if
(
!
this
.
formData
[
targetItem
.
relateAttr
])
{
this
.
notice
.
warningTips
(
'请选择基础商品'
)
return
true
}
this
.
markTarget
=
targetItem
console
.
log
(
this
.
markTarget
)
var
proSelectedIds
=
this
.
formData
.
upgradeGoods
.
map
(
item
=>
item
.
goodsCode
)
var
proSelectedIds
=
this
.
formData
.
upgradeGoods
.
map
(
item
=>
item
.
goodsCode
)
proSelectedIds
.
push
(
this
.
formData
[
targetItem
.
relateAttr
])
this
.
proList
.
forEach
(
item
=>
{
this
.
proList
.
forEach
(
item
=>
{
proSelectedIds
.
includes
(
item
.
goodsCode
)
&&
(
item
.
disabled
=
tru
e
)
item
.
disabled
=
proSelectedIds
.
includes
(
item
.
goodsCod
e
)
})
})
this
.
relateProVisible
=
true
this
.
relateProVisible
=
true
},
},
handleProChange
(
targetItem
,
targetIndex
)
{
handleProChange
(
targetItem
,
targetIndex
)
{
// console.log(targetItem)
// console.log(targetItem)
var
proSelectedIds
=
this
.
formData
.
upgradeGoods
.
map
(
item
=>
item
.
goodsCode
)
var
proSelectedIds
=
this
.
formData
.
upgradeGoods
.
map
(
item
=>
item
.
goodsCode
)
proSelectedIds
.
push
(
this
.
formData
[
targetItem
.
relateAttr
])
this
.
proList
.
forEach
(
item
=>
{
this
.
proList
.
forEach
(
item
=>
{
if
(
proSelectedIds
.
includes
(
item
.
goodsCode
)
&&
(
item
.
goodsCode
!==
targetItem
.
goodsCode
))
{
if
(
proSelectedIds
.
includes
(
item
.
goodsCode
)
&&
(
item
.
goodsCode
!==
targetItem
.
goodsCode
))
{
item
.
disabled
=
true
item
.
disabled
=
true
...
@@ -417,16 +429,24 @@ export default {
...
@@ -417,16 +429,24 @@ export default {
this
.
originProInfo
=
targetItem
this
.
originProInfo
=
targetItem
this
.
relateProVisible
=
true
this
.
relateProVisible
=
true
},
},
judgeIsDisable
()
{
// console.log(this.markTarget)
if
(
this
.
addOrEdit
===
'add'
)
{
this
.
formList
[
0
].
formBlock
[
0
].
isDisabled
=
this
.
formData
[
this
.
markTarget
.
name
].
length
}
},
handleRelateProConfirm
(
proInfo
)
{
handleRelateProConfirm
(
proInfo
)
{
this
.
relateProVisible
=
false
//
this.relateProVisible = false
proInfo
.
profitType
=
1
proInfo
.
profitType
=
1
this
.
originProInfo
=
{}
//
this.originProInfo = {}
if
(
this
.
proIndex
!==
-
1
)
{
if
(
this
.
proIndex
!==
-
1
)
{
this
.
formData
.
upgradeGoods
[
this
.
proIndex
]
=
proInfo
this
.
formData
.
upgradeGoods
[
this
.
proIndex
]
=
proInfo
}
else
{
}
else
{
this
.
formData
.
upgradeGoods
.
push
(
proInfo
)
this
.
formData
.
upgradeGoods
.
push
(
proInfo
)
this
.
judgeIsDisable
()
}
}
this
.
proIndex
=
-
1
this
.
handleRelateProClose
()
// this.proIndex = -1
},
},
handleRelateProClose
()
{
handleRelateProClose
()
{
this
.
originProInfo
=
{}
this
.
originProInfo
=
{}
...
@@ -453,6 +473,9 @@ export default {
...
@@ -453,6 +473,9 @@ export default {
var
formDataName
=
formItem
.
name
var
formDataName
=
formItem
.
name
var
filterArr
=
this
.
formData
[
formDataName
].
filter
(
i
=>
i
[
formItem
.
optionValue
]
!==
item
[
formItem
.
optionValue
])
var
filterArr
=
this
.
formData
[
formDataName
].
filter
(
i
=>
i
[
formItem
.
optionValue
]
!==
item
[
formItem
.
optionValue
])
this
.
formData
[
formDataName
]
=
filterArr
this
.
formData
[
formDataName
]
=
filterArr
console
.
log
(
this
.
formData
)
console
.
log
(
formDataName
)
this
.
judgeIsDisable
()
},
},
// 图片
// 图片
handleAddClick
(
targetItem
)
{
handleAddClick
(
targetItem
)
{
...
...
src/views/goods/editCommodity.vue
View file @
ffb03ed
...
@@ -103,7 +103,8 @@ export default {
...
@@ -103,7 +103,8 @@ export default {
name
:
'upgradeGoods'
,
name
:
'upgradeGoods'
,
label
:
'关联升级商品'
,
label
:
'关联升级商品'
,
type
:
'relatePro'
,
type
:
'relatePro'
,
optionValue
:
'goodsCode'
optionValue
:
'goodsCode'
,
relateAttr
:
'goodsCode'
}]
}]
},
{
},
{
title
:
'关联门店信息'
,
title
:
'关联门店信息'
,
...
@@ -125,6 +126,7 @@ export default {
...
@@ -125,6 +126,7 @@ export default {
// console.log(this.editData)
// console.log(this.editData)
// add - 新增;edit - 编辑
// add - 新增;edit - 编辑
this
.
addOrEdit
=
this
.
$route
.
params
.
addOrEdit
this
.
addOrEdit
=
this
.
$route
.
params
.
addOrEdit
this
.
getGoodsListNoBase
()
if
(
this
.
addOrEdit
===
'edit'
)
{
if
(
this
.
addOrEdit
===
'edit'
)
{
getGoodsInfoById
({
id
:
this
.
$route
.
params
.
row
.
id
}).
then
(
res
=>
{
getGoodsInfoById
({
id
:
this
.
$route
.
params
.
row
.
id
}).
then
(
res
=>
{
// console.log(res)
// console.log(res)
...
@@ -152,7 +154,6 @@ export default {
...
@@ -152,7 +154,6 @@ export default {
})
})
}
else
{
}
else
{
this
.
editForm
[
0
].
formBlock
[
0
].
isDisabled
=
false
this
.
editForm
[
0
].
formBlock
[
0
].
isDisabled
=
false
this
.
getGoodsListNoBase
()
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
show
=
true
this
.
show
=
true
})
})
...
@@ -163,9 +164,8 @@ export default {
...
@@ -163,9 +164,8 @@ export default {
...
mapActions
({
close
:
'd2admin/page/close'
}),
...
mapActions
({
close
:
'd2admin/page/close'
}),
// ...mapActions('d2admin/page', ['close']),
// ...mapActions('d2admin/page', ['close']),
getGoodsListNoBase
()
{
getGoodsListNoBase
()
{
getGoodsList
({
var
params
=
this
.
addOrEdit
===
'edit'
?
{}
:
{
exceptBase
:
true
}
exceptBase
:
true
getGoodsList
(
params
).
then
(
res
=>
{
}).
then
(
res
=>
{
// console.log(res)
// console.log(res)
this
.
editForm
[
0
].
formBlock
[
0
].
optionList
=
res
this
.
editForm
[
0
].
formBlock
[
0
].
optionList
=
res
})
})
...
...
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