Explorar o código

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

lrf %!s(int64=2) %!d(string=hai) anos
pai
achega
f4caf9fc2b

+ 9 - 56
src/views/selfShop/order/index.vue

@@ -3,25 +3,19 @@
     <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" :statusList="statusList" @onSubmit="search" @toReset="toClose" :total="total"></search-1>
-        </el-col>
-        <el-col :span="24" class="thr">
-          <el-button type="primary" size="mini" @click="toAdd()">新增</el-button>
-        </el-col>
         <el-col :span="24" class="four">
           <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
             <el-tab-pane label="待付款" name="1">
-              <card-1 :list="list" :toEdit="toEdit" :toDel="toDel" :total="total" :statusList="statusList"></card-1>
+              <card-1 @toEdit="toEdit" @toDel="toDel" :statusList="statusList"></card-1>
             </el-tab-pane>
             <el-tab-pane label="待发货" name="2">
-              <card-2 :list="list" :toEdit="toEdit" :toDel="toDel" :total="total" :statusList="statusList"></card-2>
+              <card-2 @toEdit="toEdit" @toDel="toDel" :statusList="statusList"></card-2>
             </el-tab-pane>
             <el-tab-pane label="待收货" name="3">
-              <card-3 :list="list" :toEdit="toEdit" :toDel="toDel" :total="total" :statusList="statusList"></card-3>
+              <card-3 @toEdit="toEdit" @toDel="toDel" :statusList="statusList"></card-3>
             </el-tab-pane>
             <el-tab-pane label="已收货" name="4">
-              <card-4 :list="list" :toEdit="toEdit" :toDel="toDel" :total="total" :statusList="statusList"></card-4>
+              <card-4 @toEdit="toEdit" @toDel="toDel" :statusList="statusList"></card-4>
             </el-tab-pane>
           </el-tabs>
         </el-col>
@@ -41,7 +35,6 @@ export default {
   name: 'index',
   props: {},
   components: {
-    search1: () => import('./parts/search-1.vue'),
     card1: () => import('./parts/card-1.vue'),
     card2: () => import('./parts/card-2.vue'),
     card3: () => import('./parts/card-3.vue'),
@@ -50,9 +43,7 @@ export default {
   data: function () {
     const that = this;
     return {
-      activeName: '2',
-      list: [],
-      total: 0,
+      activeName: '1',
       // 查询
       searchForm: {},
       // 多选值
@@ -63,58 +54,20 @@ export default {
   },
   async created() {
     await this.searchOther();
-    await this.search();
   },
   methods: {
     ...dictData({ dictQuery: 'query' }),
-    ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
-    ...orderDetail({ orderQuery: 'query', orderFetch: 'fetch', orderCreate: 'create', orderUpdate: 'update', orderDelete: 'delete' }),
-    // 查询
-    async search({ skip = 0, limit = 10, ...info } = {}) {
-      const condition = _.cloneDeep(this.searchForm);
-      if (this.activeName == '1') {
-        info.status = '0';
-        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);
-        }
-      } else if (this.activeName == '2') {
-        info.status = '1';
-        let res = await this.orderQuery({ skip, limit, ...condition, ...info });
-        if (this.$checkRes(res)) {
-          this.$set(this, 'list', res.data);
-          this.$set(this, 'total', res.total);
-        }
-      } else if (this.activeName == '3') {
-        info.status = '2';
-        let res = await this.orderQuery({ skip, limit, ...condition, ...info });
-        if (this.$checkRes(res)) {
-          this.$set(this, 'list', res.data);
-          this.$set(this, 'total', res.total);
-        }
-      } else if (this.activeName == '4') {
-        info.status = '3';
-        let res = await this.orderQuery({ skip, limit, ...condition, ...info });
-        if (this.$checkRes(res)) {
-          this.$set(this, 'list', res.data);
-          this.$set(this, 'total', res.total);
-        }
-      }
-    },
     handleClick(tab, event) {
       this.search();
     },
     // 新增
     toAdd() {},
     // 修改
-    async toEdit({ data }) {},
+    async toEdit({ data }) {
+      console.log(data);
+    },
     async toDel({ data }) {
-      let res = await this.delete(data._id);
-      if (this.$checkRes(res)) {
-        this.$message({ type: `success`, message: `刪除信息成功` });
-        this.search();
-      }
+      console.log(data);
     },
     toClose() {
       this.searchForm = {};

+ 37 - 10
src/views/selfShop/order/parts/card-1.vue

@@ -2,6 +2,9 @@
   <div id="card-1">
     <el-row>
       <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <search-1 :form="searchForm" :statusList="statusList" @onSubmit="search" @toReset="toClose" :total="total"></search-1>
+        </el-col>
         <data-table
           :select="true"
           :selected="selected"
@@ -21,13 +24,19 @@
 </template>
 
 <script>
+const _ = require('lodash');
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('order');
 export default {
   name: 'card-1',
-  props: { list: { type: Array }, total: { type: Number }, statusList: { type: Array } },
-  components: {},
+  // props: { list: { type: Array }, total: { type: Number }, statusList: { type: Array }  },
+  props: { statusList: { type: Array } },
+  components: { search1: () => import('./search-1.vue') },
   data: function () {
     return {
+      searchForm: {},
+      list: [],
+      total: 0,
       opera: [
         { label: '修改', method: 'edit' },
         { label: '删除', method: 'del', confirm: true, type: 'danger' },
@@ -49,16 +58,30 @@ export default {
       selected: [],
     };
   },
-  async created() {},
+  async created() {
+    await this.search();
+  },
   methods: {
-    search() {
-      this.$emit('search');
+    ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    // 查询
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const condition = _.cloneDeep(this.searchForm);
+      info.status = '0';
+      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);
+      }
+    },
+    toEdit({ data }) {
+      this.$emit('toEdit', { data: data });
     },
-    toEdit() {
-      this.$emit('toEdit');
+    toDel({ data }) {
+      this.$emit('toDel', { data: data });
     },
-    toDel() {
-      this.$emit('toDel');
+    toClose() {
+      this.searchForm = {};
+      this.search();
     },
     // 多选
     handleSelect(data) {
@@ -81,4 +104,8 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.one {
+  margin: 0 0 10px 0;
+}
+</style>

+ 38 - 10
src/views/selfShop/order/parts/card-2.vue

@@ -2,6 +2,9 @@
   <div id="card-1">
     <el-row>
       <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <search-1 :form="searchForm" :statusList="statusList" @onSubmit="search" @toReset="toClose" :total="total"></search-1>
+        </el-col>
         <data-table
           :select="true"
           :selected="selected"
@@ -21,13 +24,20 @@
 </template>
 
 <script>
+const _ = require('lodash');
+
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('orderDetail');
+
 export default {
   name: 'card-1',
-  props: { list: { type: Array }, total: { type: Number }, statusList: { type: Array } },
-  components: {},
+  props: { statusList: { type: Array } },
+  components: { search1: () => import('./search-1.vue') },
   data: function () {
     return {
+      searchForm: {},
+      list: [],
+      total: 0,
       opera: [
         { label: '修改', method: 'edit' },
         { label: '删除', method: 'del', confirm: true, type: 'danger' },
@@ -49,16 +59,30 @@ export default {
       selected: [],
     };
   },
-  async created() {},
+  async created() {
+    await this.search();
+  },
   methods: {
-    search() {
-      this.$emit('search');
+    ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    // 查询
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const condition = _.cloneDeep(this.searchForm);
+      info.status = '1';
+      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);
+      }
+    },
+    toEdit({ data }) {
+      this.$emit('toEdit', { data: data });
     },
-    toEdit() {
-      this.$emit('toEdit');
+    toDel({ data }) {
+      this.$emit('toDel', { data: data });
     },
-    toDel() {
-      this.$emit('toDel');
+    toClose() {
+      this.searchForm = {};
+      this.search();
     },
     // 多选
     handleSelect(data) {
@@ -81,4 +105,8 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.one {
+  margin: 0 0 10px 0;
+}
+</style>

+ 38 - 10
src/views/selfShop/order/parts/card-3.vue

@@ -2,6 +2,9 @@
   <div id="card-1">
     <el-row>
       <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <search-1 :form="searchForm" :statusList="statusList" @onSubmit="search" @toReset="toClose" :total="total"></search-1>
+        </el-col>
         <data-table
           :select="true"
           :selected="selected"
@@ -21,13 +24,20 @@
 </template>
 
 <script>
+const _ = require('lodash');
+
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('orderDetail');
+
 export default {
   name: 'card-1',
-  props: { list: { type: Array }, total: { type: Number }, statusList: { type: Array } },
-  components: {},
+  props: { statusList: { type: Array } },
+  components: { search1: () => import('./search-1.vue') },
   data: function () {
     return {
+      searchForm: {},
+      list: [],
+      total: 0,
       opera: [
         { label: '修改', method: 'edit' },
         { label: '删除', method: 'del', confirm: true, type: 'danger' },
@@ -49,16 +59,30 @@ export default {
       selected: [],
     };
   },
-  async created() {},
+  async created() {
+    await this.search();
+  },
   methods: {
-    search() {
-      this.$emit('search');
+    ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    // 查询
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const condition = _.cloneDeep(this.searchForm);
+      info.status = '2';
+      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);
+      }
+    },
+    toEdit({ data }) {
+      this.$emit('toEdit', { data: data });
     },
-    toEdit() {
-      this.$emit('toEdit');
+    toDel({ data }) {
+      this.$emit('toDel', { data: data });
     },
-    toDel() {
-      this.$emit('toDel');
+    toClose() {
+      this.searchForm = {};
+      this.search();
     },
     // 多选
     handleSelect(data) {
@@ -81,4 +105,8 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.one {
+  margin: 0 0 10px 0;
+}
+</style>

+ 38 - 10
src/views/selfShop/order/parts/card-4.vue

@@ -2,6 +2,9 @@
   <div id="card-1">
     <el-row>
       <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <search-1 :form="searchForm" :statusList="statusList" @onSubmit="search" @toReset="toClose" :total="total"></search-1>
+        </el-col>
         <data-table
           :select="true"
           :selected="selected"
@@ -21,13 +24,20 @@
 </template>
 
 <script>
+const _ = require('lodash');
+
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('orderDetail');
+
 export default {
   name: 'card-1',
-  props: { list: { type: Array }, total: { type: Number }, statusList: { type: Array } },
-  components: {},
+  props: { statusList: { type: Array } },
+  components: { search1: () => import('./search-1.vue') },
   data: function () {
     return {
+      searchForm: {},
+      list: [],
+      total: 0,
       opera: [
         { label: '修改', method: 'edit' },
         { label: '删除', method: 'del', confirm: true, type: 'danger' },
@@ -49,16 +59,30 @@ export default {
       selected: [],
     };
   },
-  async created() {},
+  async created() {
+    await this.search();
+  },
   methods: {
-    search() {
-      this.$emit('search');
+    ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    // 查询
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const condition = _.cloneDeep(this.searchForm);
+      info.status = '3';
+      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);
+      }
+    },
+    toEdit({ data }) {
+      this.$emit('toEdit', { data: data });
     },
-    toEdit() {
-      this.$emit('toEdit');
+    toDel({ data }) {
+      this.$emit('toDel', { data: data });
     },
-    toDel() {
-      this.$emit('toDel');
+    toClose() {
+      this.searchForm = {};
+      this.search();
     },
     // 多选
     handleSelect(data) {
@@ -81,4 +105,8 @@ export default {
 };
 </script>
 
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.one {
+  margin: 0 0 10px 0;
+}
+</style>