瀏覽代碼

新增积分管理

Wang-Xiao-Ran 1 年之前
父節點
當前提交
f113a82bd0
共有 2 個文件被更改,包括 239 次插入0 次删除
  1. 28 0
      src/api/score/score.js
  2. 211 0
      src/views/score/score.vue

+ 28 - 0
src/api/score/score.js

@@ -0,0 +1,28 @@
+import request from '@/utils/request'
+
+// 查询用户积分列表
+export function listScoreInfo(query) {
+  return request({
+    url: '/score/getList',
+    method: 'get',
+    params: query
+  })
+}
+
+//新增用户并初始化积分信息
+export function addPersonBasicInfo(data) {
+  return request({
+    url: '/score/initScore',
+    method: 'post',
+    data: data
+  })
+}
+
+// 查询用户积分流水详细
+export function getPersonBasicInfo(query) {
+  return request({
+    url: '/score/getScoreList',
+    method: 'get',
+    params: query
+  })
+}

+ 211 - 0
src/views/score/score.vue

@@ -0,0 +1,211 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="姓名" prop="name">
+        <el-input
+          v-model="queryParams.name"
+          placeholder="请输入姓名"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+
+      <el-form-item label="电话" prop="concernType" class="form-style">
+        <el-input
+          v-model="queryParams.phone"
+          placeholder="请输入电话"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </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-table v-loading="loading" :data="ScoreList" @selection-change="handleSelectionChange">
+      <el-table-column label="微信名称" align="center" prop="wechatName"/>
+      <el-table-column label="姓名" align="center" prop="name"/>
+      <el-table-column label="电话" align="center" prop="phone"/>
+      <el-table-column label="当前积分" align="center" prop="scoreNum"/>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleScoreFlow(scope.row)"
+            v-hasPermi="['system:cooperative:edit']"
+          >积分明细</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+
+
+    <!-- 添加或修改供销合作社对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
+      <el-table v-loading="loading" :data="ScoreOperateList" @selection-change="handleSelectionChange">
+        <el-table-column label="姓名" align="center" prop="name"/>
+        <el-table-column label="积分变动" align="center" prop="scoreOperate"/>
+        <el-table-column label="剩余积分" align="center" prop="scoreNum"/>
+        <el-table-column label="积分变动来源" align="center" prop="relevance"/>
+        <el-table-column label="变动时间" align="center" prop="createTime"/>
+      </el-table>
+      <pagination
+        v-show="totalPage>0"
+        :total="totalPage"
+        :page.sync="queryParamsPage.pageNum"
+        :limit.sync="queryParamsPage.pageSize"
+        @pagination="handleScoreFlowPage"
+      />
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {getPersonBasicInfo, listScoreInfo} from "@/api/score/score";
+import {debug} from "script-ext-html-webpack-plugin/lib/common";
+
+export default {
+  name: "ScoreInfo",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      totalPage: 0,
+      // 用户积分表格数据
+      ScoreList: [],
+      ScoreOperateList:[],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        name: null,
+        phone: null
+      },
+      queryParamsPage:{
+        pageNum: 1,
+        pageSize: 10,
+        userId : null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {}
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询用户积分列表 */
+    getList() {
+      this.loading = true;
+      listScoreInfo(this.queryParams).then(response => {
+        this.ScoreList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        userId: null,
+        scoreNum: null,
+        relevance: null,
+        relevanceDataId: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加用户积分";
+    },
+
+    /** 积分明细按钮操作 */
+    handleScoreFlow(row) {
+      this.reset();
+      this.queryParamsPage.pageNum = 1;
+      this.queryParamsPage.pageSize = 10;
+      this.queryParamsPage.userId = row.userId;
+      getPersonBasicInfo(this.queryParamsPage).then(response => {
+        console.log(response)
+        this.ScoreOperateList = response.rows;
+        this.totalPage = response.total;
+        this.open = true;
+        this.title = row.name + " - 积分流水明细";
+      });
+    },
+
+    handleScoreFlowPage(){
+      getPersonBasicInfo(this.queryParamsPage).then(response => {
+        this.ScoreOperateList = response.rows;
+        this.totalPage = response.total;
+      });
+    },
+
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          addAidsRiskInfo(this.form).then(response => {
+            this.$modal.msgSuccess("新增成功");
+            this.open = false;
+            this.getList();
+          });
+        }
+      });
+    },
+  }
+};
+</script>