Explorar o código

3端经营数据

liushengqiang %!s(int64=2) %!d(string=hai) anos
pai
achega
9ccdd865e1

+ 9 - 0
src/views/main/api.js

@@ -239,3 +239,12 @@ export const cloudTeacherSumDetail = data =>
     method: "post",
     data
   });
+  
+// 获取3端经营数据
+export const multiDataSourceHomeStatsSummerIncome = data =>
+  request2({
+    url: "/api-web/multiDataSourceHomeStats/summerIncome",
+    method: "post",
+    data,
+  });
+  

+ 101 - 25
src/views/main/baseinfo/management.vue

@@ -11,29 +11,37 @@
       />
     </div>
 
-    <el-tabs v-model="activeName">
-      <el-tab-pane label="总览" name="first">
-        <div v-if="activeName == 'first'">
-          <manageOrganAll :data="data" :search="search" ref="manageOrganAll" />
-        </div>
-      </el-tab-pane>
-      <el-tab-pane label="分部数据" name="second">
-        <div v-if="activeName == 'second'">
-          <el-button
-            type="primary"
-            @click="exportQuestion"
-            v-permission="'export/now/EXPORT_INDEX_COOPALL'"
-            >导出</el-button
-          >
-          <manageOrgan
-            :data="data"
-            :search="search"
-            ref="manageOrgan"
-            :mdate1="mdate"
-          />
-        </div>
-      </el-tab-pane>
-    </el-tabs>
+    
+
+    <div class="ment-container">
+      <el-tabs v-model="activeName">
+        <el-tab-pane label="总览" name="first">
+          <div v-if="activeName == 'first'">
+            <manageOrganAll :data="data" :search="search" ref="manageOrganAll" />
+          </div>
+        </el-tab-pane>
+        <el-tab-pane label="分部数据" name="second">
+          <div v-if="activeName == 'second'">
+            <el-button
+              type="primary"
+              @click="exportQuestion"
+              v-permission="'export/now/EXPORT_INDEX_COOPALL'"
+              >导出</el-button
+            >
+            <manageOrgan
+              :data="data"
+              :search="search"
+              ref="manageOrgan"
+              :mdate1="mdate"
+            />
+          </div>
+        </el-tab-pane>
+      </el-tabs>
+      <el-button v-permission="'multiDataSourceHomeStats/summerIncome'" class="lookAllBtn" @click="openModel = true">查看总数据</el-button>
+    </div>
+    <el-dialog class="dialog" top="5vh" width="80vw" title="总览" :visible.sync="openModel">
+      <operateEcharts></operateEcharts>
+    </el-dialog>
   </el-card>
 </template>
 <script>
@@ -49,6 +57,7 @@ import { orderType } from "@/constant";
 import manageOrganAll from "./modals/manageOrganAll";
 import manageOrgan from "./modals/manageOrgan";
 import { Export } from "@/utils/downLoadFile";
+import operateEcharts from "./modals/operateEcharts.vue";
 export default {
   props: ["data", "search"],
   components: {
@@ -57,7 +66,8 @@ export default {
     "ve-histogram": histogram,
     searchHeader,
     manageOrganAll,
-    manageOrgan
+    manageOrgan,
+    operateEcharts
   },
   computed: {
     legend() {
@@ -237,7 +247,8 @@ export default {
       loading: false,
       endDate: "",
       show: true,
-      activeName: "first"
+      activeName: "first",
+      openModel: false, // 3端弹窗
     };
   },
   mounted() {
@@ -406,4 +417,69 @@ export default {
     z-index: 100;
   }
 }
+.ment-container{
+  position: relative;
+}
+.lookAllBtn{
+  position: absolute;
+  top: 0;
+  right: 0;
+}
+.dialog {
+  ::v-deep {
+    .el-dialog {
+      border-radius: 4px;
+      overflow: hidden;
+    }
+    .el-dialog__header {
+      display: flex;
+      flex-shrink: 0;
+      justify-content: space-between;
+      align-items: center;
+      box-sizing: border-box;
+      width: 100%;
+      height: 48px;
+      padding: 0 20px;
+      .el-dialog__title {
+        font-weight: 500;
+        font-size: 16px;
+      }
+      .el-dialog__headerbtn {
+        position: relative;
+        top: 0;
+        right: 0;
+        &::before {
+          position: absolute;
+          display: block;
+          box-sizing: border-box;
+          background-color: transparent;
+          border-radius: 50%;
+          transition: background-color 0.1s cubic-bezier(0, 0, 1, 1);
+          content: "";
+          top: 50%;
+          left: 50%;
+          width: 20px;
+          height: 20px;
+          transform: translate(-50%, -50%);
+        }
+      }
+      .el-dialog__headerbtn:hover {
+        &::before {
+          background-color: rgba(0, 0, 0, 0.5);
+        }
+      }
+      .el-dialog__close {
+        position: relative;
+      }
+    }
+    .el-dialog__body {
+      padding: 10px 20px;
+      max-height: 80vh;
+      overflow-y: auto;
+    }
+    .el-input-group__append {
+      padding: 0 10px;
+    }
+  }
+}
 </style>

+ 349 - 0
src/views/main/baseinfo/modals/operateEcharts.vue

@@ -0,0 +1,349 @@
+<template>
+  <div>
+    <el-form>
+      <el-form-item label-width="0">
+        <SearchHeader
+          title="时间筛选"
+          :isShowQuert="true"
+          :dates="mdate"
+          @changeValue="changeValue"
+        />
+      </el-form-item>
+    </el-form>
+
+    <statistic :col="3" class="statistic" :cols="12">
+      <statistic-item>
+        <span>
+          {{ "总收入" + "(元)" }}
+          <el-tooltip
+            content="总收入:现金收入 + 余额收入"
+            :open-delay="0.3"
+            placement="top"
+          >
+            <i
+              style="margin-left: 5px; cursor: pointer"
+              class="el-icon-warning-outline"
+            />
+          </el-tooltip>
+        </span>
+        <span>
+          <count-to :endVal="totalAmount" :decimals="2" class="blod"
+        /></span>
+      </statistic-item>
+
+      <statistic-item>
+        <span>
+          {{ "现金收入" + "(元)" }}
+          <el-tooltip
+            content="筛选时间段内现金收入总和"
+            :open-delay="0.3"
+            placement="top"
+          >
+            <i
+              style="margin-left: 5px; cursor: pointer"
+              class="el-icon-warning-outline"
+            />
+          </el-tooltip>
+        </span>
+        <count-to :endVal="0" :decimals="2" class="blod" />
+      </statistic-item>
+      <statistic-item>
+        <span>
+          {{ "余额收入" + "(元)" }}
+          <el-tooltip
+            content="筛选时间段内余额消耗总和"
+            :open-delay="0.3"
+            placement="top"
+          >
+            <i
+              style="margin-left: 5px; cursor: pointer"
+              class="el-icon-warning-outline"
+            />
+          </el-tooltip>
+        </span>
+        <count-to :endVal="0" :decimals="2" class="blod" />
+      </statistic-item>
+    </statistic>
+
+    <el-form>
+      <el-form-item label="分部">
+        <el-select
+          clearable
+          filterable
+          placeholder="请选择分部"
+          v-model="organId"
+          @change="
+            () => {
+              this.getData();
+            }
+          "
+        >
+          <el-option
+            v-for="(item, index) in selects.branchs"
+            :key="index"
+            :label="item.name"
+            :value="item.id"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+    </el-form>
+    <div class="operateEcharts">
+      <div class="gym-echarts"></div>
+      <div class="gyt-echarts"></div>
+      <div class="colexiu-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: [],
+      gymECharts: null,
+      gymData: [],
+      gymTotal: 0,
+      gytEcharts: null,
+      gytData: [],
+      gytTotal: 0,
+      colexiuEcharts: null,
+      colexiuData: [],
+      colexiuTotal: 0
+    };
+  },
+  mounted() {
+    this.mdate = this.getInitDate();
+    this.getData();
+  },
+  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;
+          }
+          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;
+          }
+          this.init();
+        }
+      });
+    },
+    changeValue(date) {
+      // 请求更改数据
+      this.mdate = date;
+      this.getData();
+    },
+    init() {
+      this.createGym();
+      this.createGyt();
+      this.createColexiu();
+    },
+    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"
+        },
+        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,
+            rotate: 30
+          }
+        },
+        yAxis: {
+          type: "value",
+          axisLabel: { formatter: "{value}元" }
+        },
+        series: [
+          {
+            data: this.gymData.map(item => item.totalAmount),
+            type: "line",
+            color: "#E8684A"
+          }
+        ]
+      };
+      option && this.gymECharts.setOption(option);
+    },
+    createGyt() {
+      if (this.gytEcharts) {
+        this.gytEcharts.dispose();
+      }
+      this.gytEcharts = echarts.init(document.querySelector(".gyt-echarts"));
+      const option = {
+        title: {
+          text: "管乐团经营数据",
+          textStyle: {
+            color: "#333",
+            fontSize: 14
+          }
+        },
+        grid: {
+          left: 5,
+          top: 30,
+          right: 5,
+          bottom: 5,
+          containLabel: true
+        },
+        tooltip: {
+          trigger: "axis"
+        },
+        title: {
+          text: "管乐团经营数据"
+        },
+        xAxis: {
+          type: "category",
+          data: this.gytData.map(item => item.date),
+          axisLabel: {
+            color: "#333",
+            fontSize: 10,
+            rotate: 30
+          }
+        },
+        yAxis: {
+          type: "value",
+          axisLabel: { formatter: "{value}元" }
+        },
+        series: [
+          {
+            data: this.gytData.map(item => item.totalAmount),
+            type: "line",
+            color: "#5AD8A6"
+          }
+        ]
+      };
+      option && this.gytEcharts.setOption(option);
+    },
+    createColexiu() {
+      if (this.colexiuEcharts) {
+        this.colexiuEcharts.dispose();
+      }
+      this.colexiuEcharts = echarts.init(
+        document.querySelector(".colexiu-echarts")
+      );
+      const option = {
+        title: {
+          subtext: "酷乐秀经营数据",
+          textStyle: {
+            color: "#333",
+            fontSize: 14
+          }
+        },
+        grid: {
+          left: 5,
+          top: 30,
+          right: 5,
+          bottom: 5,
+          containLabel: true
+        },
+        tooltip: {
+          trigger: "axis"
+        },
+        title: {
+          text: "酷乐秀经营数据"
+        },
+        xAxis: {
+          type: "category",
+          data: this.colexiuData.map(item => item.date),
+          axisLabel: {
+            color: "#333",
+            fontSize: 10,
+            rotate: 30
+          }
+        },
+        yAxis: {
+          type: "value",
+          axisLabel: { formatter: "{value}元" }
+        },
+        series: [
+          {
+            data: this.colexiuData.map(item => item.totalAmount),
+            type: "line",
+            color: "#7AD3CB"
+          }
+        ]
+      };
+      option && this.colexiuEcharts.setOption(option);
+    }
+  },
+  computed: {
+    totalAmount() {
+      return this.gymTotal + this.gytTotal + this.colexiuTotal;
+    }
+  }
+};
+</script>
+<style lang="less" scoped>
+.operateEcharts {
+  display: flex;
+  div {
+    width: calc(80vw / 3);
+    height: 400px;
+  }
+}
+
+.statistic .statistic-content > span {
+  &:first-child {
+    font-size: 14px !important;
+  }
+  font-size: 18px !important;
+}
+.blod {
+  font-weight: bold;
+  color: var(--color-primary);
+  font-size: 22px !important;
+}
+</style>

+ 1 - 0
vue.config.js

@@ -22,6 +22,7 @@ const name = defaultSettings.title || "管乐迷后台管理系统"; // page tit
 // let target = 'http://192.168.3.146:8000' //王昭
 // let target = 'http://dev.dayaedu.com' // 开发环境
 let target = "https://test.dayaedu.com"; //测试环境
+// let target = "https://online.dayaedu.com"; //测试环境
 // All configuration item explanations can be find in https://cli.vuejs.org/config/
 module.exports = {
   /**