123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594 |
- <template>
- <div>
- <div class="eachartTop">
- <SearchHeader
- title="时间筛选: "
- :isShowQuert="true"
- :dates="mdate"
- :endDate="endDate"
- @changeValue="changeValue"
- />
- </div>
- <statistic :col="6" class="statistic" :cols="12">
- <statistic-item>
- <span>
- 现金总收入: (元)
- </span>
- <span>
- <count-to
- :endVal="totalAmount"
- :duration="300"
- :decimals="2"
- class="blod"
- />
- </span>
- </statistic-item>
- <statistic-item>
- <span>
- 管乐迷现金收入: (元)
- </span>
- <span>
- <count-to
- :endVal="gymTotal"
- :duration="300"
- :decimals="2"
- :class="'des'"
- />
- </span>
- </statistic-item>
- <statistic-item>
- <span>
- 酷乐秀现金收入: (元)
- </span>
- <span>
- <count-to
- :endVal="colexiuTotal"
- :duration="300"
- :decimals="2"
- :class="'des'"
- />
- </span>
- </statistic-item>
- <statistic-item>
- <span>
- 管乐团现金收入: (元)
- </span>
- <span>
- <count-to
- :endVal="gytTotal"
- :duration="300"
- :decimals="2"
- :class="'des'"
- />
- </span>
- </statistic-item>
- <statistic-item>
- <span>
- 课堂乐器现金收入: (元)
- </span>
- <span>
- <count-to
- :endVal="ktyqTotal"
- :duration="300"
- :decimals="2"
- :class="'des'"
- />
- </span>
- </statistic-item>
- <statistic-item>
- <span>
- 酷乐秀机构版现金收入: (元)
- </span>
- <span>
- <count-to
- :endVal="colexiuTenantTotal"
- :duration="300"
- :decimals="2"
- :class="'des'"
- />
- </span>
- </statistic-item>
- </statistic>
- <div></div>
- <div class="operateEcharts">
- <div class="eachartTitle">
- <div>
- 管乐迷现金收入:
- <count-to
- :endVal="gymTotal"
- :duration="300"
- :decimals="2"
- class="des"
- />
- 元
- </div>
- <el-select
- clearable
- filterable
- placeholder="请选择分部"
- v-model="organId"
- @change="
- () => {
- this.isChangeOrgan = true;
- this.getData();
- }
- "
- >
- <el-option
- v-for="(item, index) in selects.branchs"
- :key="index"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </div>
- <div class="gym-echarts"></div>
- <div class="eachartTitle">
- <div>
- 酷乐秀现金收入:
- <count-to
- :endVal="colexiuTotal"
- :duration="300"
- :decimals="2"
- class="des"
- />
- 元
- </div>
- </div>
- <div class="colexiu-echarts"></div>
- <div class="eachartTitle">
- <div>
- 管乐团现金收入:
- <count-to
- :endVal="gytTotal"
- :duration="300"
- :decimals="2"
- class="des"
- />
- 元
- </div>
- </div>
- <div class="gyt-echarts"></div>
- <div class="eachartTitle">
- <div>
- 课堂乐器现金收入:
- <count-to
- :endVal="ktyqTotal"
- :duration="300"
- :decimals="2"
- class="des"
- />
- 元
- </div>
- </div>
- <div class="ktyq-echarts"></div>
- <div class="eachartTitle">
- <div>
- 酷乐秀机构版现金收入:
- <count-to
- :endVal="colexiuTenantTotal"
- :duration="300"
- :decimals="2"
- class="des"
- />
- 元
- </div>
- </div>
- <div class="colexiu-tenant-echarts"></div>
- </div>
- </div>
- </template>
- <script>
- import echarts from "echarts";
- import CountTo from "vue-count-to";
- import { multiDataSourceHomeStatsSummerIncome } from "../../api";
- import SearchHeader from "./searchDayHeader";
- import { getTimes } from "@/utils";
- export default {
- components: {
- CountTo,
- SearchHeader
- },
- data() {
- return {
- organId: "",
- mdate: [],
- endDate: "",
- gymECharts: null,
- gymData: [],
- gymTotal: 0,
- gytEcharts: null,
- gytData: [],
- gytTotal: 0,
- colexiuEcharts: null,
- colexiuData: [],
- colexiuTotal: 0,
- ktyqEcharts: null,
- ktyqData: [],
- ktyqTotal: 0,
- colexiuTenantEcharts: null,
- colexiuTenantData: [],
- colexiuTenantTotal: 0,
- isChangeOrgan: false
- };
- },
- mounted() {
- this.mdate = this.getInitDate();
- this.endDate = this.$helpers.dayjs(new Date()).format("YYYY-MM-DD");
- this.getData();
- window.addEventListener("resize", this.resize);
- },
- beforeDestroy() {
- window.removeEventListener("resize", this.resize);
- },
- methods: {
- getInitDate() {
- const end = this.$helpers.dayjs(new Date()).format("YYYY-MM-DD");
- const start = this.$helpers
- .dayjs(new Date())
- // .set("month", 1)
- .subtract(1, "month")
- .format("YYYY-MM-DD");
- return [start, end];
- },
- getData() {
- multiDataSourceHomeStatsSummerIncome({
- ...getTimes(this.mdate, ["startTime", "endTime"]),
- organIds: this.organId
- }).then(res => {
- if (Array.isArray(res.data)) {
- const gym = res.data.find(item => item.platform == "gym");
- if (gym) {
- this.gymTotal = gym.totalAmount;
- this.gymData = gym.incomeByDates;
- }
- // 切换分部只更新管乐迷数据
- if (this.isChangeOrgan) {
- this.isChangeOrgan = false;
- this.createGym();
- return;
- }
- const gyt = res.data.find(item => item.platform == "gyt");
- if (gyt) {
- this.gytTotal = gyt.totalAmount;
- this.gytData = gyt.incomeByDates;
- }
- const clx = res.data.find(item => item.platform == "cls");
- if (clx) {
- this.colexiuTotal = clx.totalAmount;
- this.colexiuData = clx.incomeByDates;
- }
- const ktyq = res.data.find(item => item.platform == "kt");
- if (ktyq) {
- this.ktyqTotal = ktyq.totalAmount;
- this.ktyqData = ktyq.incomeByDates;
- }
- const clxt = res.data.find(item => item.platform == "clsOrg");
- if (clxt) {
- this.colexiuTenantTotal = clxt.totalAmount;
- this.colexiuTenantData = clxt.incomeByDates;
- }
- this.$nextTick(() => {
- this.init();
- });
- }
- });
- },
- changeValue(date) {
- // 请求更改数据
- this.mdate = date;
- this.getData();
- },
- resize() {
- this.gymECharts.resize();
- this.gytEcharts.resize();
- this.colexiuEcharts.resize();
- this.ktyqEcharts.resize();
- this.colexiuTenantEcharts.resize();
- },
- init() {
- this.createGym();
- this.createGyt();
- this.createColexiu();
- this.createColexiuTenant();
- this.createKtyq();
- },
- createGym() {
- if (this.gymECharts) {
- this.gymECharts.dispose();
- }
- this.gymECharts = echarts.init(document.querySelector(".gym-echarts"));
- const option = {
- title: {
- top: "0%",
- text: "",
- textStyle: {
- color: "#333",
- fontSize: 14
- }
- },
- tooltip: {
- trigger: "axis",
- formatter: function(data) {
- const item = data[0];
- return `${item.axisValue}<br /> ${item.marker} ${item.value.toFixed(
- 2
- )}元`;
- }
- },
- grid: {
- left: 5,
- top: 30,
- right: 5,
- bottom: 5,
- containLabel: true
- },
- xAxis: {
- type: "category",
- data: this.gymData.map(item => item.date),
- axisLabel: {
- color: "#333",
- fontSize: 10
- }
- },
- yAxis: {
- type: "value",
- axisLabel: { formatter: "{value}元" }
- },
- series: [
- {
- data: this.gymData.map(item => item.totalAmount),
- type: "bar",
- color: "#00a79d",
- barMaxWidth: 40
- }
- ]
- };
- option && this.gymECharts.setOption(option);
- },
- createGyt() {
- if (this.gytEcharts) {
- this.gytEcharts.dispose();
- }
- this.gytEcharts = echarts.init(document.querySelector(".gyt-echarts"));
- const option = {
- grid: {
- left: 5,
- top: 30,
- right: 5,
- bottom: 5,
- containLabel: true
- },
- tooltip: {
- trigger: "axis",
- formatter: function(data) {
- const item = data[0];
- return `${item.axisValue}<br /> ${item.marker} ${item.value.toFixed(
- 2
- )}元`;
- }
- },
- xAxis: {
- type: "category",
- data: this.gytData.map(item => item.date),
- axisLabel: {
- color: "#333",
- fontSize: 10
- }
- },
- yAxis: {
- type: "value",
- axisLabel: { formatter: "{value}元" }
- },
- series: [
- {
- data: this.gytData.map(item => item.totalAmount),
- type: "bar",
- color: "#00a79d",
- barMaxWidth: 40
- }
- ]
- };
- option && this.gytEcharts.setOption(option);
- },
- createColexiu() {
- if (this.colexiuEcharts) {
- this.colexiuEcharts.dispose();
- }
- this.colexiuEcharts = echarts.init(
- document.querySelector(".colexiu-echarts")
- );
- const option = {
- grid: {
- left: 5,
- top: 30,
- right: 5,
- bottom: 5,
- containLabel: true
- },
- tooltip: {
- trigger: "axis",
- formatter: function(data) {
- const item = data[0];
- return `${item.axisValue}<br /> ${item.marker} ${item.value.toFixed(
- 2
- )}元`;
- }
- },
- xAxis: {
- type: "category",
- data: this.colexiuData.map(item => item.date),
- axisLabel: {
- color: "#333",
- fontSize: 10
- }
- },
- yAxis: {
- type: "value",
- axisLabel: { formatter: "{value}元" }
- },
- series: [
- {
- data: this.colexiuData.map(item => item.totalAmount),
- type: "bar",
- color: "#00a79d",
- barMaxWidth: 40
- }
- ]
- };
- option && this.colexiuEcharts.setOption(option);
- },
- createColexiuTenant() {
- if (this.colexiuTenantEcharts) {
- this.colexiuTenantEcharts.dispose();
- }
- this.colexiuTenantEcharts = echarts.init(
- document.querySelector(".colexiu-tenant-echarts")
- );
- const option = {
- grid: {
- left: 5,
- top: 30,
- right: 5,
- bottom: 5,
- containLabel: true
- },
- tooltip: {
- trigger: "axis",
- formatter: function(data) {
- const item = data[0];
- return `${item.axisValue}<br /> ${item.marker} ${item.value.toFixed(
- 2
- )}元`;
- }
- },
- xAxis: {
- type: "category",
- data: this.colexiuTenantData.map(item => item.date),
- axisLabel: {
- color: "#333",
- fontSize: 10
- }
- },
- yAxis: {
- type: "value",
- axisLabel: { formatter: "{value}元" }
- },
- series: [
- {
- data: this.colexiuTenantData.map(item => item.totalAmount),
- type: "bar",
- color: "#00a79d",
- barMaxWidth: 40
- }
- ]
- };
- option && this.colexiuTenantEcharts.setOption(option);
- },
- createKtyq() {
- if (this.ktyqEcharts) {
- this.ktyqEcharts.dispose();
- }
- this.ktyqEcharts = echarts.init(document.querySelector(".ktyq-echarts"));
- const option = {
- grid: {
- left: 5,
- top: 30,
- right: 5,
- bottom: 5,
- containLabel: true
- },
- tooltip: {
- trigger: "axis",
- formatter: function(data) {
- const item = data[0];
- return `${item.axisValue}<br /> ${item.marker} ${item.value.toFixed(
- 2
- )}元`;
- }
- },
- xAxis: {
- type: "category",
- data: this.ktyqData.map(item => item.date),
- axisLabel: {
- color: "#333",
- fontSize: 10
- }
- },
- yAxis: {
- type: "value",
- axisLabel: { formatter: "{value}元" }
- },
- series: [
- {
- data: this.ktyqData.map(item => item.totalAmount),
- type: "bar",
- color: "#00a79d",
- barMaxWidth: 40
- }
- ]
- };
- option && this.ktyqEcharts.setOption(option);
- }
- },
- computed: {
- totalAmount() {
- return this.gymTotal + this.gytTotal + this.colexiuTotal;
- }
- }
- };
- </script>
- <style lang="less" scoped>
- .eachartTop {
- margin-bottom: 20px;
- // display: flex;
- // align-items: center;
- // justify-content: space-between;
- // flex-wrap: wrap;
- // ::v-deep .box {
- // margin-right: 5px;
- // }
- // ::v-deep .shape {
- // display: none;
- // }
- }
- .eachartTitle {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .operateEcharts {
- // display: flex;
- .gym-echarts,
- .gyt-echarts,
- .colexiu-echarts,
- .ktyq-echarts,
- .colexiu-tenant-echarts {
- width: 100%;
- height: 350px;
- margin-bottom: 24px;
- }
- }
- .statistic .statistic-content > span {
- &:first-child {
- font-size: 14px !important;
- }
- font-size: 18px !important;
- }
- .blod {
- font-weight: bold !important;
- color: var(--color-primary) !important;
- font-size: 22px !important;
- }
- .des {
- font-size: 18px !important;
- color: var(--color-primary);
- }
- </style>
|