Sfoglia il codice sorgente

修改统计总人数为总人次,增加兑换页

asd123a20 2 anni fa
parent
commit
278b78e51b

+ 18 - 0
src/api/stat/index.js

@@ -36,6 +36,24 @@ export function userTotalCountByTag(query) {
     })
 }
 
+// 统计不同群体各有多少人次参加活动
+export function userTimesByTag(query) {
+  return request({
+    url: '/community/stat/user-times-by-tag',
+    method: 'get',
+    params: query
+  })
+}
+
+// 统计参加活动的总人次
+export function userTotalTimesByTag(query) {
+  return request({
+    url: '/community/stat/user-total-times-by-tag',
+    method: 'get',
+    params: query
+  })
+}
+
 // 统计不同活动类型、主题、参与人数和积分数
 export function activityTableA(query) {
     return request({

+ 34 - 5
src/components/cmsEditor/editoritem5.vue

@@ -1,9 +1,7 @@
 <template lang="html">
   <div class="editor">
-    <div ref="toolbar" class="toolbar" id="toolbar-container">
-    </div>
-    <div ref="editor" class="text" id="editor-container">
-    </div>
+    <div ref="toolbar" class="toolbar" id="toolbar-container"></div>
+    <div ref="editor" class="text" id="editor-container"></div>
   </div>
 </template>
 
@@ -27,7 +25,11 @@ export default {
     value: {
       type: String,
       default: ''
-    }
+    },
+    disabled: {
+      type: Boolean,
+      default: false
+    },
   },
   mounted () {
     this.seteditor();
@@ -57,6 +59,16 @@ export default {
                 // 上传图片,返回结果,将图片插入到编辑器中
                 insertFn(url, alt, href);
               }
+            },
+            uploadVideo: {
+              async customUpload(file, insertFn) {
+                var data = new FormData();
+                data.append('file', file);
+                const res = await upload(data);
+                const url = res.url;
+                // 上传图片,返回结果,将图片插入到编辑器中 poster
+                insertFn(url, null);
+              }
             }
           }
         }
@@ -67,6 +79,10 @@ export default {
         selector: '#toolbar-container'
       });
       editor.setHtml((this.value));
+      if (this.disabled) editor.disable();
+      // 启用
+      // editor.enable();
+      
     }
   },
   beforeDestroy() {
@@ -77,4 +93,17 @@ export default {
 </script>
 
 <style lang="scss">
+#editor-container {
+  border: 1px solid #ccc;
+  z-index: 100;
+}
+#toolbar-container {
+  border: 1px solid #ccc;
+}
+.title {
+  margin-top: 0px;
+}
+.text {
+  height: 350px;
+}
 </style>

+ 121 - 0
src/views/goods/voucher/exchange.vue

@@ -0,0 +1,121 @@
+<template>
+    <div class="app-container">
+      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+        <el-form-item label="姓名">
+          <el-input  v-model="queryParams['user.name']" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/>
+        </el-form-item>
+        <el-form-item label="手机号">
+          <el-cascader v-model="queryParams['user.phone']" :options="voucher_category" :props="{emitPath:false}"></el-cascader>
+        </el-form-item>
+        <el-form-item label="群体">
+          <el-select v-model="queryParams['user.tags']" placeholder="请选择">
+            <el-option v-for="dict in dict.type.user_tags" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        </el-form-item>
+      </el-form>
+  
+      <el-row :gutter="10" class="mb8">
+        <el-col :span="1.5">
+            <el-button
+              type="warning"
+              plain
+              icon="el-icon-download"
+              size="mini"
+              @click="handleExport"
+            >导出</el-button>
+        </el-col>
+      </el-row>
+  
+      <el-table v-loading="loading" :data="taskList">
+        <el-table-column label="姓名" align="center" prop="user.name" />
+        <el-table-column label="手机号" align="center" prop="user.phone" />
+        <el-table-column label="群体" align="center" prop="user.tags" />
+        <el-table-column label="代金券种类" align="center" prop="voucher.category" />
+        <el-table-column label="面额" align="center" prop="voucher.money" />
+        <el-table-column label="状态" align="center" prop="status" />
+        <el-table-column label="创建时间" align="center" prop="createTime" width="180">
+          <template slot-scope="scope">
+            <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        v-show="total>0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        @pagination="getList"
+      />
+    </div>
+  </template>
+  
+  <script>
+  import { listVoucher } from "@/api/goods/voucher/index";
+  
+  export default {
+    name: "voucher",
+    dicts: ['tags'],
+    data() {
+      return {
+        // 遮罩层
+        loading: false,
+        // 总条数
+        total: 0,
+        // 检测代金券管理表格数据
+        taskList: [],
+        // 查询参数
+        queryParams: {
+          pageNum: 1,
+          pageSize: 10,
+        },
+        voucher_category: []
+      };
+    },
+    async created() {
+      // this.getList();
+      const dict = await this.getDicts('voucher_category');
+      dict.data = dict.data.map(e => ({ ...e, label: e.dictLabel, value: e.dictValue }))
+      this.voucher_category = dict.data.filter(e => !e.remark).map(e => {
+        const children = dict.data.filter(j => j.remark == e.dictValue);
+        if (children.length > 0) e.children = children;
+        return e;
+      })
+    },
+    methods: {
+      /** 查询检测代金券管理列表 */
+      getList() {
+        this.loading = true;
+        listVoucher(this.queryParams).then(response => {
+          this.taskList = response.rows.map(e => {
+            const dict = this.dict.type.voucher_category.find(j => j.dictValue == e.category)
+            if (dict) e.categoryText = dict.dictLabel;
+            return e;
+          });
+          this.total = response.total;
+          this.loading = false;
+        });
+      },
+      /** 搜索按钮操作 */
+      handleQuery() {
+        this.queryParams.pageNum = 1;
+        this.getList();
+      },
+      /** 重置按钮操作 */
+      resetQuery() {
+        this.resetForm("queryForm");
+        this.handleQuery();
+      },
+      /** 导出按钮操作 */
+      handleExport() {
+        this.download('system/user/export', {
+            ...this.queryParams
+        }, `user_${new Date().getTime()}.xlsx`)
+      },
+    }
+  };
+  </script>
+  

+ 2 - 2
src/views/goods/voucher/index.vue

@@ -53,8 +53,8 @@
     />
 
     <!-- 添加或修改检测代金券管理对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+    <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
         <el-form-item label="图片" prop="photo">
           <!-- 图片上传 -->
           <ImageUpload  @input="fileUpload" :value="form.photo" :limit="1" ></ImageUpload>

+ 3 - 5
src/views/stat/activity/index.vue

@@ -57,7 +57,7 @@
 </template>
 
 <script>
-import { activityCountByType, userCountByType, userCountByTag, userTotalCountByTag } from "@/api/stat/index";
+import { activityCountByType, userCountByType, userCountByTag, userTotalCountByTag, userTimesByTag, userTotalTimesByTag } from "@/api/stat/index";
 import echarts from "echarts";
 
 export default {
@@ -101,10 +101,8 @@ export default {
     /** 人数信息 */
     async getUserList() {
       const typeUser = await userCountByTag(this.queryParams);
-      console.log(typeUser, 'typeUser');
-      const allUser = await userTotalCountByTag(this.queryParams);
-      console.log(allUser, 'allUser');
-      const allData = [{ name: '总人数', value: allUser.data }];
+      const allUser = await userTotalTimesByTag(this.queryParams);
+      const allData = [{ name: '总人次', value: allUser.data }];
       this.userData = [ ...allData, ...typeUser?.data ];
       this.$modal.closeLoading();
     },