张延森 2 years ago
parent
commit
283e37074c
5 changed files with 34 additions and 30 deletions
  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 View File

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

+ 27
- 29
src/pages/index.vue View File

4
       <van-button
4
       <van-button
5
         round
5
         round
6
         :style="{ width: '40vw', margin: 'auto' }"
6
         :style="{ width: '40vw', margin: 'auto' }"
7
+        :disabled="!invoiceId"
7
         type="primary"
8
         type="primary"
8
         @click="goForm"
9
         @click="goForm"
9
       >
10
       >
11
       </van-button>
12
       </van-button>
12
       <van-button
13
       <van-button
13
         round
14
         round
15
+        class="mybutton"
14
         :style="{ width: '40vw', margin: 'auto' }"
16
         :style="{ width: '40vw', margin: 'auto' }"
17
+        :disabled="!invoiceId"
15
         type="primary"
18
         type="primary"
16
-        @click="goRecord"
19
+        @click="goPromulgate"
17
       >
20
       >
18
-        填写记录
21
+        信息公示
19
       </van-button>
22
       </van-button>
20
       <van-button
23
       <van-button
21
         round
24
         round
22
-        class="mybutton"
23
         :style="{ width: '40vw', margin: 'auto' }"
25
         :style="{ width: '40vw', margin: 'auto' }"
24
         type="primary"
26
         type="primary"
25
-        @click="goPromulgate"
27
+        @click="goRecord"
26
       >
28
       >
27
-        信息公示
29
+        填写记录
28
       </van-button>
30
       </van-button>
29
     </div>
31
     </div>
30
     <div>
32
     <div>
31
-      {{
32
-        formData.data.status == 1
33
-          ? "该班次将于2022年10月5日截止"
34
-          : "该班次已截止如有问题请联系报销助理"
35
-      }}
33
+      {{tipText}}
36
     </div>
34
     </div>
37
   </div>
35
   </div>
38
 </template>
36
 </template>
39
 
37
 
40
 <script setup>
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
 import { getInvoiceFill } from '@/services/invoice'
42
 import { getInvoiceFill } from '@/services/invoice'
44
 
43
 
45
 const router = useRouter();
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
 const goForm = () => {
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
 const goRecord = () => {
60
 const goRecord = () => {
65
-  router.push({ name: 'invoice.records'})
61
+  router.push({ name: 'invoice.history', query: route.query })
66
 }
62
 }
67
 const goPromulgate = () => {
63
 const goPromulgate = () => {
68
-  router.push({ name: 'publicity.list'})
64
+  router.push({ name: 'publicity.list', query: route.query })
69
 }
65
 }
66
+
70
 onMounted(() => {
67
 onMounted(() => {
71
   getInvoiceFill(formData.data.invoiceId).then(res => {
68
   getInvoiceFill(formData.data.invoiceId).then(res => {
72
-    formData.data = res
69
+    Object.assign(formData, res)
73
   }).catch(err => {
70
   }).catch(err => {
74
     console.log(err)
71
     console.log(err)
75
   })
72
   })
76
 })
73
 })
74
+
77
 </script>
75
 </script>
78
 <style lang="less" scoped>
76
 <style lang="less" scoped>
79
 .body {
77
 .body {

src/pages/invoice/records.vue → src/pages/invoice/history.vue View File


+ 1
- 1
src/router/index.js View File

6
 const routes = [
6
 const routes = [
7
   { path: '/', name: 'index', component: () => import('@/pages/index.vue') },
7
   { path: '/', name: 'index', component: () => import('@/pages/index.vue') },
8
   { path: '/invoice/fill', name: 'invoice.fill', component: () => import('@/pages/invoice/fill.vue') },
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
   { path: '/publicity/list', name: 'publicity.list', component: () => import('@/pages/publicity/list.vue') },
10
   { path: '/publicity/list', name: 'publicity.list', component: () => import('@/pages/publicity/list.vue') },
11
   { path: '/login', name: 'login', component: () => import('@/pages/login.vue') },
11
   { path: '/login', name: 'login', component: () => import('@/pages/login.vue') },
12
 ];
12
 ];

+ 5
- 0
yarn.lock View File

257
   resolved "https://registry.npmmirror.com/csstype/-/csstype-2.6.20.tgz#9229c65ea0b260cf4d3d997cb06288e36a8d6dda"
257
   resolved "https://registry.npmmirror.com/csstype/-/csstype-2.6.20.tgz#9229c65ea0b260cf4d3d997cb06288e36a8d6dda"
258
   integrity sha512-/WwNkdXfckNgw6S5R125rrW8ez139lBHWouiBvX8dfMFtcn6V81REDqnH7+CRpRipfYlyU1CmOnOxrmGcFOjeA==
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
 debug@^3.2.6:
265
 debug@^3.2.6:
261
   version "3.2.7"
266
   version "3.2.7"
262
   resolved "https://registry.npmmirror.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a"
267
   resolved "https://registry.npmmirror.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a"