浏览代码

02/22 搜索优化

1
mo 4 年之前
父节点
当前提交
ad24b72490

+ 21 - 17
src/views/businessManager/orderManager/businessStatement.vue

@@ -271,6 +271,11 @@ export default {
       },
     };
   },
+  created(){
+     const form = { ...this.searchForm };
+    form.month = dayjs().format("YYYY-MM");
+    this.searchForm = form;
+  },
   mounted() {
     this.$store.dispatch("setBranchs");
     // getEmployeeOrgan().then(res => {
@@ -283,24 +288,23 @@ export default {
         this.cooperations = res.data.rows;
       }
     });
-    const form = { ...this.searchForm };
-    form.month = dayjs().format("YYYY-MM");
-    this.searchForm = form;
+
     this.getList();
-    var now = new Date();
-    var startDate = new Date(
-      Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
-    )
-      .toISOString()
-      .slice(0, 10);
-    var endDate = new Date(
-      Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
-    )
-      .toISOString()
-      .slice(0, 10);
-    this.orderDate = [];
-    this.orderDate.push(startDate);
-    this.orderDate.push(endDate);
+
+    // var now = new Date();
+    // var startDate = new Date(
+    //   Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
+    // )
+    //   .toISOString()
+    //   .slice(0, 10);
+    // var endDate = new Date(
+    //   Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
+    // )
+    //   .toISOString()
+    //   .slice(0, 10);
+    // this.orderDate = [];
+    // this.orderDate.push(startDate);
+    // this.orderDate.push(endDate);
   },
   methods: {
     search() {

+ 2 - 2
src/views/businessManager/orderManager/businessStatementDetail.vue

@@ -345,8 +345,8 @@ export default {
     goBack () {
       // searchForm: this.searchForm,
       // pageInfo: this.pageInfo
-       this.$store.dispatch('delVisitedViews', this.$route) 
-      this.$router.push({ path: '/orderList/businessStatement', query: { ...this.$route.query } })
+       this.$store.dispatch('delVisitedViews', this.$route)
+      this.$router.push({ path: '/orderList/businessStatement' })
     }
   }
 }

+ 19 - 15
src/views/businessManager/orderManager/financeManager.vue

@@ -749,20 +749,7 @@ export default {
   created() {
     that = this;
         if (!(this.searchForm.orderDate?.length > 0)) {
-      var now = new Date();
-      var startDate = new Date(
-        Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
-      )
-        .toISOString()
-        .slice(0, 10);
-      var endDate = new Date(
-        Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
-      )
-        .toISOString()
-        .slice(0, 10);
-      this.searchForm.orderDate = [];
-      this.searchForm.orderDate.push(startDate);
-      this.searchForm.orderDate.push(endDate);
+          this.getNow()
     }
   },
   mounted() {
@@ -780,6 +767,22 @@ export default {
     this.getList();
   },
   methods: {
+    getNow(){
+       var now = new Date();
+      var startDate = new Date(
+        Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
+      )
+        .toISOString()
+        .slice(0, 10);
+      var endDate = new Date(
+        Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
+      )
+        .toISOString()
+        .slice(0, 10);
+      this.searchForm.orderDate = [];
+      this.searchForm.orderDate.push(startDate);
+      this.searchForm.orderDate.push(endDate);
+    },
     onClear(type) {
       if (type == "paymentType") {
         this.searchForm.paymentType = null;
@@ -1026,7 +1029,7 @@ export default {
         search: null,
         orderStartDate: null,
         orderEndDate: null,
-        paymentStatus: null,
+        paymentStatus: "SUCCESS",
         paymentType: null,
         routingOrganId: null,
         actualAmount: null,
@@ -1038,6 +1041,7 @@ export default {
         lessActualAmount: null,
         orderDate: [],
       };
+      this.getNow()
       this.getList();
     },
     removeGoodsList(item) {