Forráskód Böngészése

feat: 新增渠道统计页面

Developer 5 napja
szülő
commit
83d19f4bed
1 módosított fájl, 63 hozzáadás és 0 törlés
  1. 63 0
      src/views/modules/core/channelStatistics.vue

+ 63 - 0
src/views/modules/core/channelStatistics.vue

@@ -0,0 +1,63 @@
+<template>
+  <el-card shadow="never" class="aui-card--fill">
+    <div class="mod-home">
+      <div class="title adfacjb">
+        渠道统计
+        <el-button type="primary" @click="handleExcel">导出Excel</el-button>
+      </div>
+      <el-table :data="dataList" border v-loading="loading" empty-text="暂无数据" style="margin-top: 16px;">
+        <el-table-column prop="channelName" label="渠道名称" min-width="200"></el-table-column>
+        <el-table-column prop="totalLoveValue" label="总爱心值" min-width="150">
+          <template #default="scope">{{ scope.row.totalLoveValue || 0 }}</template>
+        </el-table-column>
+        <el-table-column prop="consumedLoveValue" label="消耗爱心值" min-width="150">
+          <template #default="scope">{{ scope.row.consumedLoveValue || 0 }}</template>
+        </el-table-column>
+      </el-table>
+    </div>
+  </el-card>
+</template>
+
+<script>
+import Cookies from 'js-cookie'
+export default {
+  data () {
+    return {
+      loading: false,
+      dataList: []
+    }
+  },
+  mounted () {
+    this.getList()
+  },
+  methods: {
+    getList () {
+      this.loading = true
+      this.$http.get('/core/channel/statistics').then(({ data: res }) => {
+        this.loading = false
+        if (res.code !== 0) return this.$message.error(res.msg)
+        this.dataList = res.data
+      }).catch(() => {
+        this.loading = false
+      })
+    },
+    handleExcel () {
+      var params = 'token=' + Cookies.get('token')
+      window.location.href = `${window.SITE_CONFIG['apiURL']}/core/channel/statistics/export?${params}`
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.mod-home {
+  .title {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    font-size: 18px;
+    font-weight: bold;
+    color: #333;
+  }
+}
+</style>