瀏覽代碼

修改查询方式

july 4 年之前
父節點
當前提交
b134977178
共有 2 個文件被更改,包括 37 次插入21 次删除
  1. 10 0
      src/api/ldt_bills/billtrace.js
  2. 27 21
      src/views/ldt_bills/billtrace.vue

+ 10 - 0
src/api/ldt_bills/billtrace.js

@@ -21,3 +21,13 @@ export const getBills = (current, size, params) => {
     }
   })
 }
+
+export const getBillById = (billId) => {
+  return request({
+    url: '/api/web/billTrace/getBillById',
+    method: 'get',
+    params: {
+      billId
+    }
+  })
+}

+ 27 - 21
src/views/ldt_bills/billtrace.vue

@@ -4,8 +4,8 @@
     <div class="avue-searchs__title">账单追溯</div>
     <div class="avue-searchs__content">
       <div class="avue-searchs__form">
-        <el-input :placeholder="$t('search')" v-model="value">
-          <el-button slot="append" icon="el-icon-search"></el-button>
+        <el-input :placeholder="$t('search')" v-model="value" @input="searchBill">
+          <el-button slot="append" icon="el-icon-search" @click="searchBill"></el-button>
         </el-input>
       </div>
       <div class="avue-searchs__list">
@@ -34,7 +34,7 @@
 
 <script>
 import InfiniteLoading from 'vue-infinite-loading';
-import {getBills} from "@/api/ldt_bills/billtrace"
+import {getBills} from "../../api/ldt_bills/billtrace";
 
 export default {
   components: {
@@ -52,17 +52,23 @@ export default {
       billList: [],
     }
   },
-  watch: {
-    value() {
-      this.querySearch();
-    },
-  },
+  // watch: {
+  //   value() {
+  //     this.querySearch();
+  //   },
+  // },
   methods: {
+    searchBill() {
+      getBills(1, this.page.pageSize, {id: this.value}).then((res) => {
+        const data = res.data.data;
+        this.billList = data.records;
+      })
+    },
     handleSelect(billId) {
       this.$router.push(`/work/process/billtrace/handle?billId=${billId}`)
     },
     infiniteHandler($state) {
-      getBills(this.page.currentPage, this.page.pageSize, this.value).then((res) => {
+      getBills(this.page.currentPage, this.page.pageSize, {id: this.value}).then((res) => {
         const data = res.data.data;
         if (data.records.length) {
           this.bills = this.bills.concat(data.records);
@@ -77,18 +83,18 @@ export default {
         }
       });
     },
-    querySearch() {
-      var restaurants = this.bills;
-      var queryString = this.value
-      this.billList = queryString ? this.bills.filter(this.createFilter(queryString)) : restaurants;
-    },
-    createFilter(queryString) {
-      return restaurant => {
-        return (
-          restaurant.id.indexOf(queryString) !== -1
-        );
-      };
-    },
+    // querySearch() {
+    //   var restaurants = this.bills;
+    //   var queryString = this.value
+    //   this.billList = queryString ? this.bills.filter(this.createFilter(queryString)) : restaurants;
+    // },
+    // createFilter(queryString) {
+    //   return restaurant => {
+    //     return (
+    //       restaurant.id.indexOf(queryString) !== -1
+    //     );
+    //   };
+    // },
   }
 }
 </script>