Selaa lähdekoodia

Merge branch 'master' of http://git.cc-lotus.info/pointToNetwork/web-admin

lrf 2 vuotta sitten
vanhempi
commit
7830065205

+ 4 - 0
src/components/usual/c-table.vue

@@ -289,6 +289,10 @@ export default {
     getPageConfig() {
       return { skip: (this.currentPage - 1) * this.limit, limit: this.limit, currentPage: this.currentPage };
     },
+    setPage({ skip, limit }) {
+      let currentPage = skip / limit + 1;
+      this.currentPage = currentPage;
+    },
   },
 };
 </script>

+ 14 - 5
src/views/platmanag/goods/index.vue

@@ -11,7 +11,7 @@
         >
           <search-1
             :form="searchInfo"
-            @onSubmit="search"
+            @onSubmit="toSearch"
             @querySearch="querySearch"
             @toReset="toClose"
             @changeTags="changeTags"
@@ -180,11 +180,14 @@ export default {
       statusList: [],
       // 返现金额类型
       typeList: [{ label: '固定金额' }, { label: '百分比' }],
+      searchQuery: {},
     };
   },
   created() {
     this.searchOthers();
-    this.search();
+    let route = JSON.parse(sessionStorage.getItem(this.$route.path));
+    if (route) this.search(route);
+    else this.search();
   },
   methods: {
     ...dictData({ getDict: 'query' }),
@@ -193,6 +196,11 @@ export default {
     ...shop({ shopQuery: 'query', shopFetch: 'fetch' }),
     ...goods(['copy', 'query', 'delete', 'fetch', 'update', 'create']),
     ...methodsUtil,
+    toSearch() {
+      // this.$refs.dataTable.resetPage();
+      const res = this.$refs.dataTable.getPageConfig();
+      this.search(res);
+    },
     // 查询
     async search({ skip = 0, limit = this.$limit, ...others } = {}) {
       let query = { skip, limit, ...others };
@@ -201,6 +209,7 @@ export default {
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);
         this.$set(this, `total`, res.total);
+        this.$set(this, `searchQuery`, query);
       }
       this.loadings = false;
     },
@@ -265,7 +274,6 @@ export default {
         if (this.$checkRes(res)) {
           this.$message({ type: `success`, message: `复制成功` });
           this.toBack();
-          this.search();
         }
       });
     },
@@ -335,13 +343,13 @@ export default {
       if (this.$checkRes(res)) {
         this.$message({ type: `success`, message: `维护信息成功` });
         this.toBack();
-        this.search();
       }
     },
     // 执行返回
     toBack() {
       this.form = {};
       this.view = 'list';
+      this.search(this.searchQuery);
     },
     // 上架
     async toPuton({ data }) {
@@ -355,11 +363,12 @@ export default {
         let res;
         if (data._id) res = await this.update(data);
         if (this.$checkRes(res)) this.$message({ type: `success`, message: `修改成功` });
-        this.search();
+        this.search(this.searchQuery);
       });
     },
     // 库存管理
     toSpec({ data }) {
+      sessionStorage.setItem(this.$route.path, JSON.stringify(this.searchQuery));
       this.$router.push({ path: `/platmanag/spec/${data._id}` });
     },
   },

+ 4 - 24
src/views/platmanag/goods/spec.vue

@@ -66,18 +66,8 @@ export default {
         { label: '实际销售价格', model: 'sell_money' },
         { label: '划掉销售价格', model: 'flow_money' },
         { label: '运费', model: 'freight' },
+        { label: '团长价格', model: 'leader_price' },
         { label: '状态', model: 'status', format: (i) => (i === '0' ? '使用中' : '已禁用') },
-        {
-          label: '是否可以团购',
-          model: 'can_group',
-          format: (i) => {
-            let data = this.tfList.find((f) => f.value == i);
-            if (data) return data.label;
-            else return '暂无';
-          },
-        },
-        { label: '团购金额', model: 'group_config.money' },
-        { label: '开团人数', model: 'group_config.need_person' },
         { label: '排序', model: 'sort' },
       ],
       opera: [
@@ -103,9 +93,7 @@ export default {
         { label: '运费', model: 'freight', type: 'number' },
         { label: '排序', model: 'sort', type: 'number' },
         { label: '状态', model: 'status', type: 'select' },
-        { label: '是否可以团购', model: 'can_group', type: 'select' },
-        { label: '团购金额', model: 'money', type: 'number' },
-        { label: '开团人数', model: 'need_person', type: 'number' },
+        { label: '团长价格', model: 'leader_price', type: 'number' },
         { label: '图片', model: 'file', type: 'upload', url: '/files/point/goodsSpec/upload' },
       ],
       rules: {
@@ -139,7 +127,7 @@ export default {
     ...methodUtil,
     // 添加自定义
     initAddData() {
-      const obj = { goods: this.goods, status: '0', can_group: '1', freight: 0 };
+      const obj = { goods: this.goods, status: '0', freight: 0 };
       this.$set(this, 'form', obj);
     },
     // 面包屑
@@ -172,10 +160,6 @@ export default {
     },
     // 保存
     async toSave({ data }) {
-      let group_config = {};
-      group_config.money = data.money;
-      group_config.need_person = data.need_person;
-      data.group_config = group_config;
       let res;
       if (data.id) res = await this.update(data);
       else res = await this.create(data);
@@ -189,11 +173,7 @@ export default {
     async toEdit({ data }) {
       const res = await this.fetch(data._id);
       if (this.$checkRes(res)) {
-        let data = res.data;
-        const group_config = _.get(data, 'group_config', {});
-        data = { ...data, ...group_config };
-        delete data.group_config;
-        this.$set(this, `form`, data);
+        this.$set(this, `form`, res.data);
         this.view = 'info';
       } else this.$message.error('未找到指定数据');
     },

+ 14 - 5
src/views/selfShop/goods/index.vue

@@ -105,6 +105,7 @@ const { mapActions: goods } = createNamespacedHelpers('goods');
 const { mapActions: goodsTags } = createNamespacedHelpers('goodsTags');
 const { mapActions: dictData } = createNamespacedHelpers('dictData');
 const { mapActions: actTags } = createNamespacedHelpers('actTags');
+
 export default {
   name: 'index',
   props: {},
@@ -172,22 +173,28 @@ export default {
       statusList: [],
       // 返现金额类型
       typeList: [{ label: '固定金额' }, { label: '百分比' }],
+      // 查询条件
+      searchQuery: {},
     };
   },
   created() {
     this.searchOthers();
-    this.search();
+    let route = JSON.parse(sessionStorage.getItem(this.$route.path));
+    if (route) this.search(route);
+    else this.search();
   },
+
   methods: {
     ...dictData({ getDict: 'query' }),
     ...actTags({ actQuery: 'query' }),
     ...goodsTags(['tree']),
     ...goods(['copy', 'query', 'delete', 'fetch', 'update', 'create']),
     ...methodsUtil,
+
     toSearch() {
       // this.$refs.dataTable.resetPage();
       const res = this.$refs.dataTable.getPageConfig();
-      console.log(res);
+      this.search(res);
     },
     // 查询
     async search({ skip = 0, limit = this.$limit, ...others } = {}) {
@@ -197,6 +204,8 @@ export default {
       if (this.$checkRes(res)) {
         this.$set(this, `list`, res.data);
         this.$set(this, `total`, res.total);
+        this.$set(this, `searchQuery`, query);
+        sessionStorage.removeItem(this.$route.path);
       }
       this.loadings = false;
     },
@@ -231,7 +240,6 @@ export default {
         if (this.$checkRes(res)) {
           this.$message({ type: `success`, message: `复制成功` });
           this.toBack();
-          this.search();
         }
       });
     },
@@ -253,13 +261,13 @@ export default {
       if (this.$checkRes(res)) {
         this.$message({ type: `success`, message: `维护信息成功` });
         this.toBack();
-        this.search();
       }
     },
     // 执行返回
     toBack() {
       this.form = {};
       this.view = 'list';
+      this.search(this.searchQuery);
     },
     // 上架
     async toPuton({ data }) {
@@ -273,11 +281,12 @@ export default {
         let res;
         if (data._id) res = await this.update(data);
         if (this.$checkRes(res)) this.$message({ type: `success`, message: `修改成功` });
-        this.search();
+        this.search(this.searchQuery);
       });
     },
     // 库存管理
     toSpec({ data }) {
+      sessionStorage.setItem(this.$route.path, JSON.stringify(this.searchQuery));
       this.$router.push({ path: `/selfShop/spec/${data._id}` });
     },
     // 查询其他信息

+ 4 - 24
src/views/selfShop/goods/spec.vue

@@ -67,18 +67,8 @@ export default {
         { label: '实际销售价格', model: 'sell_money' },
         { label: '划掉销售价格', model: 'flow_money' },
         { label: '运费', model: 'freight' },
+        { label: '团长价格', model: 'leader_price' },
         { label: '状态', model: 'status', format: (i) => (i === '0' ? '使用中' : '已禁用') },
-        {
-          label: '是否可以团购',
-          model: 'can_group',
-          format: (i) => {
-            let data = this.tfList.find((f) => f.value == i);
-            if (data) return data.label;
-            else return '暂无';
-          },
-        },
-        { label: '团购金额', model: 'group_config.money' },
-        { label: '开团人数', model: 'group_config.need_person' },
         { label: '排序', model: 'sort' },
       ],
       opera: [
@@ -104,9 +94,7 @@ export default {
         { label: '排序', model: 'sort', type: 'number' },
         { label: '运费', model: 'freight', type: 'number' },
         { label: '状态', model: 'status', type: 'select' },
-        { label: '是否可以团购', model: 'can_group', type: 'select' },
-        { label: '团购金额', model: 'money', type: 'number' },
-        { label: '开团人数', model: 'need_person', type: 'number' },
+        { label: '团长价格', model: 'leader_price', type: 'number' },
         { label: '图片', model: 'file', type: 'upload', url: '/files/point/goodsSpec/upload' },
       ],
       rules: {
@@ -139,7 +127,7 @@ export default {
     ...methodUtil,
     // 添加自定义
     initAddData() {
-      const obj = { goods: this.goods, status: '0', can_group: '1', freight: 0 };
+      const obj = { goods: this.goods, status: '0', freight: 0 };
       this.$set(this, 'form', obj);
     },
     async toData(row) {
@@ -171,10 +159,6 @@ export default {
     },
     // 保存
     async toSave({ data }) {
-      let group_config = {};
-      group_config.money = data.money;
-      group_config.need_person = data.need_person;
-      data.group_config = group_config;
       let res;
       if (data.id) res = await this.update(data);
       else res = await this.create(data);
@@ -188,11 +172,7 @@ export default {
     async toEdit({ data }) {
       const res = await this.fetch(data._id);
       if (this.$checkRes(res)) {
-        let data = res.data;
-        const group_config = _.get(data, 'group_config', {});
-        data = { ...data, ...group_config };
-        delete data.group_config;
-        this.$set(this, `form`, data);
+        this.$set(this, `form`, res.data);
         this.view = 'info';
       } else this.$message.error('未找到指定数据');
     },