YY 2 gadi atpakaļ
vecāks
revīzija
c8605db9c0

+ 3 - 7
src/views/platmanag/goodsRate/detail.vue

@@ -71,7 +71,7 @@ const { mapActions } = createNamespacedHelpers('goodsRate');
 
 export default {
   name: 'form-1',
-  props: {},
+  props: { id: { type: String } },
   components: {},
   data: function () {
     return {
@@ -120,14 +120,10 @@ export default {
     },
     // 返回
     toBack() {
-      window.history.go('-1');
-    },
-  },
-  computed: {
-    id() {
-      return this.$route.query.id;
+      this.$emit('toBack');
     },
   },
+  computed: {},
   metaInfo() {
     return { title: this.$route.meta.title };
   },

+ 30 - 20
src/views/platmanag/goodsRate/index.vue

@@ -2,24 +2,27 @@
   <div id="index">
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight">
-        <el-col :span="24" class="one"> <span>商品评价</span> </el-col>
-        <el-col :span="24" class="two">
-          <search-1 :form="searchForm" @onSubmit="search" @toReset="toClose"></search-1>
-        </el-col>
-        <el-col :span="24" class="four">
-          <data-table
-            :select="true"
-            :selected="selected"
-            @handleSelect="handleSelect"
-            :fields="fields"
-            :opera="opera"
-            @query="search"
-            :data="list"
-            :total="total"
-            @edit="toEdit"
-          >
-          </data-table>
-        </el-col>
+        <span v-show="view === 'list'">
+          <el-col :span="24" class="one"> <span>商品评价</span> </el-col>
+          <el-col :span="24" class="two">
+            <search-1 :form="searchForm" @onSubmit="search" @toReset="toClose"></search-1>
+          </el-col>
+          <el-col :span="24" class="four">
+            <data-table
+              :select="true"
+              :selected="selected"
+              @handleSelect="handleSelect"
+              :fields="fields"
+              :opera="opera"
+              @query="search"
+              :data="list"
+              :total="total"
+              @edit="toEdit"
+            >
+            </data-table>
+          </el-col>
+        </span>
+        <detail v-if="view === 'info'" :id="id" @toBack="toBack"></detail>
       </el-col>
     </el-row>
   </div>
@@ -35,10 +38,12 @@ export default {
   props: {},
   components: {
     search1: () => import('./parts/search-1.vue'),
+    detail: () => import('./detail.vue'),
   },
   data: function () {
     const that = this;
     return {
+      view: 'list',
       // 列表
       opera: [{ label: '查看评价', method: 'edit' }],
       fields: [
@@ -51,7 +56,6 @@ export default {
       searchForm: {},
       // 多选值
       selected: [],
-      shop: {},
     };
   },
   async created() {
@@ -61,6 +65,7 @@ export default {
   methods: {
     ...dictData({ getDict: 'query' }),
     ...goods(['query', 'delete', 'fetch', 'update', 'create']),
+    // 查询
     async search({ skip = 0, limit = this.$limit, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
       let res = await this.query({ skip, limit, ...condition, ...info });
@@ -71,7 +76,12 @@ export default {
     },
     // 修改
     async toEdit({ data }) {
-      this.$router.push({ path: '/platmanag/goodsRate/detail', query: { id: data.id } });
+      this.$set(this, `id`, data.id);
+      this.$set(this, `view`, 'info');
+    },
+
+    toBack() {
+      this.view = 'list';
     },
     // 重置
     toClose() {

+ 3 - 7
src/views/selfShop/goodsRate/detail.vue

@@ -80,7 +80,7 @@ const { mapActions } = createNamespacedHelpers('goodsRate');
 
 export default {
   name: 'form-1',
-  props: {},
+  props: { id: { type: String } },
   components: {},
   data: function () {
     return {
@@ -161,14 +161,10 @@ export default {
     },
     // 返回
     toBack() {
-      window.history.go('-1');
-    },
-  },
-  computed: {
-    id() {
-      return this.$route.query.id;
+      this.$emit('toBack');
     },
   },
+  computed: {},
   metaInfo() {
     return { title: this.$route.meta.title };
   },

+ 28 - 19
src/views/selfShop/goodsRate/index.vue

@@ -2,24 +2,27 @@
   <div id="index">
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight">
-        <el-col :span="24" class="one"> <span>商品评价</span> </el-col>
-        <el-col :span="24" class="two">
-          <search-1 :form="searchForm" @onSubmit="search" @toReset="toClose"></search-1>
-        </el-col>
-        <el-col :span="24" class="four">
-          <data-table
-            :select="true"
-            :selected="selected"
-            @handleSelect="handleSelect"
-            :fields="fields"
-            :opera="opera"
-            @query="search"
-            :data="list"
-            :total="total"
-            @edit="toEdit"
-          >
-          </data-table>
-        </el-col>
+        <span v-show="view === 'list'">
+          <el-col :span="24" class="one"> <span>商品评价</span> </el-col>
+          <el-col :span="24" class="two">
+            <search-1 :form="searchForm" @onSubmit="search" @toReset="toClose"></search-1>
+          </el-col>
+          <el-col :span="24" class="four">
+            <data-table
+              :select="true"
+              :selected="selected"
+              @handleSelect="handleSelect"
+              :fields="fields"
+              :opera="opera"
+              @query="search"
+              :data="list"
+              :total="total"
+              @edit="toEdit"
+            >
+            </data-table>
+          </el-col>
+        </span>
+        <detail v-if="view === 'info'" :id="id" @toBack="toBack"></detail>
       </el-col>
     </el-row>
   </div>
@@ -35,10 +38,12 @@ export default {
   props: {},
   components: {
     search1: () => import('./parts/search-1.vue'),
+    detail: () => import('./detail.vue'),
   },
   data: function () {
     const that = this;
     return {
+      view: 'list',
       // 列表
       opera: [{ label: '查看评价', method: 'edit' }],
       fields: [
@@ -71,7 +76,11 @@ export default {
     },
     // 修改
     async toEdit({ data }) {
-      this.$router.push({ path: '/selfShop/goodsRate/detail', query: { id: data.id } });
+      this.$set(this, `id`, data.id);
+      this.$set(this, `view`, 'info');
+    },
+    toBack() {
+      this.view = 'list';
     },
     // 重置
     toClose() {