Selaa lähdekoodia

修改店铺查看信息

zs 1 vuosi sitten
vanhempi
commit
301ba0e977

+ 1 - 1
.env

@@ -1,4 +1,4 @@
-VUE_APP_AXIOS_BASE_URL = ''
+VUE_APP_AXIOS_BASE_URL = '/dev'
 VUE_APP_ROUTER="shoppingOneAdmin"
 VUE_APP_HOST="https://broadcast.waityou24.cn"
 VUE_APP_PAGE_SIZE=50

+ 1 - 1
src/store/module/system/config.js

@@ -23,7 +23,7 @@ const actions = {
     return res;
   },
   async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.url}`);
+    const res = await this.$axios.$get(`${api.url}`, payload);
     return res;
   },
   async update({ commit }, payload) {

+ 7 - 3
src/views/platSettings/banner/detail.vue

@@ -20,7 +20,7 @@
               <el-option v-for="i in statusList" :key="i.model" :label="i.label" :value="i.value"></el-option>
             </template>
             <template #content>
-              <editor v-model="form.content" url="/files/point/banner/upload" />
+              <editor v-model="form.content" url="/files/point/shopOne/banner/upload" />
             </template>
           </data-form>
         </el-col>
@@ -63,7 +63,7 @@ export default {
           label: '图片',
           model: 'url',
           type: 'upload',
-          url: '/files/point/banner/upload',
+          url: '/files/point/shopOne/banner/upload',
         },
         { label: '内容', model: 'content', custom: true },
       ],
@@ -91,6 +91,8 @@ export default {
     // 提交
     async onSubmit({ data }) {
       let res;
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin' && !data.shop) data.shop = this.user.shop._id || this.user.shop.id;
       if (data.id) res = await this.update(data);
       else res = await this.create(data);
       if (this.$checkRes(res)) {
@@ -113,7 +115,9 @@ export default {
       this.$emit('toBack');
     },
   },
-  computed: {},
+  computed: {
+    ...mapState(['user']),
+  },
   metaInfo() {
     return { title: this.$route.meta.title };
   },

+ 4 - 1
src/views/platSettings/banner/index.vue

@@ -92,6 +92,8 @@ export default {
     // 查询
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       const condition = _.cloneDeep(this.searchForm);
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin') info.shop = this.user.shop._id || this.user.shop.id;
       let res = await this.query({ skip, limit, ...condition, ...info });
       if (this.$checkRes(res)) {
         this.$set(this, 'list', res.data);
@@ -112,12 +114,13 @@ export default {
     },
     toBack() {
       this.view = 'list';
+      this.search();
     },
     // 删除
     async toDel({ data }) {
       let res = await this.delete(data._id);
       if (this.$checkRes(res)) {
-        this.$message({ type: `success`, message: `除信息成功` });
+        this.$message({ type: `success`, message: `除信息成功` });
         this.search();
       }
     },

+ 13 - 5
src/views/platSettings/config/index.vue

@@ -124,8 +124,8 @@ export default {
       fieldsForm: [
         { label: '名称', model: 'name' },
         { label: '跳转路径', model: 'route' },
-        { label: '未选中', model: 'normal', type: 'upload', limit: 1, url: '/files/point/config/upload' },
-        { label: '选中', model: 'active', type: 'upload', limit: 1, url: '/files/point/config/upload' },
+        { label: '未选中', model: 'normal', type: 'upload', limit: 1, url: '/files/point/shopOne/config/upload' },
+        { label: '选中', model: 'active', type: 'upload', limit: 1, url: '/files/point/shopOne/config/upload' },
         { label: '跳转类型', model: 'type', type: 'select' },
         { label: '是否使用', model: 'is_use', type: 'select' },
         { label: '排序', model: 'sort', type: 'number' },
@@ -149,11 +149,14 @@ export default {
     await this.search();
   },
   methods: {
-    ...config(['query', 'fetch', 'update']),
+    ...config(['query', 'fetch', 'create', 'update']),
     ...dictData({ dictQuery: 'query' }),
     //执行查询
     async search() {
-      const res = await this.fetch();
+      // 判断是否是个人店铺查询
+      const info = {};
+      if (this.user.role.code == 'shopAdmin') info.shop = this.user.shop._id || this.user.shop.id;
+      const res = await this.fetch(info);
       if (this.$checkRes(res)) {
         let data = res.data;
         if (data.config) {
@@ -207,9 +210,14 @@ export default {
     async toSave({ data }) {
       data.bottom_menu.list = this.list;
       let config = { logo: data.logo, buyPoint: Number(data.buyPoint), pointPlan: data.pointPlan, share: data.share, autoCloseOrder: data.autoCloseOrder };
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin' && !data.shop) data.shop = this.user.shop._id || this.user.shop.id;
       data.config = config;
-      const res = await this.update(data);
+      let res;
+      if (data._id) await this.update(data);
+      else await this.create(data);
       this.$checkRes(res, '操作成功', '操作失败');
+      this.search();
     },
     // 查询其他信息
     async searchOther() {

+ 6 - 3
src/views/platSettings/indexModule/detail.vue

@@ -28,7 +28,6 @@
 
 <script>
 const _ = require('lodash');
-const moment = require('moment');
 import { mapState, mapGetters, createNamespacedHelpers } from 'vuex';
 const { mapActions } = createNamespacedHelpers('indexModule');
 const { mapActions: dictData } = createNamespacedHelpers('dictData');
@@ -53,7 +52,7 @@ export default {
         { label: '跳转类型', model: 'to_type', type: 'select' },
         { label: '跳转至', model: 'to' },
         { label: '是否正在使用', model: 'status', type: 'select' },
-        { label: '图标', model: 'url', type: 'upload', url: '/files/point/indexModule/upload' },
+        { label: '图标', model: 'url', type: 'upload', url: '/files/point/shopOne/indexModule/upload' },
         { label: '排序', model: 'sort', type: 'number' },
       ],
       typeList: [],
@@ -78,6 +77,8 @@ export default {
     // 提交
     async onSubmit({ data }) {
       let res;
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin' && !data.shop) data.shop = this.user.shop._id || this.user.shop.id;
       if (data.id) res = await this.update(data);
       else res = await this.create(data);
       if (this.$checkRes(res)) {
@@ -99,7 +100,9 @@ export default {
       this.$emit('toBack');
     },
   },
-  computed: {},
+  computed: {
+    ...mapState(['user']),
+  },
   metaInfo() {
     return { title: this.$route.meta.title };
   },

+ 4 - 1
src/views/platSettings/indexModule/index.vue

@@ -92,6 +92,8 @@ export default {
     // 查询
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       const condition = _.cloneDeep(this.searchForm);
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin') info.shop = this.user.shop._id || this.user.shop.id;
       let res = await this.query({ skip, limit, ...condition, ...info });
       if (this.$checkRes(res)) {
         this.$set(this, 'list', res.data);
@@ -112,12 +114,13 @@ export default {
     },
     toBack() {
       this.view = 'list';
+      this.search();
     },
     // 删除
     async toDel({ data }) {
       let res = await this.delete(data._id);
       if (this.$checkRes(res)) {
-        this.$message({ type: `success`, message: `除信息成功` });
+        this.$message({ type: `success`, message: `除信息成功` });
         this.search();
       }
     },

+ 11 - 2
src/views/platSettings/service/index.vue

@@ -2,6 +2,8 @@
   <div id="goods">
     <el-col :span="24" class="one"> <span>客服</span> </el-col>
     <template v-if="view === 'list'">
+      <!-- 添加 -->
+      <el-col :span="24" v-if="total == 0"><data-btn :fields="btnFields" @add="toAdd" /></el-col>
       <data-table ref="dataTable" :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @edit="toEdit"></data-table>
     </template>
     <template v-else>
@@ -38,6 +40,7 @@ export default {
       opera: [{ label: '修改', method: 'edit' }],
       list: [],
       total: 0,
+      btnFields: [{ label: '添加', method: 'add' }],
       // info部分
       infoFields: [
         { label: '联系电话', model: 'phone' },
@@ -50,20 +53,26 @@ export default {
     };
   },
   created() {
-    this.searchOthers();
     this.search();
   },
   methods: {
     ...mapActions(['query', 'delete', 'fetch', 'update', 'create']),
     ...methodsUtil,
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin') info.shop = this.user.shop._id || this.user.shop.id;
       const res = await this.query({ skip, limit, ...info });
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);
         this.$set(this, `total`, res.total);
       }
     },
-    async searchOthers() {},
+    initAddData() {
+      if (this.user.role.code == 'shopAdmin' && !this.form.shop) this.form.shop = this.user.shop._id || this.user.shop.id;
+    },
+  },
+  computed: {
+    ...mapState(['user']),
   },
 };
 </script>

+ 3 - 1
src/views/platmanag/goods/index.vue

@@ -87,7 +87,7 @@
             </el-form>
           </template>
           <template #brief>
-            <editor v-model="form.brief" url="/files/point/goods/upload" />
+            <editor v-model="form.brief" url="/files/point/shopOne/goods/upload" />
           </template>
           <template #shop>
             <el-select
@@ -219,6 +219,8 @@ export default {
     async search({ skip = 0, limit = this.$limit, ...others } = {}) {
       let query = { skip, limit, ...others };
       if (Object.keys(this.searchInfo).length > 0) query = { ...query, ...this.searchInfo };
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin') query.shop = this.user.shop._id || this.user.shop.id;
       const res = await this.query(query);
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);

+ 2 - 1
src/views/platmanag/goodsRate/index.vue

@@ -63,6 +63,8 @@ export default {
     // 查询
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin') info.shop = this.user.shop._id || this.user.shop.id;
       let res = await this.query({ skip, limit, ...condition, ...info });
       if (this.$checkRes(res)) {
         this.$set(this, 'list', res.data);
@@ -75,7 +77,6 @@ export default {
       this.$set(this, `id`, data._id);
       this.$set(this, `view`, 'info');
     },
-
     toBack() {
       this.view = 'list';
     },

+ 5 - 3
src/views/platmanag/goodsTags/index.vue

@@ -94,14 +94,13 @@ export default {
         { label: '显示名称', model: 'label' },
         { label: '标签编码', model: 'code' },
         { label: '排序', model: 'sort', type: 'number' },
-        { label: '标签图片', model: 'file', type: 'upload', url: '/files/point/goodstags/upload' },
-        { label: '分类标签图片(360*200)', model: 'tags_file', type: 'upload', url: '/files/point/goodstags/upload' },
+        { label: '标签图片', model: 'file', type: 'upload', url: '/files/point/shopOne/goodstags/upload' },
+        { label: '分类标签图片(360*200)', model: 'tags_file', type: 'upload', url: '/files/point/shopOne/goodstags/upload' },
         { label: '状态', model: 'status', type: 'select' },
       ],
       rules: {},
       form: {},
       statusList: [],
-
       levelList: [],
       data: [],
     };
@@ -120,6 +119,8 @@ export default {
     //执行查询
     async search({ skip = 0, limit = this.$limit, ...others } = {}) {
       let query = { skip, limit, ...others };
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin') query.shop = this.user.shop._id || this.user.shop.id;
       if (this.searchInfo && Object.keys(this.searchInfo).length > 0) query = { ...query, ...this.searchInfo };
       if (this.defaultSearch && Object.keys(this.defaultSearch).length > 0) query = { ...query, ...this.defaultSearch };
       if (this.levelList.length > 0) query.pid = _.last(this.levelList);
@@ -138,6 +139,7 @@ export default {
       const pid = _.last(this.levelList);
       const level = this.levelList.length + 1;
       if (pid) this.form.pid = pid;
+      if (this.user.role.code == 'shopAdmin' && !this.form.shop) this.form.shop = this.user.shop._id || this.user.shop.id;
       this.form.level = level;
       this.form.status = '0';
     },

+ 13 - 13
vue.config.js

@@ -25,7 +25,7 @@ module.exports = {
         target: 'https://broadcast.waityou24.cn',
       },
       '/dev/point/one/v1/api': {
-        target: 'http://192.168.1.113:12211', // 127.0.0.1:13003
+        target: 'http://127.0.0.1:12211', // 127.0.0.1:13003
         changeOrigin: true,
         ws: false,
       },
@@ -35,38 +35,38 @@ module.exports = {
         ws: false,
       },
       // 团购
-      '/point/one/group/v1/api': {
-        target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
+      '/dev/point/one/group/v1/api': {
+        target: 'http://127.0.0.1:12213', // 127.0.0.1:13003
         changeOrigin: true,
         ws: false,
       },
-      '/dev/point/one/group/v1/api': {
-        target: 'http://192.168.1.113:12213', // 127.0.0.1:13003
+      '/point/one/group/v1/api': {
+        target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
         changeOrigin: true,
         ws: false,
       },
       // 聊天
-      '/point/one/chat/v1/api': {
-        target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
+      '/dev/point/one/chat/v1/api': {
+        target: 'http://127.0.0.1:12214', // 127.0.0.1:13003
         changeOrigin: true,
         ws: false,
       },
-      '/dev/point/one/chat/v1/api': {
-        target: 'http://192.168.1.113:12214', // 127.0.0.1:13003
+      '/point/one/chat/v1/api': {
+        target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
         changeOrigin: true,
         ws: false,
       },
       // 尊荣
-      '/point/one/zr/v1/api': {
-        target: 'https://broadcast.waityou24.cn', // 127.0.0.1:13003
+      '/dev/point/one/zr/v1/api': {
+        target: 'http://127.0.0.1:12212', // 127.0.0.1:13003
         changeOrigin: true,
         ws: false,
         // pathRewrite: {
         //   '^/dev/point/zr/v1/api': '/point/zr/v1/api',
         // },
       },
-      '/dev/point/one/zr/v1/api': {
-        target: 'http://192.168.1.113:12212', // 127.0.0.1:13003
+      '/point/one/zr/v1/api': {
+        target: 'http://127.0.0.1:12212', // 127.0.0.1:13003
         changeOrigin: true,
         ws: false,
         // pathRewrite: {