Browse Source

团长管理

YY 2 years ago
parent
commit
9c910ac7a2

+ 6 - 0
src/router/module/platmanag.js

@@ -17,6 +17,12 @@ export default [
     meta: { title: '平台管理-用户管理-提现记录' },
     component: () => import('@/views/platmanag/user/record.vue'),
   },
+  {
+    path: '/platmanag/leader',
+    name: 'platmanag_leader',
+    meta: { title: '平台管理-团长管理' },
+    component: () => import('@/views/platmanag/leader/index.vue'),
+  },
   {
     path: '/platmanag/goodsTags',
     name: 'platmanag_goodsTags',

+ 5 - 1
src/store/index.js

@@ -5,11 +5,14 @@ import * as umutations from './module/user/mutations';
 import admin from './module/user/action';
 // 用户
 import users from './module/user/users';
+// 团长
+
+import userleader from './module/user/userleader';
 // 系统消息
 import notice from './module/user/notice';
 import msgList from './module/user/msgList';
 import address from './module/user/address';
-import cashBack from "./module/user/cashBack";
+import cashBack from './module/user/cashBack';
 import todo from './module/statistics/todo';
 import sellTotal from './module/statistics/sellTotal';
 import shopInBill from './module/statistics/shopInBill';
@@ -95,6 +98,7 @@ export default new Vuex.Store({
   actions: {},
   modules: {
     users,
+    userleader,
     admin,
     shop,
     address,

+ 44 - 0
src/store/module/user/userleader.js

@@ -0,0 +1,44 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+const _ = require('lodash');
+Vue.use(Vuex);
+const api = {
+  url: '/point/v1/api/userleader',
+};
+
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.url}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.url}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.url}/${payload}`);
+    return res;
+  },
+  async update({ commit }, payload) {
+    const id = _.get(payload, 'id', _.get(payload, '_id'));
+    const res = await this.$axios.$post(`${api.url}/${id}`, payload);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.url}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 95 - 0
src/views/platmanag/leader/detail.vue

@@ -0,0 +1,95 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="main" v-loading="loadings" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading">
+        <el-col :span="24" style="margin: 0 0 10px 0">
+          <el-col :span="2"><el-button type="primary" size="mini" @click="toBack()">返回</el-button></el-col>
+        </el-col>
+        <el-col :span="24">
+          <data-form :fields="infoFields" :rules="{}" v-model="form" labelWidth="150px" :isSave="false">
+            <template #status>
+              <el-option v-for="i in statusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+            </template>
+          </data-form>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: dictData } = createNamespacedHelpers('dictData'); // 字典
+const { mapActions: userleader } = createNamespacedHelpers('userleader'); // 消息
+export default {
+  name: 'detail',
+  props: { id: { type: String } },
+  components: {},
+  data: function () {
+    return {
+      loadings: true,
+      // info部分
+      infoFields: [
+        { label: '姓名', model: 'name', readonly: true },
+        { label: '身份证号', model: 'card', readonly: true },
+        { label: '手机号', model: 'phone', readonly: true },
+        { label: '审核状态', model: 'status', type: 'select', readonly: true },
+        { label: '审核结果', model: 'cause', type: 'textarea', readonly: true },
+      ],
+
+      form: {},
+      // 加载
+      loading: false,
+
+      // 状态列表
+      statusList: [],
+    };
+  },
+  created() {
+    this.searchOthers();
+    this.search();
+  },
+  methods: {
+    ...dictData({ dictQuery: 'query' }),
+    ...userleader(['query', 'delete', 'fetch', 'update', 'create']),
+    // 查询
+    async search() {
+      if (this.id) {
+        const res = await this.fetch(this.id);
+        if (this.$checkRes(res)) this.$set(this, `form`, res.data);
+      }
+      this.loadings = false;
+    },
+    // 返回
+    toBack() {
+      this.$emit('goBack');
+    },
+    // 查询其他信息
+    async searchOthers() {
+      let res;
+      // 信息状态
+      res = await this.dictQuery({ code: 'exam_status' });
+      if (this.$checkRes(res)) this.$set(this, `statusList`, res.data);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.el-col {
+  margin: 10px 0;
+}
+</style>

+ 185 - 0
src/views/platmanag/leader/index.vue

@@ -0,0 +1,185 @@
+<template>
+  <div id="goods">
+    <el-row>
+      <el-col
+        :span="24"
+        class="main animate__animated animate__backInRight"
+        v-loading="loadings"
+        element-loading-text="拼命加载中"
+        element-loading-spinner="el-icon-loading"
+      >
+        <span v-if="view === 'list'">
+          <el-col :span="24" class="one"> <span>团长管理</span> </el-col>
+          <data-search :fields="searchFields" v-model="searchInfo" @query="search">
+            <template #source>
+              <el-option v-for="i in statusList" :key="i.label" :label="i.label" :value="i.value"></el-option>
+            </template>
+          </data-search>
+          <el-col :span="24" class="two">
+            <data-table ref="dataTable" :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @view="toView" @exam="toExam"></data-table>
+          </el-col>
+        </span>
+        <detail v-if="view === 'info'" :id="id" @goBack="toBack"></detail>
+      </el-col>
+    </el-row>
+    <e-dialog :dialog="dialog" @toClose="toClose">
+      <template v-slot:info>
+        <data-form :fields="infoFields" :rules="rules" v-model="form" labelWidth="auto" @save="toSave">
+          <template #status>
+            <el-option v-for="i in statusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
+          </template>
+        </data-form>
+      </template>
+    </e-dialog>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: userleader } = createNamespacedHelpers('userleader');
+const { mapActions: dictData } = createNamespacedHelpers('dictData'); // 字典
+
+export default {
+  name: 'index',
+  props: {},
+  components: {
+    detail: () => import('./detail.vue'),
+  },
+  data: function () {
+    return {
+      loadings: true,
+      loading: false,
+      view: 'list',
+      fields: [
+        { label: 'openid', model: 'openid' },
+        { label: '姓名', model: 'name' },
+        { label: '身份证号', model: 'card' },
+        { label: '手机号', model: 'phone' },
+        { label: '审核结果', model: 'cause' },
+        {
+          label: '状态',
+          model: 'status',
+          format: (i) => {
+            let data = this.statusList.find((f) => f.value == i);
+            if (data) return data.label;
+            else return '暂无';
+          },
+        },
+      ],
+      opera: [
+        { label: '查看', method: 'view' },
+        { label: '审核', method: 'exam', type: 'warning', display: (i) => i.status == '0' },
+      ],
+      searchFields: [
+        { label: '姓名', model: 'name' },
+        { label: '身份证号', model: 'card' },
+        { label: '手机号', model: 'phone' },
+        { label: '状态', model: 'status', type: 'select' },
+      ],
+      searchInfo: {},
+      list: [],
+      total: 0,
+      id: '',
+      // 审核
+      statusList: [],
+      // 弹框
+      dialog: { title: '信息管理', show: false, type: '1' },
+      form: {},
+      // info部分
+      infoFields: [
+        { label: '审核状态', model: 'status', type: 'select' },
+        { label: '审核结果', model: 'cause', type: 'textarea' },
+      ],
+
+      rules: {
+        status: [{ required: true, message: '请选择审核状态', trigger: 'change' }],
+        cause: [{ required: true, message: '请输入审核原因', trigger: 'blur' }],
+      },
+    };
+  },
+  created() {
+    this.searchOthers();
+    this.search();
+  },
+  methods: {
+    ...dictData({ dictQuery: 'query' }),
+    ...userleader(['query', 'delete', 'fetch', 'update', 'create']),
+
+    // 查询
+    async search({ skip = 0, limit = this.$limit, ...others } = {}) {
+      let query = { skip, limit, ...others };
+      if (Object.keys(this.searchInfo).length > 0) query = { ...query, ...this.searchInfo };
+      const res = await this.query(query);
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+      this.loadings = false;
+    },
+    // 查看
+    async toView({ data }) {
+      this.$set(this, `id`, data._id);
+      this.$set(this, `view`, 'info');
+    },
+    // 审核
+    async toExam({ data }) {
+      const res = await this.fetch(data.id);
+      if (this.$checkRes(res)) this.$set(this, `form`, res.data);
+      this.dialog = { title: '信息管理', show: true, type: '1' };
+    },
+
+    // 保存
+    async toSave({ data }) {
+      let res = await this.update(data);
+      if (this.$checkRes(res)) {
+        this.$message({ type: `success`, message: `审核成功` });
+        this.toClose();
+      }
+    },
+    // 关闭
+    toClose() {
+      this.form = {};
+      this.dialog = { title: '信息管理', show: false, type: '1' };
+      this.search();
+    },
+    // 执行返回
+    toBack() {
+      this.view = 'list';
+    },
+    // 查询其他信息
+    async searchOthers() {
+      let res;
+      // 信息来源
+      res = await this.dictQuery({ code: 'exam_status' });
+      if (this.$checkRes(res)) this.$set(this, `statusList`, res.data);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .one {
+    margin: 0 0 10px 0;
+
+    span:nth-child(1) {
+      font-size: 20px;
+      font-weight: 700;
+      margin-right: 10px;
+    }
+  }
+  .two {
+    margin: 20px 0 10px 0;
+  }
+  .thr {
+    margin: 0 0 10px 0;
+  }
+}
+.el-col {
+  margin: 10px 0;
+}
+</style>

+ 1 - 1
src/views/selfShop/message/parts/left-1.vue

@@ -21,7 +21,7 @@
                   class="right_icon"
                 ></el-avatar>
               </el-col>
-              <el-col :span="20">
+              <el-col :span="19">
                 <el-col :span="24" class="left_time">
                   <el-col :span="14" style="text-align: left" v-if="item.customer && item.customer.name">{{ item.customer.name || '用户名称' }}</el-col>
                   <el-col :span="14" style="text-align: left" v-else>{{ '用户不存在' }}</el-col>