Commit 4004ee1b by liang ce

图表

parent 88beb353
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"ant-design-vue": "^1.3.8", "ant-design-vue": "^1.3.8",
"core-js": "^2.6.5", "core-js": "^2.6.5",
"dingtalk-jsapi": "^2.6.44", "dingtalk-jsapi": "^2.6.44",
"echarts": "^4.5.0",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-router": "^3.0.3", "vue-router": "^3.0.3",
"vuex": "^3.0.1" "vuex": "^3.0.1"
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<!-- <a-menu-item key="1">应用管理</a-menu-item> --> <!-- <a-menu-item key="1">应用管理</a-menu-item> -->
<a-menu-item key="accountManagement">支付管理</a-menu-item> <a-menu-item key="accountManagement">支付管理</a-menu-item>
<a-menu-item key="classificationOfDishes">食堂管理</a-menu-item> <a-menu-item key="classificationOfDishes">食堂管理</a-menu-item>
<a-menu-item key="historicalVisitors">访客管理</a-menu-item> <!-- <a-menu-item key="historicalVisitors">访客管理</a-menu-item> -->
<!-- <a-menu-item key="5">权限管理</a-menu-item> --> <!-- <a-menu-item key="5">权限管理</a-menu-item> -->
</a-menu> </a-menu>
</a-layout-header> </a-layout-header>
......
<template> <template>
<div class="SystemReconciliation"> <div class="SystemReconciliation">
<div class="searchBox"> <div class="searchBox">
<a-date-picker <a-select placeholder="请选择年" v-model="year" style="width: 120px" @change="handleChange">
:disabledDate="disabledStartDate" <a-select-option v-for="item in yearList" :key="item" :value="item">{{item}}</a-select-option>
format="YYYY-MM-DD" </a-select>
v-model="startValue" <a-select placeholder="请选择月" v-model="month" style="width: 120px;margin-left: 10px" @change="handleChange">
placeholder="开始日期" <a-select-option v-for="item in 12" :key="item" :value="item">{{item}}</a-select-option>
@change="onChangeStartValue" </a-select>
@openChange="handleStartOpenChange" <a-button type="primary">查询</a-button>
/>
<a-date-picker
:disabledDate="disabledEndDate"
format="YYYY-MM-DD"
placeholder="结束日期"
@change="onChangeEndValue"
v-model="endValue"
:open="endOpen"
@openChange="handleEndOpenChange"
/>
<a-button type="primary" @click="getAccountCheck">查询</a-button>
</div> </div>
<div class="title">账单汇总</div> <div class="title">账单汇总</div>
<div class="SystemReconciliationContent"> <div id="rechargeLine" :style="{width: '900px', height: '300px'}"></div>
<div class="contentItem"> <div id="subsidyList" :style="{width: '900px', height: '300px'}"></div>
<div class="title"> <div id="consumeLine" :style="{width: '900px', height: '300px'}"></div>
充值金额
</div>
<div>
<p><label>现金:</label>¥{{systemReconciliationDetails.internalRechargeAmount || '0.00'}}</p>
<p><label>支付宝:</label>¥{{systemReconciliationDetails.externalRechargeAmount || '0.00'}}</p>
</div>
<div><p>共计:<span>¥{{ returnRechargeAmount() }}</span></p></div>
</div>
<div class="contentItem">
<div class="title">
发放津贴
</div>
<div>
<p v-for=" item in systemReconciliationDetails.subsidyCheck" :key="item.sceneType"><label>{{ item.sceneType === 'TRAVEL' ? '交通补助' : '餐补' }}</label>¥{{ item.amount || '0.00' }}</p>
</div>
<div><p>共计:<span>¥{{ returnSubsidyCheckTotal() }}</span></p></div>
</div>
<div class="contentItem">
<div class="title">
消费金额
</div>
<div class="recordsBox">
<div v-for="item in systemReconciliationDetails.consumeCheck" :key="item.sceneType">
<div>{{ item.sceneType === 'TRAVEL' ? '交通消费' : '用餐消费' }}</div>
<div>
<p>现金:¥{{ item.realityAmount || '0.00' }}</p>
<p>津贴:¥{{ item.subsidyAmount || '0.00' }}</p>
</div>
</div>
</div>
<div>
<p>共计:<span>¥{{ returnConsumeCheck('total') }}</span></p>
<p>津贴总消费:<span>¥{{ returnConsumeCheck('subsidyAmount') }}</span></p>
<p>现金总消费:<span>¥{{ returnConsumeCheck('realityAmount') }}</span></p>
</div>
</div>
</div>
</div> </div>
</template> </template>
<script> <script>
import { $http } from './../../../api/axios.js' import { $http } from './../../../api/axios.js'
import moment from 'moment'
export default { export default {
name: 'systemReconciliation', name: 'systemReconciliation',
data () { data () {
return { return {
startTime: '', year: '',
endTime: '', month: '',
startValue: null, SubsidyListDataList: [],
endValue: null, ConsumeDataList: [],
endOpen: false, RechargeDataList: [],
systemReconciliationDetails: {} yearList: []
} }
}, },
created () { created () {
let date = new Date() let thisYear = new Date().getFullYear()
let year = date.getFullYear() for (let i = 2018; i <= thisYear; i++) {
let month = date.getMonth() + 1 this.yearList.push(i)
let day = (new Date(year, month, 0).getDate().toString()).length > 1 ? new Date(year, month, 0).getDate() : '0' + new Date(year, month, 0).getDate()
this.startTime = `${year}-${month.toString().length > 1 ? month : '0' + month}-01`
this.endTime = `${year}-${month.toString().length > 1 ? month : '0' + month}-${day}`
this.startValue = this.moment(`${year}-${month.toString().length > 1 ? month : '0' + month}-01`, 'YYYY-MM-DD')
this.endValue = this.moment(`${year}-${month.toString().length > 1 ? month : '0' + month}-${day}`, 'YYYY-MM-DD')
this.getAccountCheck()
},
methods: {
moment,
disabledStartDate (startValue) {
const endValue = this.endValue
if (!startValue || !endValue) {
return false
} }
return startValue.valueOf() > endValue.valueOf() || startValue.valueOf() >= moment().endOf('day').valueOf() this.year = new Date().getFullYear()
this.month = new Date().getMonth() + 1
this.getStatisticsSubsidyData()
this.getStatisticsConsumeData()
this.getStatisticsRechargeData()
}, },
disabledEndDate (endValue) { mounted () {
const startValue = this.startValue // this.drawLine()
if (!endValue || !startValue) {
return false
}
return startValue.valueOf() > endValue.valueOf() || endValue.valueOf() > moment().endOf('day').valueOf()
}, },
handleStartOpenChange (open) { methods: {
if (!open) { drawSubsidyListDataLine () {
this.endOpen = true // 基于准备好的dom,初始化echarts实例
let myChart = this.$echarts.init(document.getElementById('subsidyList'))
// 绘制图表
let xAxisData = []
let data1 = []
let data2 = []
this.SubsidyListDataList.map(item => {
xAxisData.push(item.abscissaKey)
debugger
if (item.sceneTypeTotalAmountMap !== null) {
data1.push(item.sceneTypeTotalAmountMap.MEAl)
data2.push(item.sceneTypeTotalAmountMap.TRAVEL)
} else {
data1.push('')
data2.push('')
} }
})
myChart.setOption({
title: { text: '发放津贴金额' },
tooltip: {},
xAxis: {
data: xAxisData
}, },
handleEndOpenChange (open) { yAxis: {},
this.endOpen = open series: [{
}, name: '餐补津贴',
onChangeStartValue (date, dateString) { type: 'bar',
this.startTime = dateString data: data1
}, {
name: '交通津贴',
type: 'bar',
data: data2
}]
})
}, },
onChangeEndValue (date, dateString) { drawRechargeListDataLine () {
this.endTime = dateString // 基于准备好的dom,初始化echarts实例
let myChart = this.$echarts.init(document.getElementById('rechargeLine'))
// 绘制图表
let xAxisData = []
let data1 = []
let data2 = []
this.SubsidyListDataList.map(item => {
xAxisData.push(item.abscissaKey)
data1.push(item.internalRechargeAmount)
data2.push(item.externalRechargeAmount)
})
myChart.setOption({
title: { text: '充值金额' },
tooltip: {},
xAxis: {
data: xAxisData
}, },
returnConsumeCheck (str) { yAxis: {},
let totalNum = 0 series: [{
if (this.systemReconciliationDetails.consumeCheck) { name: '支付宝充值',
if (str === 'realityAmount') { type: 'bar',
this.systemReconciliationDetails.consumeCheck.map(item => { data: data1
let realityAmountNum = item.realityAmount ? item.realityAmount : 0 }, {
totalNum = totalNum + parseFloat(realityAmountNum) name: '现金充值',
type: 'bar',
data: data2
}]
}) })
return totalNum.toFixed(2) },
} else if (str === 'subsidyAmount') { drawConsumeListDataLine () {
this.systemReconciliationDetails.consumeCheck.map(item => { // 基于准备好的dom,初始化echarts实例
let subsidyAmountNum = item.subsidyAmount ? item.subsidyAmount : 0 let myChart = this.$echarts.init(document.getElementById('consumeLine'))
totalNum = totalNum + parseFloat(subsidyAmountNum) // 绘制图表
let xAxisData = []
let data1 = []
let data2 = []
let data3 = []
this.SubsidyListDataList.map(item => {
xAxisData.push(item.abscissaKey)
data1.push(item.internalConsumeRealityAmount)
data2.push(item.internalConsumeSubsidyAmount)
data3.push(item.externalConsumeRealityAmount)
}) })
return totalNum.toFixed(2) // internalConsumeRealityAmount 员工现金
} else if (str === 'total') { // internalConsumeSubsidyAmount 津贴
this.systemReconciliationDetails.consumeCheck.map(item => { // externalConsumeRealityAmount 访客消费
let orderAmountNum = item.orderAmount ? item.orderAmount : 0 myChart.setOption({
totalNum = totalNum + parseFloat(orderAmountNum) title: { text: '消费金额' },
tooltip: {},
xAxis: {
data: xAxisData
},
yAxis: {},
series: [{
name: '员工现金消费',
type: 'bar',
data: data1
}, {
name: '员工津贴消费',
type: 'bar',
data: data2
}, {
name: '访客消费',
type: 'bar',
data: data3
}]
}) })
return totalNum.toFixed(2) },
handleChange (value) {
console.log(`selected ${value}`)
},
getStatisticsSubsidyData () {
let that = this
let SubsidyListData = {
year: this.year,
month: this.month
} }
$http.get(`/mingpay/v1/isv/account/statisticsSubsidy`, SubsidyListData).then((res) => {
if (res.data.resultCode === 0) {
that.SubsidyListDataList = res.data.data
that.drawSubsidyListDataLine()
} else { } else {
return '0.00' this.$message.error(res.data.message)
} }
},
returnSubsidyCheckTotal () {
let totalNum = 0
if (this.systemReconciliationDetails.subsidyCheck) {
this.systemReconciliationDetails.subsidyCheck.map(item => {
let amountNum = item.amount ? item.amount : 0
totalNum = totalNum + parseFloat(amountNum)
}) })
return totalNum.toFixed(2) },
getStatisticsConsumeData () {
let that = this
let ConsumeData = {
year: this.year,
month: this.month
}
$http.get(`/mingpay/v1/isv/account/statisticsConsume`, ConsumeData).then((res) => {
console.log(res.data.data)
if (res.data.resultCode === 0) {
that.ConsumeDataList = res.data.data
that.drawConsumeListDataLine()
} else { } else {
return '0.00' this.$message.error(res.data.message)
} }
})
}, },
returnRechargeAmount () { getStatisticsRechargeData () {
let internalRechargeAmount = this.systemReconciliationDetails.internalRechargeAmount || 0 let that = this
let externalRechargeAmount = this.systemReconciliationDetails.externalRechargeAmount || 0 let RechargeData = {
let totalNum = parseFloat(internalRechargeAmount) + parseFloat(externalRechargeAmount) year: this.year,
return totalNum.toFixed(2) month: this.month
},
getAccountCheck () {
let SubsidyListData = {
startTime: this.startTime,
endTime: this.endTime
} }
$http.get(`/mingpay/v1/isv/account/accountCheck`, SubsidyListData).then((res) => { $http.get(`/mingpay/v1/isv/account/statisticsRecharge`, RechargeData).then((res) => {
console.log(res.data.data) console.log(res.data.data)
if (res.data.resultCode === 0) { if (res.data.resultCode === 0) {
this.systemReconciliationDetails = res.data.data that.RechargeDataList = res.data.data
that.drawRechargeListDataLine()
} else { } else {
this.$message.error(res.data.message) this.$message.error(res.data.message)
} }
......
...@@ -6,6 +6,7 @@ import { Upload, Menu, Layout, Checkbox, Breadcrumb, Popover, Icon, Button, Date ...@@ -6,6 +6,7 @@ import { Upload, Menu, Layout, Checkbox, Breadcrumb, Popover, Icon, Button, Date
import 'ant-design-vue/dist/antd.css' import 'ant-design-vue/dist/antd.css'
import { config } from './api/config' import { config } from './api/config'
import './assets/css/global.css' import './assets/css/global.css'
import echarts from 'echarts'
Vue.use(Layout) Vue.use(Layout)
Vue.use(Upload) Vue.use(Upload)
...@@ -32,8 +33,10 @@ Vue.use(Input.TextArea) ...@@ -32,8 +33,10 @@ Vue.use(Input.TextArea)
Vue.use(message) Vue.use(message)
Vue.use(Pagination) Vue.use(Pagination)
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$confirm = Modal.confirm Vue.prototype.$confirm = Modal.confirm
Vue.prototype.$message = message Vue.prototype.$message = message
Vue.prototype.$echarts = echarts
router.beforeEach(function (to, from, next) { router.beforeEach(function (to, from, next) {
// 项目初始化进行鉴权 // 项目初始化进行鉴权
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment