Browse Source

Merge branch 'master' of http://git.ycjcjy.com/state_grid/invoice_fill_h5

李志伟 2 years ago
parent
commit
e92c09e3c2

+ 28
- 31
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: 'e288229edfd3cdd2eaac125b65eca10e',
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
-    endDate:formData.data.endDate,
62
-    status:formData.data.status
63
-  } })
57
+  router.push({ name: 'invoice.fill', query: route.query })
64
 }
58
 }
59
+
65
 const goRecord = () => {
60
 const goRecord = () => {
66
-  router.push({ name: 'invoice.records'})
61
+  router.push({ name: 'invoice.history', query: route.query })
67
 }
62
 }
68
 const goPromulgate = () => {
63
 const goPromulgate = () => {
69
-  router.push({ name: 'invoice.promulgate'})
64
+  router.push({ name: 'publicity.list', query: route.query })
70
 }
65
 }
66
+
71
 onMounted(() => {
67
 onMounted(() => {
72
-  getInvoiceFill(formData.data.invoiceId).then(res => {
73
-    formData.data = res
68
+  getInvoiceFill(invoiceId).then(res => {
69
+    Object.assign(formData, res)
74
   }).catch(err => {
70
   }).catch(err => {
75
     console.log(err)
71
     console.log(err)
76
   })
72
   })
77
 })
73
 })
74
+
78
 </script>
75
 </script>
79
 <style lang="less" scoped>
76
 <style lang="less" scoped>
80
 .body {
77
 .body {

+ 95
- 0
src/pages/invoice/history.vue View File

1
+<template>
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
+    >
11
+      <van-cell
12
+        class="item"
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 } }"
18
+      >
19
+        <template #value>
20
+          <span class="pname">{{ item.personName }}</span>
21
+        </template>
22
+      </van-cell>
23
+    </van-list>
24
+  </div>
25
+</template>
26
+<script setup>
27
+import { computed, onMounted, reactive, ref } from "vue"
28
+import { useRouter, useRoute } from 'vue-router'
29
+import { getList } from "@/services/invoice";
30
+
31
+const router = useRouter();
32
+const route = useRoute();
33
+const { invoiceId } = route.query;
34
+
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
+}
64
+
65
+onMounted(() => {
66
+  //获取提交记录
67
+  const params = { pageNum: pagenavi.pageNum, pageSize: pagenavi.pageSize }
68
+  queryData(params)
69
+})
70
+
71
+</script>
72
+<style lang="less" scoped>
73
+.history-page {
74
+  height: 100%;
75
+  display: flex;
76
+  flex-direction: column;
77
+
78
+  h3 {
79
+    flex: none;
80
+    text-align: center;
81
+    letter-spacing: 2px;
82
+  }
83
+
84
+  .history-list {
85
+    flex: 1;
86
+  }
87
+
88
+  .pname {
89
+    color: #333;
90
+  }
91
+  // .item + .item {
92
+  //   margin-top: 16px;
93
+  // }
94
+}
95
+</style>

+ 0
- 65
src/pages/invoice/promulgate.vue View File

1
-<template>
2
-  <div class="list">
3
-    <h2>信息公示</h2>
4
-    <van-list>
5
-      <van-cell
6
-        class="item"
7
-        v-for="item in recordList"
8
-        :key="item.invoiceId"
9
-        :title="item.orgName"
10
-        @click="() => goDetail(item.invoiceId)"
11
-      >
12
-        <template #value>
13
-          <span>{{ item.name }}</span>
14
-        </template>
15
-      </van-cell>
16
-    </van-list>
17
-  </div>
18
-</template>
19
-<script setup>
20
-import { onMounted, ref } from "vue"
21
-import { useRouter } from 'vue-router'
22
-
23
-const router = useRouter();
24
-
25
-const recordList = ref([
26
-  {
27
-    orgName:'江苏林业集团',
28
-    name: '张九九',
29
-    invoiceId: '1',
30
-  },
31
-  {
32
-    orgName:'南京云致科技有限公司',
33
-    name: '李盼',
34
-    invoiceId: '2',
35
-  },
36
-  {
37
-    orgName:'邓州市源盛农机专业合作社',
38
-    name: '印雪彬',
39
-    invoiceId: '3',
40
-  },
41
-  {
42
-    orgName:'杭州昱恒科技有限公司',
43
-    name: '陈康',
44
-    invoiceId: '4',
45
-  },
46
-])
47
-
48
-onMounted(() => {
49
-  //获取提交记录
50
-})
51
-const goDetail = (val) => {
52
-  router.push({ name: 'invoice.fill', params: { id: val } })
53
-}
54
-</script>
55
-<style lang="less" scoped>
56
-.list {
57
-  padding: 16px;
58
-  h2 {
59
-    text-align: center;
60
-  }
61
-  .item + .item {
62
-    margin-top: 16px;
63
-  }
64
-}
65
-</style>

+ 0
- 65
src/pages/invoice/records.vue View File

1
-<template>
2
-  <div class="list">
3
-    <h2>填写记录</h2>
4
-    <van-list>
5
-      <van-cell
6
-        class="item"
7
-        v-for="item in recordList"
8
-        :key="item.invoiceId"
9
-        :title="item.name"
10
-        @click="() => goDetail(item.invoiceId)"
11
-      >
12
-        <template #value>
13
-          <span>{{ item.createDate }} >></span>
14
-        </template>
15
-      </van-cell>
16
-    </van-list>
17
-  </div>
18
-</template>
19
-<script setup>
20
-import { onMounted, ref } from "vue"
21
-import { useRouter } from 'vue-router'
22
-
23
-const router = useRouter();
24
-
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
-])
47
-
48
-onMounted(() => {
49
-  //获取提交记录
50
-})
51
-const goDetail = (val) => {
52
-  router.push({ name: 'invoice.fill', params: { id: val } })
53
-}
54
-</script>
55
-<style lang="less" scoped>
56
-.list {
57
-  padding: 16px;
58
-  h2 {
59
-    text-align: center;
60
-  }
61
-  .item + .item {
62
-    margin-top: 16px;
63
-  }
64
-}
65
-</style>

+ 95
- 0
src/pages/publicity/list.vue View File

1
+<template>
2
+  <div class="publicity-page">
3
+    <h3>信息公示</h3>
4
+    <van-list
5
+      class="publicity-list"
6
+      v-model:loading="loading"
7
+      :finished="finished"
8
+      @load="onLoad"
9
+      finished-text="我们是有底线的"
10
+    >
11
+      <van-cell
12
+        class="item"
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 } }"
18
+      >
19
+        <template #value>
20
+          <span class="pname">{{ item.personName }}</span>
21
+        </template>
22
+      </van-cell>
23
+    </van-list>
24
+  </div>
25
+</template>
26
+<script setup>
27
+import { computed, onMounted, reactive, ref } from "vue"
28
+import { useRouter, useRoute } from 'vue-router'
29
+import { getList } from "@/services/invoice";
30
+
31
+const router = useRouter();
32
+const route = useRoute();
33
+const { invoiceId } = route.query;
34
+
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
+}
64
+
65
+onMounted(() => {
66
+  //获取提交记录
67
+  const params = { pageNum: pagenavi.pageNum, pageSize: pagenavi.pageSize }
68
+  queryData(params)
69
+})
70
+
71
+</script>
72
+<style lang="less" scoped>
73
+.publicity-page {
74
+  height: 100%;
75
+  display: flex;
76
+  flex-direction: column;
77
+
78
+  h3 {
79
+    flex: none;
80
+    text-align: center;
81
+    letter-spacing: 2px;
82
+  }
83
+
84
+  .publicity-list {
85
+    flex: 1;
86
+  }
87
+
88
+  .pname {
89
+    color: #333;
90
+  }
91
+  // .item + .item {
92
+  //   margin-top: 16px;
93
+  // }
94
+}
95
+</style>

+ 2
- 2
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') },
10
-  { path: '/invoice/promulgate', name: 'invoice.promulgate', component: () => import('@/pages/invoice/promulgate.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') },
11
   { path: '/login', name: 'login', component: () => import('@/pages/login.vue') },
11
   { path: '/login', name: 'login', component: () => import('@/pages/login.vue') },
12
 ];
12
 ];
13
 
13
 

+ 9
- 4
src/services/invoice.js View File

6
 }
6
 }
7
 
7
 
8
 // 获取报销模板详情
8
 // 获取报销模板详情
9
-export function getInvoiceModel(id, params) {
10
-  return request.get(`/invoice/${id}/detail/info`, { params });
9
+export function getInvoiceModel(id,params) {
10
+  return request.get(`/invoice/${id}/detail/info`,{params})
11
+}
12
+
13
+// 获取报销列表
14
+export function getList(invoiceId, params) {
15
+  return request.get(`/invoice/${invoiceId}/detail`,{params})
11
 }
16
 }
12
 
17
 
13
 /**
18
 /**
15
  * @param
20
  * @param
16
  * @returns
21
  * @returns
17
  */
22
  */
18
-export const setInvoiceDetail = (id, data) =>
19
-  request(`/invoice/${id}/detail`, { method: "put", data });
23
+ export const setInvoiceDetail = (id, data) =>
24
+ request(`/invoice/${id}/detail`, { method: "put", data });