mg-ocr-invoice 0.3.4 → 0.3.6

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,4 +1,3 @@
1
- import 'vant/lib/index.css';
2
1
  import '@/utils/disableZoom';
3
2
  declare const _default: import("vue").DefineComponent<{
4
3
  listId: {
@@ -10,6 +9,14 @@ declare const _default: import("vue").DefineComponent<{
10
9
  type: BooleanConstructor;
11
10
  };
12
11
  catchList: {};
12
+ businessLicense: {
13
+ required: false;
14
+ type: StringConstructor;
15
+ };
16
+ taxCode: {
17
+ required: false;
18
+ type: StringConstructor;
19
+ };
13
20
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
21
  ok: (...args: any[]) => void;
15
22
  edit: (...args: any[]) => void;
@@ -23,6 +30,14 @@ declare const _default: import("vue").DefineComponent<{
23
30
  type: BooleanConstructor;
24
31
  };
25
32
  catchList: {};
33
+ businessLicense: {
34
+ required: false;
35
+ type: StringConstructor;
36
+ };
37
+ taxCode: {
38
+ required: false;
39
+ type: StringConstructor;
40
+ };
26
41
  }>> & {
27
42
  onOk?: ((...args: any[]) => any) | undefined;
28
43
  onEdit?: ((...args: any[]) => any) | undefined;
@@ -16,6 +16,12 @@ declare const _default: import("vue").DefineComponent<{
16
16
  batchId: {
17
17
  required: false;
18
18
  };
19
+ businessLicense: {
20
+ required: false;
21
+ };
22
+ taxCode: {
23
+ required: false;
24
+ };
19
25
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
26
  submit: (...args: any[]) => void;
21
27
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -36,6 +42,12 @@ declare const _default: import("vue").DefineComponent<{
36
42
  batchId: {
37
43
  required: false;
38
44
  };
45
+ businessLicense: {
46
+ required: false;
47
+ };
48
+ taxCode: {
49
+ required: false;
50
+ };
39
51
  }>> & {
40
52
  onSubmit?: ((...args: any[]) => any) | undefined;
41
53
  }, {
@@ -1,16 +1,22 @@
1
1
  import '@/utils/disableZoom';
2
2
  declare const _default: import("vue").DefineComponent<Readonly<{
3
3
  multiple?: any;
4
+ businessLicense?: any;
5
+ taxCode?: any;
4
6
  batchId?: any;
5
7
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
8
  uploadSuccess: (...args: any[]) => void;
7
9
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<Readonly<{
8
10
  multiple?: any;
11
+ businessLicense?: any;
12
+ taxCode?: any;
9
13
  batchId?: any;
10
14
  }>>> & {
11
15
  onUploadSuccess?: ((...args: any[]) => any) | undefined;
12
16
  }, {
13
17
  readonly multiple?: any;
18
+ readonly businessLicense?: any;
19
+ readonly taxCode?: any;
14
20
  readonly batchId?: any;
15
21
  }, {}>;
16
22
  export default _default;
@@ -1,2 +1,3 @@
1
1
  import './styles/mu-invoice.css';
2
2
  import 'element-plus/dist/index.css';
3
+ import 'vant/lib/index.css';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mg-ocr-invoice",
3
3
  "private": false,
4
- "version": "0.3.4",
4
+ "version": "0.3.6",
5
5
  "type": "module",
6
6
  "types": "dist/types/index.d.ts",
7
7
  "module": "dist/index.es.js",
@@ -23,7 +23,7 @@
23
23
  "element-plus": "^2.3.7",
24
24
  "js-cookie": "^3.0.5",
25
25
  "swiper": "^9.3.2",
26
- "vant": "^4.4.1",
26
+ "vant": "^4.0.9",
27
27
  "vconsole": "^3.15.1",
28
28
  "vue": "^3.2.47"
29
29
  },
@@ -34,7 +34,10 @@
34
34
  </div>
35
35
  <div
36
36
  class="title"
37
- :class="{ person: item.invoiceCompanyType === '公司' }">
37
+ :class="{
38
+ company: item.invoiceCompanyType === '公司',
39
+ err: item.invoiceCompanyType === '异常抬头',
40
+ }">
38
41
  {{ item.invoiceCompanyType }}
39
42
  </div>
40
43
  <div class="storeName">
@@ -152,7 +155,11 @@
152
155
  </div>
153
156
  </div>
154
157
  </div>
155
- <Popup v-model:show="showPopup" position="bottom" closeable>
158
+ <Popup
159
+ v-model:show="showPopup"
160
+ teleport="#iDOCRInvoice"
161
+ position="bottom"
162
+ closeable>
156
163
  <div class="boxPopup">
157
164
  <div class="title">
158
165
  <span>添加发票</span>
@@ -169,7 +176,6 @@
169
176
  </template>
170
177
  <!-- 异常发票, 已使用的, 使用中的, 识别失败 禁止提交 -->
171
178
  <script setup lang="ts">
172
- import 'vant/lib/index.css'
173
179
  import { ref, onMounted, computed } from 'vue'
174
180
  import {
175
181
  Popup,
@@ -178,6 +184,7 @@ import {
178
184
  showToast,
179
185
  showConfirmDialog,
180
186
  Overlay,
187
+ showImagePreview
181
188
  } from 'vant'
182
189
  import '@/utils/disableZoom'
183
190
  import { selectPhoto, takePhoto } from '@/utils/upload'
@@ -189,14 +196,12 @@ import {
189
196
  import {
190
197
  const_invoiceStatus,
191
198
  const_realStatus,
192
- const_taskStatus,
193
199
  const_invoiceExceptionInfo,
194
200
  setClass,
195
201
  VerificationOfTruth,
196
202
  } from './const'
197
- import { showImagePreview } from 'vant'
198
203
  const emit = defineEmits(['edit', 'ok'])
199
- const { listId, multiple, catchList } = defineProps({
204
+ const $props = defineProps({
200
205
  listId: {
201
206
  required: false,
202
207
  type: String,
@@ -206,13 +211,21 @@ const { listId, multiple, catchList } = defineProps({
206
211
  type: Boolean,
207
212
  },
208
213
  catchList: {},
214
+ businessLicense: {
215
+ required: false,
216
+ type: String,
217
+ },
218
+ taxCode: {
219
+ required: false,
220
+ type: String,
221
+ },
209
222
  })
210
223
  const token: any = ref(sessionStorage.getItem('token'))
211
224
  const showLoading = ref(false)
212
225
  const showPopup = ref(false)
213
226
  const list: any = ref<Array<any>>([])
214
- if (catchList) {
215
- list.value = catchList
227
+ if ($props.catchList) {
228
+ list.value = $props.catchList
216
229
  }
217
230
  const batchId = ref('')
218
231
  const selectId = computed(() => {
@@ -224,7 +237,7 @@ const selectId = computed(() => {
224
237
  const getList = async () => {
225
238
  return new Promise(async (resolve, reject) => {
226
239
  const data: any = {}
227
- data.batchId = listId
240
+ data.batchId = $props.listId
228
241
  if (!data.batchId) return
229
242
  try {
230
243
  const res: any = await __getUploadInvoiceList(data, token.value)
@@ -288,15 +301,6 @@ const selectStatus = (item: any) => {
288
301
  } else {
289
302
  return false
290
303
  }
291
- // if (item.invoiceStatus==='unused') {
292
- // return true
293
- // } else if (item.manualModify) {
294
- // return true
295
- // } else if (!item.invoiceExceptionInfo) {
296
- // return true
297
- // } else {
298
- // return false
299
- // }
300
304
  }
301
305
  const selectedAll: any = ref(false)
302
306
  const changeSelectAll = (v: any) => {
@@ -319,12 +323,17 @@ const changeItemCheckbox = () => {
319
323
  }
320
324
  const deleteSelectItem = () => {
321
325
  if (selectId.value.length <= 0) {
322
- showToast({ type: 'text', message: '请先选择发票' ,teleport: '#iDOCRInvoice',})
326
+ showToast({
327
+ type: 'text',
328
+ message: '请先选择发票',
329
+ teleport: '#iDOCRInvoice',
330
+ })
323
331
  return
324
332
  }
325
333
  showConfirmDialog({
326
334
  title: '提醒',
327
335
  message: '请确认是否需要移除选中项,移除后不可恢复!',
336
+ teleport: '#iDOCRInvoice',
328
337
  })
329
338
  .then(async () => {
330
339
  var urlencoded = new URLSearchParams()
@@ -333,7 +342,11 @@ const deleteSelectItem = () => {
333
342
  urlencoded.append('taskIds', idsStr)
334
343
  const res: any = await __deleteInvoice(urlencoded, token.value)
335
344
  if (res.code === 200) {
336
- showToast({ type: 'success', message: '移除成功',teleport: '#iDOCRInvoice', })
345
+ showToast({
346
+ type: 'success',
347
+ message: '移除成功',
348
+ teleport: '#iDOCRInvoice',
349
+ })
337
350
  getList()
338
351
  }
339
352
  })
@@ -348,11 +361,13 @@ const add = () => {
348
361
  const selectImg = async (type: number) => {
349
362
  let fd: FormData
350
363
  if (type === 1) {
351
- fd = await selectPhoto(multiple)
364
+ fd = await selectPhoto($props.multiple)
352
365
  } else {
353
366
  fd = await takePhoto()
354
367
  }
355
368
  fd.append('batchId', batchId.value)
369
+ fd.append('businessLicense', $props.businessLicense || '')
370
+ fd.append('taxCode', $props.taxCode || '')
356
371
  showLoading.value = true
357
372
  showPopup.value = false
358
373
  try {
@@ -391,7 +406,11 @@ const openErrImg = (url: any) => {
391
406
  }
392
407
  const ok = () => {
393
408
  if (selectId.value.length <= 0) {
394
- showToast({ type: 'text', message: '请先选择发票',teleport: '#iDOCRInvoice', })
409
+ showToast({
410
+ type: 'text',
411
+ message: '请先选择发票',
412
+ teleport: '#iDOCRInvoice',
413
+ })
395
414
  return
396
415
  }
397
416
  if (!submitBtn.value) {
@@ -403,7 +422,7 @@ const ok = () => {
403
422
  return
404
423
  }
405
424
  // showDeleteBtn.value = false
406
- const selectData = list.value
425
+ const selectData: Array<any> = list.value
407
426
  .filter((item: any) => item.selected)
408
427
  .map((item: any) => {
409
428
  VerificationOfTruth
@@ -411,6 +430,24 @@ const ok = () => {
411
430
  let obj: any = { ...item, ...data }
412
431
  return obj
413
432
  })
433
+ const filterTitleErr = selectData.some(
434
+ (item) => item.invoiceCompanyType === '异常抬头'
435
+ )
436
+ if (filterTitleErr) {
437
+ showConfirmDialog({
438
+ title: '提醒',
439
+ message: '存在异常抬头发票,请确认是否继续提交?',
440
+ teleport: '#iDOCRInvoice',
441
+ cancelButtonText: '返回修改',
442
+ confirmButtonText: '继续提交',
443
+ })
444
+ .then(() => {
445
+ emit('ok', selectData, batchId.value)
446
+ })
447
+ .catch(() => {})
448
+
449
+ return
450
+ }
414
451
  emit('ok', selectData, batchId.value)
415
452
  }
416
453
  const timeID: any = ref(null)
@@ -491,9 +528,12 @@ onMounted(() => {
491
528
  color: #333;
492
529
  border-radius: 2px;
493
530
  }
494
- div.person {
531
+ div.company {
495
532
  background-color: #ff8b26;
496
533
  }
534
+ div.err {
535
+ background-color: #d5001c;
536
+ }
497
537
  .title {
498
538
  color: #fff;
499
539
  display: flex;
@@ -2,14 +2,22 @@
2
2
  <div class="OCRInvoice" id="iDOCRInvoice">
3
3
  <div v-if="activePage === 1" class="box">
4
4
  <PaymentMode
5
- :batchId="batchId"
6
- :multiple="multiple"
5
+ :batchId="$props.batchId"
6
+ :businessLicense="
7
+ $props.businessLicense || computed_params.businessLicense
8
+ "
9
+ :taxCode="$props.taxCode || computed_params.taxCode"
10
+ :multiple="$props.multiple"
7
11
  @uploadSuccess="uploadSuccess"></PaymentMode>
8
12
  </div>
9
13
  <div v-if="activePage === 2" class="box">
10
14
  <InvoiceList
11
- :multiple="multiple"
15
+ :multiple="$props.multiple"
12
16
  :listId="listId"
17
+ :businessLicense="
18
+ $props.businessLicense || computed_params.businessLicense
19
+ "
20
+ :taxCode="$props.taxCode || computed_params.taxCode"
13
21
  :catchList="catchList"
14
22
  @ok="submit"
15
23
  @edit="edit">
@@ -24,16 +32,11 @@
24
32
  </div>
25
33
  </template>
26
34
  <script lang="ts" setup>
27
- import { ref, onMounted } from 'vue'
35
+ import { ref, onMounted, computed } from 'vue'
28
36
  import { PaymentMode, Invoice, InvoiceList } from '@/components/index'
29
37
  import { getUrlParams } from '@/utils/getUrlParams'
30
- import { showToast } from 'vant'
31
38
  import Cookies from 'js-cookie'
32
- // import eruda from 'eruda'
33
- // eruda.init()
34
39
  import VConsole from 'vconsole'
35
- // import { data as dataObj } from './const'
36
-
37
40
  const setLog = () => {
38
41
  if (getUrlParams(window.location.href).log == 1) {
39
42
  const vConsole = new VConsole()
@@ -41,7 +44,7 @@ const setLog = () => {
41
44
  }
42
45
  setLog()
43
46
  const emit = defineEmits(['submit'])
44
- const { token, multiple, Base_URL, OCR_AuthDomain, batchId } = defineProps({
47
+ const $props = defineProps({
45
48
  token: {
46
49
  required: false,
47
50
  type: String,
@@ -58,23 +61,31 @@ const { token, multiple, Base_URL, OCR_AuthDomain, batchId } = defineProps({
58
61
  },
59
62
  batchId: {
60
63
  required: false,
61
-
62
64
  },
65
+ businessLicense: {
66
+ required: false,
67
+ },
68
+ taxCode: {
69
+ required: false,
70
+ },
71
+ })
72
+ const computed_params = computed(() => {
73
+ return getUrlParams(window.location.href)
63
74
  })
64
-
65
75
  const initToken = () => {
66
76
  activePage.value = 1
67
77
  const params = getUrlParams(window.location.href)
68
78
  const linkToken = params.token
69
- Cookies.set('token', linkToken || token)
79
+ console.log(linkToken, 'linkToken')
80
+ Cookies.set('token', linkToken || $props.token)
70
81
  }
71
82
  const init_Base_URL = () => {
72
83
  const params = getUrlParams(window.location.href)
73
84
  Cookies.set(
74
85
  'OCR_Base_URL',
75
- params.Base_URL || Base_URL || 'https://invoice.imugua.team/'
86
+ params.Base_URL || $props.Base_URL || 'https://invoice.imugua.team/'
76
87
  )
77
- Cookies.set('OCR_AuthDomain', params.OCR_AuthDomain || OCR_AuthDomain)
88
+ Cookies.set('OCR_AuthDomain', params.OCR_AuthDomain || $props.OCR_AuthDomain)
78
89
  }
79
90
  const activePage = ref(0)
80
91
  const listId: any = ref(null)
@@ -32,7 +32,7 @@ import '@/utils/disableZoom'
32
32
  import { selectPhoto, takePhoto } from '@/utils/upload'
33
33
  import { __uploadInvoice } from '@/api/invoice'
34
34
  import { showToast, Overlay, Loading, showFailToast } from 'vant'
35
- const props = defineProps(['multiple', 'batchId'])
35
+ const props = defineProps(['multiple', 'batchId', 'taxCode','businessLicense'])
36
36
  const emit = defineEmits(['uploadSuccess'])
37
37
  const payList: any = [
38
38
  {
@@ -65,6 +65,8 @@ const handleClickText = async (text: any) => {
65
65
  if (props.batchId) {
66
66
  fd.append('batchId', props.batchId)
67
67
  }
68
+ fd.append('businessLicense',props.businessLicense||'')
69
+ fd.append('taxCode',props.taxCode||'')
68
70
  showLoading.value = true
69
71
  try {
70
72
  const res: any = await __uploadInvoice(fd)
@@ -1,25 +0,0 @@
1
- import '@/utils/disableZoom';
2
- declare const _default: import("vue").DefineComponent<{
3
- ids: {
4
- type: ObjectConstructor;
5
- required: true;
6
- };
7
- invoiceData: {
8
- type: ObjectConstructor;
9
- required: true;
10
- };
11
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
- saveSuccess: (...args: any[]) => void;
13
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
14
- ids: {
15
- type: ObjectConstructor;
16
- required: true;
17
- };
18
- invoiceData: {
19
- type: ObjectConstructor;
20
- required: true;
21
- };
22
- }>> & {
23
- onSaveSuccess?: ((...args: any[]) => any) | undefined;
24
- }, {}, {}>;
25
- export default _default;