YY 2 anni fa
parent
commit
78300ab0d4

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

@@ -5,6 +5,12 @@ export default [
     meta: { title: '平台管理-用户管理' },
     component: () => import('@/views/platmanag/user/index.vue'),
   },
+  {
+    path: '/platmanag/user/detail',
+    name: 'platmanag_user_detail',
+    meta: { title: '平台管理-用户管理-流水' },
+    component: () => import('@/views/platmanag/user/detail.vue'),
+  },
   {
     path: '/platmanag/goodsTags',
     name: 'platmanag_goodsTags',

+ 2 - 1
src/store/index.js

@@ -9,7 +9,7 @@ import users from './module/user/users';
 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 todo from './module/statistics/todo';
 import sellTotal from './module/statistics/sellTotal';
 import shopInBill from './module/statistics/shopInBill';
@@ -98,6 +98,7 @@ export default new Vuex.Store({
     admin,
     shop,
     address,
+    cashBack,
     giveCoupon,
     goods,
     dictIndex,

+ 52 - 0
src/store/module/user/cashBack.js

@@ -0,0 +1,52 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+const _ = require('lodash');
+Vue.use(Vuex);
+const api = {
+  url: '/point/v1/api/cashBack',
+};
+
+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 computedTotal({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.url}/computedTotal`, {
+      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,
+};

+ 13 - 1
src/views/platGroup/order/index.vue

@@ -9,6 +9,9 @@
         element-loading-spinner="el-icon-loading"
       >
         <span v-show="view === 'list'">
+          <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" class="one"> <span>订单管理</span> </el-col>
           <el-col :span="24" class="four">
             <el-tabs v-model="activeName" @tab-click="handleClick" type="border-card">
@@ -128,11 +131,16 @@ export default {
         condition[`buy_time@end`] = _.last(condition.buy_time);
         delete condition.buy_time;
       }
+      if (this.$route.query.source_id) {
+        let data = { _id: this.source_id };
+        this.toDetails({ data });
+      }
       if (this.activeName == '1') info.status = '0';
       else if (this.activeName == '2') info.status = '1';
       else if (this.activeName == '3') info.status = '2';
       else if (this.activeName == '4') info.status = '3';
       else if (this.activeName == '5') info.status = '-1';
+
       let query = { skip, limit, ...info };
       if (Object.keys(condition).length > 0) query = { ...query, ...condition };
       let res = await this.query(query);
@@ -168,7 +176,8 @@ export default {
       this.search();
     },
     toBack() {
-      this.view = 'list';
+      if (this.$route.query.source_id) window.history.go('-1');
+      else this.view = 'list';
     },
     getAddress(i) {
       let name = i.name + ',' + i.phone;
@@ -205,6 +214,9 @@ export default {
   },
   computed: {
     ...mapState(['user']),
+    source_id() {
+      return this.$route.query.source_id;
+    },
   },
   metaInfo() {
     return { title: this.$route.meta.title };

+ 12 - 2
src/views/platmanag/order/index.vue

@@ -137,6 +137,10 @@ export default {
         condition[`buy_time@end`] = _.last(condition.buy_time);
         delete condition.buy_time;
       }
+      if (this.$route.query.source_id) {
+        let data = { _id: this.source_id };
+        this.toDetails({ data });
+      }
       if (this.activeName == '2') info.status = '1';
       else if (this.activeName == '1') info.status = '0';
       else if (this.activeName == '3') info.status = '2-';
@@ -193,8 +197,11 @@ export default {
       this.search();
     },
     toBack() {
-      this.view = 'list';
-      this.search(this.searchQuery);
+      if (this.$route.query.source_id) window.history.go('-1');
+      else {
+        this.view = 'list';
+        this.search(this.searchQuery);
+      }
     },
     getAddress(i) {
       let name = i.name + ',' + i.phone;
@@ -227,6 +234,9 @@ export default {
   },
   computed: {
     ...mapState(['user']),
+    source_id() {
+      return this.$route.query.source_id;
+    },
   },
   metaInfo() {
     return { title: this.$route.meta.title };

+ 169 - 0
src/views/platmanag/user/detail.vue

@@ -0,0 +1,169 @@
+<template>
+  <div id="card-1">
+    <el-row>
+      <el-col :span="24" class="main">
+        <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" class="one">
+          <el-col :span="24">
+            <p>
+              账户余额:<span>{{ info.total }}</span
+              >元
+            </p>
+          </el-col>
+          <el-col :span="24">
+            可提现金额:<span style="color: red">{{ info.canGet }}</span
+            >元
+          </el-col>
+        </el-col>
+        <el-col :span="24" class="two">
+          <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @view="toView">
+            <template #money="{ row }">
+              <span v-if="row.status == '-1'" style="color: red; cursor: pointer"> -{{ row.money }} </span>
+              <span v-else-if="row.status == '0'" style="color: green"> +{{ row.money }} </span>
+            </template>
+          </data-table>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+<script>
+const _ = require('lodash');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('cashBack');
+const { mapActions: dictData } = createNamespacedHelpers('dictData');
+export default {
+  name: 'card-1',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      // 账户余额
+      info: {},
+      // 账户流水
+      list: [],
+      // 来源列表
+      sourceList: [],
+      // 状态列表
+      statusList: [],
+      // 列表
+      opera: [{ label: '查看', method: 'view' }],
+      fields: [
+        {
+          label: '来源',
+          model: 'source',
+          format: (i) => {
+            let data = this.sourceList.find((f) => f.value == i);
+            if (data) return data.label;
+            else return '暂无';
+          },
+        },
+        { label: '来源id', model: 'source_id' },
+        { label: '返现金额', model: 'money', custom: true },
+        {
+          label: '状态',
+          model: 'status',
+          format: (i) => {
+            let data = this.statusList.find((f) => f.value == i);
+            if (data) return data.label;
+            else return '暂无';
+          },
+        },
+        { label: '返现时间', model: 'time' },
+      ],
+      canGet: 0,
+      total: 0,
+    };
+  },
+  async created() {
+    await this.searchOther();
+    await this.search();
+  },
+  methods: {
+    ...mapActions(['query', 'fetch', 'create', 'update', 'delete', 'computedTotal']),
+    ...dictData({ dictQuery: 'query' }),
+    // 查询
+    async search({ skip = 0, limit = this.$limit, ...info } = {}) {
+      info.inviter = this.id;
+      let arr = await this.computedTotal({ customer: this.id });
+      if (this.$checkRes(arr)) {
+        this.$set(this, `info`, arr.data);
+      }
+      let res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    // 查看来源
+    toView({ data }) {
+      if (data.source == '2') {
+        this.$router.push({ path: `/platGroup/order`, query: { source_id: data.source_id } });
+      } else if (data.source == '0' || data.source == '3') {
+        this.$router.push({ path: `/platmanag/order`, query: { source_id: data.source_id } });
+      }
+    },
+    // 查询其他信息
+    async searchOther() {
+      let res;
+      res = await this.dictQuery({ code: 'cashBack_source' });
+      if (this.$checkRes(res)) this.$set(this, `sourceList`, res.data);
+      res = await this.dictQuery({ code: 'cashBack_status' });
+      if (this.$checkRes(res)) this.$set(this, `statusList`, res.data);
+    },
+    // 返回
+    toBack() {
+      window.history.go('-1');
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    id() {
+      return this.$route.query.id;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  text-align: center;
+}
+.one {
+  margin: 0 0 10px 0;
+  p {
+    font-size: 24px;
+    font-weight: 700;
+    span {
+      color: red;
+    }
+  }
+}
+.two {
+  span {
+    color: red;
+  }
+  .sp1 {
+    font-size: 18px;
+    font-weight: 500;
+  }
+}
+.title {
+  text-align: center;
+}
+.el-col {
+  margin: 10px 0;
+}
+</style>

+ 6 - 1
src/views/platmanag/user/index.vue

@@ -13,7 +13,7 @@
           <data-search :fields="searchFields" v-model="searchInfo" @query="search"> </data-search>
         </el-col>
         <el-col :span="24" class="four">
-          <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @del="toDel" @puton="toPuton"> </data-table>
+          <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @del="toDel" @puton="toPuton" @cash="toCash"> </data-table>
         </el-col>
       </el-col>
     </el-row>
@@ -41,6 +41,7 @@ export default {
       loadings: true,
       // 列表
       opera: [
+        { label: '流水', method: 'cash' },
         { label: '设为团长', method: 'puton', display: (i) => i.is_leader != '0', type: 'success' },
         { label: '取消团长', method: 'puton', display: (i) => i.is_leader == '0', type: 'warning' },
         { label: '删除', method: 'del', confirm: true, type: 'danger' },
@@ -114,6 +115,10 @@ export default {
       }
       this.loadings = false;
     },
+    // 查看流水
+    toCash({ data }) {
+      this.$router.push({ path: `/platmanag/user/detail`, query: { id: data._id } });
+    },
     // 设置是否团长
     async toPuton({ data }) {
       this.$confirm('是否确认设置/取消该用户为团长?', '提示', {