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 @@
>
×
</span>
</p>
<p>
<img
src=
"./image/relateIcon.png"
alt=
"关联"
/>
配置分账规则
订单最大可分配比例
<el-input
class=
"pro-item"
...
...
@@ -155,7 +159,7 @@
{{
formData
.
upgradeGoods
[
0
].
profitValue
}}
</el-form-item>
-->
</div>
<el-button
@
click=
"handleAddPro"
>
新增关联商品
</el-button>
<el-button
@
click=
"handleAddPro
(item)
"
>
新增关联商品
</el-button>
</
template
>
<
template
v-else-if=
"item.type === 'photo'"
>
<p
class=
"photo-top-tips"
>
{{
item
.
topTips
}}
</p>
...
...
@@ -396,16 +400,24 @@ export default {
// 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
)
proSelectedIds
.
push
(
this
.
formData
[
targetItem
.
relateAttr
])
this
.
proList
.
forEach
(
item
=>
{
proSelectedIds
.
includes
(
item
.
goodsCode
)
&&
(
item
.
disabled
=
tru
e
)
item
.
disabled
=
proSelectedIds
.
includes
(
item
.
goodsCod
e
)
})
this
.
relateProVisible
=
true
},
handleProChange
(
targetItem
,
targetIndex
)
{
// console.log(targetItem)
var
proSelectedIds
=
this
.
formData
.
upgradeGoods
.
map
(
item
=>
item
.
goodsCode
)
proSelectedIds
.
push
(
this
.
formData
[
targetItem
.
relateAttr
])
this
.
proList
.
forEach
(
item
=>
{
if
(
proSelectedIds
.
includes
(
item
.
goodsCode
)
&&
(
item
.
goodsCode
!==
targetItem
.
goodsCode
))
{
item
.
disabled
=
true
...
...
@@ -417,16 +429,24 @@ export default {
this
.
originProInfo
=
targetItem
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
)
{
this
.
relateProVisible
=
false
//
this.relateProVisible = false
proInfo
.
profitType
=
1
this
.
originProInfo
=
{}
//
this.originProInfo = {}
if
(
this
.
proIndex
!==
-
1
)
{
this
.
formData
.
upgradeGoods
[
this
.
proIndex
]
=
proInfo
}
else
{
this
.
formData
.
upgradeGoods
.
push
(
proInfo
)
this
.
judgeIsDisable
()
}
this
.
proIndex
=
-
1
this
.
handleRelateProClose
()
// this.proIndex = -1
},
handleRelateProClose
()
{
this
.
originProInfo
=
{}
...
...
@@ -453,6 +473,9 @@ export default {
var
formDataName
=
formItem
.
name
var
filterArr
=
this
.
formData
[
formDataName
].
filter
(
i
=>
i
[
formItem
.
optionValue
]
!==
item
[
formItem
.
optionValue
])
this
.
formData
[
formDataName
]
=
filterArr
console
.
log
(
this
.
formData
)
console
.
log
(
formDataName
)
this
.
judgeIsDisable
()
},
// 图片
handleAddClick
(
targetItem
)
{
...
...
src/views/goods/editCommodity.vue
View file @
ffb03ed
...
...
@@ -103,7 +103,8 @@ export default {
name
:
'upgradeGoods'
,
label
:
'关联升级商品'
,
type
:
'relatePro'
,
optionValue
:
'goodsCode'
optionValue
:
'goodsCode'
,
relateAttr
:
'goodsCode'
}]
},
{
title
:
'关联门店信息'
,
...
...
@@ -125,6 +126,7 @@ export default {
// console.log(this.editData)
// add - 新增;edit - 编辑
this
.
addOrEdit
=
this
.
$route
.
params
.
addOrEdit
this
.
getGoodsListNoBase
()
if
(
this
.
addOrEdit
===
'edit'
)
{
getGoodsInfoById
({
id
:
this
.
$route
.
params
.
row
.
id
}).
then
(
res
=>
{
// console.log(res)
...
...
@@ -152,7 +154,6 @@ export default {
})
}
else
{
this
.
editForm
[
0
].
formBlock
[
0
].
isDisabled
=
false
this
.
getGoodsListNoBase
()
this
.
$nextTick
(()
=>
{
this
.
show
=
true
})
...
...
@@ -163,9 +164,8 @@ export default {
...
mapActions
({
close
:
'd2admin/page/close'
}),
// ...mapActions('d2admin/page', ['close']),
getGoodsListNoBase
()
{
getGoodsList
({
exceptBase
:
true
}).
then
(
res
=>
{
var
params
=
this
.
addOrEdit
===
'edit'
?
{}
:
{
exceptBase
:
true
}
getGoodsList
(
params
).
then
(
res
=>
{
// console.log(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