张延森 2 年之前
父節點
當前提交
6670501de7
共有 5 個檔案被更改,包括 285 行新增1 行删除
  1. 8
    1
      config/routes.js
  2. 89
    0
      src/pages/reconciliation/Detail.jsx
  3. 120
    0
      src/pages/reconciliation/Month.jsx
  4. 32
    0
      src/pages/reconciliation/index.jsx
  5. 36
    0
      src/services/account.js

+ 8
- 1
config/routes.js 查看文件

@@ -23,7 +23,7 @@ export default [
23 23
     name: '工作台',
24 24
     icon: 'DashboardOutlined',
25 25
     component: './dashboard',
26
-  },  
26
+  },
27 27
   {
28 28
     path: '/',
29 29
     redirect: '/dashboard',
@@ -136,6 +136,13 @@ export default [
136 136
     icon: 'SettingOutlined',
137 137
     component: '@/pages/BasicParameters',
138 138
   },
139
+  {
140
+    path: '/reconciliation',
141
+    name: '账单对账',
142
+    access:'admin',
143
+    icon: 'AccountBookOutlined',
144
+    component: '@/pages/reconciliation',
145
+  },
139 146
   {
140 147
     path: '/',
141 148
     redirect: '/welcome',

+ 89
- 0
src/pages/reconciliation/Detail.jsx 查看文件

@@ -0,0 +1,89 @@
1
+import React, { useMemo, useState, useEffect } from 'react'
2
+import { Button, DatePicker, Modal } from 'antd'
3
+import PageTable from '@/components/PageTable'
4
+import { getAccountLogList, generateAccountLog } from '@/services/account'
5
+
6
+export default (props) => {
7
+
8
+  const [visible, setVisible] = useState(false)
9
+  const [tradeDate, setTradeDate] = useState()
10
+
11
+  const columns = [
12
+    {
13
+      title: '交易日期',
14
+      dataIndex: 'createDate',
15
+      key: 'createDate',
16
+      search: false
17
+    },
18
+    {
19
+      title: '交易日',
20
+      dataIndex: 'dailyId',
21
+      key: 'dailyId',
22
+      renderFormItem: (item, fProps, form) => {
23
+        return <DatePicker />
24
+      },
25
+      hideInTable: true,
26
+    },
27
+    {
28
+      title: '订单号',
29
+      dataIndex: 'orderNo',
30
+      key: 'orderNo',
31
+      search: true,
32
+    },
33
+    {
34
+      title: '交易类型',
35
+      dataIndex: 'chargeType',
36
+      key: 'chargeType',
37
+      search: false,
38
+      render: t => t == -1 ? '退费' : '-'
39
+    },
40
+    {
41
+      title: '金额/元',
42
+      dataIndex: 'charges',
43
+      key: 'charges',
44
+      search: false,
45
+      render: t => Number(t / 100).toFixed(2)
46
+    },
47
+    {
48
+      title: '手续费/元',
49
+      dataIndex: 'poundage',
50
+      key: 'poundage',
51
+      search: false,
52
+      render: t => Number(t / 100).toFixed(2)
53
+    },
54
+  ]
55
+
56
+  const handleOk = () => {
57
+    const theDay = tradeDate.format('YYYY-MM-DD')
58
+    generateAccountLog(theDay)
59
+    setTradeDate()
60
+    setVisible(false)
61
+  }
62
+
63
+  const handleCancel = () => {
64
+    setVisible(false)
65
+    setTradeDate()
66
+  }
67
+
68
+  const actions = useMemo(() => ([
69
+    <Button key="primary" type="primary" onClick={() => setVisible(true)}>
70
+      拉取账单
71
+    </Button>,
72
+  ]), [])
73
+
74
+  return (
75
+    <div>
76
+      <PageTable
77
+        toolbar={{ actions }}
78
+        columns={columns}
79
+        params={{ monthId: props.monthId }}
80
+        request={getAccountLogList}
81
+        options={false}
82
+        rowKey="serialNo"
83
+      />
84
+      <Modal title="交易日" visible={visible} onOk={handleOk} onCancel={handleCancel}>
85
+        <DatePicker onChange={val => setTradeDate(val)} style={{ width: '240px' }} />
86
+      </Modal>
87
+    </div>
88
+  )
89
+}

+ 120
- 0
src/pages/reconciliation/Month.jsx 查看文件

@@ -0,0 +1,120 @@
1
+import React, { useMemo, useState } from 'react'
2
+import moment from 'moment'
3
+import { Button, DatePicker, Modal, message } from 'antd'
4
+import PageTable from '@/components/PageTable'
5
+import { getAccountMonthList, createMonthInfo, updateMonthInfo } from '@/services/account'
6
+
7
+const { confirm } = Modal;
8
+
9
+export default (props) => {
10
+
11
+  const [visible, setVisible] = useState(false)
12
+  const [tradeDate, setTradeDate] = useState()
13
+
14
+  const handleEdit = row => {
15
+    if (row.status === 1) {
16
+      message.warning('当前月份已对账');
17
+    }
18
+
19
+    confirm({
20
+      title: '确认对账',
21
+      content: '当前操作不可逆, 请确认金额无误',
22
+      onOk() {
23
+        updateMonthInfo({ ...row, status: 1 }).then(() => {
24
+          message.success('操作成功')
25
+        })
26
+      },
27
+    });    
28
+  }
29
+
30
+  const handleDetail = row => {
31
+    props.onSwitch(row.monthId)
32
+  }
33
+
34
+  const columns = [
35
+    {
36
+      title: '月份',
37
+      dataIndex: 'monthId',
38
+      key: 'monthId',
39
+      renderFormItem: (item, fProps, form) => {
40
+        return <DatePicker picker="month" />
41
+      },
42
+    },
43
+    {
44
+      title: '金额/元',
45
+      dataIndex: 'totalCharge',
46
+      key: 'totalCharge',
47
+      search: false,
48
+      render: t => Number(t / 100).toFixed(2)
49
+    },
50
+    {
51
+      title: '金额/元',
52
+      dataIndex: 'totalCharge',
53
+      key: 'totalCharge',
54
+      search: false,
55
+      render: t => Number(t / 100).toFixed(2)
56
+    },
57
+    {
58
+      title: '状态',
59
+      dataIndex: 'status',
60
+      key: 'status',
61
+      search: false,
62
+      render: t => t == 1 ? '已结' : '-'
63
+    },
64
+    {
65
+      title: '操作',
66
+      key: 'option',
67
+      width: 120,
68
+      valueType: 'option',
69
+      render: (_, row, index, action) => [
70
+        row.status != 1 && 
71
+        <a
72
+          key="a"
73
+          onClick={() => handleEdit(row)}
74
+        >
75
+          对账
76
+        </a>,
77
+        <a
78
+          key="b"
79
+          onClick={() => handleDetail(row)}
80
+        >
81
+          详情
82
+        </a>,
83
+      ].filter(Boolean),
84
+    },
85
+  ]
86
+
87
+  const handleOk = () => {
88
+    const theMonth = tradeDate.format('YYYY-MM')
89
+    createMonthInfo(theMonth)
90
+    setTradeDate()
91
+    setVisible(false)
92
+  }
93
+
94
+  const handleCancel = () => {
95
+    setVisible(false)
96
+    setTradeDate()
97
+  }
98
+
99
+  const actions = useMemo(() => ([
100
+    <Button key="primary" type="primary" onClick={() => setVisible(true)}>
101
+      生成账单
102
+    </Button>,
103
+  ]), [])
104
+
105
+  return (
106
+    <div>
107
+      <PageTable
108
+        toolbar={{ actions }}
109
+        columns={columns}
110
+        request={getAccountMonthList}
111
+        options={false}
112
+        beforeSearchSubmit={x => ({ ...x, monthId: x.monthId ? moment(x.monthId).format('YYYY-MM') : undefined })}
113
+        rowKey="monthId"
114
+      />
115
+      <Modal title="对账月份" visible={visible} onOk={handleOk} onCancel={handleCancel}>
116
+        <DatePicker picker="month" onChange={val => setTradeDate(val)} style={{ width: '240px' }} />
117
+      </Modal>
118
+    </div>
119
+  )
120
+}

+ 32
- 0
src/pages/reconciliation/index.jsx 查看文件

@@ -0,0 +1,32 @@
1
+import React, { useState } from 'react'
2
+import { PageHeaderWrapper } from '@ant-design/pro-layout';
3
+import { Tabs, Card } from 'antd';
4
+import Month from './Month';
5
+import Detail from './Detail';
6
+
7
+const { TabPane } = Tabs;
8
+
9
+export default (props) => {
10
+  const [active, setActive] = useState("1")
11
+  const [monthId, setMonthId] = useState()
12
+
13
+  const handleSwitch = (key, month) => {
14
+    setActive(key)
15
+    setMonthId(month)
16
+  }
17
+
18
+  return (
19
+    <PageHeaderWrapper>
20
+      <Card>
21
+        <Tabs activeKey={active} onTabClick={k => handleSwitch(k)}>
22
+          <TabPane tab="月度账单" key="1">
23
+            <Month onSwitch={m => handleSwitch('2', m)} />
24
+          </TabPane>
25
+          <TabPane tab="账单明细" key="2">
26
+            <Detail monthId={monthId} />
27
+          </TabPane>
28
+        </Tabs>
29
+      </Card>
30
+    </PageHeaderWrapper>
31
+  )
32
+}

+ 36
- 0
src/services/account.js 查看文件

@@ -0,0 +1,36 @@
1
+import request from '@/utils/request';
2
+
3
+/**
4
+ * 获取明细
5
+ * @param {*} data
6
+ * @returns
7
+ */
8
+export const getAccountLogList = (params) => request(`/account-log`, { method: 'get', params });
9
+
10
+/**
11
+ * 生成对账明细
12
+ * @param {*} dailyId 
13
+ * @returns 
14
+ */
15
+export const generateAccountLog = (dailyId) => request(`/account-log`, { method: 'post', params: { dailyId } });
16
+
17
+/**
18
+ * 获取月度列表
19
+ * @param {*} data
20
+ * @returns
21
+ */
22
+ export const getAccountMonthList = (params) => request(`/account-log/month`, { method: 'get', params });
23
+
24
+ /**
25
+  * 生成月度账单
26
+  * @param {*} monthId 
27
+  * @returns 
28
+  */
29
+ export const createMonthInfo = (monthId) => request(`/account-log/month`, { method: 'post', params: { monthId } });
30
+ 
31
+ /**
32
+  * 更新月度账单
33
+  * @param {*} monthId 
34
+  * @returns 
35
+  */
36
+ export const updateMonthInfo = (data) => request(`/account-log/month`, { method: 'put', data });