mg-ocr-invoice 0.3.4 → 0.3.5

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.
@@ -10,6 +10,12 @@ declare const _default: import("vue").DefineComponent<{
10
10
  type: BooleanConstructor;
11
11
  };
12
12
  catchList: {};
13
+ businessLicense: {
14
+ required: false;
15
+ };
16
+ taxCode: {
17
+ required: false;
18
+ };
13
19
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
20
  ok: (...args: any[]) => void;
15
21
  edit: (...args: any[]) => void;
@@ -23,6 +29,12 @@ declare const _default: import("vue").DefineComponent<{
23
29
  type: BooleanConstructor;
24
30
  };
25
31
  catchList: {};
32
+ businessLicense: {
33
+ required: false;
34
+ };
35
+ taxCode: {
36
+ required: false;
37
+ };
26
38
  }>> & {
27
39
  onOk?: ((...args: any[]) => any) | undefined;
28
40
  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;
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.5",
5
5
  "type": "module",
6
6
  "types": "dist/types/index.d.ts",
7
7
  "module": "dist/index.es.js",
@@ -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>
@@ -196,7 +203,7 @@ import {
196
203
  } from './const'
197
204
  import { showImagePreview } from 'vant'
198
205
  const emit = defineEmits(['edit', 'ok'])
199
- const { listId, multiple, catchList } = defineProps({
206
+ const { listId, multiple, catchList, businessLicense, taxCode }:any = defineProps({
200
207
  listId: {
201
208
  required: false,
202
209
  type: String,
@@ -206,6 +213,12 @@ const { listId, multiple, catchList } = defineProps({
206
213
  type: Boolean,
207
214
  },
208
215
  catchList: {},
216
+ businessLicense: {
217
+ required: false,
218
+ },
219
+ taxCode: {
220
+ required: false,
221
+ },
209
222
  })
210
223
  const token: any = ref(sessionStorage.getItem('token'))
211
224
  const showLoading = ref(false)
@@ -319,12 +332,17 @@ const changeItemCheckbox = () => {
319
332
  }
320
333
  const deleteSelectItem = () => {
321
334
  if (selectId.value.length <= 0) {
322
- showToast({ type: 'text', message: '请先选择发票' ,teleport: '#iDOCRInvoice',})
335
+ showToast({
336
+ type: 'text',
337
+ message: '请先选择发票',
338
+ teleport: '#iDOCRInvoice',
339
+ })
323
340
  return
324
341
  }
325
342
  showConfirmDialog({
326
343
  title: '提醒',
327
344
  message: '请确认是否需要移除选中项,移除后不可恢复!',
345
+ teleport: '#iDOCRInvoice',
328
346
  })
329
347
  .then(async () => {
330
348
  var urlencoded = new URLSearchParams()
@@ -333,7 +351,11 @@ const deleteSelectItem = () => {
333
351
  urlencoded.append('taskIds', idsStr)
334
352
  const res: any = await __deleteInvoice(urlencoded, token.value)
335
353
  if (res.code === 200) {
336
- showToast({ type: 'success', message: '移除成功',teleport: '#iDOCRInvoice', })
354
+ showToast({
355
+ type: 'success',
356
+ message: '移除成功',
357
+ teleport: '#iDOCRInvoice',
358
+ })
337
359
  getList()
338
360
  }
339
361
  })
@@ -353,6 +375,8 @@ const selectImg = async (type: number) => {
353
375
  fd = await takePhoto()
354
376
  }
355
377
  fd.append('batchId', batchId.value)
378
+ fd.append('businessLicense', businessLicense||'')
379
+ fd.append('taxCode', taxCode||'')
356
380
  showLoading.value = true
357
381
  showPopup.value = false
358
382
  try {
@@ -391,7 +415,11 @@ const openErrImg = (url: any) => {
391
415
  }
392
416
  const ok = () => {
393
417
  if (selectId.value.length <= 0) {
394
- showToast({ type: 'text', message: '请先选择发票',teleport: '#iDOCRInvoice', })
418
+ showToast({
419
+ type: 'text',
420
+ message: '请先选择发票',
421
+ teleport: '#iDOCRInvoice',
422
+ })
395
423
  return
396
424
  }
397
425
  if (!submitBtn.value) {
@@ -403,7 +431,7 @@ const ok = () => {
403
431
  return
404
432
  }
405
433
  // showDeleteBtn.value = false
406
- const selectData = list.value
434
+ const selectData: Array<any> = list.value
407
435
  .filter((item: any) => item.selected)
408
436
  .map((item: any) => {
409
437
  VerificationOfTruth
@@ -411,6 +439,24 @@ const ok = () => {
411
439
  let obj: any = { ...item, ...data }
412
440
  return obj
413
441
  })
442
+ const filterTitleErr = selectData.some(
443
+ (item) => item.invoiceCompanyType === '异常抬头'
444
+ )
445
+ if (filterTitleErr) {
446
+ showConfirmDialog({
447
+ title: '提醒',
448
+ message: '存在异常抬头发票,请确认是否继续提交?',
449
+ teleport: '#iDOCRInvoice',
450
+ cancelButtonText: '返回修改',
451
+ confirmButtonText: '继续提交',
452
+ })
453
+ .then(() => {
454
+ emit('ok', selectData, batchId.value)
455
+ })
456
+ .catch(() => {})
457
+
458
+ return
459
+ }
414
460
  emit('ok', selectData, batchId.value)
415
461
  }
416
462
  const timeID: any = ref(null)
@@ -491,9 +537,12 @@ onMounted(() => {
491
537
  color: #333;
492
538
  border-radius: 2px;
493
539
  }
494
- div.person {
540
+ div.company {
495
541
  background-color: #ff8b26;
496
542
  }
543
+ div.err {
544
+ background-color: #d5001c;
545
+ }
497
546
  .title {
498
547
  color: #fff;
499
548
  display: flex;
@@ -3,6 +3,8 @@
3
3
  <div v-if="activePage === 1" class="box">
4
4
  <PaymentMode
5
5
  :batchId="batchId"
6
+ :businessLicense="businessLicense || computed_params.businessLicense"
7
+ :taxCode="taxCode || computed_params.taxCode"
6
8
  :multiple="multiple"
7
9
  @uploadSuccess="uploadSuccess"></PaymentMode>
8
10
  </div>
@@ -10,6 +12,8 @@
10
12
  <InvoiceList
11
13
  :multiple="multiple"
12
14
  :listId="listId"
15
+ :businessLicense="businessLicense || computed_params.businessLicense"
16
+ :taxCode="taxCode || computed_params.taxCode"
13
17
  :catchList="catchList"
14
18
  @ok="submit"
15
19
  @edit="edit">
@@ -24,7 +28,7 @@
24
28
  </div>
25
29
  </template>
26
30
  <script lang="ts" setup>
27
- import { ref, onMounted } from 'vue'
31
+ import { ref, onMounted, computed } from 'vue'
28
32
  import { PaymentMode, Invoice, InvoiceList } from '@/components/index'
29
33
  import { getUrlParams } from '@/utils/getUrlParams'
30
34
  import { showToast } from 'vant'
@@ -41,7 +45,15 @@ const setLog = () => {
41
45
  }
42
46
  setLog()
43
47
  const emit = defineEmits(['submit'])
44
- const { token, multiple, Base_URL, OCR_AuthDomain, batchId } = defineProps({
48
+ const {
49
+ token,
50
+ multiple,
51
+ Base_URL,
52
+ OCR_AuthDomain,
53
+ batchId,
54
+ taxCode,
55
+ businessLicense,
56
+ } = defineProps({
45
57
  token: {
46
58
  required: false,
47
59
  type: String,
@@ -58,14 +70,22 @@ const { token, multiple, Base_URL, OCR_AuthDomain, batchId } = defineProps({
58
70
  },
59
71
  batchId: {
60
72
  required: false,
61
-
73
+ },
74
+ businessLicense: {
75
+ required: false,
76
+ },
77
+ taxCode: {
78
+ required: false,
62
79
  },
63
80
  })
64
-
81
+ const computed_params = computed(() => {
82
+ return getUrlParams(window.location.href)
83
+ })
65
84
  const initToken = () => {
66
85
  activePage.value = 1
67
86
  const params = getUrlParams(window.location.href)
68
87
  const linkToken = params.token
88
+ console.log(linkToken, 'linkToken')
69
89
  Cookies.set('token', linkToken || token)
70
90
  }
71
91
  const init_Base_URL = () => {
@@ -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)