浏览代码

修改店铺查看

zs 1 年之前
父节点
当前提交
9c38ee9410

+ 2 - 0
src/views/platActivi/act/index.vue

@@ -122,6 +122,8 @@ export default {
       const condition = _.cloneDeep(this.searchForm);
       let query = { skip, limit, ...others };
       if (Object.keys(condition).length > 0) query = { ...query, ...condition };
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin') query.shop = this.user.shop._id || this.user.shop.id;
       let res = await this.query(query);
       if (this.$checkRes(res)) {
         this.$set(this, 'list', res.data);

+ 5 - 1
src/views/platActivi/act/parts/detail.vue

@@ -115,6 +115,8 @@ export default {
     },
     async onSubmit(formName) {
       let form = this.form;
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin' && !form.shop) form.shop = this.user.shop._id || this.user.shop.id;
       let config = this.config;
       if (form.type == '5' || form.type == '6') config.discount = this.list;
       if (config.time) {
@@ -150,7 +152,9 @@ export default {
       this.$emit('toBack');
     },
   },
-  computed: {},
+  computed: {
+    ...mapState(['user']),
+  },
   metaInfo() {
     return { title: this.$route.meta.title };
   },

+ 2 - 1
src/views/platActivi/act/parts/goods.vue

@@ -164,6 +164,8 @@ export default {
       info.platform_act = this.id;
       if (this.type == '4') info.goods_type = 'basic';
       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);
@@ -207,7 +209,6 @@ export default {
       if (this.type == '4') query.goods_type = data;
       this.$router.push({ path: './goods/goodsDetail', query: query });
     },
-
     // 删除
     async toDel({ data }) {
       let res = await this.delete(data._id);

+ 5 - 1
src/views/platActivi/actTags/detail.vue

@@ -82,6 +82,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)) {
@@ -101,7 +103,9 @@ export default {
       this.$emit('toBack');
     },
   },
-  computed: {},
+  computed: {
+    ...mapState(['user']),
+  },
   metaInfo() {
     return { title: this.$route.meta.title };
   },

+ 2 - 0
src/views/platActivi/actTags/index.vue

@@ -109,6 +109,8 @@ export default {
       const condition = _.cloneDeep(this.searchForm);
       let query = { skip, limit, ...others };
       if (Object.keys(condition).length > 0) query = { ...query, ...condition };
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin') query.shop = this.user.shop._id || this.user.shop.id;
       let res = await this.query(query);
       if (this.$checkRes(res)) {
         this.$set(this, 'list', res.data);

+ 5 - 1
src/views/platActivi/coupon/detail.vue

@@ -249,6 +249,8 @@ export default {
       this.$refs[formName].validate(async (valid) => {
         if (valid) {
           let data = this.form;
+          // 判断是否是个人店铺查询
+          if (this.user.role.code == 'shopAdmin' && !data.shop) data.shop = this.user.shop._id || this.user.shop.id;
           let discount_config = { limit: data.limit, min: data.min, max: data.discount_type_max }; //减免配置
           let use_limit_config = { tags: data.tags }; //使用配置
           let get_limit_config = { max: data.get_limit_max }; //领取配置
@@ -291,7 +293,9 @@ export default {
       this.$emit('toBack');
     },
   },
-  computed: {},
+  computed: {
+    ...mapState(['user']),
+  },
   metaform() {
     return { title: this.$route.meta.title };
   },

+ 2 - 0
src/views/platActivi/coupon/index.vue

@@ -142,6 +142,8 @@ export default {
       const condition = _.cloneDeep(this.searchForm);
       let query = { skip, limit, ...others };
       if (Object.keys(condition).length > 0) query = { ...query, ...condition };
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin') query.shop = this.user.shop._id || this.user.shop.id;
       let res = await this.query(query);
       if (this.$checkRes(res)) {
         this.$set(this, 'list', res.data);

+ 6 - 1
src/views/platGroup/goods/detail.vue

@@ -118,7 +118,10 @@ export default {
     // 远程查询
     async querySearch(value) {
       this.loading = true;
-      let res = await this.goodsQuery({ name: value });
+      let data = { name: value };
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin' && !data.shop) data.shop = this.user.shop._id || this.user.shop.id;
+      let res = await this.goodsQuery(data);
       if (this.$checkRes(res)) this.$set(this, 'goodsList', res.data);
       this.loading = false;
     },
@@ -148,6 +151,8 @@ export default {
     // 保存
     async toSave({ 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)) {

+ 6 - 1
src/views/platGroup/goods/index.vue

@@ -130,6 +130,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 (Object.keys(this.searchInfo).length > 0) query = { ...query, ...this.searchInfo };
       const res = await this.query(query);
       if (this.$checkRes(res)) {
@@ -141,7 +143,10 @@ export default {
     // 远程查询
     async querySearch(value) {
       this.loading = true;
-      let res = await this.goodsQuery({ name: value });
+      let data = { name: value };
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin' && !data.shop) data.shop = this.user.shop._id || this.user.shop.id;
+      let res = await this.goodsQuery(data);
       if (this.$checkRes(res)) this.$set(this, 'goodsList', res.data);
       this.loading = false;
     },

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

@@ -140,6 +140,8 @@ export default {
 
       let query = { skip, limit, ...info };
       if (Object.keys(condition).length > 0) query = { ...query, ...condition };
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin') query.shop = this.user.shop._id || this.user.shop.id;
       let res = await this.query(query);
       if (this.$checkRes(res)) {
         this.$set(this, 'list', res.data);
@@ -198,7 +200,10 @@ export default {
     },
     //商品名称远程查询
     async goodsSearch(value) {
-      let res = await this.goodsQuery({ name: value });
+      let data = { name: value };
+      // 判断是否是个人店铺查询
+      if (this.user.role.code == 'shopAdmin' && !data.shop) data.shop = this.user.shop._id || this.user.shop.id;
+      let res = await this.goodsQuery(data);
       if (this.$checkRes(res)) this.$set(this, 'goodsList', res.data);
     },
     // 查询其他信息

+ 2 - 2
src/views/platmanag/user/index.vue

@@ -69,7 +69,6 @@ export default {
         { label: '设为会员', method: 'puton', display: (i) => i.is_leader != '0', type: 'success' },
         { label: '取消会员', method: 'puton', display: (i) => i.is_leader == '0', type: 'warning' },
         { label: '会员信息', method: 'leader', display: (i) => i.is_leader == '0' },
-
         { label: '删除', method: 'del', confirm: true, type: 'danger' },
       ],
       fields: [
@@ -147,6 +146,8 @@ export default {
     ...userleader({ ulQuery: 'query' }),
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchInfo);
+      // 判断是否是个人店铺查询
+      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);
@@ -231,7 +232,6 @@ export default {
       if (this.$checkRes(res)) this.$set(this, `useList`, res.data);
       // 是否使用
       res = await this.dictQuery({ code: 'use' });
-      console.log(res.data);
       if (this.$checkRes(res)) this.$set(this, `is_useList`, res.data);
     },
   },

+ 3 - 0
src/views/zr/zrGoods/index.vue

@@ -113,6 +113,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);
@@ -123,6 +125,7 @@ export default {
     // 添加自定义
     initAddData() {
       const obj = { status: '1', shop: _.get(this.user.shop, '_id') };
+      if (this.user.role.code == 'shopAdmin' && !obj.shop) obj.shop = this.user.shop._id || this.user.shop.id;
       this.$set(this, 'form', obj);
     },
     // 查询其他信息

+ 2 - 0
src/views/zr/zrOrder/parts/detail-1.vue

@@ -83,6 +83,8 @@ export default {
         condition[`buy_time@end`] = _.last(condition.buy_time);
         delete condition.buy_time;
       }
+      // 判断是否是个人店铺查询
+      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);