zs 2 lat temu
rodzic
commit
d103955c43
2 zmienionych plików z 33 dodań i 7 usunięć
  1. 0 3
      src/views/goodsTags/index.vue
  2. 33 4
      src/views/order/index.vue

+ 0 - 3
src/views/goodsTags/index.vue

@@ -4,9 +4,6 @@
       <el-col :span="24" class="main animate__animated animate__backInRight">
         <el-col :span="24" class="one">
           <c-search :is_search="true" :fields="fields" @search="btSearch">
-            <template #type>
-              <el-option v-for="i in typeList" :key="i.dict_value" :label="i.dict_label" :value="i.dict_value"></el-option>
-            </template>
             <template #is_use>
               <el-option v-for="i in is_useList" :key="i.dict_value" :label="i.dict_label" :value="i.dict_value"></el-option>
             </template>

+ 33 - 4
src/views/order/index.vue

@@ -3,7 +3,14 @@
     <el-row>
       <el-col :span="24" class="main animate__animated animate__backInRight">
         <el-col :span="24" class="one">
-          <c-search :is_search="true" :fields="fields" @search="btSearch"></c-search>
+          <c-search :is_search="true" :fields="fields" @search="btSearch">
+            <template #type>
+              <el-option v-for="item in typeList" :key="item.dict_value" :label="item.dict_label" :value="item.dict_value"> </el-option>
+            </template>
+            <template #table>
+              <el-option v-for="item in tableList" :key="item._id" :label="item.name" :value="item._id"> </el-option>
+            </template>
+          </c-search>
         </el-col>
         <el-col :span="24" class="two">
           <data-table :fields="fields" :opera="opera" @query="search" :data="list" :total="total" @view="toView" @pay="toPay"> </data-table>
@@ -17,6 +24,7 @@
 import { order_type } from '@common/src/layout/site';
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions } = createNamespacedHelpers('order');
+const { mapActions: table } = createNamespacedHelpers('table');
 export default {
   name: 'index',
   props: {},
@@ -31,7 +39,17 @@ export default {
         { label: '序号', options: { type: 'index' } },
         { label: '订单号', model: '_id', isSearch: true },
         { label: '下单时间', model: 'time' },
-        { label: '下单桌号', model: 'table' },
+        {
+          label: '下单桌号',
+          model: 'table',
+          type: 'select',
+          format: (i) => {
+            let data = this.tableList.find((r) => r._id == i);
+            if (data) return data.name;
+            else return '暂无';
+          },
+          isSearch: true,
+        },
         { label: '支付金额', model: 'money' },
         { label: '用餐人数', model: 'num' },
         {
@@ -53,14 +71,17 @@ export default {
       ],
       // 订单类型
       typeList: order_type,
+      tableList: [],
     };
   },
-  created() {
-    this.search();
+  async created() {
+    await this.searchOther();
+    await this.search();
   },
   mounted() {},
   methods: {
     ...mapActions(['query', 'fetch', 'delete']),
+    ...table({ tQuery: 'query' }),
     async search({ skip = 0, limit = 10, ...info } = {}) {
       let res = await this.query({ skip, limit, ...info, ...this.searchInfo });
       if (this.$checkRes(res)) {
@@ -80,6 +101,14 @@ export default {
     toView({ data }) {
       this.$router.push({ path: '/order/add', query: { id: data._id } });
     },
+    async searchOther() {
+      let res;
+      // 桌号
+      res = await this.tQuery();
+      if (this.$checkRes(res)) {
+        this.$set(this, `tableList`, res.data);
+      }
+    },
   },
   computed: {
     ...mapState(['user']),