张延森 2 lat temu
rodzic
commit
283e37074c
5 zmienionych plików z 34 dodań i 30 usunięć
  1. 1
    0
      package.json
  2. 27
    29
      src/pages/index.vue
  3. 0
    0
      src/pages/invoice/history.vue
  4. 1
    1
      src/router/index.js
  5. 5
    0
      yarn.lock

+ 1
- 0
package.json Wyświetl plik

@@ -11,6 +11,7 @@
11 11
     "@zjxpcyc/vue-tiny-store": "^1.0.1",
12 12
     "axios": "^0.27.2",
13 13
     "crypto-js": "^4.1.1",
14
+    "dayjs": "^1.11.3",
14 15
     "nprogress": "^0.2.0",
15 16
     "vant": "^3.5.2",
16 17
     "vue": "^3.2.25",

+ 27
- 29
src/pages/index.vue Wyświetl plik

@@ -4,6 +4,7 @@
4 4
       <van-button
5 5
         round
6 6
         :style="{ width: '40vw', margin: 'auto' }"
7
+        :disabled="!invoiceId"
7 8
         type="primary"
8 9
         @click="goForm"
9 10
       >
@@ -11,69 +12,66 @@
11 12
       </van-button>
12 13
       <van-button
13 14
         round
15
+        class="mybutton"
14 16
         :style="{ width: '40vw', margin: 'auto' }"
17
+        :disabled="!invoiceId"
15 18
         type="primary"
16
-        @click="goRecord"
19
+        @click="goPromulgate"
17 20
       >
18
-        填写记录
21
+        信息公示
19 22
       </van-button>
20 23
       <van-button
21 24
         round
22
-        class="mybutton"
23 25
         :style="{ width: '40vw', margin: 'auto' }"
24 26
         type="primary"
25
-        @click="goPromulgate"
27
+        @click="goRecord"
26 28
       >
27
-        信息公示
29
+        填写记录
28 30
       </van-button>
29 31
     </div>
30 32
     <div>
31
-      {{
32
-        formData.data.status == 1
33
-          ? "该班次将于2022年10月5日截止"
34
-          : "该班次已截止如有问题请联系报销助理"
35
-      }}
33
+      {{tipText}}
36 34
     </div>
37 35
   </div>
38 36
 </template>
39 37
 
40 38
 <script setup>
41
-import { onMounted, reactive, ref } from 'vue';
42
-import { useRouter } from 'vue-router'
39
+import { computed, onMounted, reactive, ref } from 'vue';
40
+import { useRouter, useRoute } from 'vue-router'
41
+import dayjs from 'dayjs'
43 42
 import { getInvoiceFill } from '@/services/invoice'
44 43
 
45 44
 const router = useRouter();
46
-const formData = reactive({
47
-  data: {
48
-    //班级名称
49
-    invoiceId: 'f11ab8d28fd097e7aa4877ae7068a876',
50
-    endDate: undefined,
51
-    name: undefined,
52
-    status: 1
53
-  }
45
+const route = useRoute();
46
+const { invoiceId } = route.query
47
+
48
+const formData = reactive({})
49
+
50
+const tipText = computed(() => {
51
+  if (!invoiceId) return '请扫码访问此页面';
52
+  const finished = formData.status === 2 || (formData.endDate ? dayjs().isAfter(dayjs(formData.endDate)) : false)
53
+  return finished ? '该班次已截止如有问题请联系报销助理' : `该班次将于 ${dayjs(formData.endDate).format('YYYY年MM月DD日')} 截止`
54 54
 })
55 55
 
56 56
 const goForm = () => {
57
-  router.push({ name: 'invoice.fill', 
58
-  params: { 
59
-    invoiceId: formData.data.invoiceId,
60
-    invoiceName: formData.data.name,
61
-    status:formData.data.status
62
-  } })
57
+  router.push({ name: 'invoice.fill', query: route.query })
63 58
 }
59
+
64 60
 const goRecord = () => {
65
-  router.push({ name: 'invoice.records'})
61
+  router.push({ name: 'invoice.history', query: route.query })
66 62
 }
67 63
 const goPromulgate = () => {
68
-  router.push({ name: 'publicity.list'})
64
+  router.push({ name: 'publicity.list', query: route.query })
69 65
 }
66
+
70 67
 onMounted(() => {
71 68
   getInvoiceFill(formData.data.invoiceId).then(res => {
72
-    formData.data = res
69
+    Object.assign(formData, res)
73 70
   }).catch(err => {
74 71
     console.log(err)
75 72
   })
76 73
 })
74
+
77 75
 </script>
78 76
 <style lang="less" scoped>
79 77
 .body {

src/pages/invoice/records.vue → src/pages/invoice/history.vue Wyświetl plik


+ 1
- 1
src/router/index.js Wyświetl plik

@@ -6,7 +6,7 @@ import store from '@/store';
6 6
 const routes = [
7 7
   { path: '/', name: 'index', component: () => import('@/pages/index.vue') },
8 8
   { path: '/invoice/fill', name: 'invoice.fill', component: () => import('@/pages/invoice/fill.vue') },
9
-  { path: '/invoice/records', name: 'invoice.records', component: () => import('@/pages/invoice/records.vue') },
9
+  { path: '/invoice/history', name: 'invoice.history', component: () => import('@/pages/invoice/history.vue') },
10 10
   { path: '/publicity/list', name: 'publicity.list', component: () => import('@/pages/publicity/list.vue') },
11 11
   { path: '/login', name: 'login', component: () => import('@/pages/login.vue') },
12 12
 ];

+ 5
- 0
yarn.lock Wyświetl plik

@@ -257,6 +257,11 @@ csstype@^2.6.8:
257 257
   resolved "https://registry.npmmirror.com/csstype/-/csstype-2.6.20.tgz#9229c65ea0b260cf4d3d997cb06288e36a8d6dda"
258 258
   integrity sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==
259 259
 
260
+dayjs@^1.11.3:
261
+  version "1.11.3"
262
+  resolved "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.3.tgz#4754eb694a624057b9ad2224b67b15d552589258"
263
+  integrity sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A==
264
+
260 265
 debug@^3.2.6:
261 266
   version "3.2.7"
262 267
   resolved "https://registry.npmmirror.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a"