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
e37948e3
Commit
e37948e3
authored
Dec 27, 2023
by
dragondean@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提取价格日志和快捷设置组件
parent
79f0954e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1107 additions
and
0 deletions
+1107
-0
Logs.vue
src/views/ecw/productPrice/components/Logs.vue
+130
-0
QuickSet.vue
src/views/ecw/productPrice/components/QuickSet.vue
+59
-0
editAir.vue
src/views/ecw/productPrice/editAir.vue
+918
-0
No files found.
src/views/ecw/productPrice/components/Logs.vue
0 → 100644
View file @
e37948e3
<
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/QuickSet.vue
0 → 100644
View file @
e37948e3
<
script
>
import
Selector
from
"
@/components/Selector/index.vue
"
;
export
default
{
name
:
"
QuickSet.vue
"
,
props
:{
unitList
:{
type
:
Array
,
default
:
[]
},
currencyList
:{
type
:
Array
,
default
:
[]
},
currencyAndUnit
:
{
type
:
Object
,
default
:()
=>
{
return
{
currency
:
null
,
unit
:
null
}
}
},
},
components
:
{
Selector
},
data
(){
return
{
quickForm
:{},
// 快速加价/减价表单
}
}
}
</
script
>
<
template
>
<dv>
<h2>
{{
$t
(
'
快捷设置
'
)
}}
</h2>
<div
class=
"flex items-center"
>
{{
$t
(
'
批量加价
'
)
}}
+
<el-input
v-model=
"quickForm.plus"
class=
"w-100 ml-10 mr-10"
:disabled=
"!!quickForm.minus"
></el-input>
<selector
disabled
v-model=
"currencyAndUnit.currency"
:options=
"currencyList"
:label-field=
"$l('title')"
value-field=
"id"
class=
"w-100"
/>
/
<selector
disabled
v-model=
"currencyAndUnit.unit"
:options=
"unitList"
:label-field=
"$l('title')"
value-field=
"id"
class=
"w-100"
/>
<div
class=
"ml-10"
>
{{
$t
(
'
*针对所有价格加价
'
)
}}
</div>
</div>
<div
class=
"flex items-center mt-10"
>
{{
$t
(
'
批量减价
'
)
}}
-
<el-input
v-model=
"quickForm.minus"
class=
"w-100 ml-10 mr-10"
:disabled=
"!!quickForm.plus"
></el-input>
<selector
disabled
v-model=
"currencyAndUnit.currency"
:options=
"currencyList"
:label-field=
"$l('title')"
value-field=
"id"
class=
"w-100"
/>
/
<selector
disabled
v-model=
"currencyAndUnit.unit"
:options=
"unitList"
:label-field=
"$l('title')"
value-field=
"id"
class=
"w-100"
/>
<div
class=
"ml-10"
>
{{
$t
(
'
*针对所有价格减价
'
)
}}
</div>
</div>
<div
class=
"mt-10"
>
<el-button
@
click=
"$emit('confirm', quickForm)"
type=
"primary"
:disabled=
"!quickForm.plus && !quickForm.minus"
>
{{
$t
(
'
确定
'
)
}}
</el-button>
</div>
</dv>
</
template
>
<
style
scoped
lang=
"scss"
>
</
style
>
src/views/ecw/productPrice/editAir.vue
0 → 100644
View file @
e37948e3
<
template
>
<div
class=
"app-container"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
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
v-if=
"type === 'air'"
:label=
"$t('出货渠道')"
>
{{channel ? $l(channel, 'name') : '/'}}
</el-form-item>
</template>
<!--有路线则不显示路线选择器-->
<routers-selector
v-else
v-model=
"selectedRoutes"
:option=
"routerOption"
:type=
"type"
/>
<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>
<!--空运只有阶梯价格,所以不显示勾选-->
<el-checkbox
label=
""
v-model=
"stepPrice"
v-if=
"type != 'air'"
>
{{$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`"
>
<inputor
default2=
"0"
v-model.number=
"form.minWeight"
type=
"number"
class=
"w-100"
:rules=
"{validator: priceValidator, trigger: 'blur', message: '数量错误'}"
/>
/
<selector
v-model=
"form.minWeightUnit"
:options=
"unitList"
:label-field=
"$l(null, 'title')"
value-field=
"id"
defaultable2
class=
"w-100"
disabled
/>
</el-form-item>
<!--阶梯定价-->
<
template
v-if=
"form.stepPrice==1"
>
<div
v-for=
"(item, index) in form.priceStepList"
:key=
"index"
>
<div
style=
"font-size:14px; margin:10px 0"
>
{{
$t
(
'
第{index
}
阶梯定价方案
'
,
{
index
:
index
+
1
}
)
}}
:
<
template
v
-
if
=
"
index == form.priceStepList.length - 1 && !readonly
"
>
<
el
-
link
type
=
"
primary
"
@
click
.
native
=
"
addStepPrice
"
>
{{
$t
(
'
添加区间
'
)
}}
<
/el-link
>
<
el
-
divider
direction
=
"
vertical
"
><
/el-divider
>
<
el
-
link
type
=
"
danger
"
@
click
.
native
=
"
form.priceStepList.splice(index, 1)
"
>
{{
$t
(
'
删除
'
)
}}
<
/el-link
>
<
/template
>
<
/div
>
<
el
-
form
-
item
:
label
=
"
$t('第{index
}
阶梯', {index: index + 1
}
)
"
>
<
el
-
input
v
-
model
=
"
item.startNum
"
type
=
"
number
"
placeholder
=
""
class
=
"
w-100
"
><
/el-input
>
-
<
el
-
input
v
-
model
=
"
item.endNum
"
type
=
"
number
"
placeholder
=
""
class
=
"
w-100
"
><
/el-input
>
/
<
selector
:
disabled
=
"
index > 0
"
@
input
=
"
syncAllUnit
"
v
-
model
=
"
item.weightUnit
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"
$t('默认运费')
"
v
-
if
=
"
form.priceType != 1
"
:
prop
=
"
`priceStepList.${index
}
.transportPrice`
"
:
rules
=
"
{validator: priceValidator, trigger: 'blur', message: '价格错误'
}
"
>
<
inputor
default2
=
"
0
"
v
-
model
.
number
=
"
item.transportPrice
"
type
=
"
number
"
:
placeholder
=
"
$t('整数或者两位小数')
"
class
=
"
w-100 mr-10
"
/>
<
selector
:
disabled
=
"
index > 0
"
@
input
=
"
syncAllUnit
"
v
-
model
=
"
item.transportPriceUnit
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
/ <selector :disabled="index > 0" @input="syncAllUnit" v-model="item.transportVolumeUnit" :options="unitList" :label-field="$l
(
null, 'title'
)
" value-field="id" class="w-100" /
>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"
$t('默认清关费')
"
v
-
if
=
"
form.priceType != 1 && type != 'air'
"
:
prop
=
"
`priceStepList.${index
}
.transportPrice`
"
:
rules
=
"
{validator: priceValidator, trigger: 'blur', message: '价格错误'
}
"
>
<
inputor
default2
=
"
0
"
v
-
model
.
number
=
"
item.clearancePrice
"
type
=
"
number
"
:
placeholder
=
"
$t('整数或者两位小数')
"
class
=
"
w-100 mr-10
"
:
rules
=
"
{validator: priceValidator, trigger: 'blur', message: '价格错误'
}
"
/>
<
selector
:
disabled
=
"
index > 0
"
@
input
=
"
syncAllUnit
"
v
-
model
=
"
item.clearancePriceUnit
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
/ <selector disabled @input="syncAllUnit" v-model="item.clearanceVolumeUnit" :options="unitList" :label-field="$l
(
null, 'title'
)
" value-field="id" class="w-100" /
>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"
$t('默认全包价')
"
v
-
if
=
"
form.priceType == 1
"
:
prop
=
"
`priceStepList.${index
}
.allPrice`
"
:
rules
=
"
{validator: priceValidator, trigger: 'blur', message: '价格错误'
}
"
>
<
selector
:
disabled
=
"
index > 0
"
@
input
=
"
syncAllUnit
"
v
-
model
=
"
item.allPriceUnit
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
<
inputor
default2
=
"
0
"
v
-
model
.
number
=
"
item.allPrice
"
type
=
"
number
"
:
placeholder
=
"
$t('整数或者两位小数')
"
class
=
"
w-100 ml-10
"
:
rules
=
"
{validator: priceValidator, trigger: 'blur', message: '价格错误'
}
"
/>
/ <selector :disabled="index > 0" @input="syncAllUnit" v-model="item.allVolumeUnit" :options="unitList" :label-field="$l
(
null, 'title'
)
" value-field="id" class="w-100" /
>
<
/el-form-item
>
<
/div
>
<
/template
>
<
template
v
-
else
>
<
el
-
form
-
item
:
label
=
"
$t('默认全包价')
"
v
-
if
=
"
form.priceType == 1
"
prop
=
"
allPrice
"
:
rules
=
"
{validator: priceValidator, trigger: 'blur', message: '价格错误'
}
"
>
<
selector
test
=
"
allPriceUnit
"
v
-
model
=
"
form.allPriceUnit
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l('title')
"
value
-
field
=
"
id
"
class
=
"
w-100 mr-10 aaa
"
/>
<
inputor
default2
=
"
0
"
v
-
model
.
number
=
"
form.allPrice
"
type
=
"
number
"
:
placeholder
=
"
$t('整数或者两位小数')
"
class
=
"
w-100 mr10
"
/>
<
span
class
=
"
mr-10
"
>
/</
span
>
<
selector
v
-
model
=
"
form.allVolumeUnit
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l('title')
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
<
/el-form-item
>
<
template
v
-
else
>
<
el
-
form
-
item
:
label
=
"
$t('默认运费')
"
prop
=
"
transportPrice
"
:
rules
=
"
{validator: priceValidator, trigger: 'blur', message: '价格错误'
}
"
>
<
selector
v
-
model
=
"
form.transportPriceUnit
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l('title')
"
value
-
field
=
"
id
"
class
=
"
w-100 mr-10
"
/>
<
inputor
default2
=
"
0
"
v
-
model
.
number
=
"
form.transportPrice
"
type
=
"
number
"
:
placeholder
=
"
$t('整数或者两位小数')
"
class
=
"
w-100 mr-10
"
/>
<
span
class
=
"
mr-10
"
>
/</
span
>
<
selector
v
-
model
=
"
form.transportVolumeUnit
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l('title')
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
<
/el-form-item
>
<
el
-
form
-
item
v
-
if
=
"
type != 'air'
"
:
label
=
"
$t('默认清关费')
"
prop
=
"
clearancePrice
"
:
rules
=
"
{validator: priceValidator, trigger: 'blur', message: '价格错误'
}
"
>
<
selector
v
-
model
=
"
form.clearancePriceUnit
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l('title')
"
value
-
field
=
"
id
"
class
=
"
w-100 mr-10
"
/>
<
inputor
default2
=
"
0
"
v
-
model
.
number
=
"
form.clearancePrice
"
type
=
"
number
"
:
placeholder
=
"
$t('整数或者两位小数')
"
class
=
"
w-100 mr-10
"
/>
<
span
class
=
"
mr-10
"
>
/</
span
>
<
selector
disabled
v
-
model
=
"
form.clearanceVolumeUnit
"
:
options
=
"
unitList
"
:
label
-
field
=
"
$l('title')
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
<
/el-form-item
>
<
/template
>
<
/template
>
<!--
特需
-->
<
template
v
-
if
=
"
form.priceType==1
"
>
<
el
-
form
-
item
v
-
for
=
"
(special, specialIndex) in this.form.specialList
"
:
label
=
"
getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('全包价')
"
:
key
=
"
specialIndex + 'transport'
"
:
prop
=
"
`specialList.${specialIndex
}
`.allPrice
"
:
rules
=
"
{validator: priceValidator, trigger: 'blur', message: '价格错误'
}
"
>
<
selector
disabled
v
-
model
=
"
special.allPriceUnit
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
defaultable2
class
=
"
w-100 mr-10
"
/>
<
inputor
default2
=
"
0
"
v
-
model
.
number
=
"
special.allPrice
"
type
=
"
number
"
:
placeholder
=
"
$t('整数或者两位小数')
"
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
>
<
/template
>
<
template
v
-
else
v
-
for
=
"
(special, specialIndex) in this.form.specialList
"
>
<
el
-
form
-
item
:
label
=
"
getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('运费')
"
:
key
=
"
specialIndex + 'transport'
"
:
prop
=
"
`specialList.${specialIndex
}
.transportPrice`
"
:
rules
=
"
{validator: priceValidator, trigger: 'blur', message: '价格错误'
}
"
>
<
selector
disabled
v
-
model
=
"
special.transportPriceUnit
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
defaultable2
class
=
"
w-100 mr-10
"
/>
<
inputor
default2
=
"
0
"
v
-
model
.
number
=
"
special.transportPrice
"
type
=
"
number
"
:
placeholder
=
"
$t('整数或者两位小数')
"
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
=
"
type != 'air'
"
:
label
=
"
getDictDataLabel(DICT_TYPE.ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS, special.specialDictType) + $t('清关费')
"
:
key
=
"
specialIndex + 'clearance'
"
:
prop
=
"
`specialList.${specialIndex
}
.clearancePrice`
"
:
rules
=
"
{validator: priceValidator, trigger: 'blur', message: '价格错误'
}
"
>
<
selector
disabled
v
-
model
=
"
special.clearancePriceUnit
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l(null, 'title')
"
value
-
field
=
"
id
"
defaultable2
class
=
"
w-100 mr-10
"
/>
<
inputor
default2
=
"
0
"
v
-
model
.
number
=
"
special.clearancePrice
"
type
=
"
number
"
:
placeholder
=
"
$t('整数或者两位小数')
"
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
>
<
/template
>
<
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-col
>
<!--
编辑的时候右侧显示快捷设置,查看的时候空运显示商品清关费
-->
<
el
-
col
:
span
=
"
12
"
v
-
if
=
"
!readonly
"
>
<!--
<
h2
>
{{
$t
(
'
快捷设置
'
)
}}
<
/h2
>
<
div
class
=
"
flex items-center
"
>
{{
$t
(
'
批量加价
'
)
}}
+
<
el
-
input
v
-
model
=
"
quickForm.plus
"
class
=
"
w-100 ml-10 mr-10
"
:
disabled
=
"
!!quickForm.minus
"
><
/el-input
>
<
selector
disabled
v
-
model
=
"
currencyAndUnit.currency
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l('title')
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
/ <selector disabled v-model="currencyAndUnit.unit" :options="unitList" :label-field="$l
(
'title'
)
" value-field="id" class="w-100" /
>
<
div
class
=
"
ml-10
"
>
{{
$t
(
'
*针对所有价格加价
'
)
}}
<
/div
>
<
/div
>
<
div
class
=
"
flex items-center mt-10
"
>
{{
$t
(
'
批量减价
'
)
}}
-
<
el
-
input
v
-
model
=
"
quickForm.minus
"
class
=
"
w-100 ml-10 mr-10
"
:
disabled
=
"
!!quickForm.plus
"
><
/el-input
>
<
selector
disabled
v
-
model
=
"
currencyAndUnit.currency
"
:
options
=
"
currencyList
"
:
label
-
field
=
"
$l('title')
"
value
-
field
=
"
id
"
class
=
"
w-100
"
/>
/ <selector disabled v-model="currencyAndUnit.unit" :options="unitList" :label-field="$l
(
'title'
)
" value-field="id" class="w-100" /
>
<
div
class
=
"
ml-10
"
>
{{
$t
(
'
*针对所有价格减价
'
)
}}
<
/div
>
<
/div
>
<
div
class
=
"
mt-10
"
>
<
el
-
button
@
click
=
"
quickSet
"
type
=
"
primary
"
:
disabled
=
"
!quickForm.plus && !quickForm.minus
"
>
{{
$t
(
'
确定
'
)
}}
<
/el-button
>
<
/div>--
>
<
quick
-
set
:
currency
-
and
-
unit
=
"
currencyAndUnit
"
:
unit
-
list
=
"
unitList
"
:
currency
-
list
=
"
currencyList
"
@
confirm
=
"
quickSet
"
><
/quick-set
>
<
/el-col
>
<!--
甲方要求不显示清关费
https
:
//zentao.test.jdshangmen.com/bug-view-5298.html
-->
<!--
<
el
-
col
:
span
=
"
12
"
v
-
else
-
if
=
"
readonly && type === 'air'
"
>
&
lt
;
!&
ndash
;
商品清关费
&
ndash
;
&
gt
;
<
h2
>
{{
$t
(
'
商品清关费价格
'
)
}}
<
/h2
>
<
packaging
-
type
v
-
if
=
"
product && product.priceStepClearanceList && product.priceStepClearanceList.length
"
:
value
=
"
product
"
key
-
arr
=
"
priceStepClearanceList
"
readonly
/>
<
div
v
-
else
>
{{
$t
(
'
未设置清关费
'
)
}}
<
/div
>
<
/el-col>--
>
<
/el-row
>
<
/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
>
<!--
空运不显示这几个字段
-->
<
template
v
-
if
=
"
type != 'air'
"
>
<
el
-
form
-
item
:
label
=
"
$t('每日入仓上限')
"
prop
=
"
dayLimit
"
v
-
if
=
"
form.needBook == 1
"
>
<
el
-
input
v
-
model
.
number
=
"
form.dayLimit
"
type
=
"
number
"
class
=
"
w-100
"
/>
{{
$t
(
'
立方米
'
)
}}
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"
$t('货柜位置')
"
prop
=
"
containerLocation
"
>
<
dict
-
selector
:
type
=
"
DICT_TYPE.ECW_CONTAINER_LOCATION
"
v
-
model
=
"
form.containerLocation
"
/>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"
$t('订单方数上限')
"
prop
=
"
square
"
>
<
el
-
input
v
-
model
.
number
=
"
form.square
"
type
=
"
number
"
style
=
"
width:200px
"
/>
<
/el-form-item
>
<
/template
>
<
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
>
<
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
}
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
"
;
export
default
{
components
:
{
Logs
,
QuickSet
,
PackagingType
,
RoutersSelector
,
ProductSelector
,
Selector
,
Inputor
}
,
filters
:
{
parseTime
}
,
data
()
{
return
{
checkList
:
[],
selectedRoutes
:
[],
// 勾选的路线渠道
form
:
{
minWeightUnit
:
0
,
priceStepList
:
[],
// 阶梯价格
specialList
:
[],
// 是否单询,默认否
needOrderInquiry
:
'
0
'
}
,
needPay
:
false
,
// 是否需要预付
stepPrice
:
false
,
// 是否阶梯订单
// specialProducts: [],
// priceStepList: [
{
}
,{
}
],
// 阶梯价格
// specialList:[], // 特殊需求,默认四个
rules
:
{
transportPrice
:
[{
required
:
true
,
message
:
this
.
$t
(
"
海运费不能为空
"
),
trigger
:
"
blur
"
}
],
clearancePrice
:
[{
required
:
true
,
message
:
this
.
$t
(
"
清关费不能为空
"
),
trigger
:
"
blur
"
}
],
advanceStatus
:
[{
required
:
true
,
message
:
this
.
$t
(
"
是否预付不能为空
"
),
trigger
:
"
blur
"
}
]
}
,
product
:
null
,
/* productType: null, */
currencyList
:
[],
unitList
:
[],
productTypeList
:
[],
productDisabled
:
true
,
readonly
:
false
,
lineList
:
[],
//路线数组
loading
:
false
,
// showLogsDialog: false, // 显示价格日志弹层
// logs: [],
// 批量加价/减价
// quickForm:
{
}
,
// 快速加价/减价表单
// 渠道信息
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
,
fields
=
null
// 如果是阶梯价格则取第一阶梯,否则就取form中的字段
let
obj
=
this
.
form
.
stepPrice
==
1
?
(
this
.
form
.
priceStepList
[
0
]
||
{
}
)
:
this
.
form
// 全包价
if
(
this
.
form
.
priceType
==
1
){
currency
=
obj
.
allPriceUnit
unit
=
obj
.
allVolumeUnit
}
else
{
currency
=
obj
.
transportPriceUnit
unit
=
obj
.
transportVolumeUnit
}
return
{
currency
,
unit
}
}
,
// 类型,默认海运sea,air表示空运
type
(){
return
this
.
$route
.
path
.
split
(
/
[
-_
]
/
).
pop
()
}
,
}
,
watch
:
{
showLogsDialog
(
showLogsDialog
){
if
(
showLogsDialog
){
this
.
laodLogs
()
}
}
,
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
(
val
)
{
if
(
!
val
)
return
// 特殊需求回显
if
(
val
.
specialList
)
{
val
.
specialList
.
forEach
(
item
=>
{
let
index
=
this
.
form
.
specialList
.
findIndex
(
special
=>
special
.
specialDictType
==
item
.
specialDictType
)
if
(
index
>
-
1
)
this
.
form
.
specialList
[
index
]
=
item
}
)
}
}
,
'
form.priceType
'
(
priceType
){
// 切换全包价的时候给默认货币单位,如果是回填则不需要给默认值
if
(
priceType
==
1
&&
!
this
.
form
.
allPrice
){
this
.
$set
(
this
.
form
,
'
allPriceUnit
'
,
1
)
}
this
.
syncAllUnit
(
'
watch:form.priceType
'
)
}
,
'
form.minWeightUnit
'
(
minWeightUnit
){
console
.
log
(
'
最小起计量单位
'
,
minWeightUnit
)
}
,
'
form.transportVolumeUnit
'
(
transportVolumeUnit
){
// 最小其计量
this
.
$set
(
this
.
form
,
'
minWeightUnit
'
,
transportVolumeUnit
)
this
.
syncSpecialUnit
({
transportVolumeUnit
}
)
this
.
form
.
clearanceVolumeUnit
=
transportVolumeUnit
// 清关费体积单位同步运费体积单位
}
,
'
form.clearanceVolumeUnit
'
(
clearanceVolumeUnit
){
this
.
syncSpecialUnit
({
clearanceVolumeUnit
}
)
}
,
'
form.transportPriceUnit
'
(
transportPriceUnit
){
this
.
syncSpecialUnit
({
transportPriceUnit
}
)
}
,
'
form.clearancePriceUnit
'
(
clearancePriceUnit
){
this
.
syncSpecialUnit
({
clearancePriceUnit
}
)
}
,
'
form.allPriceUnit
'
(
allPriceUnit
){
this
.
syncSpecialUnit
({
allPriceUnit
}
)
}
,
'
form.allVolumeUnit
'
(
allVolumeUnit
){
// 最小起计量
this
.
$set
(
this
.
form
,
'
minWeightUnit
'
,
allVolumeUnit
)
this
.
syncSpecialUnit
({
allVolumeUnit
}
)
}
,
'
form.needBook
'
(
val
){
if
(
val
)
this
.
$set
(
this
.
form
,
'
dayLimit
'
,
10000
)
else
delete
this
.
form
.
dayLimit
}
,
'
form.stepPrice
'
(
stepPrice
){
if
(
stepPrice
==
1
&&
(
!
this
.
form
.
priceStepList
||
!
this
.
form
.
priceStepList
.
length
)){
this
.
$set
(
this
.
form
,
'
priceStepList
'
,
[{
}
,{
}
])
}
this
.
syncAllUnit
(
'
watch:form.stepPrice
'
)
this
.
stepPrice
=
!!
stepPrice
}
,
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
}
if
(
this
.
type
==
'
air
'
){
this
.
stepPrice
=
true
}
const
defaultVolumeUnit
=
this
.
type
===
'
air
'
?
6
:
7
const
defaultPriceUnit
=
1
// action=batchUpdate 表示批量修改单个商品的价格(一条或者多条),如果没有ids显示路线选择组件,否则不显示路线组件
// action=update 表示修改单个商品的单条路线价格,需要回显
if
(
this
.
$route
.
query
.
action
==
'
update
'
){
let
res
=
await
getProductPrice
(
this
.
$route
.
query
.
id
)
this
.
$set
(
this
,
'
form
'
,
res
.
data
)
if
(
this
.
form
.
needPay
){
this
.
needPay
=
true
}
if
(
this
.
form
.
stepPrice
==
1
){
this
.
stepPrice
=
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
]
// 如果是阶梯价格,但是一个阶梯价都没有(异常数据),则默认给两个阶梯价
if
(
this
.
form
.
stepPrice
==
1
&&
(
!
this
.
form
.
priceStepList
||
!
this
.
form
.
priceStepList
.
length
)){
const
defaultStep
=
this
.
form
.
priceType
==
1
?
{
allPriceUnit
:
defaultPriceUnit
,
allVolumeUnit
:
defaultVolumeUnit
,
weightUnit
:
defaultVolumeUnit
}
:
{
transportVolumeUnit
:
defaultVolumeUnit
,
transportPriceUnit
:
defaultPriceUnit
,
weightUnit
:
defaultVolumeUnit
}
console
.
log
(
'
阶梯价没有阶梯信息,默认给两个
'
,
{...
defaultStep
}
)
this
.
$set
(
this
.
form
,
'
priceStepList
'
,
[{...
defaultStep
}
,{...
defaultStep
}
])
}
}
// 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
}
// 获取类型列表
getProductTypeList
().
then
(
res
=>
this
.
productTypeList
=
res
.
data
)
// 没有操作标识的就是新建,给有效期默认值
if
(
!
this
.
$route
.
query
.
action
){
this
.
form
=
{
priceType
:
0
,
// 空运则默认是阶梯价格
stepPrice
:
this
.
type
==
'
air
'
?
1
:
0
,
advanceStatus
:
0
,
needBook
:
0
,
specialList
:
[],
priceStepList
:
this
.
type
===
'
air
'
?
[{
}
,{
}
]
:
[],
// dayLimit: 10000,
validateEndDate
:
undefined
,
validateStartDate
:
undefined
,
clearancePrice
:
0
,
transportPrice
:
0
,
minWeight
:
0
,
minWeightUnit
:
null
,
// 是否单询,默认否
needOrderInquiry
:
0
}
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
}
}
if
(
!
this
.
$route
.
query
.
action
||
this
.
$route
.
query
.
action
==
'
batchUpdate
'
){
this
.
$nextTick
(()
=>
{
// 默认体积单位,空运为千克,海运为立方米
console
.
log
(
'
指定默认单位
'
,
this
.
type
===
'
air
'
?
6
:
7
)
this
.
setDefaultVolumeUnit
(
this
.
type
===
'
air
'
?
6
:
7
)
// 默认货币单位(美元)
this
.
setDefaultPriceUnit
(
1
)
// 空运默认的阶梯重量单位是千克
if
(
this
.
type
===
'
air
'
){
this
.
$set
(
this
.
form
.
priceStepList
[
0
],
'
weightUnit
'
,
6
)
}
}
)
}
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
.
type
==
'
air
'
){
getChannel
(
this
.
form
.
shippingChannelId
).
then
(
res
=>
{
this
.
channel
=
res
.
data
}
)
}
getCurrencyList
().
then
(
res
=>
this
.
currencyList
=
res
.
data
)
getUnitList
().
then
(
res
=>
this
.
unitList
=
res
.
data
)
this
.
getDictDatas
(
this
.
DICT_TYPE
.
ECW_SPECIAL_REQ_FOR_LINE_PRODUCTS
).
forEach
(
item
=>
{
if
(
!
this
.
form
.
specialList
.
find
(
special
=>
special
.
specialDictType
==
item
.
value
)){
this
.
form
.
specialList
.
push
({
"
clearancePrice
"
:
!
this
.
$route
.
query
.
action
?
0
:
null
,
// 新建默认给0,否则默认是null
"
clearancePriceUnit
"
:
null
,
"
clearanceVolumeUnit
"
:
null
,
"
specialDictType
"
:
item
.
value
,
"
transportPrice
"
:
!
this
.
$route
.
query
.
action
?
0
:
null
,
// 新建默认给0,否则默认是null
"
transportPriceUnit
"
:
null
,
"
transportVolumeUnit
"
:
null
,
}
)
}
}
)
}
,
methods
:
{
// 同步全部单位
syncAllUnit
(
from
){
let
obj
=
this
.
form
.
stepPrice
==
1
?
this
.
form
.
priceStepList
[
0
]
:
this
.
form
let
fields
=
{
}
// 全包价
if
(
this
.
form
.
priceType
==
1
){
fields
=
{
allPriceUnit
:
obj
[
'
allPriceUnit
'
],
allVolumeUnit
:
obj
[
'
allVolumeUnit
'
]
}
}
else
{
fields
=
{
transportPriceUnit
:
obj
.
transportPriceUnit
,
transportVolumeUnit
:
obj
.
transportVolumeUnit
,
clearancePriceUnit
:
obj
.
clearancePriceUnit
,
clearanceVolumeUnit
:
obj
.
transportVolumeUnit
,
// 清关费和运费的体积单位同步
}
}
// 阶梯价还需要同步阶梯的重量单位
if
(
this
.
form
.
stepPrice
==
1
){
fields
[
'
weightUnit
'
]
=
obj
.
weightUnit
}
console
.
log
(
'
-> 同步特需单位
'
,
fields
,
{
from
}
)
this
.
syncSpecialUnit
(
fields
)
}
,
// 同步特需的货币单位和体积单位
syncSpecialUnit
(
obj
){
console
.
log
(
'
syncSpecialUnit
'
,
obj
)
if
(
!
obj
)
return
// 同步特需单位
this
.
form
.
specialList
.
forEach
(
item
=>
{
Object
.
assign
(
item
,
obj
)
}
)
// 如果是阶梯价则需要同步其他阶梯
if
(
this
.
form
.
stepPrice
==
1
&&
this
.
form
.
priceStepList
){
this
.
form
.
priceStepList
.
forEach
((
item
,
index
)
=>
{
this
.
$set
(
this
.
form
.
priceStepList
,
index
,
Object
.
assign
(
item
,
obj
))
}
)
}
// 不是阶梯价需要 同步最小起计量
if
(
obj
[
'
transportVolumeUnit
'
]
||
obj
[
'
allVolumeUnit
'
]){
this
.
$set
(
this
.
form
,
'
minWeightUnit
'
,
obj
[
'
transportVolumeUnit
'
]
||
obj
[
'
allVolumeUnit
'
])
}
}
,
priceValidator
(
rule
,
value
,
callback
){
if
(
!
value
||
value
==
''
)
return
callback
()
value
=
parseFloat
(
value
)
if
(
!
value
||
value
<
0
){
return
callback
(
new
Error
(
'
价格错误
'
))
}
callback
()
}
,
setDefaultVolumeUnit
(
unit
){
console
.
log
(
'
设置默认体积单位
'
,
unit
)
this
.
$set
(
this
.
form
,
'
transportVolumeUnit
'
,
unit
)
this
.
$set
(
this
.
form
,
'
clearanceVolumeUnit
'
,
unit
)
this
.
$set
(
this
.
form
,
'
allVolumeUnit
'
,
unit
)
}
,
setDefaultPriceUnit
(
priceUnit
){
console
.
log
(
'
设置默认价格单位
'
,
priceUnit
)
this
.
$set
(
this
.
form
,
'
transportPriceUnit
'
,
priceUnit
)
this
.
$set
(
this
.
form
,
'
clearancePriceUnit
'
,
priceUnit
)
this
.
$set
(
this
.
form
,
'
allPriceUnit
'
,
priceUnit
)
}
,
// force 为是否强制提交,在价格过期的时候需要确认后强制提交
submitForm
(
force
=
false
)
{
this
.
$refs
[
"
form
"
].
validate
(
async
(
valid
)
=>
{
if
(
!
valid
)
{
return
;
}
// 只有修改单条路线的时候,不需要选择路线
/* if (this.$route.query.action !== 'update' && (!this.selectedRoutes || !this.selectedRoutes.length)) {
this.$message.error('请选择线路');
return;
}
*/
if
(
!
this
.
lineList
.
length
&&
(
!
this
.
selectedRoutes
||
!
this
.
selectedRoutes
.
length
))
{
this
.
$message
.
error
(
this
.
$t
(
'
请选择线路
'
));
return
;
}
let
data
=
Object
.
assign
({
}
,
this
.
form
,
{
// lineChannelList: this.selectedRoutes,
// specialList: this.specialProducts,
isAllProduct
:
0
}
)
if
(
this
.
form
.
stepPrice
!=
1
){
// data.priceStepList = this.priceStepList
delete
data
.
priceStepList
// 非阶梯价格判断是否运费(全包价是否为空)
if
((
this
.
form
.
priceType
==
0
&&
!
this
.
form
.
transportPrice
)
||
(
this
.
form
.
priceType
==
1
&&
!
this
.
form
.
allPrice
)){
return
this
.
$message
.
error
(
this
.
$t
(
'
运费/全包价不能为0
'
))
}
}
else
{
// 全包价 的阶段 设置和运费(全包价)不能为空
let
stepPriceEmpty
=
[]
this
.
form
.
priceStepList
.
forEach
((
item
,
index
)
=>
{
let
notEmptyFields
=
[
'
endNum
'
,
'
weightUnit
'
]
// 第一条阶梯的起始值可以是0,其他的不能为0
if
(
index
){
notEmptyFields
.
push
(
'
startNum
'
)
}
notEmptyFields
.
forEach
(
field
=>
{
// 第一个阶梯的起始值不判断0
if
(
index
===
0
&&
field
==
'
startNum
'
&&
item
[
field
]
==
0
)
return
if
(
!
item
[
field
]
||
item
[
field
].
toString
().
trim
()
==
''
){
stepPriceEmpty
.
push
({
index
,
field
}
)
}
}
)
if
((
this
.
form
.
priceType
==
0
&&
!
item
.
transportPrice
)
||
(
this
.
form
.
priceType
==
1
&&
!
item
.
allPrice
)){
stepPriceEmpty
.
push
({
index
,
field
:
!
item
.
transportPrice
?
'
transportPrice
'
:
'
allPrice
'
}
)
}
}
)
if
(
stepPriceEmpty
.
length
){
console
.
log
(
'
stepPriceEmpty
'
,
stepPriceEmpty
)
return
this
.
$message
.
error
(
this
.
$t
(
'
阶梯和价格设置不能留空
'
))
}
}
// 设置了有效期,且已过期则给提示
if
(
this
.
form
.
validateEndDate
&&
force
!==
true
){
let
validateEndDate
=
new
Date
(
this
.
form
.
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
updateProductPrice
(
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
batchUpdateProductPrice
(
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
}
))
// 空运且不是全包价的清关费用0填充
if
(
this
.
type
==
'
air
'
&&
this
.
form
.
priceType
==
0
){
// 根据是否全包价确定字段
data
.
priceStepList
.
forEach
(
item
=>
{
item
.
clearancePrice
=
item
.
clearancePrice
||
0
}
)
}
this
.
loading
=
true
createProductPrice
(
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
);
}
);
}
,
closeLogsDialog
(){
this
.
showLogsDialog
=
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
()))
}
)
}
,
// 添加区间价
addStepPrice
(){
let
fields
=
{
}
const
obj
=
this
.
form
.
priceStepList
[
0
]
||
{
}
if
(
this
.
form
.
priceType
==
1
){
fields
=
{
allPriceUnit
:
obj
[
'
allPriceUnit
'
],
allVolumeUnit
:
obj
[
'
allVolumeUnit
'
]
}
}
else
{
fields
=
{
transportPriceUnit
:
obj
.
transportPriceUnit
,
transportVolumeUnit
:
obj
.
transportVolumeUnit
,
clearancePriceUnit
:
obj
.
clearancePriceUnit
,
clearanceVolumeUnit
:
obj
.
transportVolumeUnit
,
}
}
this
.
form
.
priceStepList
.
push
(
fields
)
}
,
showLogs
(){
if
(
!
this
.
$refs
.
logs
){
return
this
.
$message
.
error
(
"
未找到组件
"
)
}
this
.
$refs
.
logs
.
open
(
this
.
form
.
id
)
}
}
}
<
/script
>
<
style
scoped
>
.
w
-
100
{
width
:
100
px
;
}
.
mr10
{
margin
-
right
:
10
px
;
}
<
/style
>
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