Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
shld-databoard-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
潘自豪 Rambo Pan
shld-databoard-ui
Commits
fe7f1a53
Commit
fe7f1a53
authored
Sep 19, 2023
by
潘自豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
营业额
parent
8da7109a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
229 additions
and
97 deletions
+229
-97
apiList.js
src/module/api/apiList.js
+21
-1
index.vue
src/module/databoard/index.vue
+164
-96
util.js
src/module/util/util.js
+44
-0
No files found.
src/module/api/apiList.js
View file @
fe7f1a53
...
@@ -20,12 +20,32 @@ export const userLogin = (username, pass, captchaSign, verificationcode, captcha
...
@@ -20,12 +20,32 @@ export const userLogin = (username, pass, captchaSign, verificationcode, captcha
}
}
},
'POST'
);
},
'POST'
);
//首页营业额率值 -汇总
export
const
getBusinessConditionDatas
=
(
cur_day
)
=>
fetch
(
'/api/query/*/action/get_business_condition_datas'
,
{
export
const
getBusinessConditionDatas
=
(
cur_day
)
=>
fetch
(
'/api/query/*/action/get_business_condition_datas'
,
{
aux
:
{
aux
:
{
cur_day
:
cur_day
cur_day
:
cur_day
}
}
},
'POST'
);
},
'POST'
);
//明细页营业额汇月 -汇总
export
const
getBusinessConditionDataByMonth
=
(
cur_day
)
=>
fetch
(
'/api/query/*/action/get_business_condition_datas_by_month'
,
{
aux
:
{
cur_day
:
cur_dayS
}
},
'POST'
);
//明细页营业额汇年 -汇总
export
const
getBusinessConditionDatasByYear
=
(
cur_day
)
=>
fetch
(
'/api/query/*/action/get_business_condition_datas_by_year'
,
{
aux
:
{
cur_day
:
cur_dayS
}
},
'POST'
);
src/module/databoard/index.vue
View file @
fe7f1a53
...
@@ -2,14 +2,18 @@
...
@@ -2,14 +2,18 @@
<div
class=
"main"
>
<div
class=
"main"
>
<div
class=
"middle"
>
<div
class=
"middle"
>
<display-board
class=
"trade_left"
title=
"营业情况"
>
<display-board
class=
"trade_left"
title=
"营业情况"
>
<div
style=
"height: 100%; display: flex; flex-direction: column; justify-content: space-around; padding: 0 1rem 0 1rem;"
>
<div
<contrast-card
v-for=
"data in mockData.yyqk"
style=
"height: 28%;"
@
click
.
native=
"routerTo(paths[data.title])"
>
style=
"height: 100%; display: flex; flex-direction: column; justify-content: space-around; padding: 0 1rem 0 1rem;"
>
<title-content-mark
style=
"width: 40%;color: #369afa;float: left;"
:title=
"data.title"
:content=
"data.amount"
:mark=
"data.unit"
/>
<contrast-card
v-for=
"data in yyqk"
style=
"height: 28%;"
@
click
.
native=
"routerTo(paths[data.title])"
>
<div
style=
"width: 60%; height: 100%; float:left; padding: 4% 4% 0 12%; line-height: 26px;; display: flex; align-items: center;"
>
<title-content-mark
style=
"width: 40%;color: #369afa;float: left;"
:title=
"data.title"
:content=
"data.amount"
:mark=
"data.unit"
/>
<div
style=
"width: 60%; height: 100%; float:left; padding: 4% 4% 0 12%; line-height: 26px;; display: flex; align-items: center;"
>
<table-column
style=
"float: left;width: 25%;"
:data=
"data.hb"
name=
"title"
/>
<table-column
style=
"float: left;width: 25%;"
:data=
"data.hb"
name=
"title"
/>
<table-column
style=
"float: left;width: 40%;"
:data=
"data.hb"
name=
"amount"
/>
<table-column
style=
"float: left;width: 40%;"
:data=
"data.hb"
name=
"amount"
/>
<table-column
style=
"float: left;width: 35%;"
:data=
"data.hb"
name=
"rate"
:cell-style-function=
"cellStyleFunction"
/>
<table-column
style=
"float: left;width: 35%;"
:data=
"data.hb"
name=
"rate"
<!--
<table-column
style=
"float: left;width: 35%;"
:data=
"data.hb"
name=
"rate"
cell-style-js=
"var res =
{color: '#5eeef4'}; if(data.indexOf('+') !== -1){res.color = '#fee064'} res; "/>-->
:cell-style-function=
"cellStyleFunction"
/>
<!--
<table-column
style=
"float: left;width: 35%;"
:data=
"data.hb"
name=
"rate"
cell-style-js=
"var res =
{color: '#5eeef4'}; if(data.indexOf('+') !== -1){res.color = '#fee064'} res; "/>-->
</div>
</div>
</contrast-card>
</contrast-card>
</div>
</div>
...
@@ -17,19 +21,24 @@
...
@@ -17,19 +21,24 @@
<display-board
class=
"trade_middle"
corner_size=
"large"
>
<display-board
class=
"trade_middle"
corner_size=
"large"
>
<div
style=
"height: 36%;display: flex;justify-content: space-evenly;padding-top: 1.5rem"
>
<div
style=
"height: 36%;display: flex;justify-content: space-evenly;padding-top: 1.5rem"
>
<simple-card
v-for=
"data in mockData.sr"
style=
"width: 30%;height: 100%"
>
<simple-card
v-for=
"data in mockData.sr"
style=
"width: 30%;height: 100%"
>
<title-content-mark
style=
"color: #5eeef4;"
:title=
"data.title"
:content=
"data.value"
:mark=
"'万元'"
isCenter
isBold
/>
<title-content-mark
style=
"color: #5eeef4;"
:title=
"data.title"
:content=
"data.value"
:mark=
"'万元'"
isCenter
isBold
/>
</simple-card>
</simple-card>
</div>
</div>
<ar-summary-bar
style=
"width: 100%; height: 64%;"
></ar-summary-bar>
<ar-summary-bar
style=
"width: 100%; height: 64%;"
></ar-summary-bar>
</display-board>
</display-board>
<display-board
class=
"trade_right"
title=
"账款情况"
>
<display-board
class=
"trade_right"
title=
"账款情况"
>
<div
style=
"height: 100%; display: flex; flex-direction: column; justify-content: space-around; padding: 0 1rem 0 1rem;"
>
<div
style=
"height: 100%; display: flex; flex-direction: column; justify-content: space-around; padding: 0 1rem 0 1rem;"
>
<contrast-card
v-for=
"data in mockData.zkqk"
style=
"height: 28%;"
>
<contrast-card
v-for=
"data in mockData.zkqk"
style=
"height: 28%;"
>
<title-content-mark
style=
"width: 40%;color: #369afa;float: left;"
:title=
"data.title"
:content=
"data.amount"
:mark=
"data.unit"
/>
<title-content-mark
style=
"width: 40%;color: #369afa;float: left;"
:title=
"data.title"
<div
style=
"width: 60%; height: 100%; float:left; padding: 4% 4% 0 12%; line-height: 26px;; display: flex; align-items: center;"
>
:content=
"data.amount"
:mark=
"data.unit"
/>
<div
style=
"width: 60%; height: 100%; float:left; padding: 4% 4% 0 12%; line-height: 26px;; display: flex; align-items: center;"
>
<table-column
style=
"float: left;width: 25%;"
:data=
"data.hb"
name=
"title"
/>
<table-column
style=
"float: left;width: 25%;"
:data=
"data.hb"
name=
"title"
/>
<table-column
style=
"float: left;width: 40%;"
:data=
"data.hb"
name=
"amount"
/>
<table-column
style=
"float: left;width: 40%;"
:data=
"data.hb"
name=
"amount"
/>
<table-column
style=
"float: left;width: 35%;"
:data=
"data.hb"
name=
"rate"
:cell-style-function=
"cellStyleFunction"
/>
<table-column
style=
"float: left;width: 35%;"
:data=
"data.hb"
name=
"rate"
:cell-style-function=
"cellStyleFunction"
/>
</div>
</div>
</contrast-card>
</contrast-card>
</div>
</div>
...
@@ -42,54 +51,93 @@
...
@@ -42,54 +51,93 @@
<div
class=
"trade_middle"
style=
"border: none;box-shadow: none;"
>
<div
class=
"trade_middle"
style=
"border: none;box-shadow: none;"
>
<div
style=
"display: flex; justify-content: space-between; height: 50%;"
>
<div
style=
"display: flex; justify-content: space-between; height: 50%;"
>
<display-board
style=
"width: 32%;"
title=
"每日目标情况"
>
<display-board
style=
"width: 32%;"
title=
"每日目标情况"
>
<div
style=
"width: 100%; height: 100%; float:left; padding: 2%; line-height: 33px; display: flex; align-items: center; font-size: 10px;"
>
<div
style=
"width: 100%; height: 100%; float:left; padding: 2%; line-height: 33px; display: flex; align-items: center; font-size: 10px;"
>
<table-column
style=
"float: left;width: 35%;"
:data=
"mockData.mrmbqk"
name=
"title"
show-head
/>
<table-column
style=
"float: left;width: 35%;"
:data=
"mockData.mrmbqk"
name=
"title"
show-head
/>
<table-column
style=
"float: left;width: 45%;font-size: 24px;font-weight: bold;color: #5eeef4;text-align: center;"
:data=
"mockData.mrmbqk"
name=
"actualValue"
title=
"实时值"
show-head
/>
<table-column
<table-column
style=
"float: left;width: 20%;"
:data=
"mockData.mrmbqk"
name=
"currentValue"
title=
"目标值"
show-head
/>
style=
"float: left;width: 45%;font-size: 24px;font-weight: bold;color: #5eeef4;text-align: center;"
:data=
"mockData.mrmbqk"
name=
"actualValue"
title=
"实时值"
show-head
/>
<table-column
style=
"float: left;width: 20%;"
:data=
"mockData.mrmbqk"
name=
"currentValue"
title=
"目标值"
show-head
/>
</div>
</div>
</display-board>
</display-board>
<display-board
style=
"width: 32%;"
title=
"月度目标情况"
>
<display-board
style=
"width: 32%;"
title=
"月度目标情况"
>
<div
style=
"width: 100%; height: 100%; float:left; padding: 2%; line-height: 33px; display: flex; align-items: center; font-size: 10px;"
>
<div
style=
"width: 100%; height: 100%; float:left; padding: 2%; line-height: 33px; display: flex; align-items: center; font-size: 10px;"
>
<table-column
style=
"float: left;width: 35%;"
:data=
"mockData.ydmbqk"
name=
"title"
show-head
/>
<table-column
style=
"float: left;width: 35%;"
:data=
"mockData.ydmbqk"
name=
"title"
show-head
/>
<table-column
style=
"float: left;width: 45%;font-size: 24px;font-weight: bold;color: #5eeef4;text-align: center;"
:data=
"mockData.ydmbqk"
name=
"actualValue"
title=
"实时值"
show-head
/>
<table-column
<table-column
style=
"float: left;width: 20%;"
:data=
"mockData.ydmbqk"
name=
"currentValue"
title=
"目标值"
show-head
/>
style=
"float: left;width: 45%;font-size: 24px;font-weight: bold;color: #5eeef4;text-align: center;"
:data=
"mockData.ydmbqk"
name=
"actualValue"
title=
"实时值"
show-head
/>
<table-column
style=
"float: left;width: 20%;"
:data=
"mockData.ydmbqk"
name=
"currentValue"
title=
"目标值"
show-head
/>
</div>
</div>
</display-board>
</display-board>
<display-board
style=
"width: 32%;"
title=
"年度目标情况"
>
<display-board
style=
"width: 32%;"
title=
"年度目标情况"
>
<div
style=
"width: 100%; height: 100%; float:left; padding: 2%; line-height: 33px; display: flex; align-items: center; font-size: 10px;"
>
<div
style=
"width: 100%; height: 100%; float:left; padding: 2%; line-height: 33px; display: flex; align-items: center; font-size: 10px;"
>
<table-column
style=
"float: left;width: 35%;"
:data=
"mockData.ndmbqk"
name=
"title"
show-head
/>
<table-column
style=
"float: left;width: 35%;"
:data=
"mockData.ndmbqk"
name=
"title"
show-head
/>
<table-column
style=
"float: left;width: 45%;font-size: 24px;font-weight: bold;color: #5eeef4;text-align: center;"
:data=
"mockData.ndmbqk"
name=
"actualValue"
title=
"实时值"
show-head
/>
<table-column
<table-column
style=
"float: left;width: 20%;"
:data=
"mockData.ndmbqk"
name=
"currentValue"
title=
"目标值"
show-head
/>
style=
"float: left;width: 45%;font-size: 24px;font-weight: bold;color: #5eeef4;text-align: center;"
:data=
"mockData.ndmbqk"
name=
"actualValue"
title=
"实时值"
show-head
/>
<table-column
style=
"float: left;width: 20%;"
:data=
"mockData.ndmbqk"
name=
"currentValue"
title=
"目标值"
show-head
/>
</div>
</div>
</display-board>
</display-board>
</div>
</div>
<div
style=
"display: flex; justify-content: space-between; height: 50%; padding-top: 2rem;"
>
<div
style=
"display: flex; justify-content: space-between; height: 50%; padding-top: 2rem;"
>
<showcase
style=
"width: 18%;"
title=
"当日订单量"
>
<showcase
style=
"width: 18%;"
title=
"当日订单量"
>
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.drddl.weight"
mark=
"万吨"
/>
<title-content-mark
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.drddl.amount"
mark=
"万元"
/>
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.drddl.weight"
mark=
"万吨"
/>
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.drddl.amount"
mark=
"万元"
/>
</showcase>
</showcase>
<showcase
style=
"width: 18%;"
title=
"当日完成量"
>
<showcase
style=
"width: 18%;"
title=
"当日完成量"
>
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.drwcl.weight"
mark=
"万吨"
/>
<title-content-mark
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.drwcl.amount"
mark=
"万元"
/>
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.drwcl.weight"
mark=
"万吨"
/>
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.drwcl.amount"
mark=
"万元"
/>
</showcase>
</showcase>
<showcase
style=
"width: 18%;"
title=
"余量"
>
<showcase
style=
"width: 18%;"
title=
"余量"
>
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.yl.weight"
mark=
"万吨"
/>
<title-content-mark
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.yl.amount"
mark=
"万元"
/>
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.yl.weight"
mark=
"万吨"
/>
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.yl.amount"
mark=
"万元"
/>
</showcase>
</showcase>
<showcase
style=
"width: 18%;"
title=
"流失客户"
>
<showcase
style=
"width: 18%;"
title=
"流失客户"
>
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.lskh.weight"
mark=
"万吨"
/>
<title-content-mark
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.lskh.amount"
mark=
"万元"
/>
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.lskh.weight"
mark=
"万吨"
/>
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.lskh.amount"
mark=
"万元"
/>
</showcase>
</showcase>
<showcase
style=
"width: 18%;"
title=
"新增客户"
>
<showcase
style=
"width: 18%;"
title=
"新增客户"
>
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.xzkh.weight"
mark=
"万吨"
/>
<title-content-mark
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.xzkh.amount"
mark=
"万元"
/>
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;font-size: 16px;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.xzkh.weight"
mark=
"万吨"
/>
<title-content-mark
style=
"float:left;width: 100%;height: 50%;color: #5eeef4;padding: 0 15%;"
content-style=
"font-size: 16px;"
mark-style=
"font-size: 10px;"
:content=
"mockData.xzkh.amount"
mark=
"万元"
/>
</showcase>
</showcase>
</div>
</div>
</div>
</div>
<display-board
class=
"trade_right"
title=
"当日订单量占比"
>
<display-board
class=
"trade_right"
title=
"当日订单量占比"
>
<div
style=
"height: 100%; display: flex; flex-direction: column; justify-content: space-around; padding: 0 1rem 0 1rem;"
>
<div
<ring-pie-chart
ref=
"transportTypeChart"
style=
"width: 100%;height: 50%;"
name=
"运输类型占比"
:data=
"mockData.drddlzb.transportType"
/>
style=
"height: 100%; display: flex; flex-direction: column; justify-content: space-around; padding: 0 1rem 0 1rem;"
>
<ring-pie-chart
ref=
"customerChart"
style=
"width: 100%;height: 50%;"
name=
"公司占比"
:data=
"mockData.drddlzb.customer"
/>
<ring-pie-chart
ref=
"transportTypeChart"
style=
"width: 100%;height: 50%;"
name=
"运输类型占比"
:data=
"mockData.drddlzb.transportType"
/>
<ring-pie-chart
ref=
"customerChart"
style=
"width: 100%;height: 50%;"
name=
"公司占比"
:data=
"mockData.drddlzb.customer"
/>
</div>
</div>
</display-board>
</display-board>
</div>
</div>
...
@@ -106,8 +154,7 @@ import TitleContentMark from "./components/layout/title-content-mark.vue";
...
@@ -106,8 +154,7 @@ import TitleContentMark from "./components/layout/title-content-mark.vue";
import
TableColumn
from
"./components/table/table-column.vue"
;
import
TableColumn
from
"./components/table/table-column.vue"
;
import
RingPieChart
from
"./components/chart/ring-pie-chart.vue"
;
import
RingPieChart
from
"./components/chart/ring-pie-chart.vue"
;
import
{
getBusinessConditionDatas
}
from
"../api/apiList"
;
import
{
getBusinessConditionDatas
}
from
"../api/apiList"
;
import
moment
from
"moment"
;
import
{
calc_hb_str
,
calc_tb_str
,
conver_amont
}
from
"../util/util"
;
import
VueCookies
from
"vue-cookies"
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -123,8 +170,8 @@ export default {
...
@@ -123,8 +170,8 @@ export default {
},
},
data
()
{
data
()
{
return
{
return
{
today
:
moment
().
format
(
"yyyy-MM-DD"
),
//
today: moment().format("yyyy-MM-DD"),
mockData
:
{
today
:
'2023-06-19'
,
yyqk
:
{
yyqk
:
{
yye
:
{
yye
:
{
title
:
"营业额"
,
title
:
"营业额"
,
...
@@ -178,7 +225,8 @@ export default {
...
@@ -178,7 +225,8 @@ export default {
],
],
},
},
},
},
zkqk
:
{
mockData
:
{
zqk
:
{
yszk
:
{
yszk
:
{
title
:
"应收账款"
,
title
:
"应收账款"
,
amount
:
"20,303"
,
amount
:
"20,303"
,
...
@@ -361,9 +409,10 @@ export default {
...
@@ -361,9 +409,10 @@ export default {
},
},
methods
:
{
methods
:
{
cellStyleFunction
(
data
)
{
cellStyleFunction
(
data
)
{
let
res
=
{
color
:
'#5eeef4'
};
let
res
=
{
color
:
'#33ff66'
};
if
(
data
.
indexOf
(
'+'
)
!==
-
1
)
{
console
.
log
(
data
+
":"
+
data
.
indexOf
(
'+'
))
res
.
color
=
'#fee064'
if
(
data
.
indexOf
(
'-'
)
!==
-
1
)
{
res
.
color
=
'#ff3300'
}
}
return
res
;
return
res
;
},
},
...
@@ -378,9 +427,28 @@ export default {
...
@@ -378,9 +427,28 @@ export default {
},
},
//营业情况
//营业情况
showBusinessConditionDatas
()
{
showBusinessConditionDatas
()
{
getBusinessConditionDatas
(
this
.
today
)
let
res
=
getBusinessConditionDatas
(
this
.
today
)
console
.
log
(
"--"
+
this
.
today
+
"--"
)
res
.
then
(
data
=>
{
console
.
log
(
"cookies:"
+
VueCookies
.
keys
());
data
=
data
.
data
;
//营业额
this
.
yyqk
.
yye
.
amount
=
conver_amont
(
data
.
cur_sell_settle_amount
);
this
.
yyqk
.
yye
.
hb
[
0
].
amount
=
conver_amont
(
data
.
pre_sell_settle_amount
);
this
.
yyqk
.
yye
.
hb
[
0
].
rate
=
calc_hb_str
(
data
.
cur_sell_settle_amount
,
data
.
pre_sell_settle_amount
);
this
.
yyqk
.
yye
.
hb
[
1
].
amount
=
conver_amont
(
data
.
pre_month_sell_settle_amount
);
this
.
yyqk
.
yye
.
hb
[
1
].
rate
=
calc_tb_str
(
data
.
cur_sell_settle_amount
,
data
.
pre_month_sell_settle_amount
);
//成本
this
.
yyqk
.
cb
.
amount
=
conver_amont
(
data
.
cur_buy_settle_amount
);
this
.
yyqk
.
cb
.
hb
[
0
].
amount
=
conver_amont
(
data
.
pre_buy_settle_amount
);
this
.
yyqk
.
cb
.
hb
[
0
].
rate
=
calc_hb_str
(
data
.
cur_buy_settle_amount
,
data
.
pre_buy_settle_amount
);
this
.
yyqk
.
cb
.
hb
[
1
].
amount
=
conver_amont
(
data
.
pre_month_buy_settle_amount
);
this
.
yyqk
.
cb
.
hb
[
1
].
rate
=
calc_tb_str
(
data
.
cur_buy_settle_amount
,
data
.
pre_month_buy_settle_amount
);
//毛利
this
.
yyqk
.
ml
.
amount
=
conver_amont
(
data
.
cur_gross_profit_amount
);
this
.
yyqk
.
ml
.
hb
[
0
].
amount
=
conver_amont
(
data
.
pre_gross_profit_amount
);
this
.
yyqk
.
ml
.
hb
[
0
].
rate
=
calc_hb_str
(
data
.
cur_gross_profit_amount
,
data
.
pre_gross_profit_amount
);
this
.
yyqk
.
ml
.
hb
[
1
].
amount
=
conver_amont
(
data
.
pre_month_gross_profit_amount
);
this
.
yyqk
.
ml
.
hb
[
1
].
rate
=
calc_tb_str
(
data
.
cur_gross_profit_amount
,
data
.
pre_month_gross_profit_amount
);
})
}
}
},
},
...
...
src/module/util/util.js
0 → 100644
View file @
fe7f1a53
//环比值=(当日营业额-昨日营业额)/昨日营业额*100%计算
export
const
calc_hb_str
=
function
(
cur
,
pre
)
{
return
conver_num_rate
(
formater
((
cur
-
pre
)
/
pre
*
100
));
};
//同比值=(当日营业额上个月同一日营业额)/上个月同一日营业额*100%计算
export
const
calc_tb_str
=
function
(
cur
,
pre
)
{
return
conver_num_rate
(
formater
(
cur
/
pre
*
100
));
};
//conver amont
export
const
conver_amont
=
function
(
amont
)
{
return
formater
(
amont
/
10000
);
};
//Positive and negative
export
const
conver_num_rate
=
function
(
amont
)
{
if
(
amont
>
0
)
{
return
"+"
+
amont
+
"%"
}
else
{
return
"-"
+
amont
+
"%"
}
};
//数字金额显示
function
formater
(
data
)
{
if
(
!
data
)
return
'0.00'
// 将数据分割,保留两位小数
data
=
data
.
toFixed
(
2
)
// 获取整数部分
const
intPart
=
Math
.
trunc
(
data
)
// 整数部分处理,增加,
const
intPartFormat
=
intPart
.
toString
().
replace
(
/
(\d)(?=(?:\d{3})
+$
)
/g
,
'$1,'
)
// 预定义小数部分
let
floatPart
=
'.00'
// 将数据分割为小数部分和整数部分
const
newArr
=
data
.
toString
().
split
(
'.'
)
if
(
newArr
.
length
===
2
)
{
// 有小数部分
floatPart
=
newArr
[
1
].
toString
()
// 取得小数部分
return
intPartFormat
+
'.'
+
floatPart
}
return
intPartFormat
+
floatPart
}
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