Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-app-operator-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-app-operator-master
Commits
4aaac458
Commit
4aaac458
authored
Oct 09, 2024
by
1483922988@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
海运空运指加价可以为负数
parent
98eec040
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
229 additions
and
318 deletions
+229
-318
PriceStep.vue
src/views/ecw/productPrice/components/PriceStep.vue
+165
-162
SeaPrice.vue
src/views/ecw/productPrice/components/SeaPrice.vue
+64
-156
No files found.
src/views/ecw/productPrice/components/PriceStep.vue
View file @
4aaac458
<
script
>
import
Selector
from
"
@/components/Selector/index.vue
"
;
import
Inputor
from
"
@/components/Inputor/index.vue
"
;
import
Template
from
"
@/views/cms/template/index.vue
"
;
import
{
DICT_TYPE
,
getDictDatas
}
from
"
@/utils/dict
"
;
import
Selector
from
"
@/components/Selector/index.vue
"
import
Inputor
from
"
@/components/Inputor/index.vue
"
import
Template
from
"
@/views/cms/template/index.vue
"
import
{
DICT_TYPE
,
getDictDatas
}
from
"
@/utils/dict
"
export
default
{
name
:
"
PriceStep
"
,
components
:
{
Template
,
Inputor
,
Selector
},
props
:{
components
:
{
Template
,
Inputor
,
Selector
},
props
:
{
index
:
Number
,
type
:
String
,
priceName
:
String
,
fieldPrefix
:
String
,
unitList
:{
unitList
:
{
type
:
Array
,
default
:
[]
},
currencyList
:{
currencyList
:
{
type
:
Array
,
default
:
[]
},
showAdd
:
Boolean
,
readonly
:
Boolean
,
stepTips
:
String
,
value
:{
value
:
{
type
:
Object
,
default
:
()
=>
{
return
{
}
return
{}
}
}
},
created
()
{
if
(
!
this
.
value
.
packagingList
)
{
if
(
!
this
.
value
.
packagingList
)
{
this
.
addPackage
()
}
// 格式化包装
if
(
this
.
value
.
packagingList
?.
length
)
{
this
.
value
.
packagingList
.
forEach
(
item
=>
{
if
(
item
.
packagingTypes
&&
typeof
item
.
packagingTypes
==
'
string
'
)
{
item
.
packagingTypes
=
item
.
packagingTypes
.
split
(
'
,
'
)
if
(
this
.
value
.
packagingList
?.
length
)
{
this
.
value
.
packagingList
.
forEach
(
(
item
)
=>
{
if
(
item
.
packagingTypes
&&
typeof
item
.
packagingTypes
==
"
string
"
)
{
item
.
packagingTypes
=
item
.
packagingTypes
.
split
(
"
,
"
)
}
})
}
this
.
initSpecialPrice
()
},
data
(){
return
{
}
data
()
{
return
{}
},
computed
:{
packagingList
(){
computed
:
{
packagingList
()
{
const
dicts
=
JSON
.
parse
(
JSON
.
stringify
(
getDictDatas
(
DICT_TYPE
.
ECW_PACKAGING_TYPE
)))
return
dicts
.
map
(
dict
=>
{
return
dicts
.
map
(
(
dict
)
=>
{
dict
.
enable
=
true
this
.
value
.
packagingList
.
forEach
(
item
=>
{
if
(
item
.
packagingTypes
?.
length
&&
item
.
packagingTypes
.
indexOf
(
dict
.
value
)
>
-
1
)
{
this
.
value
.
packagingList
.
forEach
(
(
item
)
=>
{
if
(
item
.
packagingTypes
?.
length
&&
item
.
packagingTypes
.
indexOf
(
dict
.
value
)
>
-
1
)
{
dict
.
enable
=
false
}
})
...
...
@@ -65,106 +61,114 @@ export default {
})
}
},
methods
:{
methods
:
{
getDictDatas
,
// 初始化特需加价
initSpecialPrice
(){
if
(
!
this
.
value
.
specialList
)
{
this
.
$set
(
this
.
value
,
'
specialList
'
,
[])
initSpecialPrice
()
{
if
(
!
this
.
value
.
specialList
)
{
this
.
$set
(
this
.
value
,
"
specialList
"
,
[])
}
this
.
getDictDatas
(
this
.
DICT_TYPE
.
ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS
).
forEach
(
item
=>
{
if
(
!
this
.
value
.
specialList
.
find
(
special
=>
special
.
specialDictType
==
item
.
value
))
{
this
.
getDictDatas
(
this
.
DICT_TYPE
.
ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS
).
forEach
(
(
item
)
=>
{
if
(
!
this
.
value
.
specialList
.
find
((
special
)
=>
special
.
specialDictType
==
item
.
value
))
{
this
.
value
.
specialList
.
push
({
[
`
${
this
.
fieldPrefix
}
Price`
]:
undefined
,
// 新建默认给0,否则默认是null
[
`
${
this
.
fieldPrefix
}
PriceUnit`
]:
this
.
value
[
`
${
this
.
fieldPrefix
}
PriceUnit`
],
[
`
${
this
.
fieldPrefix
}
VolumeUnit`
]:
this
.
value
[
`
${
this
.
fieldPrefix
}
VolumeUnit`
],
"
specialDictType
"
:
item
.
value
specialDictType
:
item
.
value
})
}
})
},
// 添加包装类型运费
addPackage
(){
if
(
!
this
.
value
.
packagingList
)
{
this
.
$set
(
this
.
value
,
'
packagingList
'
,
[])
addPackage
()
{
if
(
!
this
.
value
.
packagingList
)
{
this
.
$set
(
this
.
value
,
"
packagingList
"
,
[])
}
this
.
value
.
packagingList
.
push
({
packagingPrice
:
undefined
,
packagingPriceUnit
:
this
.
value
[
`
${
this
.
fieldPrefix
}
PriceUnit`
],
packagingVolumeUnit
:
this
.
value
[
`
${
this
.
fieldPrefix
}
VolumeUnit`
],
packagingPriceUnit
:
this
.
value
[
`
${
this
.
fieldPrefix
}
PriceUnit`
],
packagingVolumeUnit
:
this
.
value
[
`
${
this
.
fieldPrefix
}
VolumeUnit`
]
})
},
// 删除包装类型运费
deletePackage
(
index
){
deletePackage
(
index
)
{
this
.
value
.
packagingList
.
splice
(
index
,
1
)
},
// 校验
validate
(){
validate
()
{
const
index
=
this
.
index
const
errors
=
[]
// 区间设置检查
if
(
typeof
this
.
value
.
startNum
!=
"
number
"
){
errors
.
push
(
this
.
$t
(
"
请设置{priceName}第{index}阶段的起始值
"
,
{
if
(
typeof
this
.
value
.
startNum
!=
"
number
"
)
{
errors
.
push
(
this
.
$t
(
"
请设置{priceName}第{index}阶段的起始值
"
,
{
index
:
index
+
1
,
priceName
:
this
.
priceName
}))
})
)
}
if
(
!
this
.
value
.
endNum
){
errors
.
push
(
this
.
$t
(
"
请设置{priceName}第{index}阶段的结束值
"
,
{
if
(
!
this
.
value
.
endNum
)
{
errors
.
push
(
this
.
$t
(
"
请设置{priceName}第{index}阶段的结束值
"
,
{
index
:
index
+
1
,
priceName
:
this
.
priceName
}))
})
)
}
// 价格检查
if
(
!
this
.
validatePrice
(
this
.
value
[
`
${
this
.
fieldPrefix
}
Price`
])){
errors
.
push
(
this
.
$t
(
"
请设置第{index}阶段的{priceName}
"
,
{
index
:
index
+
1
,
if
(
!
this
.
validatePrice
(
this
.
value
[
`
${
this
.
fieldPrefix
}
Price`
]))
{
errors
.
push
(
this
.
$t
(
"
请设置第{index}阶段的{priceName}
"
,
{
index
:
index
+
1
,
priceName
:
this
.
priceName
}))
})
)
}
// 包装价格检查
if
(
this
.
value
.
packagingList
?.
length
)
{
if
(
this
.
value
.
packagingList
?.
length
)
{
this
.
value
.
packagingList
.
forEach
((
item
,
i
)
=>
{
if
(
item
.
packagingTypes
?.
length
&&
!
this
.
validatePrice
(
item
.
packagingPrice
)){
errors
.
push
(
this
.
$t
(
"
请设置第{index}阶段的包装类型{i}的{priceName}
"
,
{
index
:
index
+
1
,
i
:
i
+
1
,
if
(
item
.
packagingTypes
?.
length
&&
!
this
.
validatePrice
(
item
.
packagingPrice
))
{
errors
.
push
(
this
.
$t
(
"
请设置第{index}阶段的包装类型{i}的{priceName}
"
,
{
index
:
index
+
1
,
i
:
i
+
1
,
priceName
:
this
.
priceName
}))
})
)
}
})
}
if
(
errors
.
length
)
{
if
(
errors
.
length
)
{
this
.
$notify
.
error
({
title
:
this
.
$t
(
"
表单错误
"
),
message
:
errors
.
join
(
'
;
\n
'
)
})
;
message
:
errors
.
join
(
"
;
\n
"
)
})
}
return
!
errors
.
length
},
// 校验价格是否为空,可以是0
validatePrice
(
value
){
if
(
value
===
undefined
||
value
===
null
||
value
===
''
)
{
validatePrice
(
value
)
{
if
(
value
===
undefined
||
value
===
null
||
value
===
""
)
{
return
false
}
return
true
}
,
}
}
}
</
script
>
<
template
>
<div>
<div
class=
"bold text-lg"
>
{{
$t
(
'
{type
}
{priceName
}
价格设置
'
,
{
type
,
priceName
}
)
}}
<
/div
>
<
div
style
=
"
font-size:14px; margin:
10px 0
"
>
{{
$t
(
'
第{index
}
阶梯定价方案
'
,
{
index
:
index
+
1
}
)
}}
:
<div>
<div
class=
"bold text-lg"
>
{{
$t
(
"
{type
}
{priceName
}
价格设置
"
,
{
type
,
priceName
}
)
}}
<
/div
>
<
div
style
=
"
font-size: 14px; margin:
10px 0
"
>
{{
$t
(
"
第{index
}
阶梯定价方案
"
,
{
index
:
index
+
1
}
)
}}
:
<
template
v
-
if
=
"
showAdd
"
>
<
el
-
link
type
=
"
primary
"
@
click
.
native
=
"
$emit('add', fieldPrefix)
"
>
{{
$t
(
'
添加区间
'
)
}}
<
/el-link
>
<
el
-
link
type
=
"
primary
"
@
click
.
native
=
"
$emit('add', fieldPrefix)
"
>
{{
$t
(
"
添加区间
"
)
}}
<
/el-link
>
<
el
-
divider
direction
=
"
vertical
"
><
/el-divider
>
<
el
-
link
type
=
"
danger
"
@
click
.
native
=
"
$emit( 'delete', index)
"
>
{{
$t
(
'
删除
'
)
}}
<
/el-link
>
<
el
-
link
type
=
"
danger
"
@
click
.
native
=
"
$emit('delete', index)
"
>
{{
$t
(
"
删除
"
)
}}
<
/el-link
>
<
/template
>
<
/div
>
<
el
-
form
-
item
:
label
=
"
$t('第{index
}
阶梯', {index: index+1
}
)
"
>
<
el
-
form
-
item
:
label
=
"
$t('第{index
}
阶梯', { index: index + 1
}
)
"
>
<
el
-
input
-
number
v
-
model
=
"
value.startNum
"
:
controls
=
"
false
"
class
=
"
w-100
"
><
/el-input-number
>
-
<
el
-
input
-
number
v
-
model
=
"
value.endNum
"
:
controls
=
"
false
"
class
=
"
w-100
"
><
/el-input-number
>
...
...
@@ -175,49 +179,55 @@ export default {
v
-
model
=
"
value.weightUnit
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l(null, 'title')
"
@
input
=
"
$emit('changeUnit', {
@
input
=
"
$emit('changeUnit', {
value: $event,
field: 'weightUnit',
type: fieldPrefix
}
)
"
}
)
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
<
div
class
=
"
tips
"
v
-
if
=
"
stepTips
"
>
{{
stepTips
}}
<
/div
>
class
=
"
w-100
"
/>
<
div
class
=
"
tips
"
v
-
if
=
"
stepTips
"
>
{{
stepTips
}}
<
/div
>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"
$t('默认') + priceName
"
>
<
el
-
input
-
number
v
-
model
=
"
value[`${fieldPrefix
}
Price`]
"
:
placeholder
=
"
$t('整数或者两位小数')
"
:
precision
=
"
2
"
:
controls
=
"
false
"
class
=
"
w-100 mr-10
"
/>
<
el
-
input
-
number
v
-
model
=
"
value[`${fieldPrefix
}
Price`]
"
:
placeholder
=
"
$t('整数或者两位小数')
"
:
precision
=
"
2
"
:
controls
=
"
false
"
class
=
"
w-100 mr-10
"
/>
<
selector
:
disabled
=
"
index>
0
"
:
disabled
=
"
index >
0
"
v
-
model
=
"
value[`${fieldPrefix
}
PriceUnit`]
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
@
input
=
"
$emit('changeUnit', {
@
input
=
"
$emit('changeUnit', {
value: $event,
field: `${fieldPrefix
}
PriceUnit`
}
)
"
}
)
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
class
=
"
w-100
"
/>
/
<
selector
:
disabled
=
"
index>
0
"
:
disabled
=
"
index >
0
"
v
-
model
=
"
value[`${fieldPrefix
}
VolumeUnit`]
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l(null, 'title')
"
@
input
=
"
$emit('changeUnit', {
@
input
=
"
$emit('changeUnit', {
value: $event,
field: `${fieldPrefix
}
VolumeUnit`
}
)
"
}
)
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
class
=
"
w-100
"
/>
<
/el-form-item
>
<!--
特性加价
-->
<
template
v
-
for
=
"
(special, specialIndex) in value.specialList
"
>
<
el
-
form
-
item
:
label
=
"
getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + priceName + $t('加价')
"
:
key
=
"
specialIndex + 'transport'
"
>
<
el
-
input
-
number
v
-
model
.
number
=
"
special[`${fieldPrefix
}
Price`]
"
:
controls
=
"
false
"
:
min
=
"
0
"
:
placeholder
=
"
$t('整数或者两位小数')
"
class
=
"
w-100 mr-10
"
/>
<
el
-
form
-
item
:
label
=
"
getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + priceName + $t('加价')
"
:
key
=
"
specialIndex + 'transport'
"
>
<
el
-
input
-
number
v
-
model
.
number
=
"
special[`${fieldPrefix
}
Price`]
"
:
controls
=
"
false
"
:
placeholder
=
"
$t('整数或者两位小数')
"
class
=
"
w-100 mr-10
"
/>
<
selector
disabled
v
-
model
=
"
special[`${fieldPrefix
}
PriceUnit`]
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
defaultable2
class
=
"
w-100 mr-10
"
/>
<
span
class
=
"
mr-10
"
>
/</
span
>
<
selector
disabled
v
-
model
=
"
special[`${fieldPrefix
}
VolumeUnit`]
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
defaultable2
class
=
"
w-100
"
/>
...
...
@@ -226,44 +236,37 @@ export default {
<!--
包装类型价格
-->
<
template
v
-
for
=
"
(item, i) in value.packagingList
"
>
<
el
-
form
-
item
:
label
=
"
$t('包装类型加价') + (i+
1)
"
:
key
=
"
i
"
>
<
el
-
form
-
item
:
label
=
"
$t('包装类型加价') + (i +
1)
"
:
key
=
"
i
"
>
<
template
#
label
>
<
div
class
=
"
el-form-item__label
"
style
=
"
width: 150px;
"
>
{{
$t
(
'
包装类型{name
}
加价
'
,
{
name
:
priceName
}
)
+
(
i
+
1
)
}}
<
/div
>
<
div
v
-
if
=
"
!item.packagingTypes || !item.packagingTypes.length
"
class
=
"
tips
"
>
{{
$t
(
'
未选择包装类型将被忽略
'
)
}}
<
/div
>
<
div
class
=
"
el-form-item__label
"
style
=
"
width: 150px
"
>
{{
$t
(
"
包装类型{name
}
加价
"
,
{
name
:
priceName
}
)
+
(
i
+
1
)
}}
<
/div
>
<
div
v
-
if
=
"
!item.packagingTypes || !item.packagingTypes.length
"
class
=
"
tips
"
>
{{
$t
(
"
未选择包装类型将被忽略
"
)
}}
<
/div
>
<
/template
>
<
el
-
select
v
-
model
=
"
item.packagingTypes
"
multiple
placeholder
=
"
请选择
"
style
=
"
width: 100%; max-width: 450px; margin-bottom: 5px; display: block
"
>
<
el
-
option
v
-
for
=
"
item in packagingList
"
:
key
=
"
item.value
"
:
label
=
"
$l(item, 'label')
"
:
value
=
"
item.value
"
:
disabled
=
"
!item.enable
"
>
<
/el-option
>
<
el
-
option
v
-
for
=
"
item in packagingList
"
:
key
=
"
item.value
"
:
label
=
"
$l(item, 'label')
"
:
value
=
"
item.value
"
:
disabled
=
"
!item.enable
"
>
<
/el-option
>
<
/el-select
>
<
el
-
input
-
number
v
-
model
=
"
item.packagingPrice
"
:
controls
=
"
false
"
:
min
=
"
0
"
:
placeholder
=
"
$t('整数或者两位小数')
"
class
=
"
w-100 mr-10
"
/>
<
el
-
input
-
number
v
-
model
=
"
item.packagingPrice
"
:
controls
=
"
false
"
:
placeholder
=
"
$t('整数或者两位小数')
"
class
=
"
w-100 mr-10
"
/>
<
selector
disabled
v
-
model
=
"
item.packagingPriceUnit
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
defaultable2
class
=
"
w-100 mr-10
"
/>
<
span
class
=
"
mr-10
"
>
/</
span
>
<
selector
disabled
v
-
model
=
"
item.packagingVolumeUnit
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
defaultable2
class
=
"
w-100
"
/>
<
template
v
-
if
=
"
i == value.packagingList.length -
1 && !readonly
"
>
<
el
-
link
type
=
"
primary
"
@
click
.
native
=
"
addPackage
"
class
=
"
ml-5
"
>
{{
$t
(
'
添加
'
)
}}
<
/el-link
>
<
template
v
-
if
=
"
i == value.packagingList.length -
1 && !readonly
"
>
<
el
-
link
type
=
"
primary
"
@
click
.
native
=
"
addPackage
"
class
=
"
ml-5
"
>
{{
$t
(
"
添加
"
)
}}
<
/el-link
>
<
el
-
divider
direction
=
"
vertical
"
><
/el-divider
>
<
el
-
link
type
=
"
danger
"
@
click
.
native
=
"
deletePackage(i)
"
>
{{
$t
(
'
删除
'
)
}}
<
/el-link
>
<
el
-
link
type
=
"
danger
"
@
click
.
native
=
"
deletePackage(i)
"
>
{{
$t
(
"
删除
"
)
}}
<
/el-link
>
<
/template
>
<
/el-form-item
>
<
/template
>
<
/div
>
<
/div
>
<
/template
>
<
style
scoped
lang
=
"
scss
"
>
.
bold
{
font
-
weight
:
bold
;
}
.
text
-
lg
{
.
text
-
lg
{
font
-
size
:
1.3
rem
;
}
.
tips
{
font
-
size
:
1
rem
;
color
:
red
;
.
tips
{
font
-
size
:
1
rem
;
color
:
red
;
}
<
/style
>
src/views/ecw/productPrice/components/SeaPrice.vue
View file @
4aaac458
<
script
>
import
Selector
from
"
@/components/Selector/index.vue
"
;
import
Inputor
from
"
@/components/Inputor/index.vue
"
;
import
Template
from
"
@/views/cms/template/index.vue
"
;
import
{
DICT_TYPE
,
getDictDatas
}
from
"
@/utils/dict
"
;
import
Selector
from
"
@/components/Selector/index.vue
"
import
Inputor
from
"
@/components/Inputor/index.vue
"
import
Template
from
"
@/views/cms/template/index.vue
"
import
{
DICT_TYPE
,
getDictDatas
}
from
"
@/utils/dict
"
export
default
{
name
:
"
SeaPrice
"
,
components
:
{
Inputor
,
Selector
},
...
...
@@ -15,45 +15,40 @@ export default {
packagingField
:
String
,
unitList
:
{
type
:
Array
,
default
:
[]
,
default
:
[]
},
currencyList
:
{
type
:
Array
,
default
:
[]
,
default
:
[]
},
readonly
:
Boolean
,
value
:
{
type
:
Object
,
default
:
()
=>
{
return
{}
;
}
,
}
,
return
{}
}
}
},
computed
:
{
packagingList
()
{
const
dicts
=
JSON
.
parse
(
JSON
.
stringify
(
getDictDatas
(
DICT_TYPE
.
ECW_PACKAGING_TYPE
))
);
const
dicts
=
JSON
.
parse
(
JSON
.
stringify
(
getDictDatas
(
DICT_TYPE
.
ECW_PACKAGING_TYPE
)))
return
dicts
.
map
((
dict
)
=>
{
dict
.
enable
=
true
;
dict
.
enable
=
true
this
.
value
[
this
.
packagingField
]?.
forEach
((
item
)
=>
{
if
(
item
.
packagingTypes
?.
length
&&
item
.
packagingTypes
.
indexOf
(
dict
.
value
)
>
-
1
)
{
dict
.
enable
=
false
;
if
(
item
.
packagingTypes
?.
length
&&
item
.
packagingTypes
.
indexOf
(
dict
.
value
)
>
-
1
)
{
dict
.
enable
=
false
}
})
return
dict
})
}
});
return
dict
;
});
},
},
created
()
{
this
.
initSpecialPrice
()
;
this
.
initPackingPrice
()
;
this
.
initSpecialPrice
()
this
.
initPackingPrice
()
},
data
()
{
return
{}
;
return
{}
},
methods
:
{
getDictDatas
,
...
...
@@ -63,28 +58,22 @@ export default {
if
(
this
.
value
[
this
.
packagingField
]?.
length
)
{
this
.
value
[
this
.
packagingField
].
forEach
((
item
)
=>
{
if
(
!
item
.
packagingTypes
)
{
this
.
$set
(
item
,
"
packagingTypes
"
,
[])
;
this
.
$set
(
item
,
"
packagingTypes
"
,
[])
}
else
if
(
typeof
item
.
packagingTypes
==
"
string
"
)
{
item
.
packagingTypes
=
item
.
packagingTypes
.
split
(
"
,
"
)
;
item
.
packagingTypes
=
item
.
packagingTypes
.
split
(
"
,
"
)
}
})
;
return
;
})
return
}
this
.
addPackage
()
;
this
.
addPackage
()
},
// 初始化特需加价
initSpecialPrice
()
{
if
(
!
this
.
value
.
specialList
)
{
this
.
$set
(
this
.
value
,
"
specialList
"
,
[])
;
this
.
$set
(
this
.
value
,
"
specialList
"
,
[])
}
this
.
getDictDatas
(
this
.
DICT_TYPE
.
ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS
).
forEach
((
item
)
=>
{
if
(
!
this
.
value
.
specialList
.
find
(
(
special
)
=>
special
.
specialDictType
==
item
.
value
)
)
{
this
.
getDictDatas
(
this
.
DICT_TYPE
.
ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS
).
forEach
((
item
)
=>
{
if
(
!
this
.
value
.
specialList
.
find
((
special
)
=>
special
.
specialDictType
==
item
.
value
))
{
this
.
value
.
specialList
.
push
({
allPrice
:
undefined
,
// 新建默认给0,否则默认是null
allPriceUnit
:
this
.
value
[
`allPriceUnit`
],
...
...
@@ -95,62 +84,62 @@ export default {
clearancePrice
:
undefined
,
clearancePriceUnit
:
this
.
value
[
`clearancePriceUnit`
],
clearanceVolumeUnit
:
this
.
value
[
`clearanceVolumeUnit`
],
specialDictType
:
item
.
value
,
})
;
specialDictType
:
item
.
value
})
}
})
;
})
},
// 添加包装类型运费
addPackage
()
{
if
(
!
this
.
value
[
this
.
packagingField
])
{
this
.
$set
(
this
.
value
,
this
.
packagingField
,
[])
;
this
.
$set
(
this
.
value
,
this
.
packagingField
,
[])
}
this
.
value
[
this
.
packagingField
]?.
push
({
packagingPrice
:
undefined
,
packagingPriceUnit
:
this
.
value
[
`
${
this
.
fieldPrefix
}
PriceUnit`
],
packagingVolumeUnit
:
this
.
value
[
`
${
this
.
fieldPrefix
}
VolumeUnit`
]
,
})
;
packagingVolumeUnit
:
this
.
value
[
`
${
this
.
fieldPrefix
}
VolumeUnit`
]
})
},
// 删除包装类型运费
deletePackage
(
index
)
{
this
.
value
[
this
.
packagingField
]?.
splice
(
index
,
1
)
;
this
.
value
[
this
.
packagingField
]?.
splice
(
index
,
1
)
},
// 校验
validate
()
{
let
valid
=
true
;
let
valid
=
true
// 价格检查
if
(
!
this
.
validatePrice
(
this
.
value
[
`
${
this
.
fieldPrefix
}
Price`
]))
{
valid
=
false
;
this
.
$message
.
error
(
this
.
$t
(
"
请设置{name}
"
,
{
name
:
this
.
priceName
}))
;
valid
=
false
this
.
$message
.
error
(
this
.
$t
(
"
请设置{name}
"
,
{
name
:
this
.
priceName
}))
}
// 检查包装费
if
(
this
.
value
[
this
.
packagingField
]?.
length
)
{
this
.
value
[
this
.
packagingField
]?.
forEach
((
item
,
index
)
=>
{
if
(
!
item
.
packagingTypes
?.
length
)
return
;
if
(
!
item
.
packagingTypes
?.
length
)
return
if
(
!
this
.
validatePrice
(
item
.
packagingPrice
))
{
valid
=
false
;
valid
=
false
this
.
$message
.
error
(
this
.
$t
(
"
请设置{name}的包装费{index}
"
,
{
name
:
this
.
priceName
,
index
:
index
+
1
,
index
:
index
+
1
})
)
;
)
}
})
;
})
}
return
valid
;
return
valid
},
// 校验价格是否为空,可以是0
validatePrice
(
value
)
{
if
(
value
===
undefined
||
value
===
null
||
value
===
""
)
{
return
false
;
return
false
}
return
true
;
}
,
}
,
}
;
return
true
}
}
}
</
script
>
<
template
>
...
...
@@ -159,13 +148,7 @@ export default {
{{
$t
(
"
{name
}
价格设置
"
,
{
name
:
this
.
priceName
}
)
}}
<
/div
>
<
el
-
form
-
item
:
label
=
"
$t('默认{name
}
', { name: this.priceName
}
)
"
>
<
el
-
input
-
number
v
-
model
=
"
value[`${fieldPrefix
}
Price`]
"
:
placeholder
=
"
$t('整数或者两位小数')
"
:
controls
=
"
false
"
:
disabled
=
"
readonly
"
class
=
"
w-100 mr-10
"
/>
<
el
-
input
-
number
v
-
model
=
"
value[`${fieldPrefix
}
Price`]
"
:
placeholder
=
"
$t('整数或者两位小数')
"
:
controls
=
"
false
"
:
disabled
=
"
readonly
"
class
=
"
w-100 mr-10
"
/>
<
selector
:
disabled
=
"
readonly
"
v
-
model
=
"
value[`${fieldPrefix
}
PriceUnit`]
"
...
...
@@ -174,7 +157,7 @@ export default {
@
input
=
"
$emit('changeUnit', {
value: $event,
field: `${fieldPrefix
}
PriceUnit`
,
field: `${fieldPrefix
}
PriceUnit`
}
)
"
value
-
field
=
"
id
"
...
...
@@ -189,7 +172,7 @@ export default {
@
input
=
"
$emit('changeUnit', {
value: $event,
field: `${fieldPrefix
}
VolumeUnit`
,
field: `${fieldPrefix
}
VolumeUnit`
}
)
"
value
-
field
=
"
id
"
...
...
@@ -200,40 +183,11 @@ export default {
<!--
特性加价
-->
<
template
v
-
for
=
"
(special, specialIndex) in value.specialList
"
>
<
div
:
key
=
"
specialIndex + 'transport'
"
>
<
el
-
form
-
item
:
label
=
"
getDictDataLabel(
DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS,
special.specialDictType
) +
priceName +
$t('加价')
"
>
<
el
-
input
-
number
v
-
model
.
number
=
"
special[`${fieldPrefix
}
Price`]
"
:
controls
=
"
false
"
:
disabled
=
"
readonly
"
:
placeholder
=
"
$t('整数或者两位小数')
"
class
=
"
w-100 mr-10
"
/>
<
selector
disabled
v
-
model
=
"
special[`${fieldPrefix
}
PriceUnit`]
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
class
=
"
w-100 mr-10
"
/>
<
el
-
form
-
item
:
label
=
"
getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + priceName + $t('加价')
"
>
<
el
-
input
-
number
v
-
model
.
number
=
"
special[`${fieldPrefix
}
Price`]
"
:
controls
=
"
false
"
:
disabled
=
"
readonly
"
:
placeholder
=
"
$t('整数或者两位小数')
"
class
=
"
w-100 mr-10
"
/>
<
selector
disabled
v
-
model
=
"
special[`${fieldPrefix
}
PriceUnit`]
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
class
=
"
w-100 mr-10
"
/>
<
span
class
=
"
mr-10
"
>
/</
span
>
<
selector
disabled
v
-
model
=
"
special[`${fieldPrefix
}
VolumeUnit`]
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
<
selector
disabled
v
-
model
=
"
special[`${fieldPrefix
}
VolumeUnit`]
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
<
/el-form-item
>
<
/div
>
<
/template
>
...
...
@@ -245,67 +199,21 @@ export default {
<
div
class
=
"
el-form-item__label
"
style
=
"
width: 150px
"
>
{{
$t
(
"
包装类型{name
}
加价
"
,
{
name
:
priceName
}
)
+
(
i
+
1
)
}}
<
/div
>
<
div
v
-
if
=
"
!item.packagingTypes || !item.packagingTypes.length
"
class
=
"
tips
"
>
<
div
v
-
if
=
"
!item.packagingTypes || !item.packagingTypes.length
"
class
=
"
tips
"
>
{{
$t
(
"
未选择包装类型将被忽略
"
)
}}
<
/div
>
<
/template
>
<
el
-
select
v
-
model
=
"
item.packagingTypes
"
multiple
placeholder
=
"
请选择
"
style
=
"
width: 100%;
max-width: 450px;
margin-bottom: 5px;
display: block;
"
>
<
el
-
option
v
-
for
=
"
item in packagingList
"
:
key
=
"
item.value
"
:
label
=
"
$l(item, 'label')
"
:
value
=
"
item.value
"
:
disabled
=
"
!item.enable
"
>
<
/el-option
>
<
el
-
select
v
-
model
=
"
item.packagingTypes
"
multiple
placeholder
=
"
请选择
"
style
=
"
width: 100%; max-width: 450px; margin-bottom: 5px; display: block
"
>
<
el
-
option
v
-
for
=
"
item in packagingList
"
:
key
=
"
item.value
"
:
label
=
"
$l(item, 'label')
"
:
value
=
"
item.value
"
:
disabled
=
"
!item.enable
"
>
<
/el-option
>
<
/el-select
>
<
el
-
input
-
number
v
-
model
=
"
item.packagingPrice
"
:
controls
=
"
false
"
:
min
=
"
0
"
:
placeholder
=
"
$t('整数或者两位小数')
"
class
=
"
w-100 mr-10
"
/>
<
selector
disabled
v
-
model
=
"
item.packagingPriceUnit
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
defaultable2
class
=
"
w-100 mr-10
"
/>
<
el
-
input
-
number
v
-
model
=
"
item.packagingPrice
"
:
controls
=
"
false
"
:
placeholder
=
"
$t('整数或者两位小数')
"
class
=
"
w-100 mr-10
"
/>
<
selector
disabled
v
-
model
=
"
item.packagingPriceUnit
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
defaultable2
class
=
"
w-100 mr-10
"
/>
<
span
class
=
"
mr-10
"
>
/</
span
>
<
selector
disabled
v
-
model
=
"
item.packagingVolumeUnit
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
defaultable2
class
=
"
w-100
"
/>
<
selector
disabled
v
-
model
=
"
item.packagingVolumeUnit
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
defaultable2
class
=
"
w-100
"
/>
<
template
v
-
if
=
"
i == value[packagingField].length - 1 && !readonly
"
>
<
el
-
link
type
=
"
primary
"
@
click
.
native
=
"
addPackage
"
class
=
"
ml-5
"
>
{{
$t
(
"
添加
"
)
}}
<
/el-link
>
<
el
-
link
type
=
"
primary
"
@
click
.
native
=
"
addPackage
"
class
=
"
ml-5
"
>
{{
$t
(
"
添加
"
)
}}
<
/el-link
>
<
el
-
divider
direction
=
"
vertical
"
><
/el-divider
>
<
el
-
link
type
=
"
danger
"
@
click
.
native
=
"
deletePackage(i)
"
>
{{
$t
(
"
删除
"
)
}}
<
/el-link
>
<
el
-
link
type
=
"
danger
"
@
click
.
native
=
"
deletePackage(i)
"
>
{{
$t
(
"
删除
"
)
}}
<
/el-link
>
<
/template
>
<
/el-form-item
>
<
/template
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment