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
f801a9f9
Commit
f801a9f9
authored
Jan 12, 2024
by
dragondean@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
海运非阶梯价包装类型
parent
c862a18e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
214 additions
and
152 deletions
+214
-152
SeaPrice.vue
src/views/ecw/productPrice/components/SeaPrice.vue
+120
-137
edit.vue
src/views/ecw/productPrice/edit.vue
+94
-15
No files found.
src/views/ecw/productPrice/components/SeaPrice.vue
View file @
f801a9f9
...
...
@@ -3,12 +3,16 @@ 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
:
{
Template
,
Inputor
,
Selector
},
components
:
{
Inputor
,
Selector
},
props
:{
priceType
:
Number
,
// 1全包价,0清关费+运费
// 字段前缀
fieldPrefix
:
String
,
// 价格名称
priceName
:
String
,
// 包装类型字段
packagingField
:
String
,
unitList
:{
type
:
Array
,
default
:
[]
...
...
@@ -27,8 +31,23 @@ export default {
}
}
},
computed
:{
packagingList
(){
const
dicts
=
JSON
.
parse
(
JSON
.
stringify
(
getDictDatas
(
DICT_TYPE
.
ECW_PACKAGING_TYPE
)))
return
dicts
.
map
(
dict
=>
{
dict
.
enable
=
true
this
.
value
[
this
.
packagingField
]?.
forEach
(
item
=>
{
if
(
item
.
packagingTypes
?.
length
&&
item
.
packagingTypes
.
indexOf
(
dict
.
value
)
>
-
1
){
dict
.
enable
=
false
}
})
return
dict
})
}
},
created
()
{
this
.
initSpecialPrice
()
this
.
initPackingPrice
()
},
data
(){
return
{
...
...
@@ -37,6 +56,11 @@ export default {
},
methods
:{
getDictDatas
,
// 包装类型初始化
initPackingPrice
(){
if
(
this
.
value
[
this
.
packagingField
]?.
length
)
return
this
.
addPackage
()
},
// 初始化特需加价
initSpecialPrice
(){
if
(
!
this
.
value
.
specialList
){
...
...
@@ -59,24 +83,38 @@ export default {
}
})
},
// 添加包装类型运费
addPackage
(){
if
(
!
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`
],
})
},
// 删除包装类型运费
deletePackage
(
index
){
this
.
value
[
this
.
packagingField
]?.
splice
(
index
,
1
)
},
// 校验
validate
(){
let
valid
=
true
// 价格检查
if
(
this
.
priceType
){
if
(
!
this
.
validatePrice
(
this
.
value
[
`allPrice`
])){
valid
=
false
this
.
$message
.
error
(
`请设置全包价`
)
}
}
else
{
if
(
!
this
.
validatePrice
(
this
.
value
[
`transportPrice`
])){
valid
=
false
this
.
$message
.
error
(
`请设置运费`
)
}
if
(
!
this
.
validatePrice
(
this
.
value
[
`clearancePrice`
])){
valid
=
false
this
.
$message
.
error
(
`请设置清关费`
)
}
if
(
!
this
.
validatePrice
(
this
.
value
[
`
${
this
.
fieldPrefix
}
Price`
])){
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
(
!
this
.
validatePrice
(
item
.
packagingPrice
)){
valid
=
false
this
.
$message
.
error
(
this
.
$t
(
"
请设置{name}的包装费{index}
"
,
{
name
:
this
.
priceName
,
index
:
index
+
1
}))
}
})
}
return
valid
...
...
@@ -93,133 +131,78 @@ export default {
</
script
>
<
template
>
<el-row>
<el-col
:span=
"12"
>
<div
class=
"page-title"
>
{{
$t
(
'
海运运费价格设置
'
)
}}
</div>
<el-form-item
:label=
"$t('默认运费')"
v-if=
"!priceType"
>
<el-input-number
v-model=
"value[`transportPrice`]"
:placeholder=
"$t('整数或者两位小数')"
:controls=
"false"
:disabled=
"readonly"
class=
"w-100 mr-10"
/>
<selector
:disabled=
"readonly"
v-model=
"value[`transportPriceUnit`]"
:options=
"currencyList"
:label-field=
"$l(null, 'title')"
@
input=
"$emit('changeUnit',
{
<div>
<div
class=
"page-title"
>
{{
$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
"
/>
<
selector
:
disabled
=
"
readonly
"
v
-
model
=
"
value[`${fieldPrefix
}
PriceUnit`]
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
@
input
=
"
$emit('changeUnit', {
value: $event,
field: `
transport
PriceUnit`
field: `
${fieldPrefix
}
PriceUnit`
}
)
"
value-field="id"
class="w-100" />
/
<selector
:disabled=
"readonly"
v-model=
"value[`transport
VolumeUnit`]"
:options=
"unitList"
:label-field=
"$l(null, 'title')"
@
input=
"$emit('changeUnit',
{
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
/
<
selector
:
disabled
=
"
readonly
"
v
-
model
=
"
value[`${fieldPrefix
}
VolumeUnit`]
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l(null, 'title')
"
@
input
=
"
$emit('changeUnit', {
value: $event,
field: `
transport
VolumeUnit`
field: `
${fieldPrefix
}
VolumeUnit`
}
)
"
value-field="id"
class="w-100" />
</el-form-item>
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
<
/el-form-item
>
<el-form-item
:label=
"$t('默认全包价')"
v-if=
"priceType"
>
<el-input-number
v-model=
"value[`allPrice`]"
:placeholder=
"$t('整数或者两位小数')"
:disabled=
"readonly"
:controls=
"false"
class=
"w-100 mr-10"
/>
<selector
:disabled=
"readonly"
v-model=
"value[`allPriceUnit`]"
:options=
"currencyList"
:label-field=
"$l(null, 'title')"
@
input=
"$emit('changeUnit',
{
value: $event,
field: `allPriceUnit`
})"
value-field="id"
class="w-100" />
/
<selector
:disabled=
"readonly"
v-model=
"value[`allVolumeUnit`]"
:options=
"unitList"
:label-field=
"$l(null, 'title')"
@
input=
"$emit('changeUnit',
{
value: $event,
field: `allVolumeUnit`
})"
value-field="id"
class="w-100" />
</el-form-item>
<!--特性加价-->
<template
v-for=
"(special, specialIndex) in value.specialList"
>
<div
:key=
"specialIndex + 'transport'"
>
<el-form-item
v-if=
"!priceType"
:label=
"getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('运费')"
>
<el-input-number
v-model.number=
"special[`transportPrice`]"
:controls=
"false"
:min=
"0"
:disabled=
"readonly"
:placeholder=
"$t('整数或者两位小数')"
class=
"w-100 mr-10"
/>
<selector
disabled
v-model=
"special[`transportPriceUnit`]"
: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[`transportVolumeUnit`]"
:options=
"unitList"
:label-field=
"$l(null, 'title')"
value-field=
"id"
defaultable2
class=
"w-100"
/>
</el-form-item>
<el-form-item
v-if=
"priceType"
:label=
"getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('全包价')"
>
<el-input-number
v-model.number=
"special[`allPrice`]"
:controls=
"false"
:min=
"0"
:disabled=
"readonly"
:placeholder=
"$t('整数或者两位小数')"
class=
"w-100 mr-10"
/>
<selector
disabled
v-model=
"special[`allPriceUnit`]"
: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[`allVolumeUnit`]"
:options=
"unitList"
:label-field=
"$l(null, 'title')"
value-field=
"id"
defaultable2
class=
"w-100"
/>
</el-form-item>
</div>
</
template
>
</el-col>
<el-col
:span=
"12"
v-if=
"!priceType"
>
<div
class=
"page-title"
>
{{$t('海运清关费价格设置')}}
</div>
<el-form-item
:label=
"$t('默认清关费')"
>
<el-input-number
v-model=
"value[`clearancePrice`]"
:placeholder=
"$t('整数或者两位小数')"
:disabled=
"readonly"
:controls=
"false"
class=
"w-100 mr-10"
/>
<selector
:disabled=
"readonly"
v-model=
"value[`clearancePriceUnit`]"
:options=
"currencyList"
:label-field=
"$l(null, 'title')"
@
input=
"$emit('changeUnit', {
value: $event,
field: `clearancePriceUnit`
})"
value-field=
"id"
class=
"w-100"
/>
/
<selector
:disabled=
"readonly"
v-model=
"value[`clearanceVolumeUnit`]"
:options=
"unitList"
:label-field=
"$l(null, 'title')"
@
input=
"$emit('changeUnit', {
value: $event,
field: `clearanceVolumeUnit`
})"
value-field=
"id"
class=
"w-100"
/>
</el-form-item>
<!--特性加价-->
<
template
v-for=
"(special, specialIndex) in value.specialList"
>
<div
:key=
"specialIndex + 'transport'"
>
<!--
特性加价
-->
<
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) + $t('运费')
"
>
<
el
-
input
-
number
v
-
model
.
number
=
"
special[`${fieldPrefix
}
Price`]
"
:
controls
=
"
false
"
:
min
=
"
0
"
:
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
"
/>
<
/el-form-item
>
<
/div
>
<
/template
>
<el-form-item
v-if=
"!priceType"
:label=
"getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('清关费')"
<!--
包装类型价格
-->
<
template
v
-
for
=
"
(item, i) in value[packagingField]
"
>
<
el
-
form
-
item
:
label
=
"
$t('包装类型') + priceName + (i+1)
"
:
key
=
"
i
"
>
<
template
#
label
>
<
div
class
=
"
el-form-item__label
"
style
=
"
width: 150px;
"
>
{{
$t
(
'
包装类型
'
)
+
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-input-number
v-model.number=
"special[`clearancePrice`]"
:controls=
"false"
:min=
"0"
:disabled=
"readonly"
:placeholder=
"$t('整数或者两位小数')"
class=
"w-100 mr-10"
/>
<selector
disabled
v-model=
"special[`clearancePriceUnit`]"
: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[`clearanceVolumeUnit`]"
:options=
"unitList"
:label-field=
"$l(null, 'title')"
value-field=
"id"
defaultable2
class=
"w-100"
/>
</el-form-item>
</div>
</
template
>
</el-col>
</el-row>
<
/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
"
/>
<
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[packagingField].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
>
<
/template
>
<
/el-form-item
>
<
/template
>
<
/div
>
<
/template
>
<
style
scoped
lang
=
"
scss
"
>
...
...
src/views/ecw/productPrice/edit.vue
View file @
f801a9f9
...
...
@@ -161,17 +161,49 @@
</el-col>
</el-row>
</template>
<
template
v-else
>
<
template
v-else
-if=
"form.priceType === 1"
>
<sea-price
ref=
"seaPrice"
:price-type=
"form.priceType"
:currency-list=
"currencyList"
:unit-list=
"unitList"
:value=
"form"
:readonly=
"readonly"
field-prefix=
"all"
:price-name=
"$t('全包价')"
packaging-field=
"fullPricePackagingList"
@
changeUnit=
"handleFormUnitChange($event)"
></sea-price>
</
template
>
<
template
v-else
>
<el-row
:gutter=
"20"
>
<el-col
:span=
"12"
>
<sea-price
ref=
"seaPrice"
:currency-list=
"currencyList"
:unit-list=
"unitList"
:value=
"form"
:readonly=
"readonly"
field-prefix=
"transport"
:price-name=
"$t('运费')"
packaging-field=
"freightPricePackagingList"
@
changeUnit=
"handleFormUnitChange($event)"
></sea-price>
</el-col>
<el-col
:span=
"12"
>
<sea-price
ref=
"seaPrice"
:currency-list=
"currencyList"
:unit-list=
"unitList"
:value=
"form"
:readonly=
"readonly"
field-prefix=
"clearance"
:price-name=
"$t('清关费')"
packaging-field=
"clearancePricePackagingList"
@
changeUnit=
"handleFormUnitChange($event)"
></sea-price>
</el-col>
</el-row>
</
template
>
<el-form-item
:label=
"$t('价格有效期')"
>
<el-date-picker
v-model=
"form.validateStartDate"
value-format=
"yyyy-MM-dd HH:mm:ss"
></el-date-picker>
...
...
@@ -608,6 +640,15 @@ export default {
})
return
stepPriceList
},
// 格式化包装类型费用
getPackingPrice
(
packging
){
if
(
!
packging
?.
length
)
return
packging
=
JSON
.
parse
(
JSON
.
stringify
(
packging
))
return
packging
.
map
(
item
=>
{
item
.
packagingTypes
=
item
.
packagingTypes
.
join
(
"
,
"
)
return
item
})
},
// 非阶梯价格更新单位
handleFormUnitChange
(
data
){
// 海运非阶梯价没有重量单位,所以按照体积单位同步最小起计量单位
...
...
@@ -621,7 +662,23 @@ export default {
})
}
// TODO 等加了包装之后还需要同步包装的单位
// 同步包装的单位
let
packingField
=
{
transportVolumeUnit
:
'
freightPricePackagingList
'
,
clearanceVolumeUnit
:
'
clearancePricePackagingList
'
,
allVolumeUnit
:
'
fullPricePackagingList
'
}[
data
.
field
]
if
(
!
this
.
form
[
packingField
]?.
length
){
return
false
}
this
.
form
[
packingField
].
forEach
(
item
=>
{
if
(
data
.
field
.
indexOf
(
"
PriceUnit
"
)
>
-
1
){
p
[
'
packagingPriceUnit
'
]
=
data
.
value
}
if
(
data
.
field
.
indexOf
(
"
VolumeUnit
"
)
>
-
1
){
p
[
'
packagingVolumeUnit
'
]
=
data
.
value
}
})
},
initStepPrice
(){
if
(
this
.
form
.
priceType
==
1
&&
!
this
.
form
.
fullPriceStepList
?.
length
){
...
...
@@ -638,7 +695,6 @@ export default {
},
// force 为是否强制提交,在价格过期的时候需要确认后强制提交
submitForm
(
force
=
false
)
{
console
.
log
(
"
this.$refs[
\"
form
\"
]
"
,
this
.
$refs
[
"
form
"
])
this
.
$refs
[
"
form
"
].
validate
(
async
(
valid
)
=>
{
if
(
!
valid
)
{
return
;
...
...
@@ -658,7 +714,8 @@ export default {
// specialList: this.specialProducts,
isAllProduct
:
0
})
if
(
this
.
$refs
.
stepPrice
){
// 阶梯价
if
(
this
.
form
.
stepPrice
){
let
isValid
=
true
for
(
let
stepPrice
of
this
.
$refs
.
stepPrice
){
if
(
!
stepPrice
.
validate
()){
...
...
@@ -667,18 +724,40 @@ export default {
}
}
if
(
!
isValid
)
return
}
// 全包价
if
(
this
.
form
.
priceType
==
1
)
{
data
.
fullPriceStepList
=
this
.
getPriceList
(
this
.
form
.
fullPriceStepList
)
delete
data
.
clearancePriceStepList
delete
data
.
freightPriceStepList
}
else
{
data
.
clearancePriceStepList
=
this
.
getPriceList
(
this
.
form
.
clearancePriceStepList
)
data
.
freightPriceStepList
=
this
.
getPriceList
(
this
.
form
.
freightPriceStepList
)
delete
data
.
fullPriceStepList
}
}
//海运非阶梯价校验
else
{
// 有多个组件则表示清关费 + 运费
if
(
this
.
$refs
.
seaPrice
?.
length
){
let
isValid
=
true
for
(
let
seaPrice
of
this
.
$refs
.
seaPrice
){
if
(
!
seaPrice
.
validate
()){
isValid
=
false
break
}
}
if
(
!
isValid
)
return
}
// 只有一个海运费组件,全包价
else
if
(
this
.
$refs
.
seaPrice
&&
!
this
.
$refs
.
seaPrice
.
validate
()){
return
}
// 全包价
if
(
this
.
form
.
priceType
==
1
)
{
data
.
fullPriceStepList
=
this
.
getPriceList
(
this
.
form
.
fullPriceStepList
)
delete
data
.
clearancePriceStepList
delete
data
.
freightPriceStepList
}
else
{
data
.
clearancePriceStepList
=
this
.
getPriceList
(
this
.
form
.
clearancePriceStepList
)
data
.
freightPriceStepList
=
this
.
getPriceList
(
this
.
form
.
freightPriceStepList
)
delete
data
.
fullPriceStepList
// 格式化
data
.
fullPricePackagingList
=
this
.
getPackingPrice
(
data
.
fullPricePackagingList
)
data
.
freightPricePackagingList
=
this
.
getPackingPrice
(
data
.
freightPricePackagingList
)
data
.
clearancePricePackagingList
=
this
.
getPackingPrice
(
data
.
clearancePricePackagingList
)
}
// 设置了有效期,且已过期则给提示
...
...
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