mg-ocr-invoice 0.4.6 → 0.4.8

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.6",
4
+ "version": "0.4.8",
5
5
  "type": "module",
6
6
  "types": "dist/types/index.d.ts",
7
7
  "module": "dist/index.es.js",
@@ -141,7 +141,7 @@
141
141
  </div>
142
142
  <div class="right-btn">
143
143
  <span class="add" @click="add">继续添加发票</span>
144
- <span class="ok" :class="{ disabledColor: !submitBtn }" @click="ok"
144
+ <span class="ok" :class="{ disabledColor: !submitBtn }" @click="submitData"
145
145
  >确定选择</span
146
146
  >
147
147
  </div>
@@ -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 {
@@ -421,7 +451,7 @@ const selectedLengthCount = computed(() => {
421
451
  const openErrImg = (url: any) => {
422
452
  showImagePreview([url])
423
453
  }
424
- const ok = () => {
454
+ const submitData = () => {
425
455
  if (selectId.value.length <= 0) {
426
456
  showToast({
427
457
  type: 'text',
@@ -454,15 +484,16 @@ const ok = () => {
454
484
  item.invoiceCompanyType === '异常税号'
455
485
  )
456
486
  const ProhibitSubmissionFlag = filterTitleErr.some(
457
- (item) => item.invoiceRootType === '专票'
487
+ (item) => item.invoiceRootType === '专票' || item.invoiceRootType === '普票'
458
488
  )
459
489
  if (ProhibitSubmissionFlag) {
460
- console.log('专票不允许出现异常抬头或异常税号,请取消勾选后继续提交')
490
+ console.log('专票和普票不允许出现异常抬头或异常税号,请取消勾选后继续提交')
461
491
  showConfirmDialog({
462
492
  message: () => {
463
493
  return h('div', {
464
494
  style: 'color:#EF1725;',
465
- innerHTML: '专票不允许出现异常抬头或异常税号,请取消勾选后继续提交',
495
+ innerHTML:
496
+ '专票和普票不允许出现异常抬头或异常税号,请取消勾选后继续提交',
466
497
  })
467
498
  },
468
499
  teleport: Cookies.get('teleport') || null,
@@ -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)