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
c0f06559
Commit
c0f06559
authored
Dec 29, 2023
by
我在何方
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://gitlab.jdshangmen.com/jiedao-app/jiedao-app-operator
into dev
parents
a9a995dc
9a9db221
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1700 additions
and
11 deletions
+1700
-11
productPrice.js
src/api/ecw/productPrice.js
+26
-0
index.vue
src/components/ProductsSelector/index.vue
+39
-9
batchEditAir.vue
src/views/ecw/productPrice/batchEditAir.vue
+424
-0
Logs.vue
src/views/ecw/productPrice/components/Logs.vue
+130
-0
PriceStep.vue
src/views/ecw/productPrice/components/PriceStep.vue
+248
-0
QuickSet.vue
src/views/ecw/productPrice/components/QuickSet.vue
+114
-0
editAir.vue
src/views/ecw/productPrice/editAir.vue
+703
-0
index.vue
src/views/ecw/productPrice/index.vue
+16
-2
No files found.
src/api/ecw/productPrice.js
View file @
c0f06559
...
...
@@ -9,6 +9,14 @@ export function createProductPrice(data) {
})
}
export
function
createProductPriceAir
(
data
)
{
return
request
({
url
:
'
/ecw/product-price/createAir
'
,
method
:
'
post
'
,
data
:
data
})
}
// 更新产品价格
export
function
updateProductPrice
(
data
)
{
return
request
({
...
...
@@ -18,6 +26,15 @@ export function updateProductPrice(data) {
})
}
// 更新空运价格
export
function
updateProductPriceAir
(
data
)
{
return
request
({
url
:
'
/ecw/product-price/updateAir
'
,
method
:
'
put
'
,
data
:
data
})
}
// 删除产品价格
export
function
deleteProductPrice
(
id
)
{
return
request
({
...
...
@@ -71,6 +88,15 @@ export function batchUpdateProductPrice(query) {
})
}
// 批量修改空运产品价格
export
function
batchUpdateProductPriceAir
(
data
)
{
return
request
({
url
:
'
/ecw/product-price/batchUpdate
'
,
method
:
'
put
'
,
data
})
}
// 批量拉黑
export
function
batchBlock
(
query
)
{
return
request
({
...
...
src/components/ProductsSelector/index.vue
View file @
c0f06559
...
...
@@ -12,7 +12,7 @@
<el-input
v-model=
"queryParams.titleZh"
:placeholder=
"$t('产品关键字')"
style=
"width:120px"
clearable
:disabled=
"loading"
/>
<el-button
type=
"primary"
@
click=
"reLoad"
:loading=
"loading"
>
{{
$t
(
'
搜索
'
)
}}
</el-button>
<div>
<div
style=
"height: 36px; display: flex; align-items: center"
>
<el-checkbox
:label=
"$t('全选') + `($
{$t('{total}个', {total})})`" @change="toggleAll" :disabled="isAllProduct || loading">
</el-checkbox>
</div>
</div>
...
...
@@ -27,18 +27,28 @@
</div>
<div
class=
"flex-1 ml-10"
>
<el-card
style=
"height:100%"
>
<div
slot=
"header"
class=
"header flex"
>
<div
class=
"flex-1 flex items-center"
>
{{
$t
(
'
已选{cnt
}
个产品
'
,
{
cnt
:
choosedList
.
length
}
)
}}
<
/div
>
<div
slot=
"header"
class=
"header"
>
<el-select
v-model=
"selectedFilterParams.typeId"
:placeholder=
"$t('选择类型')"
style=
"width:120px"
clearable
:disabled=
"loading"
>
<el-option
v-for=
"item in typeList"
:key=
"item.id"
:label=
"item.titleZh"
:value=
"item.id"
/>
</el-select>
<el-select
v-model=
"selectedFilterParams.attrId"
:placeholder=
"$t('选择属性')"
style=
"width:120px"
clearable
:disabled=
"loading"
>
<el-option
v-for=
"item in attrList"
:key=
"item.id"
:label=
"item.attrName"
:value=
"item.id"
/>
</el-select>
<el-input
v-model=
"selectedFilterParams.titleZh"
:placeholder=
"$t('产品关键字')"
style=
"width:120px"
clearable
:disabled=
"loading"
/>
<!--
<el-button
type=
"primary"
@
click=
"reLoad"
:loading=
"loading"
>
{{
$t
(
'
搜索
'
)
}}
</el-button>
-->
<div
class=
"flex"
>
<div
class=
"flex-1 flex items-center"
>
{{
$t
(
'
已选{cnt
}
个产品
'
,
{
cnt
:
choosedList
.
length
}
)
}}
<
/div
>
<
el
-
button
:
disabled
=
"
!choosedList.length
"
type
=
"
text
"
@
click
=
"
clearAll
"
>
{{
$t
(
'
全部清除
'
)
}}
<
/el-button
>
<
/div
>
<
/div
>
<
div
class
=
"
list
"
>
<
div
class
=
"
item
"
v
-
for
=
"
(choosed) in selectedList
"
:
key
=
"
choosed.id
"
:
data
-
data
=
"
JSON.stringify(choosed)
"
>
<
div
class
=
"
item
"
v
-
for
=
"
(choosed) in selectedList
"
:
key
=
"
choosed.id
"
>
<
el
-
link
class
=
"
el-icon-delete
"
@
click
=
"
remove(choosed)
"
:
disabled
=
"
isAllProduct
"
/>
{{
choosed
.
titleZh
}}
<
div
>
{{
choosed
.
titleEn
}}
<
/div
>
<
/div
>
<
/div
>
<
el
-
pagination
:
total
=
"
choos
edList.length
"
:
page
-
sizes
=
"
[100, 200, 300, 500]
"
:
page
-
size
=
"
pageSize
"
@
current
-
change
=
"
rightPage = $event
"
layout
=
"
prev, pager, next, total, sizes
"
:
current
-
page
=
"
rightPage
"
/>
<
el
-
pagination
:
total
=
"
filter
edList.length
"
:
page
-
sizes
=
"
[100, 200, 300, 500]
"
:
page
-
size
=
"
pageSize
"
@
current
-
change
=
"
rightPage = $event
"
layout
=
"
prev, pager, next, total, sizes
"
:
current
-
page
=
"
rightPage
"
/>
<
/el-card
>
<
/div
>
<
/div
>
...
...
@@ -75,6 +85,11 @@ export default {
titleZh
:
null
,
typeId
:
null
}
,
selectedFilterParams
:{
attrId
:
null
,
titleZh
:
null
,
typeId
:
null
}
,
choosedList
:
[],
typeList
:
[],
attrList
:
[],
...
...
@@ -110,9 +125,24 @@ export default {
currentList
(){
return
this
.
list
.
slice
((
this
.
leftPage
-
1
)
*
this
.
pageSize
,
this
.
leftPage
*
this
.
pageSize
)
}
,
// 已勾选的显示列表
// 已选中 且符合筛选的
filteredList
(){
return
this
.
choosedList
.
filter
(
item
=>
{
if
(
this
.
selectedFilterParams
.
typeId
&&
item
.
typeId
!=
this
.
selectedFilterParams
.
typeId
){
return
false
}
if
(
this
.
selectedFilterParams
.
attrId
&&
item
.
attrId
!=
this
.
selectedFilterParams
.
attrId
){
return
false
}
if
(
this
.
selectedFilterParams
.
titleZh
&&
item
.
titleZh
.
indexOf
(
this
.
selectedFilterParams
.
titleZh
)
==
-
1
){
return
false
}
return
true
}
)
}
,
// 已勾选的显示列表,当前分页显示的
selectedList
(){
return
this
.
choos
edList
.
slice
((
this
.
rightPage
-
1
)
*
this
.
pageSize
,
this
.
rightPage
*
this
.
pageSize
)
return
this
.
filter
edList
.
slice
((
this
.
rightPage
-
1
)
*
this
.
pageSize
,
this
.
rightPage
*
this
.
pageSize
)
}
}
,
watch
:
{
...
...
@@ -131,7 +161,7 @@ export default {
}
,*/
defaultIds
(
newValue
,
oldValue
){
if
(
!
oldValue
||
!
oldValue
.
length
){
this
.
loadDefaultProds
()
//
this.loadDefaultProds()
}
}
,
isall
(
isall
){
...
...
src/views/ecw/productPrice/batchEditAir.vue
0 → 100644
View file @
c0f06559
<
template
>
<div
class=
"app-container"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"150px"
>
<products-selector
ref=
"productSelector"
v-model=
"form.productIdList"
show-all
@
setall=
"isAllProduct=$event"
:default-ids=
"form.productIdList"
enable-filtered
@
setFiltered=
"isAllFilteredProduct=$event"
class=
"mb-20"
/>
<routers-selector
v-model=
"selectedRoutes"
type=
"air"
/>
<el-card
style=
"margin-bottom: 10px"
>
<div
slot=
"header"
style=
"font-size:20px;"
>
{{
$t
(
'
价格设置
'
)
}}
</div>
<el-row
:gutter=
"20"
>
<el-col
:span=
"12"
>
<el-form-item
:label=
"$t('预付')"
prop=
"needPay"
>
<el-radio-group
v-model=
"form.needPay"
>
<el-radio
:label=
"1"
>
{{
$t
(
'
预付
'
)
}}
</el-radio>
<el-radio
:label=
"0"
>
{{
$t
(
'
均可
'
)
}}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
:label=
"$t('单价模式')"
prop=
"priceType"
>
<dict-selector
:type=
"DICT_TYPE.ECW_PRICE_TYPE"
v-model=
"form.priceType"
form-type=
"radio"
formatter=
'number'
/>
</el-form-item>
<el-form-item
:label=
"$t('最小起计量')"
:prop=
"`minWeight`"
>
<el-input-number
v-model=
"form.minWeight"
:controls=
"false"
class=
"w-100"
/>
/
<selector
v-model=
"form.minWeightUnit"
:options=
"unitList"
:label-field=
"$l(null, 'title')"
value-field=
"id"
defaultable2
class=
"w-100"
disabled
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
>
<quick-set
:unit-list=
"unitList"
:currency-list=
"currencyList"
:value=
"form"
></quick-set>
</el-col>
</el-row>
<!--全包价-->
<template
v-if=
"form.priceType==1"
>
<div
v-for=
"(item, index) in form.fullPriceStepList"
:key=
"index"
>
<price-step
ref=
"stepPrice"
:index=
"index"
:currency-list=
"currencyList"
:unit-list=
"unitList"
field-prefix=
"all"
:price-name=
"$t('全包价')"
:show-add=
"index === form.fullPriceStepList.length -1"
:value=
"item"
@
add=
"handleAddPrice('fullPriceStepList', $event)"
@
delete=
"handleDeletePrice('fullPriceStepList', $event)"
@
changeUnit=
"handleUnitChange(form.fullPriceStepList, index, ...$event)"
></price-step>
</div>
</
template
>
<el-row
v-else
:gutter=
"20"
class=
"mt-20"
>
<el-col
:span=
"12"
>
<div
v-for=
"(item, index) in form.freightPriceStepList"
:key=
"index"
>
<price-step
ref=
"stepPrice"
:index=
"index"
:currency-list=
"currencyList"
:unit-list=
"unitList"
field-prefix=
"transport"
:price-name=
"$t('运费')"
:show-add=
"index === form.freightPriceStepList.length -1"
:value=
"item"
@
add=
"handleAddPrice('freightPriceStepList', $event)"
@
delete=
"handleDeletePrice('freightPriceStepList', $event)"
@
changeUnit=
"handleUnitChange(form.freightPriceStepList, index, ...$event)"
></price-step>
</div>
</el-col>
<el-col
:span=
"12"
>
<div
v-for=
"(item, index) in form.clearancePriceStepList"
:key=
"index"
>
<price-step
ref=
"stepPrice"
:index=
"index"
:currency-list=
"currencyList"
:unit-list=
"unitList"
field-prefix=
"clearance"
:price-name=
"$t('清关费')"
:show-add=
"index === form.clearancePriceStepList.length -1"
:value=
"item"
@
add=
"handleAddPrice('clearancePriceStepList', $event)"
@
delete=
"handleDeletePrice('clearancePriceStepList', $event)"
@
changeUnit=
"handleUnitChange(form.clearancePriceStepList, index, ...$event)"
></price-step>
</div>
</el-col>
</el-row>
<el-form-item
:label=
"$t('价格有效期')"
>
<el-date-picker
v-model=
"form.validateStartDate"
value-format=
"yyyy-MM-dd HH:mm:ss"
></el-date-picker>
-
<el-date-picker
v-model=
"form.validateEndDate"
value-format=
"yyyy-MM-dd HH:mm:ss"
></el-date-picker>
</el-form-item>
</el-card>
<el-card>
<div
slot=
"header"
style=
"font-size:20px;"
>
{{$t('基础信息')}}
</div>
<el-form-item
:label=
"$t('是否预约入仓')"
prop=
"needBook"
>
<el-radio
v-model.number=
"form.needBook"
:label=
"1"
>
{{$t('是')}}
</el-radio>
<el-radio
v-model.number=
"form.needBook"
:label=
"0"
>
{{$t('否')}}
</el-radio>
</el-form-item>
<el-form-item
:label=
"$t('是否单询')"
prop=
"inquiry"
>
<dict-selector
:type=
"DICT_TYPE.NEED_ORDER_INQUIRY"
v-model=
"form.needOrderInquiry"
form-type=
"radio"
formatter=
"number"
></dict-selector>
</el-form-item>
</el-card>
</el-form>
<div
style=
"margin: 20px 0"
>
<el-button
@
click=
"submitForm"
type=
"primary"
:loading=
"loading"
>
{{$t('确认提交')}}
</el-button>
<el-button
type=
"default"
@
click=
"$router.back()"
>
{{$t('返回上一页')}}
</el-button>
</div>
</div>
</template>
<
script
>
import
RoutersSelector
from
'
@/components/RoutersSelector
'
import
{
batchUpdateProductPrice
,
batchUpdateProductPriceAir
,
getProductPrice
}
from
"
@/api/ecw/productPrice
"
;
import
{
getCurrencyList
}
from
'
@/api/ecw/currency
'
;
import
{
getUnitList
}
from
'
@/api/ecw/unit
'
;
import
ProductsSelector
from
'
@/components/ProductsSelector
'
import
Selector
from
'
@/components/Selector
'
import
Inputor
from
'
@/components/Inputor
'
import
Decimal
from
'
decimal.js
'
import
{
getProduct
}
from
"
@/api/ecw/product
"
;
import
QuickSet
from
"
@/views/ecw/productPrice/components/QuickSet.vue
"
;
import
PriceStep
from
"
@/views/ecw/productPrice/components/PriceStep.vue
"
;
import
{
getProductTypeList
}
from
"
@/api/ecw/productType
"
;
// 定义默认的价格单位和体积单位
const
DEFAULT_PRICE_UNIT
=
1
const
DEFAULT_VOLUME_UNIT
=
6
const
DEFAULT_WEIGHT_UNIT
=
6
export
default
{
components
:
{
PriceStep
,
QuickSet
,
RoutersSelector
,
ProductsSelector
,
Selector
,
Inputor
},
data
()
{
return
{
checkList
:
[],
selectedRoutes
:
[],
// 勾选的路线渠道
form
:
{
stepPrice
:
0
,
priceType
:
null
},
isAllProduct
:
false
,
// 是否全部商品
isAllFilteredProduct
:
false
,
// 是否勾選全部搜索結果
specialProducts
:
[],
rules
:
{},
product
:
null
,
currencyList
:
[],
unitList
:
[],
productTypeList
:
[],
productDisabled
:
true
,
lineList
:
[],
//路线数组
loading
:
false
,
}
},
computed
:
{
// 判断是否空值
isEmpty
()
{
return
(
content
)
=>
{
return
!
content
&&
content
!==
0
&&
content
!==
'
0
'
}
},
},
watch
:
{
checkList
()
{
//选择路线
if
(
this
.
checkList
.
length
>
0
)
{
this
.
form
.
lineChannelList
=
this
.
checkList
.
map
(
item
=>
{
return
{
lineId
:
item
,
shippingChannelId
:
0
}
})
}
else
{
this
.
form
.
lineChannelList
=
[]
}
},
product
()
{
this
.
$set
(
this
.
form
,
'
productType
'
,
this
.
product
.
typeId
)
},
// 价格类型切换,需要初始化对应的字段
'
form.priceType
'
(
priceType
){
if
(
priceType
==
1
&&
!
this
.
form
.
fullPriceStepList
?.
length
){
this
.
handleAddPrice
(
'
fullPriceStepList
'
,
'
all
'
)
}
if
(
priceType
==
0
){
if
(
!
this
.
form
.
freightPriceStepList
?.
length
){
this
.
handleAddPrice
(
'
freightPriceStepList
'
,
'
transport
'
)
}
if
(
!
this
.
form
.
clearancePriceStepList
?.
length
){
this
.
handleAddPrice
(
'
clearancePriceStepList
'
,
'
clearance
'
)
}
}
},
'
form.needBook
'
(
val
){
if
(
val
)
this
.
$set
(
this
.
form
,
'
dayLimit
'
,
10000
)
else
delete
this
.
form
.
dayLimit
},
},
async
created
()
{
this
.
currencyList
=
(
await
getCurrencyList
())?.
data
||
[]
this
.
unitList
=
(
await
getUnitList
())?.
data
||
[]
this
.
$set
(
this
.
form
,
'
stepPrice
'
,
1
)
// 如果是复制,则获取数据并填充,先复制,然后填充特需,避免数据的特需不全导致部分不显示
if
(
this
.
$route
.
query
.
templateId
){
await
this
.
getTemplateDetail
(
this
.
$route
.
query
.
templateId
)
}
},
methods
:
{
// 获取模板数据(复制的源路线价格信息)
async
getTemplateDetail
(
id
){
const
res
=
await
getProductPrice
(
id
)
// 填充商品、线路、价格信息、出货渠道(空运)
// this.form.productIdList = [res.data.productId]
/* 23-11-07要求不复制商品和线路 https://zentao.test.jdshangmen.com/bug-view-5145.html
this.selectedRoutes = [{
"lineId": res.data.warehouseLineId,
"channelId": res.data.shippingChannelId,
"transportId": res.data.warehouseLineDO.transportType,
"shippingChannelId":res.data.channelId
}]*/
// 要复制过来的字段
const
{
allPrice
,
allPriceUnit
,
allVolumeUnit
,
transportPrice
,
transportPriceUnit
,
transportVolumeUnit
,
clearancePrice
,
clearancePriceUnit
,
clearanceVolumeUnit
,
priceType
,
stepPrice
,
specialList
,
priceStepList
,
minWeight
,
minWeightUnit
,
needOrderInquiry
,
needBook
,
needPay
}
=
res
.
data
const
data
=
{
allPrice
,
allPriceUnit
,
allVolumeUnit
,
transportPrice
,
transportPriceUnit
,
transportVolumeUnit
,
clearancePrice
,
clearancePriceUnit
,
clearanceVolumeUnit
,
priceType
,
stepPrice
,
specialList
,
priceStepList
,
minWeight
,
minWeightUnit
,
needOrderInquiry
,
needBook
,
needPay
}
this
.
$set
(
this
,
'
form
'
,
Object
.
assign
({},
this
.
form
,
data
))
// 产品选择器默认选择的商品
/* 23-11-07要求不复制商品和线路 https://zentao.test.jdshangmen.com/bug-view-5145.html
getProduct(res.data.productId).then(res => {
this.$refs.productSelector.choose(res.data)
})*/
},
handleAddPrice
(
field
,
fieldPrefix
){
if
(
!
this
.
form
[
field
]){
this
.
$set
(
this
.
form
,
field
,
[])
}
let
priceUnit
=
DEFAULT_PRICE_UNIT
let
volumeUnit
=
DEFAULT_VOLUME_UNIT
let
weightUnit
=
DEFAULT_WEIGHT_UNIT
if
(
this
.
form
[
field
].
length
){
const
first
=
this
.
form
[
field
][
0
]
priceUnit
=
first
[
`
${
fieldPrefix
}
PriceUnit`
]
volumeUnit
=
first
[
`
${
fieldPrefix
}
VolumeUnit`
]
weightUnit
=
first
.
weightUnit
}
console
.
log
(
"
添加价格的默认单位
"
,
{
priceUnit
,
volumeUnit
,
weightUnit
})
this
.
form
[
field
].
push
({
[
`
${
fieldPrefix
}
PriceUnit`
]:
priceUnit
,
[
`
${
fieldPrefix
}
VolumeUnit`
]:
volumeUnit
,
weightUnit
:
weightUnit
,
specialList
:[]
})
},
handleDeletePrice
(
field
,
index
){
this
.
form
[
field
].
splice
(
index
,
1
)
},
handleUnitChange
(
stepPriceList
,
index
,
data
){
console
.
log
(
'
handleUnitChange
'
,
...
arguments
)
if
(
index
>
0
)
return
// 如果是重量单位,且不是清关费想换的,则需要同步最小起计量单位
if
(
data
.
field
===
'
weightUnit
'
&&
data
.
type
!=
'
clearance
'
){
this
.
form
.
minWeightUnit
=
data
.
value
}
stepPriceList
.
forEach
(
item
=>
{
item
[
data
.
field
]
=
data
.
value
if
(
item
.
packagingList
?.
length
){
item
.
packagingList
.
forEach
(
p
=>
{
p
[
data
.
field
]
=
data
.
value
})
}
if
(
item
.
specialList
?.
length
){
item
.
specialList
.
forEach
(
p
=>
{
p
[
data
.
field
]
=
data
.
value
})
}
})
},
// 获得用语提交的阶梯价副本
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
})
})
return
stepPriceList
},
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
,
{
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
(
'
请选择商品
'
)
}
data
.
lineChannelList
=
this
.
selectedRoutes
let
isValid
=
true
for
(
let
stepPrice
of
this
.
$refs
.
stepPrice
){
if
(
!
stepPrice
.
validate
()){
isValid
=
false
break
}
}
if
(
!
isValid
)
return
// 全包价
if
(
this
.
form
.
priceType
==
1
)
{
data
.
fullPriceStepList
=
this
.
getPriceList
(
this
.
form
.
fullPriceStepList
)
}
else
{
data
.
clearancePriceStepList
=
this
.
getPriceList
(
this
.
form
.
clearancePriceStepList
)
data
.
freightPriceStepList
=
this
.
getPriceList
(
this
.
form
.
freightPriceStepList
)
}
if
(
data
.
lineChannelList
.
length
<
1
){
return
this
.
$message
.
error
(
this
.
$t
(
'
请选择需要修改的路线
'
))
}
await
this
.
$confirm
(
this
.
$t
(
'
已选择{route}条路线,{product}个商品;确认提交修改?
'
,
{
route
:
data
.
lineChannelList
.
length
,
product
:
this
.
isAllProduct
?
this
.
$refs
.
productSelector
.
allTotal
:
data
.
productIdList
.
length
}))
this
.
loading
=
true
batchUpdateProductPriceAir
(
data
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
this
.
$t
(
"
修改成功
"
));
this
.
$router
.
replace
(
'
/lineProject/product-price?
'
+
(
new
URLSearchParams
(
this
.
$route
.
query
)).
toString
())
})
.
finally
(
res
=>
this
.
loading
=
false
)
});
},
// 快捷设置,只更新默认运费
quickSet
(){
// 字段,根据是否全包价来取
let
field
=
this
.
form
.
priceType
==
1
?
'
allPrice
'
:
'
transportPrice
'
// 取得要加的数额(减少则是负数)
let
amount
=
Decimal
(
this
.
quickForm
.
plus
||
-
this
.
quickForm
.
minus
)
this
.
form
.
priceStepList
.
forEach
(
item
=>
{
// 加上对应的价格,但是不能小于0
this
.
$set
(
item
,
field
,
Math
.
max
(
0
,
Decimal
(
item
[
field
]
||
0
).
plus
(
amount
).
toNumber
()))
})
}
}
}
</
script
>
<
style
scoped
>
.w100
{
width
:
100px
;
}
.mr10
{
margin-right
:
10px
;
}
</
style
>
src/views/ecw/productPrice/components/Logs.vue
0 → 100644
View file @
c0f06559
<
script
>
import
{
getPriceSnapshotList
}
from
"
@/api/ecw/productPrice
"
;
export
default
{
name
:
"
Logs
"
,
props
:{
currencyMap
:{
type
:
Object
,
default
:()
=>
{
return
{}
}
},
unitMap
:{
type
:
Object
,
default
:()
=>
{
return
{}
}
},
},
data
(){
return
{
showLogsDialog
:
false
,
loading
:
false
,
logs
:[]
}
},
methods
:{
open
(
id
){
this
.
showLogsDialog
=
true
this
.
loading
=
true
getPriceSnapshotList
(
id
).
then
(
res
=>
{
this
.
logs
=
res
.
data
this
.
logs
.
forEach
(
item
=>
{
item
.
detail
=
JSON
.
parse
(
item
.
content
)
})
}).
finally
(()
=>
{
this
.
loading
=
false
})
},
closeLogsDialog
(){
this
.
logs
=
[]
this
.
showLogsDialog
=
false
}
}
}
</
script
>
<
template
>
<el-dialog
:title=
"$t('查看价格日志')"
:visible.sync=
"showLogsDialog"
:before-close=
"closeLogsDialog"
width=
"1000px"
>
<el-table
:data=
"logs"
v-loading=
"loading"
>
<el-table-column
:label=
"$t('序号')"
type=
"index"
></el-table-column>
<el-table-column
:label=
"$t('修改人')"
prop=
"creatorName"
width=
"200px"
></el-table-column>
<el-table-column
:label=
"$t('修改时间')"
>
<template
slot-scope=
"
{row}">
{{
row
.
createTime
|
parseTime
}}
</
template
>
</el-table-column>
<el-table-column
:label=
"$t('修改前')"
>
<
template
slot-scope=
"{row}"
>
<div>
{{
$t
(
'
预付
'
)
}}
:
<dict-tag
:type=
"DICT_TYPE.ECW_PAY_ADVANCE"
:value=
"row.detail.needPay"
/></div>
<div>
{{
$t
(
'
单价模式
'
)
}}
:
<dict-tag
:type=
"DICT_TYPE.ECW_PRICE_TYPE"
:value=
"row.detail.priceType"
/></div>
<div
v-if=
"row.detail.minWeight"
>
{{
$t
(
'
最小起计量
'
)
}}
:
{{
row
.
detail
.
minWeight
}}{{
unitMap
[
row
.
detail
.
minWeightUnit
]
}}
</div>
<!----阶梯定价-->
<template
v-if=
"row.detail.stepPrice == 1"
>
<template
v-for=
"(item, index) in row.detail.priceStepList"
>
<div
class=
"mt-10"
>
第
{{
index
+
1
}}
阶段
{{
item
.
startNum
}}
-
{{
item
.
endNum
}}
{{
unitMap
[
item
.
weightUnit
]
}}
</div>
<template
v-if=
"row.detail.priceType != 1"
>
<div
:key=
"index + '_freight'"
class=
"pl-10"
>
运费:
{{
item
.
transportPrice
}}
{{
currencyMap
[
item
.
transportPriceUnit
]
}}
/
{{
unitMap
[
item
.
transportVolumeUnit
]
}}
</div>
<!--空运没有清关费, 不需要显示-->
<div
v-if=
"type != 'air'"
:key=
"item.specialDictType + '_clearance'"
class=
"pl-10"
>
清关费:
{{
item
.
clearancePrice
}}
{{
currencyMap
[
item
.
clearancePriceUnit
]
}}
/
{{
unitMap
[
item
.
clearanceVolumeUnit
]
}}
</div>
</
template
>
<div
v-else
class=
"pl-10"
>
全包价:
{{item.allPrice}} {{currencyMap[item.allPriceUnit]}} / {{unitMap[item.allVolumeUnit]}}
</div>
</template>
</template>
<
template
v-else
>
<template
v-if=
"row.detail.priceType != 1"
>
<div>
默认运费:
{{
row
.
detail
.
transportPrice
}}
{{
currencyMap
[
row
.
detail
.
transportPriceUnit
]
}}
/
{{
unitMap
[
row
.
detail
.
transportVolumeUnit
]
}}
</div>
<div>
默认清关费:
{{
row
.
detail
.
clearancePrice
}}
{{
currencyMap
[
row
.
detail
.
clearancePriceUnit
]
}}
/
{{
unitMap
[
row
.
detail
.
clearanceVolumeUnit
]
}}
</div>
</
template
>
<div
v-else
>
全包价:
{{row.detail.allPrice}} {{currencyMap[row.detail.allPriceUnit]}} / {{unitMap[row.detail.allVolumeUnit]}}
</div>
<
template
v-for=
"(item, index) in row.detail.specialList"
>
<template
v-if=
"row.detail.priceType != 1"
>
<div
:key=
"item.specialDictType + '_freight'"
>
{{
getDictDataLabel
(
DICT_TYPE
.
ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS
,
item
.
specialDictType
)
}}
运费:
{{
item
.
transportPrice
}}
{{
currencyMap
[
item
.
transportPriceUnit
]
}}
/
{{
unitMap
[
item
.
transportVolumeUnit
]
}}
</div>
<div
:key=
"item.specialDictType + '_clearance'"
>
{{
getDictDataLabel
(
DICT_TYPE
.
ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS
,
item
.
specialDictType
)
}}
清关费:
{{
item
.
clearancePrice
}}
{{
currencyMap
[
item
.
clearancePriceUnit
]
}}
/
{{
unitMap
[
item
.
clearanceVolumeUnit
]
}}
</div>
</
template
>
<div
v-else
>
{{getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, item.specialDictType)}} 全包价:
{{item.allPrice}} {{currencyMap[item.allPriceUnit]}} / {{unitMap[item.allVolumeUnit]}}
</div>
</template>
</template>
<div
v-if=
"row.detail.validateStartDate || row.detail.validateStartDate"
>
有效期:{{ row.detail.validateStartDate|parseTime }}-{{ row.detail.validateEndDate|parseTime }}
</div>
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
<
style
scoped
lang=
"scss"
>
</
style
>
src/views/ecw/productPrice/components/PriceStep.vue
0 → 100644
View file @
c0f06559
<
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
"
;
export
default
{
name
:
"
PriceStep
"
,
components
:
{
Template
,
Inputor
,
Selector
},
props
:{
index
:
Number
,
priceName
:
String
,
fieldPrefix
:
String
,
unitList
:{
type
:
Array
,
default
:
[]
},
currencyList
:{
type
:
Array
,
default
:
[]
},
showAdd
:
Boolean
,
readonly
:
Boolean
,
value
:{
type
:
Object
,
default
:
()
=>
{
return
{
}
}
}
},
created
()
{
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
(
'
,
'
)
}
})
}
this
.
initSpecialPrice
()
},
data
(){
return
{
}
},
computed
:{
packagingList
(){
return
getDictDatas
(
DICT_TYPE
.
ECW_PACKAGING_TYPE
).
map
(
dict
=>
{
dict
.
enable
=
true
this
.
value
.
packagingList
.
forEach
(
item
=>
{
if
(
item
.
packagingTypes
?.
length
&&
item
.
packagingTypes
.
indexOf
(
dict
.
value
)
>
-
1
){
dict
.
enable
=
false
}
})
return
dict
})
}
},
methods
:{
getDictDatas
,
// 初始化特需加价
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
.
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
})
}
})
},
// 添加包装类型运费
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`
],
})
},
// 删除包装类型运费
deletePackage
(
index
){
this
.
value
.
packagingList
.
splice
(
index
,
1
)
},
// 校验
validate
(){
let
valid
=
true
const
index
=
this
.
index
// 区间设置检查
if
(
index
>
0
&&
!
this
.
value
.
startNum
){
valid
=
false
this
.
$message
.
error
(
`请设置第
${
index
+
1
}
阶段的起始值`
)
}
if
(
!
this
.
value
.
endNum
){
valid
=
false
this
.
$message
.
error
(
`请设置第
${
index
+
1
}
阶段的结束值`
)
}
// 价格检查
if
(
!
this
.
validatePrice
(
this
.
value
[
`
${
this
.
fieldPrefix
}
Price`
])){
valid
=
false
this
.
$message
.
error
(
`请设置第
${
index
+
1
}
阶段的
${
this
.
priceName
}
`
)
}
// 包装价格检查
if
(
this
.
value
.
packagingList
?.
length
){
this
.
value
.
packagingList
.
forEach
((
item
,
i
)
=>
{
if
(
item
.
packagingTypes
?.
length
&&
!
this
.
validatePrice
(
item
.
packagingPrice
)){
valid
=
false
this
.
$message
.
error
(
`请设置第
${
index
+
1
}
阶段的包装类型
${
i
+
1
}
的
${
this
.
priceName
}
`
)
}
})
}
return
valid
},
// 校验价格是否为空,可以是0
validatePrice
(
value
){
if
(
value
===
undefined
||
value
===
null
||
value
===
''
){
return
false
}
return
true
},
}
}
</
script
>
<
template
>
<div>
<div
class=
"bold text-lg"
>
{{
$t
(
'
空运{type
}
设置
'
,
{
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
-
divider
direction
=
"
vertical
"
><
/el-divider
>
<
el
-
link
type
=
"
danger
"
@
click
.
native
=
"
$emit( 'delete', index)
"
>
{{
$t
(
'
删除
'
)
}}
<
/el-link
>
<
/template
>
<
/div
>
<
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
>
/
<
selector
:
disabled
=
"
index>0
"
v
-
model
=
"
value.weightUnit
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l(null, 'title')
"
@
input
=
"
$emit('changeUnit', {
value: $event,
field: 'weightUnit',
type: fieldPrefix
}
)
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
<
/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
"
/>
<
selector
:
disabled
=
"
index>0
"
v
-
model
=
"
value[`${fieldPrefix
}
PriceUnit`]
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
@
input
=
"
$emit('changeUnit', {
value: $event,
field: `${fieldPrefix
}
PriceUnit`
}
)
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
/
<
selector
:
disabled
=
"
index>0
"
v
-
model
=
"
value[`${fieldPrefix
}
VolumeUnit`]
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l(null, 'title')
"
@
input
=
"
$emit('changeUnit', {
value: $event,
field: `${fieldPrefix
}
VolumeUnit`
}
)
"
value
-
field
=
"
id
"
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
"
:
key
=
"
specialIndex + 'transport'
"
>
<
el
-
input
-
number
v
-
model
.
number
=
"
special[`${fieldPrefix
}
Price`]
"
:
controls
=
"
false
"
:
min
=
"
0
"
:
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
"
/>
<
/el-form-item
>
<
/template
>
<!--
包装类型价格
-->
<
template
v
-
for
=
"
(item, i) in value.packagingList
"
>
<
el
-
form
-
item
:
label
=
"
$t('包装类型') + priceName + (i+1)
"
>
<
template
#
label
>
<
div
class
=
"
el-form-item__label
"
style
=
"
width: 150px;
"
>
{{
$t
(
'
包装类型
'
)
+
priceName
+
(
i
+
1
)
}}
<
/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
>
<
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.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
>
<
/template
>
<
div
v
-
if
=
"
!item.packagingTypes || !item.packagingTypes.length
"
class
=
"
tips
"
>
{{
$t
(
'
未选择包装类型,将被忽略
'
)
}}
<
/div
>
<
/el-form-item
>
<
/template
>
<
/div
>
<
/template
>
<
style
scoped
lang
=
"
scss
"
>
.
bold
{
font
-
weight
:
bold
;
}
.
text
-
lg
{
font
-
size
:
1.3
rem
;
}
.
tips
{
font
-
size
:
1
rem
;
color
:
red
;
}
<
/style
>
src/views/ecw/productPrice/components/QuickSet.vue
0 → 100644
View file @
c0f06559
<
script
>
import
Selector
from
"
@/components/Selector/index.vue
"
;
export
default
{
name
:
"
QuickSet.vue
"
,
props
:{
unitList
:{
type
:
Array
,
default
:
[]
},
currencyList
:{
type
:
Array
,
default
:
[]
},
value
:{
type
:
Object
,
default
(){
return
{}
}
}
},
components
:
{
Selector
},
data
(){
return
{
quickForm
:{},
// 快速加价/减价表单
}
},
computed
:{
getUnit
(){
return
(
field
,
unitField
)
=>
{
if
(
!
this
.
value
[
field
]?.
length
)
return
null
return
this
.
value
[
field
][
0
][
unitField
]
}
}
},
methods
:{
handleConfirm
(
type
){
let
amount
=
this
.
quickForm
[
type
]
if
(
!
amount
){
return
this
.
$message
.
error
(
this
.
$t
(
'
请输入加价金额
'
))
}
if
(
this
.
value
?.
priceType
==
1
){
this
.
batchSetPrice
(
"
fullPriceStepList
"
,
'
all
'
,
amount
)
}
else
if
(
type
==
'
transport
'
){
this
.
batchSetPrice
(
"
freightPriceStepList
"
,
"
transport
"
,
amount
)
}
else
if
(
type
==
'
clearance
'
){
this
.
batchSetPrice
(
"
clearancePriceStepList
"
,
"
clearance
"
,
amount
)
}
},
batchSetPrice
(
field
,
fieldPrefix
,
amount
){
if
(
!
this
.
value
[
field
]?.
length
)
return
this
.
value
[
field
].
forEach
(
item
=>
{
if
(
item
[
fieldPrefix
+
'
Price
'
]){
item
[
fieldPrefix
+
'
Price
'
]
=
(
item
[
fieldPrefix
+
'
Price
'
]
*
100
+
amount
*
100
)
/
100
}
// 特性价格
if
(
item
.
specialList
?.
length
){
item
.
specialList
.
forEach
(
special
=>
{
console
.
log
(
special
.
specialDictType
,
special
[
fieldPrefix
+
'
Price
'
])
if
(
special
[
fieldPrefix
+
'
Price
'
]){
special
[
fieldPrefix
+
'
Price
'
]
=
(
special
[
fieldPrefix
+
'
Price
'
]
*
100
+
amount
*
100
)
/
100
}
})
}
// 包装价格
if
(
item
.
packagingList
?.
length
){
item
.
packagingList
.
forEach
(
packaging
=>
{
if
(
packaging
[
'
packagingPrice
'
]){
packaging
[
'
packagingPrice
'
]
=
(
packaging
[
'
packagingPrice
'
]
*
100
+
amount
*
100
)
/
100
}
})
}
})
}
}
}
</
script
>
<
template
>
<div>
<h2
class=
"mt-5"
>
{{
$t
(
'
快捷设置
'
)
}}
</h2>
<div
class=
"flex items-center"
v-if=
"value.priceType != 1"
>
<div
class=
"w-100"
>
{{
$t
(
'
运费快捷加价
'
)
}}
</div>
<el-input-number
:controls=
"false"
v-model=
"quickForm.transport"
class=
"w-100 ml-10 mr-10"
></el-input-number>
<selector
disabled
:value=
"getUnit('freightPriceStepList', 'transportPriceUnit')"
:options=
"currencyList"
:label-field=
"$l('title')"
value-field=
"id"
class=
"w-100"
/>
/
<selector
disabled
:value=
"getUnit('freightPriceStepList', 'transportVolumeUnit')"
:options=
"unitList"
:label-field=
"$l('title')"
value-field=
"id"
class=
"w-100"
/>
<div
class=
"ml-10"
>
<el-button
@
click=
"handleConfirm('transport')"
type=
"primary"
>
{{
$t
(
'
提交运费
'
)
}}
</el-button>
</div>
</div>
<div
class=
"flex items-center mt-10"
v-if=
"value.priceType != 1"
>
<div
class=
"w-100"
>
{{
$t
(
'
清关费快捷加价
'
)
}}
</div>
<el-input-number
:controls=
"false"
v-model=
"quickForm.clearance"
class=
"w-100 ml-10 mr-10"
></el-input-number>
<selector
disabled
:value=
"getUnit('clearancePriceStepList', 'clearancePriceUnit')"
:options=
"currencyList"
:label-field=
"$l('title')"
value-field=
"id"
class=
"w-100"
/>
/
<selector
disabled
:value=
"getUnit('clearancePriceStepList', 'clearanceVolumeUnit')"
:options=
"unitList"
:label-field=
"$l('title')"
value-field=
"id"
class=
"w-100"
/>
<div
class=
"ml-10"
>
<el-button
@
click=
"handleConfirm('clearance')"
type=
"primary"
>
{{
$t
(
'
提交清关费
'
)
}}
</el-button>
</div>
</div>
<div
class=
"flex items-center"
v-if=
"value.priceType == 1"
>
<div
class=
"w-100"
>
{{
$t
(
'
全包价快捷加价
'
)
}}
</div>
<el-input-number
v-model=
"quickForm.all"
:controls=
"false"
class=
"w-100 ml-10 mr-10"
></el-input-number>
<selector
disabled
:value=
"getUnit('fullPriceStepList', 'allPriceUnit')"
:options=
"currencyList"
:label-field=
"$l('title')"
value-field=
"id"
class=
"w-100"
/>
/
<selector
disabled
:value=
"getUnit('fullPriceStepList', 'allVolumeUnit')"
:options=
"unitList"
:label-field=
"$l('title')"
value-field=
"id"
class=
"w-100"
/>
<div
class=
"ml-10"
>
<el-button
@
click=
"handleConfirm('all')"
type=
"primary"
>
{{
$t
(
'
提交全包价
'
)
}}
</el-button>
</div>
</div>
</div>
</
template
>
<
style
scoped
lang=
"scss"
>
</
style
>
src/views/ecw/productPrice/editAir.vue
0 → 100644
View file @
c0f06559
<
template
>
<div
class=
"app-container"
>
<el-form
ref=
"form"
:model=
"form"
label-width=
"150px"
:disabled=
"readonly"
>
<el-form-item
:label=
"$t('商品类型')"
prop=
"productType"
>
<el-select
v-model=
"form.productType"
:disabled=
"!!$route.query.action"
>
<el-option
v-for=
"type in productTypeList"
:key=
"type.id"
:label=
"$l(type, 'title')"
:value=
"type.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
:label=
"$t('商品名称')"
prop=
"titleZh"
>
<product-selector
v-model=
"form.productId"
:product-type=
"form.productType"
@
change=
"product = $event"
:disabled=
"!!$route.query.action"
/>
</el-form-item>
<el-form-item
:label=
"$t('英文名称')"
prop=
"titleEn"
>
<el-input
:value=
"product ? product.titleEn : ''"
disabled
/>
</el-form-item>
<!--多条路线批量修改-->
<template
v-if=
"lineList.length"
>
<el-form-item
:label=
"$t('路线')"
prop=
"lineChannelList"
>
<template
v-if=
"lineList.length == 1"
>
<el-input
v-for=
"(item, index) in lineList"
:key=
"index"
:value=
"!item.warehouseLineDO ? $t('数据异常,缺少warehouseLineDO字段') : $t('【
{transport}】从【{from}】发往【{to}】', {
transport: getDictDataLabel(DICT_TYPE.ECW_TRANSPORT_TYPE, item.warehouseLineDO.transportType),
from: $l(item.warehouseLineDO, 'startTitle'),
to: $l(item.warehouseLineDO, 'destTitle')
})"
disabled />
</
template
>
<el-checkbox-group
v-else
v-model=
"checkList"
>
<el-checkbox
v-for=
"item in lineList"
:key=
"item.id"
:label=
"item.id"
:disabled=
"!item.warehouseLineDO"
style=
"display:block"
>
{{
!item.warehouseLineDO ? $t('数据异常,缺少warehouseLineDO字段') : $t('【{transport}】从【{from}】发往【{to}】', {
transport: getDictDataLabel(DICT_TYPE.ECW_TRANSPORT_TYPE, item.warehouseLineDO.transportType),
from: $l(item.warehouseLineDO, 'startTitle'),
to: $l(item.warehouseLineDO, 'destTitle')
})
}}
</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item
:label=
"$t('出货渠道')"
>
{{channel ? $l(channel, 'name') : '/'}}
</el-form-item>
</template>
<!--有路线则不显示路线选择器-->
<routers-selector
v-else
v-model=
"selectedRoutes"
:option=
"routerOption"
type=
"air"
/>
<el-card
style=
"margin-bottom: 10px"
>
<div
slot=
"header"
style=
"font-size:20px;"
>
{{$t('价格设置')}}
<span>
<el-checkbox
v-if=
"$route.query.action != 'batchUpdate'"
label=
""
v-model=
"needPay"
>
{{$t('预付')}}
</el-checkbox>
</span>
</div>
<el-row
:gutter=
"20"
>
<el-col
:span=
"12"
>
<el-form-item
:label=
"$t('预付')"
prop=
"needPay"
v-if=
"$route.query.action == 'batchUpdate'"
>
<el-radio-group
v-model=
"form.needPay"
>
<el-radio
:label=
"1"
>
{{$t('预付')}}
</el-radio>
<el-radio
:label=
"0"
>
{{$t('均可')}}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
:label=
"$t('单价模式')"
prop=
"priceType"
>
<dict-selector
:type=
"DICT_TYPE.ECW_PRICE_TYPE"
v-model=
"form.priceType"
form-type=
"radio"
formatter=
"number"
defaultable2
/>
</el-form-item>
<el-form-item
:label=
"$t('最小起计量')"
:prop=
"`minWeight`"
>
<el-input-number
:min=
"0"
v-model=
"form.minWeight"
:controls=
"false"
class=
"w-100"
/>
/
<selector
v-model=
"form.minWeightUnit"
:options=
"unitList"
:label-field=
"$l(null, 'title')"
value-field=
"id"
defaultable2
class=
"w-100"
disabled
/>
</el-form-item>
</el-col>
<el-col
:span=
"12"
v-if=
"!readonly"
>
<quick-set
:unit-list=
"unitList"
:currency-list=
"currencyList"
:value=
"form"
></quick-set>
</el-col>
</el-row>
<!--全包价-->
<
template
v-if=
"form.priceType==1"
>
<div
v-for=
"(item, index) in form.fullPriceStepList"
:key=
"index"
>
<price-step
ref=
"stepPrice"
:index=
"index"
:currency-list=
"currencyList"
:unit-list=
"unitList"
field-prefix=
"all"
:price-name=
"$t('全包价')"
:show-add=
"index === form.fullPriceStepList.length -1 && !readonly"
:value=
"item"
:readonly=
"readonly"
@
add=
"handleAddPrice('fullPriceStepList', $event)"
@
delete=
"handleDeletePrice('fullPriceStepList', $event)"
@
changeUnit=
"handleUnitChange(form.fullPriceStepList, index, ...$event)"
></price-step>
</div>
</
template
>
<el-row
v-else
:gutter=
"20"
class=
"mt-20"
>
<el-col
:span=
"12"
>
<div
v-for=
"(item, index) in form.freightPriceStepList"
:key=
"index"
>
<price-step
ref=
"stepPrice"
:index=
"index"
:currency-list=
"currencyList"
:unit-list=
"unitList"
field-prefix=
"transport"
:price-name=
"$t('运费')"
:show-add=
"index === form.freightPriceStepList.length -1 && !readonly"
:value=
"item"
:readonly=
"readonly"
@
add=
"handleAddPrice('freightPriceStepList', $event)"
@
delete=
"handleDeletePrice('freightPriceStepList', $event)"
@
changeUnit=
"handleUnitChange(form.freightPriceStepList, index, ...$event)"
></price-step>
</div>
</el-col>
<el-col
:span=
"12"
>
<div
v-for=
"(item, index) in form.clearancePriceStepList"
:key=
"index"
>
<price-step
ref=
"stepPrice"
:index=
"index"
:currency-list=
"currencyList"
:unit-list=
"unitList"
field-prefix=
"clearance"
:price-name=
"$t('清关费')"
:show-add=
"index === form.clearancePriceStepList.length -1 && !readonly"
:value=
"item"
:readonly=
"readonly"
@
add=
"handleAddPrice('clearancePriceStepList', $event)"
@
delete=
"handleDeletePrice('clearancePriceStepList', $event)"
@
changeUnit=
"handleUnitChange(form.clearancePriceStepList, index, ...$event)"
></price-step>
</div>
</el-col>
</el-row>
<el-form-item
:label=
"$t('价格有效期')"
>
<el-date-picker
v-model=
"form.validateStartDate"
value-format=
"yyyy-MM-dd HH:mm:ss"
></el-date-picker>
-
<el-date-picker
v-model=
"form.validateEndDate"
value-format=
"yyyy-MM-dd HH:mm:ss"
></el-date-picker>
</el-form-item>
</el-card>
<el-card>
<div
slot=
"header"
style=
"font-size:20px;"
>
{{$t('基础信息')}}
</div>
<el-form-item
:label=
"$t('是否预约入仓')"
prop=
"needBook"
>
<el-radio
v-model.number=
"form.needBook"
:label=
"1"
>
{{$t('是')}}
</el-radio>
<el-radio
v-model.number=
"form.needBook"
:label=
"0"
>
{{$t('否')}}
</el-radio>
</el-form-item>
<el-form-item
:label=
"$t('是否单询')"
prop=
"inquiry"
>
<dict-selector
:type=
"DICT_TYPE.NEED_ORDER_INQUIRY"
v-model=
"form.needOrderInquiry"
form-type=
"radio"
formatter=
"number"
></dict-selector>
</el-form-item>
<el-form-item
:label=
"$t('线路重量上限')"
prop=
"inquiry"
>
<el-input-number
v-model=
"form.weightLimit"
:min=
"0"
:controls=
"false"
></el-input-number>
</el-form-item>
</el-card>
</el-form>
<el-card
class=
"mt-10"
v-if=
"readonly"
>
<el-descriptions
:column=
"1"
>
<el-descriptions-item
:label=
"$t('状态')"
>
{{ statusName(form) }}
</el-descriptions-item>
<el-descriptions-item
:label=
"$t('创建时间')"
>
{{form.createTime|parseTime}}
</el-descriptions-item>
<el-descriptions-item
:label=
"$t('创建人')"
>
{{form.creatorName}}
</el-descriptions-item>
<el-descriptions-item
:label=
"$t('最新修改时间')"
>
{{form.updateTime|parseTime}}
</el-descriptions-item>
<el-descriptions-item
:label=
"$t('最新修改人')"
>
{{form.updaterName}}
</el-descriptions-item>
</el-descriptions>
</el-card>
<div
style=
"margin: 20px 0"
>
<el-button
@
click=
"submitForm"
type=
"primary"
v-if=
"!readonly"
:loading=
"loading"
>
{{$t('确认提交')}}
</el-button>
<el-button
type=
"default"
@
click=
"$router.back()"
>
{{$t('返回上一页')}}
</el-button>
<el-button
@
click=
"showLogs"
type=
"primary"
v-if=
"readonly"
>
{{$t('查看价格日志')}}
</el-button>
</div>
<logs
ref=
"logs"
></logs>
</div>
</template>
<
script
>
import
RoutersSelector
from
'
@/components/RoutersSelector
'
import
{
createProductPrice
,
updateProductPrice
,
batchUpdateProductPrice
,
getProductPrice
,
getProductPriceList
,
getPriceSnapshotList
,
updateProductPriceAir
,
createProductPriceAir
,
batchUpdateProductPriceAir
}
from
"
@/api/ecw/productPrice
"
;
import
{
getProductType
,
getProductTypeList
}
from
'
@/api/ecw/productType
'
import
{
getCurrencyList
}
from
'
@/api/ecw/currency
'
;
import
{
getUnitList
}
from
'
@/api/ecw/unit
'
;
import
ProductSelector
from
'
@/components/ProductSelector
'
import
{
arrryToKeyedObjectBy
}
from
'
@/utils/index
'
import
Selector
from
'
@/components/Selector
'
import
Inputor
from
'
@/components/Inputor
'
import
{
parseTime
}
from
'
@/utils/ruoyi
'
import
{
openedRouterList
}
from
'
@/api/ecw/warehouse
'
import
Decimal
from
"
decimal.js
"
;
import
{
getChannel
}
from
"
@/api/ecw/channel
"
;
import
PackagingType
from
"
@/views/ecw/channel/componrnts/packaging-type.vue
"
;
import
{
getStatusName
}
from
'
./util
'
import
QuickSet
from
"
./components/QuickSet.vue
"
import
Logs
from
"
@/views/ecw/productPrice/components/Logs.vue
"
;
import
PriceStep
from
"
@/views/ecw/productPrice/components/PriceStep.vue
"
;
// 定义默认的价格单位和体积单位
const
DEFAULT_PRICE_UNIT
=
1
const
DEFAULT_VOLUME_UNIT
=
6
const
DEFAULT_WEIGHT_UNIT
=
6
export
default
{
components
:
{
PriceStep
,
Logs
,
QuickSet
,
PackagingType
,
RoutersSelector
,
ProductSelector
,
Selector
,
Inputor
},
filters
:
{
parseTime
},
data
()
{
return
{
checkList
:
[],
selectedRoutes
:
[],
// 勾选的路线渠道
form
:
{
minWeightUnit
:
0
,
priceStepList
:
[],
// 阶梯价格
specialList
:
[],
// 是否单询,默认否
needOrderInquiry
:
'
0
'
},
needPay
:
false
,
// 是否需要预付
product
:
null
,
currencyList
:
[],
unitList
:
[],
productTypeList
:
[],
productDisabled
:
true
,
readonly
:
false
,
lineList
:
[],
//路线数组
loading
:
false
,
channel
:
null
}
},
computed
:
{
statusName
(){
return
getStatusName
},
routerOption
(){
return
this
.
$route
.
query
},
currencyMap
(){
let
map
=
{}
this
.
currencyList
.
forEach
(
item
=>
{
map
[
item
.
id
]
=
this
.
$l
(
item
,
'
title
'
)
})
return
map
},
unitMap
(){
let
map
=
{}
this
.
unitList
.
forEach
(
item
=>
{
map
[
item
.
id
]
=
this
.
$l
(
item
,
'
title
'
)
})
return
map
},
// 默认运费的货币和体积单位
currencyAndUnit
(){
let
currency
=
null
,
unit
=
null
if
(
this
.
form
.
priceType
==
1
&&
this
.
form
.
fullPriceStepList
?.
length
){
currency
=
this
.
form
.
fullPriceStepList
[
0
].
allPriceUnit
unit
=
this
.
form
.
fullPriceStepList
[
0
].
allVolumeUnit
}
if
(
this
.
form
.
priceType
==
1
&&
this
.
form
.
freightPriceStepList
?.
length
){
currency
=
this
.
form
.
freightPriceStepList
[
0
].
allPriceUnit
unit
=
this
.
form
.
freightPriceStepList
[
0
].
allVolumeUnit
}
return
{
currency
,
unit
}
},
},
watch
:
{
checkList
()
{
//选择路线
if
(
this
.
checkList
.
length
>
0
)
{
this
.
form
.
lineChannelList
=
this
.
checkList
.
map
(
item
=>
{
return
{
lineId
:
item
,
shippingChannelId
:
0
}
})
}
else
{
this
.
form
.
lineChannelList
=
[]
}
},
product
()
{
this
.
$set
(
this
.
form
,
'
productType
'
,
this
.
product
.
typeId
)
/* getProductType(this.product.typeId).then(res => {
this.productType = res.data
}) */
// 只有新建才需要把参数带过来
if
(
!
this
.
$route
.
query
.
action
){
this
.
$set
(
this
.
form
,
'
needBook
'
,
this
.
product
.
needBook
)
this
.
$set
(
this
.
form
,
'
square
'
,
this
.
product
.
square
)
this
.
$set
(
this
.
form
,
'
dayLimit
'
,
this
.
product
.
dayLimit
)
this
.
$set
(
this
.
form
,
'
containerLocation
'
,
this
.
product
.
containerLocation
)
}
},
// 价格类型切换,需要初始化对应的字段
'
form.priceType
'
(
priceType
){
if
(
priceType
==
1
&&
!
this
.
form
.
fullPriceStepList
?.
length
){
this
.
handleAddPrice
(
'
fullPriceStepList
'
,
'
all
'
)
}
if
(
priceType
==
0
){
if
(
!
this
.
form
.
freightPriceStepList
?.
length
){
this
.
handleAddPrice
(
'
freightPriceStepList
'
,
'
transport
'
)
}
if
(
!
this
.
form
.
clearancePriceStepList
?.
length
){
this
.
handleAddPrice
(
'
clearancePriceStepList
'
,
'
clearance
'
)
}
}
},
'
form.needBook
'
(
val
){
if
(
val
)
this
.
$set
(
this
.
form
,
'
dayLimit
'
,
10000
)
else
delete
this
.
form
.
dayLimit
},
needPay
(
val
){
this
.
$set
(
this
.
form
,
'
needPay
'
,
val
?
1
:
0
)
},
stepPrice
(
val
){
this
.
$set
(
this
.
form
,
'
stepPrice
'
,
val
?
1
:
0
)
},
selectedRoutes
(
routers
)
{
let
transportIds
=
[]
routers
.
forEach
(
item
=>
{
item
.
shippingChannelId
=
item
.
channelId
transportIds
.
push
(
+
item
.
transportId
)
})
// 如果只选择了空运(3),则默认体积单位改成千克
transportIds
=
new
Set
(
transportIds
)
console
.
log
(
transportIds
)
window
.
transportIds
=
transportIds
if
(
transportIds
.
size
==
1
&&
transportIds
.
has
(
3
)){
this
.
setDefaultVolumeUnit
(
6
)
}
else
this
.
setDefaultVolumeUnit
(
7
)
}
},
async
created
()
{
if
(
this
.
$route
.
query
.
readonly
){
this
.
readonly
=
true
}
this
.
currencyList
=
(
await
getCurrencyList
())?.
data
||
[]
this
.
unitList
=
(
await
getUnitList
())?.
data
||
[]
this
.
productTypeList
=
(
await
getProductTypeList
())?.
data
||
[]
// action=batchUpdate 表示批量修改单个商品的价格(一条或者多条),如果没有ids显示路线选择组件,否则不显示路线组件
// action=update 表示修改单个商品的单条路线价格,需要回显
if
(
this
.
$route
.
query
.
action
==
'
update
'
){
await
this
.
initUpdate
()
}
// action=batchUpdate且ids不为空
if
(
this
.
$route
.
query
.
action
==
'
batchUpdate
'
){
delete
this
.
form
.
needBook
}
// 同时修改多条线路
if
(
this
.
$route
.
query
.
ids
)
{
let
query
=
{
ids
:
this
.
$route
.
query
.
ids
}
getProductPriceList
(
query
).
then
(
res
=>
{
this
.
lineList
=
res
.
data
this
.
lineList
.
forEach
(
item
=>
{
this
.
checkList
.
push
(
item
.
id
)
})
})
}
// 未指定商品则不禁用商品选择
if
(
!
this
.
$route
.
query
.
product_id
){
this
.
productDisabled
=
false
}
// 没有操作标识的就是新建,给有效期默认值
if
(
!
this
.
$route
.
query
.
action
){
await
this
.
initCreate
()
}
if
(
this
.
$route
.
query
.
product_type
)
{
this
.
$set
(
this
.
form
,
'
productType
'
,
+
this
.
$route
.
query
.
product_type
)
}
if
(
this
.
$route
.
query
.
product_id
)
{
this
.
$set
(
this
.
form
,
'
productId
'
,
+
this
.
$route
.
query
.
product_id
)
}
// 显示渠道(修改或者从异常处理等进入携带了渠道参数)
if
(
this
.
form
.
shippingChannelId
){
this
.
channel
=
(
await
getChannel
(
this
.
form
.
shippingChannelId
))?.
data
||
{}
}
},
methods
:
{
// 新建的初始化
async
initCreate
(){
this
.
form
=
{
priceType
:
0
,
stepPrice
:
1
,
advanceStatus
:
0
,
needBook
:
0
,
clearancePriceStepList
:
[],
freightPriceStepList
:
[],
fullPriceStepList
:
[],
validateEndDate
:
undefined
,
validateStartDate
:
undefined
,
clearancePrice
:
0
,
transportPrice
:
0
,
minWeight
:
0
,
minWeightUnit
:
null
,
// 是否单询,默认否
needOrderInquiry
:
0
,
needPay
:
0
,
weightLimit
:
undefined
}
this
.
form
.
validateStartDate
=
parseTime
(
Date
.
now
())
this
.
form
.
validateEndDate
=
parseTime
(
Date
.
now
()
+
86400
*
365
*
2
*
1000
)
// 如果指定了始发,目的仓和运输方式,渠道,则是从未报价异常跳转过来的,固定一个路线
if
(
this
.
$route
.
query
.
startWarehouseId
){
const
res
=
await
openedRouterList
({
destCityId
:
this
.
$route
.
query
.
importCity
,
lineId
:
this
.
$route
.
query
.
lineId
,
startCityId
:
this
.
$route
.
query
.
exportCity
,
transportType
:
this
.
$route
.
query
.
transportId
})
console
.
log
(
"
open --->
"
,
res
)
this
.
lineList
=
[
Object
.
assign
({
// id: res.data[0].id,
lineId
:
this
.
$route
.
query
.
lineId
,
shippingChannelId
:
this
.
$route
.
query
.
channelId
,
warehouseLineDO
:
{...
res
.
data
[
0
]}
})
]
// 后面会根据这个渠道ID获取渠道信息
this
.
form
.
shippingChannelId
=
this
.
$route
.
query
.
channelId
}
},
async
initUpdate
(){
let
res
=
await
getProductPrice
(
this
.
$route
.
query
.
id
)
this
.
$set
(
this
,
'
form
'
,
res
.
data
)
if
(
this
.
form
.
needPay
){
this
.
needPay
=
true
}
if
(
res
.
data
.
validateStartDate
){
this
.
form
.
validateStartDate
=
parseTime
(
res
.
data
.
validateStartDate
)
}
if
(
res
.
data
.
validateEndDate
){
this
.
form
.
validateEndDate
=
parseTime
(
res
.
data
.
validateEndDate
)
}
this
.
lineList
=
[
res
.
data
]
// 如果没有对应的阶梯价字段,则初始化一个
await
this
.
$nextTick
()
if
(
this
.
form
.
priceType
===
1
){
if
(
!
this
.
form
.
fullPriceStepList
?.
length
){
this
.
handleAddPrice
(
"
fullPriceStepList
"
,
"
all
"
)
}
}
else
{
if
(
!
this
.
form
.
clearancePriceStepList
?.
length
){
this
.
handleAddPrice
(
"
clearancePriceStepList
"
,
"
clearance
"
)
}
if
(
!
this
.
form
.
freightPriceStepList
?.
length
){
this
.
handleAddPrice
(
"
freightPriceStepList
"
,
"
transport
"
)
}
}
},
handleAddPrice
(
field
,
fieldPrefix
){
if
(
!
this
.
form
[
field
]){
this
.
$set
(
this
.
form
,
field
,
[])
}
let
priceUnit
=
DEFAULT_PRICE_UNIT
let
volumeUnit
=
DEFAULT_VOLUME_UNIT
let
weightUnit
=
DEFAULT_WEIGHT_UNIT
if
(
this
.
form
[
field
].
length
){
const
first
=
this
.
form
[
field
][
0
]
priceUnit
=
first
[
`
${
fieldPrefix
}
PriceUnit`
]
volumeUnit
=
first
[
`
${
fieldPrefix
}
VolumeUnit`
]
weightUnit
=
first
.
weightUnit
}
console
.
log
(
"
添加价格的默认单位
"
,
{
priceUnit
,
volumeUnit
,
weightUnit
})
this
.
form
[
field
].
push
({
[
`
${
fieldPrefix
}
PriceUnit`
]:
priceUnit
,
[
`
${
fieldPrefix
}
VolumeUnit`
]:
volumeUnit
,
weightUnit
:
weightUnit
,
specialList
:[]
})
},
handleDeletePrice
(
field
,
index
){
this
.
form
[
field
].
splice
(
index
,
1
)
},
handleUnitChange
(
stepPriceList
,
index
,
data
){
console
.
log
(
'
handleUnitChange
'
,
...
arguments
)
if
(
index
>
0
)
return
// 如果是重量单位,且不是清关费想换的,则需要同步最小起计量单位
if
(
data
.
field
===
'
weightUnit
'
&&
data
.
type
!=
'
clearance
'
){
this
.
form
.
minWeightUnit
=
data
.
value
}
stepPriceList
.
forEach
(
item
=>
{
item
[
data
.
field
]
=
data
.
value
if
(
item
.
packagingList
?.
length
){
item
.
packagingList
.
forEach
(
p
=>
{
p
[
data
.
field
]
=
data
.
value
})
}
if
(
item
.
specialList
?.
length
){
item
.
specialList
.
forEach
(
p
=>
{
p
[
data
.
field
]
=
data
.
value
})
}
})
},
// 获得用语提交的阶梯价副本
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
})
})
return
stepPriceList
},
// force 为是否强制提交,在价格过期的时候需要确认后强制提交
submitForm
(
force
=
false
)
{
this
.
$refs
[
"
form
"
].
validate
(
async
(
valid
)
=>
{
if
(
!
valid
)
{
return
;
}
if
(
!
this
.
lineList
.
length
&&
(
!
this
.
selectedRoutes
||
!
this
.
selectedRoutes
.
length
))
{
this
.
$message
.
error
(
this
.
$t
(
'
请选择线路
'
));
return
;
}
let
data
=
Object
.
assign
({},
this
.
form
,
{
isAllProduct
:
0
})
let
isValid
=
true
for
(
let
stepPrice
of
this
.
$refs
.
stepPrice
){
if
(
!
stepPrice
.
validate
()){
isValid
=
false
break
}
}
if
(
!
isValid
)
return
// 全包价
if
(
this
.
form
.
priceType
==
1
)
{
data
.
fullPriceStepList
=
this
.
getPriceList
(
this
.
form
.
fullPriceStepList
)
}
else
{
data
.
clearancePriceStepList
=
this
.
getPriceList
(
this
.
form
.
clearancePriceStepList
)
data
.
freightPriceStepList
=
this
.
getPriceList
(
this
.
form
.
freightPriceStepList
)
}
// 设置了有效期,且已过期则给提示
if
(
data
.
validateEndDate
&&
force
!==
true
){
let
validateEndDate
=
new
Date
(
data
.
validateEndDate
)
if
(
validateEndDate
.
getTime
()
<
Date
.
now
()){
return
this
.
$confirm
(
'
您设置的线路价格已过期,确定提交吗?
'
,
'
提示
'
,
{
confirmButtonText
:
'
确认提交
'
,
cancelButtonText
:
'
取消提交
'
,
type
:
'
warning
'
}).
then
(
res
=>
{
this
.
submitForm
(
true
)
})
}
}
// 修改单条路线
if
(
this
.
$route
.
query
.
action
==
'
update
'
)
{
this
.
loading
=
true
return
updateProductPriceAir
(
data
).
then
(
res
=>
{
this
.
$modal
.
msgSuccess
(
this
.
$t
(
"
请求成功
"
));
this
.
$tab
.
closePage
()
}).
finally
(
res
=>
this
.
loading
=
false
)
}
// 批量修改(单个商品的单个路线,多个路线,或者全部路线)的提交
if
(
this
.
$route
.
query
.
action
==
'
batchUpdate
'
)
{
// 指定一条路线
if
(
this
.
lineList
.
length
==
1
){
data
.
lineChannelList
=
{
lineId
:
this
.
lineList
[
0
].
warehouseLineId
,
shippingChannelId
:
this
.
lineList
[
0
].
shippingChannelId
||
0
}
}
// 指定多条路线的需要过滤未勾选的
else
if
(
this
.
lineList
.
length
>
1
){
data
.
lineChannelList
=
[]
this
.
lineList
.
forEach
(
item
=>
{
if
(
this
.
checkList
.
indexOf
(
item
.
id
)
>
-
1
){
data
.
lineChannelList
.
push
({
lineId
:
item
.
warehouseLineId
,
shippingChannelId
:
item
.
shippingChannelId
||
0
}
)
}
})
}
// 未指定路线的从路线选择组件里获取
if
(
!
this
.
lineList
.
length
){
data
.
lineChannelList
=
this
.
selectedRoutes
}
if
(
data
.
lineChannelList
.
length
<
1
){
return
this
.
$message
.
error
(
this
.
$t
(
'
请选择需要修改的路线
'
))
}
await
this
.
$confirm
(
this
.
$t
(
"
已选择{route}条路线,确认提交?
"
,
{
route
:
data
.
lineChannelList
.
length
}))
data
.
productIdList
=
[
this
.
form
.
productId
]
this
.
loading
=
true
batchUpdateProductPriceAir
(
data
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
this
.
$t
(
"
修改成功
"
));
this
.
$router
.
replace
(
'
/product/product-price?
'
+
(
new
URLSearchParams
(
this
.
$route
.
query
)).
toString
())
}).
finally
(
res
=>
this
.
loading
=
false
)
return
;
}
// 添加的提交
if
(
!
this
.
product
){
return
this
.
$message
.
error
(
this
.
$t
(
'
请选择商品
'
))
}
data
.
productId
=
this
.
product
.
id
;
data
.
lineChannelList
=
this
.
lineList
.
length
?
this
.
lineList
:
this
.
selectedRoutes
await
this
.
$confirm
(
this
.
$t
(
"
已选择{route}条路线,确认提交?
"
,
{
route
:
data
.
lineChannelList
.
length
}))
this
.
loading
=
true
createProductPriceAir
(
data
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
this
.
$t
(
"
请求成功
"
));
this
.
$router
.
replace
(
'
/lineProject/product-price?
'
+
(
new
URLSearchParams
(
this
.
$route
.
query
)).
toString
())
}).
finally
(
res
=>
this
.
loading
=
false
);
});
},
// 快捷设置,只更新默认运费
quickSet
(
data
){
// 字段,根据是否全包价来取
let
field
=
this
.
form
.
priceType
==
1
?
'
allPrice
'
:
'
transportPrice
'
// 取得要加的数额(减少则是负数)
let
amount
=
Decimal
(
data
.
plus
||
-
data
.
minus
)
this
.
form
.
priceStepList
.
forEach
(
item
=>
{
// 加上对应的价格,但是不能小于0
this
.
$set
(
item
,
field
,
Math
.
max
(
0
,
Decimal
(
item
[
field
]
||
0
).
plus
(
amount
).
toNumber
()))
})
},
/*// 添加区间价,field是阶梯价字段,fieldPrefix是价格字段前缀
addStepPrice(field, fieldPrefix){
console.log('addPrice', field, fieldPrefix)
let fields = {}
if(!this.form[field]) this.$set(this.form, field, [])
const obj = this.form[field][0] || {}
fields[fieldPrefix + 'PriceUnit'] = obj[fieldPrefix + 'PriceUnit']
fields[fieldPrefix + 'VolumeUnit'] = obj[fieldPrefix + 'VolumeUnit']
fields[fieldPrefix + 'Price'] = obj[fieldPrefix + 'Price']
this.form[field].push(fields)
},*/
showLogs
(){
if
(
!
this
.
$refs
.
logs
){
return
this
.
$message
.
error
(
"
未找到组件
"
)
}
this
.
$refs
.
logs
.
open
(
this
.
form
.
id
)
}
}
}
</
script
>
<
style
scoped
>
.w-100
{
width
:
100px
;
}
.mr10
{
margin-right
:
10px
;
}
</
style
>
src/views/ecw/productPrice/index.vue
View file @
c0f06559
...
...
@@ -4,7 +4,15 @@
<!-- 搜索工作栏 -->
<el-form
:model=
"queryParams"
ref=
"queryForm"
size=
"small"
:inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
:label=
"$t('商品名称')"
prop=
"titleZh"
v-if=
"!$route.query.product_id"
>
<el-input
v-model=
"queryParams.titleZh"
:placeholder=
"$t('请输入中英文名称、商品编码、海关编码')"
clearable
@
keyup.enter.native=
"handleQuery"
/>
<el-input
v-model=
"queryParams.titleZh"
:placeholder=
"$t('请输入中英文名称、商品编码、海关编码')"
clearable
@
keyup.enter.native=
"handleQuery"
>
<template
#prepend
>
<el-select
v-model=
"queryParams.searchType"
style=
"width: 100px"
>
<el-option
:value=
"1"
:label=
"$t('包含')"
></el-option>
<el-option
:value=
"2"
:label=
"$t('不包含')"
></el-option>
<el-option
:value=
"3"
:label=
"$t('等于')"
></el-option>
</el-select>
</
template
>
</el-input>
</el-form-item>
<el-form-item
:label=
"$t('商品类型')"
prop=
"typeId"
v-if=
"!$route.query.product_id"
>
...
...
@@ -58,7 +66,12 @@
<el-option
:label=
"$t('否')"
value=
"0"
></el-option>
</el-select>
</el-form-item>
<el-form-item
:label=
"$t('单价模式')"
prop=
"priceType"
>
<el-select
v-model=
"queryParams.priceType"
:placeholder=
"$t('请选择')"
clearable
>
<el-option
:label=
"$t('运费+清关费')"
value=
"0"
></el-option>
<el-option
:label=
"$t('全包价')"
value=
"1"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
@
click=
"handleQuery"
>
{{$t('搜索')}}
</el-button>
<el-button
icon=
"el-icon-refresh"
@
click=
"resetQuery"
>
{{$t('重置')}}
</el-button>
...
...
@@ -393,6 +406,7 @@ export default {
dateRangeCreateTime
:
[],
// 查询参数
queryParams
:
{
searchType
:
1
,
pageNo
:
1
,
pageSize
:
10
,
productId
:
null
,
...
...
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