瀏覽代碼

店铺消息

YY 2 年之前
父節點
當前提交
31e7873a85

+ 6 - 0
src/layout/data/menu.js

@@ -191,6 +191,12 @@ export const adminMenu = [
         name: '账单管理',
         name: '账单管理',
         index: '6-6',
         index: '6-6',
       },
       },
+      {
+        icon: 'icon-rencai',
+        path: '/selfShop/notice',
+        name: '消息管理',
+        index: '6-6',
+      },
     ],
     ],
   },
   },
   {
   {

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

@@ -41,4 +41,10 @@ export default [
     meta: { title: '自营店铺-账单管理' },
     meta: { title: '自营店铺-账单管理' },
     component: () => import('@/views/selfShop/bill/index.vue'),
     component: () => import('@/views/selfShop/bill/index.vue'),
   },
   },
+  {
+    path: '/selfShop/notice',
+    name: 'selfShop_notice',
+    meta: { title: '自营店铺-消息管理' },
+    component: () => import('@/views/selfShop/notice/index.vue'),
+  },
 ];
 ];

+ 198 - 0
src/views/selfShop/notice/index.vue

@@ -0,0 +1,198 @@
+<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"
+      >
+        <el-col :span="24" class="one"> <span>消息管理</span> </el-col>
+        <el-col :span="24">
+          <data-search :fields="searchFields" v-model="searchInfo" @query="search">
+            <template #source>
+              <el-option v-for="i in sourceList" :key="i.model" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #type>
+              <el-option v-for="i in typeList" :key="i.model" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #status>
+              <el-option v-for="i in statusList" :key="i.model" :label="i.label" :value="i.value"></el-option>
+            </template>
+            <template #source_type>
+              <el-option v-for="i in source_typeList" :key="i.model" :label="i.label" :value="i.value"></el-option>
+            </template>
+          </data-search>
+        </el-col>
+        <el-col :span="24">
+          <data-table ref="dataTable" :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @view="toView" @see="toSee"></data-table>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: shopNotice } = createNamespacedHelpers('shopNotice');
+const { mapActions: dictData } = createNamespacedHelpers('dictData');
+
+export default {
+  name: 'index',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      loadings: true,
+      loading: false,
+      view: 'list',
+      fields: [
+        {
+          label: '消息来源',
+          model: 'source',
+          showTip: false,
+          format: (i) => {
+            let data = this.sourceList.find((f) => f.value == i);
+            if (data) return data.label;
+            else return '';
+          },
+        },
+        { label: '发送时间', model: 'time' },
+        { label: '内容', model: 'content', showTip: false },
+        {
+          label: '类型',
+          model: 'type',
+          format: (i) => {
+            let data = this.typeList.find((f) => f.value == i);
+            if (data) return data.label;
+            else return '';
+          },
+        },
+        {
+          label: '状态',
+          model: 'status',
+          format: (i) => {
+            let data = this.statusList.find((f) => f.value == i);
+            if (data) return data.label;
+            else return '';
+          },
+        },
+        {
+          label: '来源类型',
+          model: 'source_type',
+          format: (i) => {
+            let data = this.source_typeList.find((f) => f.value == i);
+            if (data) return data.label;
+            else return '';
+          },
+        },
+      ],
+      opera: [
+        { label: '查看', method: 'view' },
+        { label: '已读', method: 'see', confirm: true, type: 'warning' },
+      ],
+      btnList: [{ label: '添加', method: 'add' }],
+      searchFields: [
+        { label: '来源', model: 'source', type: 'select' },
+        { label: '类型', model: 'type', type: 'select' },
+        { label: '状态', model: 'status', type: 'select' },
+        { label: '来源类型', model: 'source_type', type: 'select' },
+      ],
+      searchInfo: {},
+      list: [],
+      total: 0,
+      // 来源
+      sourceList: [],
+      // 类型
+      typeList: [],
+      // 状态
+      statusList: [],
+      // 来源类型
+      source_typeList: [],
+    };
+  },
+  created() {
+    this.searchOthers();
+    this.search();
+  },
+  methods: {
+    ...dictData({ getDict: 'query' }),
+    ...shopNotice(['query', 'delete', 'fetch', 'update', 'create']),
+    // 查询
+    async search({ skip = 0, limit = this.$limit, ...others } = {}) {
+      others.shop = this.user.shop._id;
+      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 }) {
+      if (data.source_type == '0') this.$router.push({ path: `/selfShop/order`, query: { id: data.source_id } });
+      else if (data.source_type == '1') this.$router.push({ path: `/selfShop/sales`, query: { id: data.source_id } });
+      let info = { _id: data._id, status: '1' };
+      let res = await this.update(info);
+      if (this.$checkRes(res)) {
+        this.$message({ type: `success`, message: `已读` });
+        this.search();
+      }
+    },
+    // 已读
+    async toSee({ data }) {
+      let info = { _id: data._id, status: '1' };
+      let res = await this.update(info);
+      if (this.$checkRes(res)) {
+        this.$message({ type: `success`, message: `已读` });
+        this.search();
+      }
+    },
+    // 查询其他信息
+    async searchOthers() {
+      // 来源
+      let res = await this.getDict({ code: 'notice_source' });
+      if (this.$checkRes(res)) this.$set(this, 'sourceList', res.data);
+      // 类型
+      res = await this.getDict({ code: 'notice_type' });
+      if (this.$checkRes(res)) this.$set(this, 'typeList', res.data);
+      // 状态
+      res = await this.getDict({ code: 'notice_status' });
+      if (this.$checkRes(res)) this.$set(this, 'statusList', res.data);
+      // 来源类型
+      res = await this.getDict({ code: 'notice_source_type' });
+      if (this.$checkRes(res)) this.$set(this, 'source_typeList', 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: 0 0 10px 0;
+  }
+  .thr {
+    margin: 0 0 10px 0;
+  }
+}
+.el-col {
+  margin: 10px 0;
+}
+</style>

+ 27 - 21
src/views/selfShop/order/index.vue

@@ -124,29 +124,33 @@ export default {
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     // 查询
     // 查询
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
-      if (this.active) this.$set(this, 'activeName', this.active);
-      let condition = _.cloneDeep(this.searchForm);
-      if (condition.buy_time) {
-        condition[`buy_time@start`] = _.head(condition.buy_time);
-        condition[`buy_time@end`] = _.last(condition.buy_time);
-        delete condition.buy_time;
-      }
-      if (this.activeName == '3') info.status = '2-';
-      else if (this.activeName == '4') info.status = '2';
-      else if (this.activeName == '5') info.status = '3';
-      else if (this.activeName == '6') info.status = '-1';
-      else if (this.activeName == '7') info.status = '-2';
-      else if (this.activeName == '8') info.status = '-3';
-      else if (this.activeName == '9') info.status = '-4';
-      info.shop = this.user.shop.id;
-      let res = await this.query({ skip, limit, ...condition, ...info });
-      if (this.$checkRes(res)) {
-        this.$set(this, 'list', res.data);
-        this.$set(this, 'total', res.total);
+      if (this.orders_id) {
+        let data = this.orders_id;
+        this.toDetail_t(data);
+      } else {
+        if (this.active) this.$set(this, 'activeName', this.active);
+        let condition = _.cloneDeep(this.searchForm);
+        if (condition.buy_time) {
+          condition[`buy_time@start`] = _.head(condition.buy_time);
+          condition[`buy_time@end`] = _.last(condition.buy_time);
+          delete condition.buy_time;
+        }
+        if (this.activeName == '3') info.status = '2-';
+        else if (this.activeName == '4') info.status = '2';
+        else if (this.activeName == '5') info.status = '3';
+        else if (this.activeName == '6') info.status = '-1';
+        else if (this.activeName == '7') info.status = '-2';
+        else if (this.activeName == '8') info.status = '-3';
+        else if (this.activeName == '9') info.status = '-4';
+        info.shop = this.user.shop.id;
+        let res = await this.query({ skip, limit, ...condition, ...info });
+        if (this.$checkRes(res)) {
+          this.$set(this, 'list', res.data);
+          this.$set(this, 'total', res.total);
+        }
       }
       }
       this.loadings = false;
       this.loadings = false;
     },
     },
-
     // 未付款
     // 未付款
     toDetail(val) {
     toDetail(val) {
       this.$set(this, `order_id`, val);
       this.$set(this, `order_id`, val);
@@ -185,7 +189,6 @@ export default {
     },
     },
     getAddress(i) {
     getAddress(i) {
       let name = i.name + ',' + i.phone;
       let name = i.name + ',' + i.phone;
-      // let name = i.name + ',' + i.phone + ',' + i.province;
       return name;
       return name;
     },
     },
     // 店铺名称
     // 店铺名称
@@ -219,6 +222,9 @@ export default {
     active() {
     active() {
       return this.$route.query.activeName;
       return this.$route.query.activeName;
     },
     },
+    orders_id() {
+      return this.$route.query.id;
+    },
   },
   },
   metaInfo() {
   metaInfo() {
     return { title: this.$route.meta.title };
     return { title: this.$route.meta.title };

+ 17 - 8
src/views/selfShop/sales/index.vue

@@ -91,15 +91,21 @@ export default {
     },
     },
     // 查询
     // 查询
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
-      info.shop = this.user.shop.id;
-      let query = { skip, limit, ...info };
-      if (Object.keys(this.searchForm).length > 0) query = { ...query, ...this.searchForm };
-      let res = await this.query(query);
-      if (this.$checkRes(res)) {
-        this.$set(this, 'list', res.data);
-        this.$set(this, 'total', res.total);
-        this.$set(this, `searchQuery`, query);
+      if (this.sales_id) {
+        let data = { data: { id: this.sales_id } };
+        this.toExam(data);
+      } else {
+        info.shop = this.user.shop.id;
+        let query = { skip, limit, ...info };
+        if (Object.keys(this.searchForm).length > 0) query = { ...query, ...this.searchForm };
+        let res = await this.query(query);
+        if (this.$checkRes(res)) {
+          this.$set(this, 'list', res.data);
+          this.$set(this, 'total', res.total);
+          this.$set(this, `searchQuery`, query);
+        }
       }
       }
+
       this.loadings = false;
       this.loadings = false;
     },
     },
     toExam({ data }) {
     toExam({ data }) {
@@ -127,6 +133,9 @@ export default {
   },
   },
   computed: {
   computed: {
     ...mapState(['user']),
     ...mapState(['user']),
+    sales_id() {
+      return this.$route.query.id;
+    },
   },
   },
   metaInfo() {
   metaInfo() {
     return { title: this.$route.meta.title };
     return { title: this.$route.meta.title };