mg-ocr-invoice 0.4.5 → 0.4.7

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.
@@ -3,6 +3,8 @@ declare const _default: import("vue").DefineComponent<Readonly<{
3
3
  multiple?: any;
4
4
  businessLicense?: any;
5
5
  taxCode?: any;
6
+ allUrlParams?: any;
7
+ allParams?: any;
6
8
  batchId?: any;
7
9
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
10
  uploadSuccess: (...args: any[]) => void;
@@ -10,6 +12,8 @@ declare const _default: import("vue").DefineComponent<Readonly<{
10
12
  multiple?: any;
11
13
  businessLicense?: any;
12
14
  taxCode?: any;
15
+ allUrlParams?: any;
16
+ allParams?: any;
13
17
  batchId?: any;
14
18
  }>>> & {
15
19
  onUploadSuccess?: ((...args: any[]) => any) | undefined;
@@ -17,6 +21,8 @@ declare const _default: import("vue").DefineComponent<Readonly<{
17
21
  readonly multiple?: any;
18
22
  readonly businessLicense?: any;
19
23
  readonly taxCode?: any;
24
+ readonly allUrlParams?: any;
25
+ readonly allParams?: any;
20
26
  readonly batchId?: any;
21
27
  }, {}>;
22
28
  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.4.5",
4
+ "version": "0.4.7",
5
5
  "type": "module",
6
6
  "types": "dist/types/index.d.ts",
7
7
  "module": "dist/index.es.js",
@@ -75,7 +75,7 @@
75
75
  </div>
76
76
  <div class="item-info">
77
77
  <span class="label">发票类型</span>
78
- <span class="value">{{ item.description }}</span>
78
+ <span class="value">{{ item.invoiceRootType }}</span>
79
79
  </div>
80
80
  <div class="item-info">
81
81
  <span class="label">发票时间</span>
@@ -171,7 +171,7 @@
171
171
  </template>
172
172
  <!-- 异常发票, 已使用的, 使用中的, 识别失败 禁止提交 -->
173
173
  <script setup lang="ts">
174
- import { ref, onMounted, computed } from 'vue'
174
+ import { ref, onMounted, computed, h } from 'vue'
175
175
  import {
176
176
  Popup,
177
177
  Skeleton,
@@ -217,6 +217,20 @@ const $props = defineProps({
217
217
  required: false,
218
218
  type: String,
219
219
  },
220
+ allUrlParams: {
221
+ required: false,
222
+ type: Object,
223
+ default: () => {
224
+ return {}
225
+ },
226
+ },
227
+ allParams: {
228
+ required: false,
229
+ type: Object,
230
+ default: () => {
231
+ return {}
232
+ },
233
+ },
220
234
  })
221
235
  const token: any = ref(sessionStorage.getItem('token'))
222
236
  const showLoading = ref(false)
@@ -231,11 +245,14 @@ const selectId = computed(() => {
231
245
  .filter((item: any) => item.selected)
232
246
  .map((item: any) => item.taskId)
233
247
  })
234
-
248
+ const paramsObj = computed(() => {
249
+ return Object.assign({}, $props.allParams, $props.allUrlParams)
250
+ })
235
251
  const getList = async () => {
236
252
  return new Promise(async (resolve, reject) => {
237
- const data: any = {}
253
+ let data: any = {}
238
254
  data.batchId = $props.listId
255
+ data = Object.assign(data, paramsObj.value)
239
256
  if (!data.batchId) return
240
257
  try {
241
258
  const res: any = await __getUploadInvoiceList(data, token.value)
@@ -351,10 +368,16 @@ const deleteSelectItem = () => {
351
368
  overlayClass: 'OCR-Zindex-OCR',
352
369
  })
353
370
  .then(async () => {
354
- var urlencoded = new URLSearchParams()
355
- urlencoded.append('batchId', batchId.value)
356
371
  const idsStr = selectId.value.join(',')
357
- urlencoded.append('taskIds', idsStr)
372
+ let newData: any = {
373
+ batchId: batchId.value,
374
+ taskIds: idsStr,
375
+ }
376
+ newData = Object.assign(newData, paramsObj.value)
377
+ var urlencoded = new URLSearchParams()
378
+ for (const key in newData) {
379
+ urlencoded.append(key, newData[key])
380
+ }
358
381
  const res: any = await __deleteInvoice(urlencoded, token.value)
359
382
  if (res.code === 200) {
360
383
  showToast({
@@ -381,9 +404,16 @@ const selectImg = async (type: number) => {
381
404
  } else {
382
405
  fd = await takePhoto()
383
406
  }
384
- fd.append('batchId', batchId.value)
385
- fd.append('businessLicense', $props.businessLicense || '')
386
- fd.append('taxCode', $props.taxCode || '')
407
+
408
+ let newData: any = {
409
+ businessLicense: $props.businessLicense || '',
410
+ taxCode: $props.taxCode || '',
411
+ batchId: batchId.value,
412
+ }
413
+ newData = Object.assign(newData, paramsObj.value)
414
+ for (const key in newData) {
415
+ fd.append(key, newData[key])
416
+ }
387
417
  showLoading.value = true
388
418
  showPopup.value = false
389
419
  try {
@@ -448,14 +478,32 @@ const ok = () => {
448
478
  let obj: any = { ...item, ...data }
449
479
  return obj
450
480
  })
451
- const filterTitleErr = selectData.some(
481
+ const filterTitleErr = selectData.filter(
452
482
  (item) =>
453
483
  item.invoiceCompanyType === '异常抬头' ||
454
484
  item.invoiceCompanyType === '异常税号'
455
485
  )
456
- console.log(filterTitleErr, 'filterTitleErr')
457
- if (filterTitleErr) {
458
- console.log(Cookies.get('teleport'), 'teleport')
486
+ const ProhibitSubmissionFlag = filterTitleErr.some(
487
+ (item) => item.invoiceRootType === '专票'
488
+ )
489
+ if (ProhibitSubmissionFlag) {
490
+ console.log('专票不允许出现异常抬头或异常税号,请取消勾选后继续提交')
491
+ showConfirmDialog({
492
+ message: () => {
493
+ return h('div', {
494
+ style: 'color:#EF1725;',
495
+ innerHTML: '专票不允许出现异常抬头或异常税号,请取消勾选后继续提交',
496
+ })
497
+ },
498
+ teleport: Cookies.get('teleport') || null,
499
+ confirmButtonText: '确定',
500
+ className: 'OCR-Zindex-OCR',
501
+ showCancelButton: false,
502
+ overlayClass: 'OCR-Zindex-OCR',
503
+ })
504
+ return
505
+ }
506
+ if (filterTitleErr.length > 0) {
459
507
  showConfirmDialog({
460
508
  title: '提醒',
461
509
  message: '存在异常抬头发票,请确认是否继续提交?',
@@ -3,6 +3,8 @@
3
3
  <div v-if="activePage === 1" class="box">
4
4
  <PaymentMode
5
5
  :batchId="$props.batchId"
6
+ :allParams="$props.allParams"
7
+ :allUrlParams="computed_params"
6
8
  :businessLicense="
7
9
  $props.businessLicense || computed_params.businessLicense
8
10
  "
@@ -12,8 +14,10 @@
12
14
  </div>
13
15
  <div v-if="activePage === 2" class="box">
14
16
  <InvoiceList
17
+ :allParams="$props.allParams"
15
18
  :multiple="$props.multiple"
16
19
  :listId="listId"
20
+ :allUrlParams="computed_params"
17
21
  :businessLicense="
18
22
  $props.businessLicense || computed_params.businessLicense
19
23
  "
@@ -72,6 +76,10 @@ const $props = defineProps({
72
76
  required: false,
73
77
  type: String,
74
78
  },
79
+ allParams: {
80
+ required: false,
81
+ type: Object,
82
+ },
75
83
  })
76
84
  const computed_params = computed(() => {
77
85
  return getUrlParams(window.location.href)
@@ -28,13 +28,20 @@
28
28
  </template>
29
29
 
30
30
  <script setup lang="ts">
31
- import { ref } from 'vue'
31
+ import { computed, ref, watch } from 'vue'
32
32
  import '@/utils/disableZoom'
33
33
  import { selectPhoto, takePhoto } from '@/utils/upload'
34
34
  import { __uploadInvoice } from '@/api/invoice'
35
35
  import { showToast, Overlay, Loading } from 'vant'
36
36
  import Cookies from 'js-cookie'
37
- const props = defineProps(['multiple', 'batchId', 'taxCode', 'businessLicense'])
37
+ const props = defineProps([
38
+ 'multiple',
39
+ 'batchId',
40
+ 'taxCode',
41
+ 'businessLicense',
42
+ 'allUrlParams',
43
+ 'allParams',
44
+ ])
38
45
  const emit = defineEmits(['uploadSuccess'])
39
46
  const payList: any = [
40
47
  {
@@ -55,6 +62,9 @@ const payList: any = [
55
62
  // },
56
63
  ]
57
64
  document.title = '请选择添加费用方式'
65
+ const paramsObj = computed(() => {
66
+ return Object.assign({}, props.allParams, props.allUrlParams)
67
+ })
58
68
  const showLoading = ref(false)
59
69
  const handleClickText = async (text: any) => {
60
70
  let fd: any
@@ -64,11 +74,18 @@ const handleClickText = async (text: any) => {
64
74
  if (text == '相册') {
65
75
  fd = await selectPhoto(props.multiple)
66
76
  }
77
+ let newData: any = {
78
+ businessLicense: props.businessLicense || '',
79
+ taxCode: props.taxCode || '',
80
+ }
67
81
  if (props.batchId) {
68
- fd.append('batchId', props.batchId)
82
+ newData.batchId = props.batchId
83
+ }
84
+ newData = Object.assign(newData, paramsObj.value)
85
+ for (const key in newData) {
86
+ fd.append(key, newData[key])
69
87
  }
70
- fd.append('businessLicense', props.businessLicense || '')
71
- fd.append('taxCode', props.taxCode || '')
88
+ console.log(newData,'newData')
72
89
  showLoading.value = true
73
90
  try {
74
91
  const res: any = await __uploadInvoice(fd)