Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-presale
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0f16f0b6
authored
Dec 19, 2024
by
zhangxw
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'SAAS+V4.47.5' into SAAS+V4.48-0103
2 parents
1f39721d
4e42c5fd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
37 deletions
src/api/modules/serviceConfig.js
src/util/gradeData.js
src/views/serviceConfig/addService.vue
src/views/serviceConfig/components/ServicesTable/index.vue
src/api/modules/serviceConfig.js
View file @
0f16f0b
...
...
@@ -218,6 +218,16 @@ const getExtendedWarrantyContractListApi = params => {
sign
:
true
})
}
// 获取服务项目修改记录
const
getServiceRecordApi
=
params
=>
{
params
.
method
=
`scrm.api.equity.service.items.modify.detail.record.pages`
return
http
({
url
:
CUR_BASE_URL
,
method
:
'POST'
,
data
:
params
,
sign
:
true
})
}
export
default
{
get4SList
,
...
...
@@ -240,5 +250,6 @@ export default {
exportExtendedWarrantyApi
,
addExtendedWarrantyApi
,
getExtendedWarrantyDetailApi
,
getExtendedWarrantyContractListApi
getExtendedWarrantyContractListApi
,
getServiceRecordApi
}
\ No newline at end of file
src/util/gradeData.js
View file @
0f16f0b
...
...
@@ -5,25 +5,37 @@ const gradeObj = {
servicePeriod
:
''
,
maxPrice
:
'15'
,
minPrice
:
'0'
,
computeFlag
:
0
,
priceCoefficient
:
''
,
standardShelfCost
:
''
,
standardSalesCost
:
''
standardSalesCost
:
''
,
shelfCost
:
''
,
salesCost
:
''
,
childSalePeriodData
:
[]
},
{
servicePeriod
:
''
,
maxPrice
:
'30'
,
minPrice
:
'15'
,
computeFlag
:
0
,
priceCoefficient
:
''
,
standardShelfCost
:
''
,
standardSalesCost
:
''
standardSalesCost
:
''
,
shelfCost
:
''
,
salesCost
:
''
,
childSalePeriodData
:
[]
},
{
servicePeriod
:
''
,
maxPrice
:
'200'
,
minPrice
:
'30'
,
computeFlag
:
0
,
priceCoefficient
:
''
,
standardShelfCost
:
''
,
standardSalesCost
:
''
standardSalesCost
:
''
,
shelfCost
:
''
,
salesCost
:
''
,
childSalePeriodData
:
[]
}
],
salePeriodData
:
[],
...
...
@@ -61,7 +73,10 @@ export const addGradeItem = (grade = 'A', salePeriodList = []) => {
return
a
-
b
})
_gradeObj
.
salePeriodData
=
salePeriodList
.
map
(
item
=>
{
return
{
servicePeriod
:
item
,
standardShelfCost
:
''
,
standardSalesCost
:
''
}
return
{
servicePeriod
:
item
,
standardShelfCost
:
''
,
standardSalesCost
:
''
,
shelfCost
:
''
,
salesCost
:
''
}
})
_gradeObj
.
gradeConfigList
?.
forEach
(
item
=>
{
item
.
childSalePeriodData
=
deepClone
(
_gradeObj
.
salePeriodData
)
})
console
.
log
(
_gradeObj
)
return
_gradeObj
...
...
@@ -80,22 +95,26 @@ export const handleGradeData = (dataFromApi, salePeriodList = []) => {
serviceGrade
,
gradeConfigList
:
[]
}
let
_priceGradeNum
=
NP
.
divide
(
gradeConfigList
?.
length
||
0
,
salePeriodList
?.
length
||
0
)
let
_salePeriodNum
=
0
while
(
_salePeriodNum
<
_priceGradeNum
)
{
const
_target
=
gradeConfigList
.
find
(
o
=>
o
.
priceGrade
==
_salePeriodNum
)
let
{
id
,
servicePeriod
,
maxPrice
,
minPrice
,
priceCoefficient
}
=
_target
||
{}
maxPrice
=
NP
.
divide
(
maxPrice
||
0
,
1000000
)
minPrice
=
NP
.
divide
(
minPrice
||
0
,
1000000
)
_gradeObj
.
gradeConfigList
.
push
({
servicePeriod
,
priceGrade
:
_salePeriodNum
,
maxPrice
,
minPrice
,
priceCoefficient
,
id
})
_salePeriodNum
++
}
// gradeConfigList.forEach(item => {
// let { id, servicePeriod, maxPrice, minPrice, priceCoefficient } = item || {}
// maxPrice = NP.divide(maxPrice || 0, 1000000)
// minPrice = NP.divide(minPrice || 0, 1000000)
// _gradeObj.gradeConfigList.push({ servicePeriod, maxPrice, minPrice, priceCoefficient, id })
// })
// 根据区间去重
let
intervalArr
=
gradeConfigList
?.
reduce
((
acc
,
current
)
=>
{
const
exists
=
acc
.
some
(
item
=>
item
.
maxPrice
===
current
.
maxPrice
&&
item
.
minPrice
===
current
.
minPrice
)
if
(
!
exists
)
{
acc
.
push
(
current
)
}
return
acc
},
[])
intervalArr
.
forEach
((
item
,
index
)
=>
{
let
{
maxPrice
,
minPrice
,
priceCoefficient
,
computeFlag
,
id
}
=
item
||
{}
_gradeObj
.
gradeConfigList
.
push
({
maxPrice
:
NP
.
divide
(
maxPrice
||
0
,
1000000
),
minPrice
:
NP
.
divide
(
minPrice
||
0
,
1000000
),
priceCoefficient
:
priceCoefficient
,
computeFlag
,
id
})
})
salePeriodList
=
salePeriodList
.
sort
(
function
(
a
,
b
)
{
return
a
-
b
})
...
...
@@ -103,6 +122,14 @@ export const handleGradeData = (dataFromApi, salePeriodList = []) => {
const
_target
=
element
.
gradeConfigList
.
find
(
o
=>
o
.
servicePeriod
==
item
)
return
{
servicePeriod
:
item
,
standardShelfCost
:
NP
.
divide
(
_target
?.
standardShelfCost
||
0
,
100
),
standardSalesCost
:
NP
.
divide
(
_target
?.
standardSalesCost
||
0
,
100
)
}
})
_gradeObj
.
gradeConfigList
?.
forEach
(
item
=>
{
let
arr
=
[]
salePeriodList
?.
forEach
(
it
=>
{
let
_obj
=
gradeConfigList
.
find
(
o
=>
o
.
servicePeriod
==
it
&&
NP
.
divide
(
o
.
minPrice
||
0
,
1000000
)
==
item
.
minPrice
&&
NP
.
divide
(
o
.
maxPrice
||
0
,
1000000
)
==
item
.
maxPrice
)
arr
.
push
({
id
:
_obj
?.
id
,
servicePeriod
:
it
,
shelfCost
:
_obj
?.
shelfCost
,
salesCost
:
_obj
?.
salesCost
})
})
item
.
childSalePeriodData
=
arr
})
arr
.
push
(
_gradeObj
)
})
return
arr
...
...
src/views/serviceConfig/addService.vue
View file @
0f16f0b
...
...
@@ -398,6 +398,12 @@ export default {
isEmpty
(
value
)
{
return
value
!==
0
&&
value
!==
'0'
&&
!
value
},
// 计算精确价格
calcPrice
(
price1
,
price2
)
{
price1
=
price1
||
0
price2
=
price2
||
0
return
NP
.
times
(
price1
,
price2
)
},
commit
()
{
const
_gradeList
=
[]
try
{
...
...
@@ -405,20 +411,33 @@ export default {
const
{
id
,
serviceGrade
,
serviceOverview
,
serviceDetail
,
salePeriodData
,
gradeConfigList
}
=
item
let
_gradeConfigList
=
[]
gradeConfigList
.
forEach
((
ele
,
eleIdx
)
=>
{
let
{
priceCoefficient
,
minPrice
,
maxPrice
}
=
ele
if
(
this
.
isEmpty
(
minPrice
)
||
this
.
isEmpty
(
maxPrice
)
||
this
.
isEmpty
(
priceCoefficient
))
{
throw
new
Error
(
`请输入
${
serviceGrade
}
规格的
${
this
.
isEmpty
(
priceCoefficient
)
?
'价格系数'
:
'价格区间'
}
`
)
let
{
priceCoefficient
,
minPrice
,
maxPrice
,
childSalePeriodData
,
computeFlag
}
=
ele
if
(
this
.
isEmpty
(
minPrice
)
||
this
.
isEmpty
(
maxPrice
)
||
(
this
.
isEmpty
(
priceCoefficient
)
&&
computeFlag
==
0
))
{
throw
new
Error
(
`请输入
${
serviceGrade
}
规格的
${
this
.
isEmpty
(
priceCoefficient
)
&&
computeFlag
==
0
?
'价格系数'
:
'价格区间'
}
`
)
}
// 标准行数据
salePeriodData
.
forEach
(
element
=>
{
let
{
id
,
servicePeriod
,
standardSalesCost
,
standardShelfCost
}
=
element
let
{
servicePeriod
,
standardSalesCost
,
standardShelfCost
}
=
element
if
(
this
.
isEmpty
(
standardSalesCost
)
||
this
.
isEmpty
(
standardShelfCost
))
{
throw
new
Error
(
`请输入
${
serviceGrade
}
规格
${
servicePeriod
}
年版的
${
this
.
isEmpty
(
standardSalesCost
)
?
'销售成本'
:
'上架成本'
}
`
)
}
})
// 计算/自定义行数据
childSalePeriodData
?.
forEach
(
element
=>
{
let
{
servicePeriod
,
standardSalesCost
,
standardShelfCost
,
salesCost
,
shelfCost
}
=
element
const
it
=
salePeriodData
.
find
(
v
=>
v
.
servicePeriod
==
servicePeriod
)
if
(
computeFlag
==
0
)
{
shelfCost
=
this
.
calcPrice
(
it
?.
standardShelfCost
,
priceCoefficient
)
||
0
// 计算后销售成本
salesCost
=
this
.
calcPrice
(
it
?.
standardSalesCost
,
priceCoefficient
)
||
0
// 计算后上架成本
}
if
(
this
.
isEmpty
(
salesCost
)
||
this
.
isEmpty
(
shelfCost
))
{
throw
new
Error
(
`请输入
${
serviceGrade
}
规格
${
servicePeriod
}
年版的
${
this
.
isEmpty
(
salesCost
)
?
'销售成本'
:
'上架成本'
}
`
)
}
standardSalesCost
=
NP
.
times
(
it
?.
standardSalesCost
||
0
,
100
)
// 标准销售成本
standardShelfCost
=
NP
.
times
(
it
?.
standardShelfCost
||
0
,
100
)
// 标准上架成本
let
min_price
=
NP
.
times
(
minPrice
||
0
,
1000000
)
let
max_price
=
NP
.
times
(
maxPrice
||
0
,
1000000
)
standardSalesCost
=
NP
.
times
(
standardSalesCost
||
0
,
100
)
standardShelfCost
=
NP
.
times
(
standardShelfCost
||
0
,
100
)
let
gradeConfigObj
=
{
id
,
priceGrade
:
eleIdx
,
priceCoefficient
,
minPrice
:
min_price
,
maxPrice
:
max_price
,
servicePeriod
,
standardSalesCost
,
standardShelfCost
}
let
gradeConfigObj
=
{
id
:
element
.
id
,
priceGrade
:
eleIdx
,
priceCoefficient
:
priceCoefficient
?
priceCoefficient
:
undefined
,
minPrice
:
min_price
,
maxPrice
:
max_price
,
servicePeriod
,
standardSalesCost
,
standardShelfCost
,
computeFlag
,
salesCost
,
shelfCost
}
_gradeConfigList
.
push
(
gradeConfigObj
)
})
})
...
...
src/views/serviceConfig/components/ServicesTable/index.vue
View file @
0f16f0b
...
...
@@ -4,6 +4,7 @@
<tr
class=
"th-wrap"
>
<th
rowspan=
"2"
>
规格
</th>
<th
rowspan=
"2"
>
价格区间(万元)
</th>
<th
rowspan=
"2"
>
是否计算
</th>
<th
rowspan=
"2"
>
价格系数
</th>
<th
colspan=
"2"
v-for=
"(item, index) in tableData.salePeriodData"
:key=
"index"
>
{{
item
.
servicePeriod
}}
年版
</th>
<th
rowspan=
"2"
style=
"white-space: nowrap;"
>
操作
</th>
...
...
@@ -28,6 +29,7 @@
<td
:rowspan=
"tableData.gradeConfigList.length + 2"
>
{{ tableData.serviceGrade }}
</td>
<td>
标准
</td>
<td>
-
</td>
<td>
-
</td>
<
template
v-for=
"(item, index) in tableData.salePeriodData"
>
<td
:key=
"index"
><el-input
:placeholder=
"placeholder"
@
input=
"changePrice($event, item, 'standardShelfCost')"
:disabled=
"disabled"
v-model=
"item.standardShelfCost"
></el-input></td>
<td
:key=
"index"
><el-input
:placeholder=
"placeholder"
@
input=
"changePrice($event, item, 'standardSalesCost')"
:disabled=
"disabled"
v-model=
"item.standardSalesCost"
></el-input></td>
...
...
@@ -40,18 +42,28 @@
<span
class=
"sign"
>
-
</span>
<el-input
:placeholder=
"placeholder"
@
input=
"changePrice($event, item, 'maxPrice')"
:disabled=
"disabled"
v-model=
"item.maxPrice"
></el-input>
</td>
<td><el-input
:placeholder=
"placeholder"
@
input=
"changePrice($event, item, 'priceCoefficient')"
:disabled=
"disabled"
@
blur=
"formatPrice($event, item, 'priceCoefficient', 100)"
v-model=
"item.priceCoefficient"
></el-input></td>
<td><el-switch
v-model=
"item.computeFlag"
:active-value=
"0"
@
change=
"changeComputeFlag($event, item, index)"
:inactive-value=
"1"
:disabled=
"disabled"
></el-switch></td>
<td>
<span
v-if=
"item.computeFlag == 1"
>
-
</span>
<el-input
v-else
:placeholder=
"placeholder"
@
input=
"changePrice($event, item, 'priceCoefficient', index)"
:disabled=
"disabled"
v-model=
"item.priceCoefficient"
@
blur=
"formatPrice($event, item, 'priceCoefficient', 100)"
></el-input>
</td>
<
template
v-for=
"(ele, eIdx) in tableData.salePeriodData"
>
<td
:key=
"eIdx"
>
{{
calcPrice
(
ele
.
standardShelfCost
,
item
.
priceCoefficient
)
}}
</td>
<td
:key=
"eIdx"
>
{{
calcPrice
(
ele
.
standardSalesCost
,
item
.
priceCoefficient
)
}}
</td>
<template
v-if=
"item.computeFlag == 0"
>
<td
:key=
"eIdx"
>
{{
calcPrice
(
ele
.
standardShelfCost
,
item
.
priceCoefficient
)
}}
</td>
<td
:key=
"eIdx"
>
{{
calcPrice
(
ele
.
standardSalesCost
,
item
.
priceCoefficient
)
}}
</td>
</
template
>
<
template
v-if=
"item.computeFlag == 1"
>
<td
:key=
"eIdx"
><el-input
v-model=
"item.childSalePeriodData[eIdx].shelfCost"
:placeholder=
"placeholder"
@
input=
"changePrice($event, item.childSalePeriodData[eIdx], 'shelfCost')"
:disabled=
"disabled"
></el-input></td>
<td
:key=
"eIdx"
><el-input
v-model=
"item.childSalePeriodData[eIdx].salesCost"
:placeholder=
"placeholder"
@
input=
"changePrice($event, item.childSalePeriodData[eIdx], 'salesCost')"
:disabled=
"disabled"
></el-input></td>
</
template
>
</template>
<td
class=
"del-btn"
><span
v-if=
"index > 2 && !disabled"
class=
"btn"
@
click=
"delSection(index)"
>
删除
</span></td>
</tr>
<tr>
<td
class=
"add-btn"
:colspan=
"tableData.salePeriodData.length * 2 +
3
"
><span
v-if=
"!disabled"
class=
"btn"
@
click=
"addSection"
>
新增价格区间
</span></td>
<td
class=
"add-btn"
:colspan=
"tableData.salePeriodData.length * 2 +
4
"
><span
v-if=
"!disabled"
class=
"btn"
@
click=
"addSection"
>
新增价格区间
</span></td>
</tr>
<tr
class=
"desc-wrap"
>
<td
class=
"desc-td"
:colspan=
"tableData.salePeriodData.length * 2 +
4
"
>
<td
class=
"desc-td"
:colspan=
"tableData.salePeriodData.length * 2 +
5
"
>
<div
class=
"desc"
>
<label
for=
""
>
服务条款概述:
</label>
<Editor
:disabled=
"disabled"
:hasTool=
"false"
:editorOption=
"overviewOption"
v-model=
"tableData.serviceOverview"
></Editor>
...
...
@@ -59,7 +71,7 @@
</td>
</tr>
<tr
class=
"desc-wrap"
>
<td
class=
"desc-td"
:colspan=
"tableData.salePeriodData.length * 2 +
4
"
>
<td
class=
"desc-td"
:colspan=
"tableData.salePeriodData.length * 2 +
5
"
>
<div
class=
"desc"
>
<label
for=
""
>
规格详细描述:
</label>
<Editor
:disabled=
"disabled"
:hasTool=
"false"
:editorOption=
"DetailOption"
v-model=
"tableData.serviceDetail"
></Editor>
...
...
@@ -128,6 +140,7 @@ export default {
},
methods
:
{
changePrice
(
value
,
item
,
key
)
{
const
decimal
=
[
'standardShelfCost'
,
'standardSalesCost'
,
'minPrice'
,
'maxPrice'
].
includes
(
key
)
?
2
:
16
item
[
key
]
=
value
?
value
.
replace
(
/^0
\d
/g
,
'0'
)
...
...
@@ -138,9 +151,17 @@ export default {
.
replace
(
'.'
,
'$#$'
)
.
replace
(
/
\.
/g
,
''
)
.
replace
(
'$#$'
,
'.'
)
.
replace
(
/^
(
-
)
*
(\d
+
)\.(\d\d)
.*$/
,
'$1$2.$3'
)
.
replace
(
new
RegExp
(
`^(\\-)*(\\d+)\\.(\\d{
${
decimal
}
}).*`
,
'g'
)
,
'$1$2.$3'
)
:
''
},
changeComputeFlag
(
e
,
item
)
{
if
(
e
==
1
)
{
item
?.
childSalePeriodData
?.
forEach
(
ele
=>
{
ele
.
shelfCost
=
''
ele
.
salesCost
=
''
})
}
},
formatPrice
(
e
,
item
,
key
,
maxNum
)
{
let
num
=
e
.
target
.
value
if
(
num
>
maxNum
)
{
...
...
@@ -150,7 +171,7 @@ export default {
calcPrice
(
price1
,
price2
)
{
price1
=
price1
||
0
price2
=
price2
||
0
return
Number
((
price1
*
price2
).
toFixed
(
2
))
return
Number
((
price1
*
price2
)
?
.
toFixed
(
2
))
},
HandleCustomMatcher
(
node
,
Delta
)
{
// 文字、图片等,从别处复制而来,清除自带样式,转为纯文本
...
...
@@ -168,13 +189,18 @@ export default {
addSection
()
{
// 获取最后一个的最大价格赋值到新增的最小价格
const
minPrice
=
this
.
tableData
.
gradeConfigList
[
this
.
tableData
.
gradeConfigList
.
length
-
1
].
maxPrice
const
arr
=
this
.
tableData
.
salePeriodData
.
map
(
item
=>
{
return
{
servicePeriod
:
item
.
servicePeriod
,
standardShelfCost
:
''
,
standardSalesCost
:
''
,
shelfCost
:
''
,
salesCost
:
''
}
})
let
sectionItem
=
{
servicePeriod
:
''
,
maxPrice
:
''
,
minPrice
,
computeFlag
:
0
,
priceCoefficient
:
''
,
standardShelfCost
:
''
,
standardSalesCost
:
''
standardSalesCost
:
''
,
childSalePeriodData
:
arr
}
this
.
tableData
.
gradeConfigList
.
push
(
sectionItem
)
},
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment