mg-ocr-invoice 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,70 +1,70 @@
1
- export const data = {
2
- angle: '0',
3
- attachmentLink:
4
- 'https://filegw.nuonuo.com/U1ylUBa5YlUHWOpta7hoLSC6QX9pEcu8Kcy-JnCnHTGn6PYXKNdZosH32iDDaLWGzhkY0N88rGOaS4w2krdeCw.png',
5
- description: '增值税专用发票',
6
- invoiceType: 'vat_special_invoice',
7
- invoiceRootType: '专票',
8
- position: '[0,0,2048,0,0,928,2048,928]',
9
- checkCode: '',
10
- clerk: '江海珍',
11
- electronicMark: '0',
12
- electronicNumber: '',
13
- invoiceCode: '3300231130',
14
- invoiceDate: '2023年07月17日',
15
- invoiceNum: '08148218',
16
- itemNames: '*住宿服务*住宿费',
17
- noTaxAmountTotal: '212.87',
18
- note: '',
19
- payee: '王宝存',
20
- payerAccount: '中信银行上海虹桥商务区支行8110201012601374925',
21
- payerContact: '上海市闵行区沪青平公路277号5楼13301773703',
22
- payerId: '91310112MA7BGUJL15',
23
- payerName: '上海半小妖科技有限公司',
24
- priceTaxTotalFigure: '215.00',
25
- printCode: '0814821',
26
- printNum: '0814821',
27
- producerStamp: '浙江',
28
- recheck: '金芬兰',
29
- seal: '1',
30
- sellerAccount: '温州银行股份有限公司营业部 745000120190095098',
31
- sellerContact: '温州市瓯海娄桥古岸头村(不作拆迁凭证)0577-88812123',
32
- sellerId: '913303046845118206',
33
- sellerName: '温州蔬农招待所有限公司',
34
- serviceName: '住宿服务',
35
- taxAmountTotal: '2.13',
36
- title: '浙江增值税专用发票',
37
- totalCn: '贰佰壹拾伍圆整',
38
- vatInvoicePage: '发票联',
39
- nuonuoFileId: '3232300437-7d12c82340b84855a04e1f6d9d059c2f',
40
- deatis: [
41
- {
42
- itemExTaxAmount: '212.87',
43
- itemExTaxPrice: '',
44
- itemName: '*住宿服务*住宿费',
45
- itemQuantity: '',
46
- itemSpec: '',
47
- itemTaxAmount: '2.13',
48
- itemTaxRate: '1%',
49
- itemUtil: '',
50
- id: 1345,
51
- code: '1691272134678020096',
52
- tenantCode: 'af9390a20cccc90fd174e5706f302769',
53
- brandCode: '1645512743732000029',
54
- createdAt: 1692065673000,
55
- updatedAt: 1692065673000,
56
- invoiceTableCode: '1691272117275852800',
57
- },
58
- ],
59
- status: 'entered',
60
- invoiceStatus: 'unused',
61
- realStatus: 'checked',
62
- fileUrlKey:
63
- 'https://invoice-sit-1251881907.cos.ap-nanjing.myqcloud.com/f8c6ff4af53241269c39dbd70f59cf6a.png?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDwtmcPMRRMAe9d4Sju00wq7KQPKAvZ6Yt%26q-sign-time%3D1693876509%3B1693876689%26q-key-time%3D1693876509%3B1693876689%26q-header-list%3Dhost%26q-url-param-list%3D%26q-signature%3Dd49201f59ae86085771f52b2df0b13f40556e848',
64
- invoiceCompanyType: '公司',
65
- taxRate: '1%',
66
- taskStatus: 'repeat',
67
- taskId: '1698867126367944704',
68
- invoiceConsumptionType: 'accommodation',
69
- invoiceConsumptionTypeInfo: '住宿费',
70
- }
1
+ export const data = {
2
+ angle: '0',
3
+ attachmentLink:
4
+ 'https://filegw.nuonuo.com/U1ylUBa5YlUHWOpta7hoLSC6QX9pEcu8Kcy-JnCnHTGn6PYXKNdZosH32iDDaLWGzhkY0N88rGOaS4w2krdeCw.png',
5
+ description: '增值税专用发票',
6
+ invoiceType: 'vat_special_invoice',
7
+ invoiceRootType: '专票',
8
+ position: '[0,0,2048,0,0,928,2048,928]',
9
+ checkCode: '',
10
+ clerk: '江海珍',
11
+ electronicMark: '0',
12
+ electronicNumber: '',
13
+ invoiceCode: '3300231130',
14
+ invoiceDate: '2023年07月17日',
15
+ invoiceNum: '08148218',
16
+ itemNames: '*住宿服务*住宿费',
17
+ noTaxAmountTotal: '212.87',
18
+ note: '',
19
+ payee: '王宝存',
20
+ payerAccount: '中信银行上海虹桥商务区支行8110201012601374925',
21
+ payerContact: '上海市闵行区沪青平公路277号5楼13301773703',
22
+ payerId: '91310112MA7BGUJL15',
23
+ payerName: '上海半小妖科技有限公司',
24
+ priceTaxTotalFigure: '215.00',
25
+ printCode: '0814821',
26
+ printNum: '0814821',
27
+ producerStamp: '浙江',
28
+ recheck: '金芬兰',
29
+ seal: '1',
30
+ sellerAccount: '温州银行股份有限公司营业部 745000120190095098',
31
+ sellerContact: '温州市瓯海娄桥古岸头村(不作拆迁凭证)0577-88812123',
32
+ sellerId: '913303046845118206',
33
+ sellerName: '温州蔬农招待所有限公司',
34
+ serviceName: '住宿服务',
35
+ taxAmountTotal: '2.13',
36
+ title: '浙江增值税专用发票',
37
+ totalCn: '贰佰壹拾伍圆整',
38
+ vatInvoicePage: '发票联',
39
+ nuonuoFileId: '3232300437-7d12c82340b84855a04e1f6d9d059c2f',
40
+ deatis: [
41
+ {
42
+ itemExTaxAmount: '212.87',
43
+ itemExTaxPrice: '',
44
+ itemName: '*住宿服务*住宿费',
45
+ itemQuantity: '',
46
+ itemSpec: '',
47
+ itemTaxAmount: '2.13',
48
+ itemTaxRate: '1%',
49
+ itemUtil: '',
50
+ id: 1345,
51
+ code: '1691272134678020096',
52
+ tenantCode: 'af9390a20cccc90fd174e5706f302769',
53
+ brandCode: '1645512743732000029',
54
+ createdAt: 1692065673000,
55
+ updatedAt: 1692065673000,
56
+ invoiceTableCode: '1691272117275852800',
57
+ },
58
+ ],
59
+ status: 'entered',
60
+ invoiceStatus: 'unused',
61
+ realStatus: 'checked',
62
+ fileUrlKey:
63
+ 'https://invoice-sit-1251881907.cos.ap-nanjing.myqcloud.com/f8c6ff4af53241269c39dbd70f59cf6a.png?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDwtmcPMRRMAe9d4Sju00wq7KQPKAvZ6Yt%26q-sign-time%3D1693876509%3B1693876689%26q-key-time%3D1693876509%3B1693876689%26q-header-list%3Dhost%26q-url-param-list%3D%26q-signature%3Dd49201f59ae86085771f52b2df0b13f40556e848',
64
+ invoiceCompanyType: '公司',
65
+ taxRate: '1%',
66
+ taskStatus: 'repeat',
67
+ taskId: '1698867126367944704',
68
+ invoiceConsumptionType: 'accommodation',
69
+ invoiceConsumptionTypeInfo: '住宿费',
70
+ }
@@ -1,116 +1,116 @@
1
- <template>
2
- <div class="OCRInvoice">
3
- <div v-if="activePage === 1" class="box">
4
- <PaymentMode
5
- :batchId="batchId"
6
- :multiple="multiple"
7
- @uploadSuccess="uploadSuccess"></PaymentMode>
8
- </div>
9
- <div v-if="activePage === 2" class="box">
10
- <InvoiceList
11
- :multiple="multiple"
12
- :listId="listId"
13
- :catchList="catchList"
14
- @ok="submit"
15
- @edit="edit">
16
- </InvoiceList>
17
- </div>
18
- <div v-if="activePage === 3" class="box">
19
- <Invoice
20
- @saveSuccess="saveSuccess"
21
- :ids="ids"
22
- :invoiceData="invoiceData"></Invoice>
23
- </div>
24
- </div>
25
- </template>
26
- <script lang="ts" setup>
27
- import { ref, onMounted } from 'vue'
28
- import { PaymentMode, Invoice, InvoiceList } from '@/components/index'
29
- import { getUrlParams } from '@/utils/getUrlParams'
30
- import { showToast } from 'vant'
31
- import Cookies from 'js-cookie'
32
- // import eruda from 'eruda'
33
- // eruda.init()
34
- import VConsole from 'vconsole'
35
- // import { data as dataObj } from './const'
36
-
37
- const setLog = () => {
38
- if (getUrlParams(window.location.href).log == 1) {
39
- const vConsole = new VConsole()
40
- }
41
- }
42
- setLog()
43
- const emit = defineEmits(['submit'])
44
- const { token, multiple, Base_URL, OCR_AuthDomain, batchId } = defineProps({
45
- token: {
46
- required: false,
47
- type: String,
48
- },
49
- multiple: {
50
- required: false,
51
- default: true,
52
- },
53
- Base_URL: {
54
- required: false,
55
- },
56
- OCR_AuthDomain: {
57
- required: false,
58
- },
59
- batchId: {
60
- required: false,
61
-
62
- },
63
- })
64
-
65
- const initToken = () => {
66
- activePage.value = 1
67
- const params = getUrlParams(window.location.href)
68
- const linkToken = params.token
69
- Cookies.set('token', linkToken || token)
70
- }
71
- const init_Base_URL = () => {
72
- const params = getUrlParams(window.location.href)
73
- Cookies.set(
74
- 'OCR_Base_URL',
75
- params.Base_URL || Base_URL || 'https://invoice.imugua.team/'
76
- )
77
- Cookies.set('OCR_AuthDomain', params.OCR_AuthDomain || OCR_AuthDomain)
78
- }
79
- const activePage = ref(0)
80
- const listId: any = ref(null)
81
- const ids = ref({})
82
- const invoiceData = ref({})
83
- // invoiceData.value = dataObj
84
- const uploadSuccess = (id: any) => {
85
- listId.value = id
86
- activePage.value = 2
87
- }
88
- const catchList: any = ref(null)
89
- const edit = (id: object, row: any, list: any) => {
90
- ids.value = id
91
- invoiceData.value = row
92
- catchList.value = list
93
- activePage.value = 3
94
- }
95
- const saveSuccess = (id: object) => {
96
- activePage.value = 2
97
- }
98
- const submit = (data: any, id: string) => {
99
- emit('submit', data, id)
100
- }
101
- onMounted(() => {
102
- initToken()
103
- init_Base_URL()
104
- })
105
- </script>
106
- <style lang="scss" scoped>
107
- .OCRInvoice {
108
- width: 100%;
109
- height: 100vh;
110
- .box {
111
- width: 100%;
112
- min-height: 100%;
113
- height: 100%;
114
- }
115
- }
116
- </style>
1
+ <template>
2
+ <div class="OCRInvoice">
3
+ <div v-if="activePage === 1" class="box">
4
+ <PaymentMode
5
+ :batchId="batchId"
6
+ :multiple="multiple"
7
+ @uploadSuccess="uploadSuccess"></PaymentMode>
8
+ </div>
9
+ <div v-if="activePage === 2" class="box">
10
+ <InvoiceList
11
+ :multiple="multiple"
12
+ :listId="listId"
13
+ :catchList="catchList"
14
+ @ok="submit"
15
+ @edit="edit">
16
+ </InvoiceList>
17
+ </div>
18
+ <div v-if="activePage === 3" class="box">
19
+ <Invoice
20
+ @saveSuccess="saveSuccess"
21
+ :ids="ids"
22
+ :invoiceData="invoiceData"></Invoice>
23
+ </div>
24
+ </div>
25
+ </template>
26
+ <script lang="ts" setup>
27
+ import { ref, onMounted } from 'vue'
28
+ import { PaymentMode, Invoice, InvoiceList } from '@/components/index'
29
+ import { getUrlParams } from '@/utils/getUrlParams'
30
+ import { showToast } from 'vant'
31
+ import Cookies from 'js-cookie'
32
+ // import eruda from 'eruda'
33
+ // eruda.init()
34
+ import VConsole from 'vconsole'
35
+ // import { data as dataObj } from './const'
36
+
37
+ const setLog = () => {
38
+ if (getUrlParams(window.location.href).log == 1) {
39
+ const vConsole = new VConsole()
40
+ }
41
+ }
42
+ setLog()
43
+ const emit = defineEmits(['submit'])
44
+ const { token, multiple, Base_URL, OCR_AuthDomain, batchId } = defineProps({
45
+ token: {
46
+ required: false,
47
+ type: String,
48
+ },
49
+ multiple: {
50
+ required: false,
51
+ default: true,
52
+ },
53
+ Base_URL: {
54
+ required: false,
55
+ },
56
+ OCR_AuthDomain: {
57
+ required: false,
58
+ },
59
+ batchId: {
60
+ required: false,
61
+
62
+ },
63
+ })
64
+
65
+ const initToken = () => {
66
+ activePage.value = 1
67
+ const params = getUrlParams(window.location.href)
68
+ const linkToken = params.token
69
+ Cookies.set('token', linkToken || token)
70
+ }
71
+ const init_Base_URL = () => {
72
+ const params = getUrlParams(window.location.href)
73
+ Cookies.set(
74
+ 'OCR_Base_URL',
75
+ params.Base_URL || Base_URL || 'https://invoice.imugua.team/'
76
+ )
77
+ Cookies.set('OCR_AuthDomain', params.OCR_AuthDomain || OCR_AuthDomain)
78
+ }
79
+ const activePage = ref(0)
80
+ const listId: any = ref(null)
81
+ const ids = ref({})
82
+ const invoiceData = ref({})
83
+ // invoiceData.value = dataObj
84
+ const uploadSuccess = (id: any) => {
85
+ listId.value = id
86
+ activePage.value = 2
87
+ }
88
+ const catchList: any = ref(null)
89
+ const edit = (id: object, row: any, list: any) => {
90
+ ids.value = id
91
+ invoiceData.value = row
92
+ catchList.value = list
93
+ activePage.value = 3
94
+ }
95
+ const saveSuccess = (id: object) => {
96
+ activePage.value = 2
97
+ }
98
+ const submit = (data: any, id: string) => {
99
+ emit('submit', data, id)
100
+ }
101
+ onMounted(() => {
102
+ initToken()
103
+ init_Base_URL()
104
+ })
105
+ </script>
106
+ <style lang="scss" scoped>
107
+ .OCRInvoice {
108
+ width: 100%;
109
+ height: 100vh;
110
+ .box {
111
+ width: 100%;
112
+ min-height: 100%;
113
+ height: 100%;
114
+ }
115
+ }
116
+ </style>
@@ -1,144 +1,144 @@
1
- <template>
2
- <div class="PaymentMode">
3
- <div class="title">选择识别方式</div>
4
- <div class="list">
5
- <div
6
- class="method-item"
7
- @click="handleClickText(item.text)"
8
- v-for="(item, index) in payList"
9
- :key="item.id || index">
10
- <div class="left-text">
11
- <span class="icon-left">
12
- <i class="iconfont" :class="item.leftIcon"></i>
13
- </span>
14
- <span class="text">{{ item.text }}</span>
15
- </div>
16
- <div class="right-icon">
17
- <i class="iconfont icon-xiangyou"></i>
18
- </div>
19
- </div>
20
- </div>
21
- </div>
22
- <Overlay
23
- style="display: flex; justify-content: center; align-items: center"
24
- :show="showLoading">
25
- <Loading class="loading" color="#0094ff">上传中...</Loading>
26
- </Overlay>
27
- </template>
28
-
29
- <script setup lang="ts">
30
- import { ref } from 'vue'
31
- import '@/utils/disableZoom'
32
- import { selectPhoto, takePhoto } from '@/utils/upload'
33
- import { __uploadInvoice } from '@/api/invoice'
34
- import { showToast, Overlay, Loading, showFailToast } from 'vant'
35
- const props = defineProps(['multiple', 'batchId'])
36
- const emit = defineEmits(['uploadSuccess'])
37
- const payList: any = [
38
- {
39
- text: '拍照',
40
- leftIcon: 'icon-xiangji',
41
- },
42
- {
43
- text: '相册',
44
- leftIcon: 'icon-xiangce',
45
- },
46
- // {
47
- // text: '微信',
48
- // leftIcon: 'icon-weixin3',
49
- // },
50
- // {
51
- // text: '支付宝',
52
- // leftIcon: 'icon-zhifubao',
53
- // },
54
- ]
55
- document.title = '请选择添加费用方式'
56
- const showLoading = ref(false)
57
- const handleClickText = async (text: any) => {
58
- let fd: any
59
- if (text == '拍照') {
60
- fd = await takePhoto()
61
- }
62
- if (text == '相册') {
63
- fd = await selectPhoto(props.multiple)
64
- }
65
- if (props.batchId) {
66
- fd.append('batchId', props.batchId)
67
- }
68
- showLoading.value = true
69
- try {
70
- const res: any = await __uploadInvoice(fd)
71
- if (res.code === 200) {
72
- showToast({
73
- type: 'success',
74
- message: '上传成功',
75
- })
76
- emit('uploadSuccess', res.data)
77
- }
78
- } catch (err: any) {
79
- console.log(err)
80
- showFailToast(err.msg)
81
- }
82
- showLoading.value = false
83
- }
84
- </script>
85
- <style scoped lang="scss">
86
- .PaymentMode {
87
- width: 100%;
88
- height: 100%;
89
- padding: 20px 12px 0;
90
- background-color: #f3f4f6;
91
- .title {
92
- font-size: 14px;
93
- font-weight: 600;
94
- }
95
- .list {
96
- .method-item {
97
- width: 100%;
98
- height: 60px;
99
- background-color: #fff;
100
- margin-top: 12px;
101
- display: flex;
102
- align-items: center;
103
- justify-content: space-between;
104
- padding: 0 12px;
105
- .left-text {
106
- // display: flex;
107
- // align-items: center;
108
- // gap: 11px;
109
- // font-size: 16px;
110
- // font-weight: 700;
111
- display: grid;
112
- grid-auto-flow: column;
113
- grid-template-columns: auto;
114
- grid-template-rows: auto;
115
- grid-gap: 11px;
116
- font-size: 16px;
117
- font-weight: 700;
118
- span {
119
- align-self: center;
120
- }
121
- .icon-left {
122
- i {
123
- font-size: 22px;
124
- font-weight: initial;
125
- }
126
- }
127
- }
128
- .right-icon {
129
- background-color: rgba(38, 111, 232, 0.1);
130
- border-radius: 50%;
131
- width: 24px;
132
- height: 24px;
133
- display: flex;
134
- justify-content: center;
135
- align-items: center;
136
- i {
137
- color: #266fe8;
138
- font-size: 12px;
139
- }
140
- }
141
- }
142
- }
143
- }
144
- </style>
1
+ <template>
2
+ <div class="PaymentMode">
3
+ <div class="title">选择识别方式</div>
4
+ <div class="list">
5
+ <div
6
+ class="method-item"
7
+ @click="handleClickText(item.text)"
8
+ v-for="(item, index) in payList"
9
+ :key="item.id || index">
10
+ <div class="left-text">
11
+ <span class="icon-left">
12
+ <i class="iconfont" :class="item.leftIcon"></i>
13
+ </span>
14
+ <span class="text">{{ item.text }}</span>
15
+ </div>
16
+ <div class="right-icon">
17
+ <i class="iconfont icon-xiangyou"></i>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ <Overlay
23
+ style="display: flex; justify-content: center; align-items: center"
24
+ :show="showLoading">
25
+ <Loading class="loading" color="#0094ff">上传中...</Loading>
26
+ </Overlay>
27
+ </template>
28
+
29
+ <script setup lang="ts">
30
+ import { ref } from 'vue'
31
+ import '@/utils/disableZoom'
32
+ import { selectPhoto, takePhoto } from '@/utils/upload'
33
+ import { __uploadInvoice } from '@/api/invoice'
34
+ import { showToast, Overlay, Loading, showFailToast } from 'vant'
35
+ const props = defineProps(['multiple', 'batchId'])
36
+ const emit = defineEmits(['uploadSuccess'])
37
+ const payList: any = [
38
+ {
39
+ text: '拍照',
40
+ leftIcon: 'icon-xiangji',
41
+ },
42
+ {
43
+ text: '相册',
44
+ leftIcon: 'icon-xiangce',
45
+ },
46
+ // {
47
+ // text: '微信',
48
+ // leftIcon: 'icon-weixin3',
49
+ // },
50
+ // {
51
+ // text: '支付宝',
52
+ // leftIcon: 'icon-zhifubao',
53
+ // },
54
+ ]
55
+ document.title = '请选择添加费用方式'
56
+ const showLoading = ref(false)
57
+ const handleClickText = async (text: any) => {
58
+ let fd: any
59
+ if (text == '拍照') {
60
+ fd = await takePhoto()
61
+ }
62
+ if (text == '相册') {
63
+ fd = await selectPhoto(props.multiple)
64
+ }
65
+ if (props.batchId) {
66
+ fd.append('batchId', props.batchId)
67
+ }
68
+ showLoading.value = true
69
+ try {
70
+ const res: any = await __uploadInvoice(fd)
71
+ if (res.code === 200) {
72
+ showToast({
73
+ type: 'success',
74
+ message: '上传成功',
75
+ })
76
+ emit('uploadSuccess', res.data)
77
+ }
78
+ } catch (err: any) {
79
+ console.log(err)
80
+ showFailToast(err.msg)
81
+ }
82
+ showLoading.value = false
83
+ }
84
+ </script>
85
+ <style scoped lang="scss">
86
+ .PaymentMode {
87
+ width: 100%;
88
+ height: 100%;
89
+ padding: 20px 12px 0;
90
+ background-color: #f3f4f6;
91
+ .title {
92
+ font-size: 14px;
93
+ font-weight: 600;
94
+ }
95
+ .list {
96
+ .method-item {
97
+ width: 100%;
98
+ height: 60px;
99
+ background-color: #fff;
100
+ margin-top: 12px;
101
+ display: flex;
102
+ align-items: center;
103
+ justify-content: space-between;
104
+ padding: 0 12px;
105
+ .left-text {
106
+ // display: flex;
107
+ // align-items: center;
108
+ // gap: 11px;
109
+ // font-size: 16px;
110
+ // font-weight: 700;
111
+ display: grid;
112
+ grid-auto-flow: column;
113
+ grid-template-columns: auto;
114
+ grid-template-rows: auto;
115
+ grid-gap: 11px;
116
+ font-size: 16px;
117
+ font-weight: 700;
118
+ span {
119
+ align-self: center;
120
+ }
121
+ .icon-left {
122
+ i {
123
+ font-size: 22px;
124
+ font-weight: initial;
125
+ }
126
+ }
127
+ }
128
+ .right-icon {
129
+ background-color: rgba(38, 111, 232, 0.1);
130
+ border-radius: 50%;
131
+ width: 24px;
132
+ height: 24px;
133
+ display: flex;
134
+ justify-content: center;
135
+ align-items: center;
136
+ i {
137
+ color: #266fe8;
138
+ font-size: 12px;
139
+ }
140
+ }
141
+ }
142
+ }
143
+ }
144
+ </style>
@@ -1,5 +1,5 @@
1
- import Invoice from './Invoice/index.vue'
2
- import InvoiceList from './InvoiceList/index.vue'
3
- import PaymentMode from './PaymentMode/index.vue'
4
- import OCRInvoice from './OCRInvoice/index.vue'
5
- export { Invoice, InvoiceList, PaymentMode, OCRInvoice }
1
+ import Invoice from './Invoice/index.vue'
2
+ import InvoiceList from './InvoiceList/index.vue'
3
+ import PaymentMode from './PaymentMode/index.vue'
4
+ import OCRInvoice from './OCRInvoice/index.vue'
5
+ export { Invoice, InvoiceList, PaymentMode, OCRInvoice }