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
bf704adf
Commit
bf704adf
authored
Jan 14, 2024
by
dragondean@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善海运批量加价
parent
5b1b334b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
123 additions
and
54 deletions
+123
-54
batchIncrease.vue
src/views/ecw/productPrice/batchIncrease.vue
+123
-54
No files found.
src/views/ecw/productPrice/batchIncrease.vue
View file @
bf704adf
...
...
@@ -81,16 +81,47 @@
</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"
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"
field-prefix=
"clearance"
:price-name=
"$t('清关费')"
packaging-field=
"clearancePricePackagingList"
@
changeUnit=
"handleFormUnitChange($event)"
></sea-price>
</el-col>
</el-row>
</
template
>
</div>
</el-card>
...
...
@@ -114,6 +145,7 @@ import Decimal from 'decimal.js'
import
SeaPrice
from
"
@/views/ecw/productPrice/components/SeaPrice.vue
"
;
import
Template
from
"
@/views/cms/template/index.vue
"
;
import
PriceStep
from
"
@/views/ecw/productPrice/components/PriceStep.vue
"
;
import
{
getFormData
}
from
'
@/views/ecw/productPrice/util
'
const
DEFAULT_PRICE_UNIT
=
1
const
DEFAULT_VOLUME_UNIT
=
7
...
...
@@ -186,10 +218,6 @@ export default {
this
.
currencyList
=
(
await
getCurrencyList
())?.
data
||
[]
this
.
unitList
=
(
await
getUnitList
())?.
data
||
[]
this
.
$nextTick
(
async
()
=>
{
this
.
setDefaultVolumeUnit
(
this
.
type
==
'
air
'
?
6
:
7
)
})
this
.
getDictDatas
(
this
.
DICT_TYPE
.
ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS
).
forEach
(
item
=>
{
// 没有的才push,已有的可能是从复制模板携带过来的数据
if
(
!
this
.
form
.
specialList
.
find
(
special
=>
special
.
specialDictType
==
item
.
value
))
{
...
...
@@ -257,28 +285,57 @@ export default {
})
},
// 获得用
语
提交的阶梯价副本
// 获得用
于
提交的阶梯价副本
getPriceList
(
stepList
){
if
(
!
stepList
?.
length
)
return
[]
let
stepPriceList
=
JSON
.
parse
(
JSON
.
stringify
(
stepList
))
stepPriceList
.
forEach
((
item
,
index
)
=>
{
item
.
rankNum
=
index
+
1
item
.
packagingList
=
item
.
packagingList
.
filter
(
p
=>
!!
p
.
packagingTypes
?.
length
)
item
.
packagingList
=
item
.
packagingList
.
map
(
p
=>
{
p
.
packagingTypes
=
p
.
packagingTypes
.
join
(
"
,
"
)
return
p
})
item
.
packagingList
=
this
.
getPackagingPrice
(
item
.
packagingList
)
})
// 过滤掉空的阶梯
return
stepPriceList
.
filter
(
this
.
isStepPriceValid
)
},
// 获取包装类型价
getPackagingPrice
(
packagingList
){
const
list
=
JSON
.
parse
(
JSON
.
stringify
(
packagingList
))
return
list
.
filter
(
p
=>
!!
p
.
packagingTypes
?.
length
).
map
(
p
=>
{
p
.
packagingTypes
=
p
.
packagingTypes
.
join
(
"
,
"
)
return
p
})
},
// 非阶梯价格更新单位
handleFormUnitChange
(
data
){
// 海运非阶梯价没有重量单位,所以按照体积单位同步最小起计量单位
if
(
data
.
field
===
'
transportVolumeUnit
'
||
data
.
field
==
'
allVolumeUnit
'
){
this
.
form
.
minWeightUnit
=
data
.
value
}
if
(
this
.
form
.
specialList
?.
length
){
this
.
form
.
specialList
.
forEach
(
p
=>
{
p
[
data
.
field
]
=
data
.
value
})
}
// 同步包装的单位
let
packingField
=
{
transportVolumeUnit
:
'
freightPricePackagingList
'
,
clearanceVolumeUnit
:
'
clearancePricePackagingList
'
,
allVolumeUnit
:
'
fullPricePackagingList
'
,
transportPriceUnit
:
'
freightPricePackagingList
'
,
clearancePriceUnit
:
'
clearancePricePackagingList
'
}[
data
.
field
]
if
(
!
this
.
form
[
packingField
]?.
length
){
return
false
}
this
.
form
[
packingField
].
forEach
(
item
=>
{
if
(
data
.
field
.
indexOf
(
"
PriceUnit
"
)
>
-
1
){
item
[
'
packagingPriceUnit
'
]
=
data
.
value
}
if
(
data
.
field
.
indexOf
(
"
VolumeUnit
"
)
>
-
1
){
item
[
'
packagingVolumeUnit
'
]
=
data
.
value
}
})
},
initStepPrice
(){
if
(
this
.
form
.
priceType
==
1
&&
!
this
.
form
.
fullPriceStepList
?.
length
){
...
...
@@ -293,68 +350,80 @@ export default {
}
}
},
// 检查包装类型价格是否有效
validatePackagingPrice
(
packagingList
,
priceName
){
if
(
!
packagingList
?.
length
)
return
true
let
valid
=
true
for
(
const
index
in
packagingList
){
const
item
=
packagingList
[
index
]
if
(
!
item
.
packagingPrice
){
valid
=
false
const
no
=
parseInt
(
index
)
+
1
this
.
$message
.
error
(
this
.
$t
(
"
请设置{priceName}的第{no}包装费
"
,
{
priceName
,
no
}))
break
;
}
}
return
valid
},
submitForm
()
{
this
.
$refs
[
"
form
"
].
validate
(
async
(
valid
)
=>
{
if
(
!
valid
)
{
return
;
}
// 只有新增的时候做判断
if
(
!
this
.
$route
.
query
.
ids
&&
(
!
this
.
selectedRoutes
||
!
this
.
selectedRoutes
.
length
))
{
this
.
$message
.
error
(
this
.
$t
(
'
请选择线路
'
));
return
;
}
let
data
=
Object
.
assign
({},
this
.
form
,
{
// lineChannelList: this.selectedRoutes,
// specialList: this.specialProducts,
isAllProduct
:
this
.
isAllProduct
?
1
:
0
})
// 如果是勾選了全部篩選商品,則獲取商品ID
if
(
this
.
isAllFilteredProduct
){
data
.
productIdList
=
await
this
.
$refs
.
productSelector
.
getFilteredIds
()
}
if
(
!
data
.
isAllProduct
&&
(
!
data
.
productIdList
||
!
data
.
productIdList
.
length
)){
return
this
.
$message
.
error
(
this
.
$t
(
'
请选择商品
'
)
+
"
!
"
)
}
let
data
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
form
))
data
.
isAllProduct
=
this
.
isAllProduct
?
1
:
0
data
.
lineChannelList
=
this
.
selectedRoutes
if
(
data
.
lineChannelList
.
length
<
1
){
if
(
!
data
.
lineChannelList
?.
length
){
return
this
.
$message
.
error
(
this
.
$t
(
'
请选择需要修改的路线
'
))
}
if
(
!
data
.
productIdList
?.
length
){
return
this
.
$message
.
error
(
this
.
$t
(
'
请选择商品
'
)
+
"
!
"
)
}
data
.
fullPriceStepList
=
this
.
getPriceList
(
data
.
fullPriceStepList
)
data
.
freightPriceStepList
=
this
.
getPriceList
(
data
.
freightPriceStepList
)
data
.
clearancePriceStepList
=
this
.
getPriceList
(
data
.
clearancePriceStepList
)
// 检查被忽略的阶梯价
let
msgArr
=
[];
if
(
data
.
priceType
){
const
ignoreAll
=
data
.
fullPriceStepList
.
length
!=
this
.
form
.
fullPriceStepList
.
length
if
(
ignoreAll
){
msgArr
.
push
(
this
.
$t
(
"
{n}个全包阶梯价
"
,
{
n
:
ignoreAll
}))
// 如果是阶梯价,需要把阶梯价的数据转换成提交的格式
delete
data
.
freightPriceStepList
delete
data
.
clearancePriceStepList
delete
data
.
fullPriceStepList
delete
data
.
clearancePricePackagingList
delete
data
.
freightPricePackagingList
delete
data
.
fullPricePackagingList
// 阶梯价
if
(
data
.
stepPrice
){
delete
data
.
specialList
if
(
data
.
priceType
===
1
){
data
.
fullPriceStepList
=
this
.
getPriceList
(
this
.
form
.
fullPriceStepList
)
}
else
{
data
.
freightPriceStepList
=
this
.
getPriceList
(
this
.
form
.
freightPriceStepList
)
data
.
clearancePriceStepList
=
this
.
getPriceList
(
this
.
form
.
clearancePriceStepList
)
}
}
else
{
const
ignoreFreight
=
this
.
form
.
freightPriceStepList
.
length
-
data
.
freightPriceStepList
.
length
const
ignoreClearance
=
this
.
form
.
clearancePriceStepList
.
length
-
data
.
clearancePriceStepList
.
length
if
(
ignoreFreight
){
msgArr
.
push
(
this
.
$t
(
"
{n}个运费阶梯价
"
,
{
n
:
ignoreFreight
}))
}
if
(
ignoreClearance
){
msgArr
.
push
(
this
.
$t
(
"
{n}个清关费阶梯价
"
,
{
n
:
ignoreClearance
}))
if
(
data
.
priceType
){
data
.
fullPricePackagingList
=
this
.
getPackagingPrice
(
this
.
form
.
fullPricePackagingList
)
if
(
!
this
.
validatePackagingPrice
(
data
.
fullPricePackagingList
,
"
全包价
"
)){
return
false
}
}
else
{
data
.
clearancePricePackagingList
=
this
.
getPackagingPrice
(
this
.
form
.
clearancePricePackagingList
)
data
.
freightPricePackagingList
=
this
.
getPackagingPrice
(
this
.
form
.
freightPricePackagingList
)
if
(
!
this
.
validatePackagingPrice
(
data
.
freightPricePackagingList
,
this
.
$t
(
"
运费
"
))
||
!
this
.
validatePackagingPrice
(
data
.
clearancePricePackagingList
,
this
.
$t
(
"
清关费
"
))
){
return
false
}
}
data
.
specialList
=
data
.
specialList
.
filter
(
item
=>
{
return
item
.
transportPrice
||
item
.
clearancePrice
})
}
let
msg
=
this
.
$t
(
'
已选择{route}条路线,{product}个商品
'
,
{
route
:
data
.
lineChannelList
.
length
,
product
:
this
.
isAllProduct
?
this
.
$refs
.
productSelector
.
allTotal
:
data
.
productIdList
.
length
})
console
.
log
(
msgArr
)
if
(
msgArr
.
length
){
msg
+=
"
;
"
+
msgArr
.
join
(
"
,
"
)
+
"
被忽略
"
}
await
this
.
$confirm
(
msg
+
this
.
$t
(
'
;确认提交修改?
'
,
))
this
.
loading
=
true
...
...
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