|
@@ -1,26 +1,86 @@
|
|
<template>
|
|
<template>
|
|
<div class="dashboard-editor-container">
|
|
<div class="dashboard-editor-container">
|
|
-
|
|
|
|
- <panel-group @handleSetLineChartData="handleSetLineChartData" />
|
|
|
|
-
|
|
|
|
- <el-row style="background:#fff;padding:16px 16px 0;margin-bottom:32px;">
|
|
|
|
- <line-chart :chart-data="lineChartData" />
|
|
|
|
- </el-row>
|
|
|
|
-
|
|
|
|
- <el-row :gutter="32">
|
|
|
|
- <el-col :xs="24" :sm="24" :lg="8">
|
|
|
|
|
|
+ <el-row :gutter="22" style="min-height: calc(100vh - 84px);">
|
|
|
|
+ <el-col :xs="24" :sm="24" :lg="12">
|
|
|
|
+ <div class="chart-wrapper">
|
|
|
|
+ <div class="chart-title">
|
|
|
|
+ <span>收款金额(元)</span>
|
|
|
|
+ <div style="float: right;">
|
|
|
|
+ <el-date-picker
|
|
|
|
+ v-model="Receivable.startTime"
|
|
|
|
+ type="datetime"
|
|
|
|
+ placeholder="选择日期时间"
|
|
|
|
+ />
|
|
|
|
+ 至
|
|
|
|
+ <el-date-picker
|
|
|
|
+ v-model="Receivable.endTime"
|
|
|
|
+ type="datetime"
|
|
|
|
+ placeholder="选择日期时间"
|
|
|
|
+ @blur="handleGetReceivable"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="chartText">
|
|
|
|
+ <p>应收金额</p>
|
|
|
|
+ <p class="money">¥{{ numFormat(payTotalFee) }}元</p>
|
|
|
|
+ </div>
|
|
|
|
+ <raddar-chart v-if="isRequest" :receivab="ReceivableData" />
|
|
|
|
+ </div>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :xs="24" :sm="24" :lg="12">
|
|
<div class="chart-wrapper">
|
|
<div class="chart-wrapper">
|
|
- <raddar-chart />
|
|
|
|
|
|
+ <div class="chart-title">
|
|
|
|
+ <span>订单数量(个)</span>
|
|
|
|
+ <div style="float: right;">
|
|
|
|
+ <el-date-picker
|
|
|
|
+ v-model="Order.startTime"
|
|
|
|
+ type="datetime"
|
|
|
|
+ placeholder="选择日期时间"
|
|
|
|
+ />
|
|
|
|
+ 至
|
|
|
|
+ <el-date-picker
|
|
|
|
+ v-model="Order.endTime"
|
|
|
|
+ type="datetime"
|
|
|
|
+ placeholder="选择日期时间"
|
|
|
|
+ @blur="handleGetHomepageOrder"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="chartText">
|
|
|
|
+ <p>全部订单</p>
|
|
|
|
+ <p class="money">{{ count }}个</p>
|
|
|
|
+ </div>
|
|
|
|
+ <pie-chart v-if="isOrderRequest" :order-data="OrderData" />
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
- <el-col :xs="24" :sm="24" :lg="8">
|
|
|
|
|
|
+ <el-col :xs="24" :sm="24" :lg="12">
|
|
<div class="chart-wrapper">
|
|
<div class="chart-wrapper">
|
|
- <pie-chart />
|
|
|
|
|
|
+ <div class="chart-title">
|
|
|
|
+ <span>销售额趋势</span>
|
|
|
|
+ </div>
|
|
|
|
+ <bar-chart v-if="isSaleRequest" :paytotalfee-data="payTotalFeeData" :month-data="monthData" />
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
- <el-col :xs="24" :sm="24" :lg="8">
|
|
|
|
|
|
+ <el-col :xs="24" :sm="24" :lg="12">
|
|
<div class="chart-wrapper">
|
|
<div class="chart-wrapper">
|
|
- <bar-chart />
|
|
|
|
|
|
+ <div class="chart-title">
|
|
|
|
+ <span>热销商品</span>
|
|
|
|
+ <div style="float: right;">
|
|
|
|
+ <el-date-picker
|
|
|
|
+ v-model="Commodity.startTime"
|
|
|
|
+ type="datetime"
|
|
|
|
+ placeholder="选择日期时间"
|
|
|
|
+ />
|
|
|
|
+ 至
|
|
|
|
+ <el-date-picker
|
|
|
|
+ v-model="Commodity.endTime"
|
|
|
|
+ type="datetime"
|
|
|
|
+ placeholder="选择日期时间"
|
|
|
|
+ @blur="handleGetHomepageCommodity"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <hot-goods v-if="isGoodRequest" :goodslist-data="goodsList" />
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -28,48 +88,94 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import PanelGroup from './components/PanelGroup'
|
|
|
|
-import LineChart from './components/LineChart'
|
|
|
|
import RaddarChart from './components/RaddarChart'
|
|
import RaddarChart from './components/RaddarChart'
|
|
import PieChart from './components/PieChart'
|
|
import PieChart from './components/PieChart'
|
|
import BarChart from './components/BarChart'
|
|
import BarChart from './components/BarChart'
|
|
-
|
|
|
|
-const lineChartData = {
|
|
|
|
- newVisitis: {
|
|
|
|
- expectedData: [100, 120, 161, 134, 105, 160, 165],
|
|
|
|
- actualData: [120, 82, 91, 154, 162, 140, 145]
|
|
|
|
- },
|
|
|
|
- messages: {
|
|
|
|
- expectedData: [200, 192, 120, 144, 160, 130, 140],
|
|
|
|
- actualData: [180, 160, 151, 106, 145, 150, 130]
|
|
|
|
- },
|
|
|
|
- purchases: {
|
|
|
|
- expectedData: [80, 100, 121, 104, 105, 90, 100],
|
|
|
|
- actualData: [120, 90, 100, 138, 142, 130, 130]
|
|
|
|
- },
|
|
|
|
- shoppings: {
|
|
|
|
- expectedData: [130, 140, 141, 142, 145, 150, 160],
|
|
|
|
- actualData: [120, 82, 91, 154, 162, 140, 130]
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
|
|
+import HotGoods from './components/HotGoods'
|
|
|
|
+import { getReceivable, getHomepageOrder, getHomepageSale, getHomepageCommodity } from '@/api/home'
|
|
export default {
|
|
export default {
|
|
- name: 'DashboardAdmin',
|
|
|
|
|
|
+ name: 'Admin',
|
|
components: {
|
|
components: {
|
|
- PanelGroup,
|
|
|
|
- LineChart,
|
|
|
|
RaddarChart,
|
|
RaddarChart,
|
|
PieChart,
|
|
PieChart,
|
|
- BarChart
|
|
|
|
|
|
+ BarChart,
|
|
|
|
+ HotGoods
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- lineChartData: lineChartData.newVisitis
|
|
|
|
|
|
+ isRequest: false,
|
|
|
|
+ isOrderRequest: false,
|
|
|
|
+ isSaleRequest: false,
|
|
|
|
+ isGoodRequest: false,
|
|
|
|
+ ReceivableData: [],
|
|
|
|
+ OrderData: [],
|
|
|
|
+ payTotalFeeData: [],
|
|
|
|
+ monthData: [],
|
|
|
|
+ goodsList: [],
|
|
|
|
+ Receivable: {
|
|
|
|
+ startTime: '',
|
|
|
|
+ endTime: '',
|
|
|
|
+ organizeID: this.organizeID
|
|
|
|
+ },
|
|
|
|
+ Order: {
|
|
|
|
+ startTime: '',
|
|
|
|
+ endTime: '',
|
|
|
|
+ organizeID: this.organizeID
|
|
|
|
+ },
|
|
|
|
+ Commodity: {
|
|
|
|
+ startTime: '',
|
|
|
|
+ endTime: '',
|
|
|
|
+ organizeID: this.organizeID
|
|
|
|
+ },
|
|
|
|
+ count: 0,
|
|
|
|
+ payTotalFee: ''
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ created() {
|
|
|
|
+ this.fetchData()
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
- handleSetLineChartData(type) {
|
|
|
|
- this.lineChartData = lineChartData[type]
|
|
|
|
|
|
+ fetchData() {
|
|
|
|
+ this.handleGetReceivable()
|
|
|
|
+ this.handleGetHomepageOrder()
|
|
|
|
+ this.handleGetHomepageSale()
|
|
|
|
+ this.handleGetHomepageCommodity()
|
|
|
|
+ },
|
|
|
|
+ handleGetReceivable() {
|
|
|
|
+ getReceivable(this.Receivable).then(response => {
|
|
|
|
+ this.isRequest = true
|
|
|
|
+ this.payTotalFee = response.data.payTotalFee
|
|
|
|
+ const receob = { name: '已收金额', value: response.data.amountReceived }
|
|
|
|
+ const receob1 = { name: '未收金额', value: response.data.uncollected }
|
|
|
|
+ this.ReceivableData = [receob, receob1]
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ handleGetHomepageOrder() {
|
|
|
|
+ getHomepageOrder(this.Order).then(response => {
|
|
|
|
+ this.isOrderRequest = true
|
|
|
|
+ this.count = response.data.count
|
|
|
|
+ const order = { name: '已收款订单', value: response.data.received }
|
|
|
|
+ const order1 = { name: '未收款订单', value: response.data.uncollected }
|
|
|
|
+ const order2 = { name: '部分收款订单', value: response.data.portion }
|
|
|
|
+ this.OrderData = [order, order1, order2]
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ handleGetHomepageSale() {
|
|
|
|
+ getHomepageSale({ organizeID: this.organizeID }).then(response => {
|
|
|
|
+ this.isSaleRequest = true
|
|
|
|
+ this.monthData = response.data.month
|
|
|
|
+ this.payTotalFeeData = response.data.payTotalFee
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ handleGetHomepageCommodity() {
|
|
|
|
+ getHomepageCommodity(this.Commodity).then(response => {
|
|
|
|
+ this.isGoodRequest = true
|
|
|
|
+ this.goodsList = response.data
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ numFormat(num) {
|
|
|
|
+ var c = (num.toString().indexOf('.') !== -1) ? num.toLocaleString() : num.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
|
|
|
|
+ return c
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -77,21 +183,51 @@ export default {
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
.dashboard-editor-container {
|
|
.dashboard-editor-container {
|
|
- padding: 32px;
|
|
|
|
- background-color: rgb(240, 242, 245);
|
|
|
|
|
|
+ padding: 22px;
|
|
|
|
+ min-height: calc(100vh - 84px);
|
|
|
|
+ background-color: rgba(43, 67, 94, 1);
|
|
position: relative;
|
|
position: relative;
|
|
-
|
|
|
|
.github-corner {
|
|
.github-corner {
|
|
position: absolute;
|
|
position: absolute;
|
|
top: 0px;
|
|
top: 0px;
|
|
border: 0;
|
|
border: 0;
|
|
right: 0;
|
|
right: 0;
|
|
}
|
|
}
|
|
-
|
|
|
|
.chart-wrapper {
|
|
.chart-wrapper {
|
|
background: #fff;
|
|
background: #fff;
|
|
- padding: 16px 16px 0;
|
|
|
|
- margin-bottom: 32px;
|
|
|
|
|
|
+ padding: 0 16px 0;
|
|
|
|
+ margin-bottom: 22px;
|
|
|
|
+ height: 475px;
|
|
|
|
+ border-radius: 10px;
|
|
|
|
+ position: relative;
|
|
|
|
+ .chartText{
|
|
|
|
+ width: 130px;
|
|
|
|
+ height: 140px;
|
|
|
|
+ padding-top:30px;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ font-size: 18px;
|
|
|
|
+ color:#98A0A7;
|
|
|
|
+ text-align: center;
|
|
|
|
+ position: absolute;
|
|
|
|
+ top:0;
|
|
|
|
+ left:0;
|
|
|
|
+ right:0;
|
|
|
|
+ bottom:0;
|
|
|
|
+ margin:auto;
|
|
|
|
+ .money{
|
|
|
|
+ color:#000000;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .chart-title{
|
|
|
|
+ height: 48px;
|
|
|
|
+ line-height: 48px;
|
|
|
|
+ span{
|
|
|
|
+ text-align: left;
|
|
|
|
+ font-size: 14px;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ color: #000000;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|