张延森 2 år sedan
förälder
incheckning
44868e6ee4
3 ändrade filer med 72 tillägg och 42 borttagningar
  1. 1
    1
      src/pages/index.vue
  2. 70
    40
      src/pages/invoice/history.vue
  3. 1
    1
      src/pages/publicity/list.vue

+ 1
- 1
src/pages/index.vue Visa fil

@@ -65,7 +65,7 @@ const goPromulgate = () => {
65 65
 }
66 66
 
67 67
 onMounted(() => {
68
-  getInvoiceFill(formData.data.invoiceId).then(res => {
68
+  getInvoiceFill(invoiceId).then(res => {
69 69
     Object.assign(formData, res)
70 70
   }).catch(err => {
71 71
     console.log(err)

+ 70
- 40
src/pages/invoice/history.vue Visa fil

@@ -1,65 +1,95 @@
1 1
 <template>
2
-  <div class="list">
3
-    <h2>填写记录</h2>
4
-    <van-list>
2
+  <div class="history-page">
3
+    <h3>填写记录</h3>
4
+    <van-list
5
+      class="history-list"
6
+      v-model:loading="loading"
7
+      :finished="finished"
8
+      @load="onLoad"
9
+      finished-text="我们是有底线的"
10
+    >
5 11
       <van-cell
6 12
         class="item"
7
-        v-for="item in recordList"
8
-        :key="item.invoiceId"
9
-        :title="item.name"
10
-        @click="() => goDetail(item.invoiceId)"
13
+        v-for="item in list"
14
+        :key="item.detailId"
15
+        :title="item.orgName"
16
+        is-link
17
+        :to="{ name: 'invoice.fill', query: { invoiceId, personId: item.personId } }"
11 18
       >
12 19
         <template #value>
13
-          <span>{{ item.createDate }} >></span>
20
+          <span class="pname">{{ item.personName }}</span>
14 21
         </template>
15 22
       </van-cell>
16 23
     </van-list>
17 24
   </div>
18 25
 </template>
19 26
 <script setup>
20
-import { onMounted, ref } from "vue"
21
-import { useRouter } from 'vue-router'
27
+import { computed, onMounted, reactive, ref } from "vue"
28
+import { useRouter, useRoute } from 'vue-router'
29
+import { getList } from "@/services/invoice";
22 30
 
23 31
 const router = useRouter();
32
+const route = useRoute();
33
+const { invoiceId } = route.query;
24 34
 
25
-const recordList = ref([
26
-  {
27
-    name: '电网一班',
28
-    invoiceId: '1',
29
-    createDate: '2022-4-8'
30
-  },
31
-  {
32
-    name: '电网二班',
33
-    invoiceId: '2',
34
-    createDate: '2022-6-8'
35
-  },
36
-  {
37
-    name: '电网三班',
38
-    invoiceId: '3',
39
-    createDate: '2022-9-8'
40
-  },
41
-  {
42
-    name: '电网四班',
43
-    invoiceId: '4',
44
-    createDate: '2022-2-8'
45
-  },
46
-])
35
+const list = ref([])
36
+const error = ref(false);
37
+const loading = ref(false);
38
+const pagenavi = reactive({ pageNum: 1, pageSize: 10, total: 0 })
39
+const finished = computed(() => pagenavi.pageNum * pagenavi.pageSize > pagenavi.total)
40
+
41
+const queryData = (params) => {
42
+  getList(invoiceId, params).then(res => {
43
+    const { records, ...pageInfo } = res;
44
+    if (pageInfo.current === 1) {
45
+      list.value = records || []
46
+    } else {
47
+      list.value = list.value.concat(records || [])
48
+    }
49
+
50
+    pagenavi.pageNum = pageInfo.current
51
+    pagenavi.total = pageInfo.total
52
+    error.value = false
53
+    loading.value = false
54
+  }).catch(() => {
55
+    error.value = true
56
+    loading.value = false
57
+  })
58
+}
59
+
60
+const onLoad = () => {
61
+  const params = { pageNum: pagenavi.pageNum + 1, pageSize: pagenavi.pageSize }
62
+  queryData(params)
63
+}
47 64
 
48 65
 onMounted(() => {
49 66
   //获取提交记录
67
+  const params = { pageNum: pagenavi.pageNum, pageSize: pagenavi.pageSize }
68
+  queryData(params)
50 69
 })
51
-const goDetail = (val) => {
52
-  router.push({ name: 'invoice.fill', params: { id: val } })
53
-}
70
+
54 71
 </script>
55 72
 <style lang="less" scoped>
56
-.list {
57
-  padding: 16px;
58
-  h2 {
73
+.history-page {
74
+  height: 100%;
75
+  display: flex;
76
+  flex-direction: column;
77
+
78
+  h3 {
79
+    flex: none;
59 80
     text-align: center;
81
+    letter-spacing: 2px;
60 82
   }
61
-  .item + .item {
62
-    margin-top: 16px;
83
+
84
+  .history-list {
85
+    flex: 1;
86
+  }
87
+
88
+  .pname {
89
+    color: #333;
63 90
   }
91
+  // .item + .item {
92
+  //   margin-top: 16px;
93
+  // }
64 94
 }
65 95
 </style>

+ 1
- 1
src/pages/publicity/list.vue Visa fil

@@ -30,7 +30,7 @@ import { getList } from "@/services/invoice";
30 30
 
31 31
 const router = useRouter();
32 32
 const route = useRoute();
33
-const { invoiceId = 'f11ab8d28fd097e7aa4877ae7068a876' } = route;
33
+const { invoiceId } = route.query;
34 34
 
35 35
 const list = ref([])
36 36
 const error = ref(false);