mg-ocr-invoice 0.3.3 → 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.3",
4
+ "version": "0.3.5",
5
5
  "type": "module",
6
6
  "types": "dist/types/index.d.ts",
7
7
  "module": "dist/index.es.js",
@@ -337,6 +337,7 @@ const submit = async () => {
337
337
  showToast({
338
338
  type: 'success',
339
339
  message: '保存成功',
340
+ teleport:'#iDOCRInvoice'
340
341
  })
341
342
  emit('saveSuccess')
342
343
  }
@@ -166,6 +166,8 @@ const submit = async () => {
166
166
  showToast({
167
167
  type: 'success',
168
168
  message: '保存成功',
169
+ teleport:'#iDOCRInvoice'
170
+
169
171
  })
170
172
  emit('saveSuccess')
171
173
  }
@@ -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)
@@ -252,7 +265,11 @@ const getList = async () => {
252
265
  const clickItem = (row: any) => {
253
266
  console.log(row.invoiceStatus)
254
267
  if (row.invoiceStatus !== 'unused') {
255
- return showToast('发票已被使用!')
268
+ return showToast({
269
+ type: 'text',
270
+ teleport: '#iDOCRInvoice',
271
+ message: '发票已被使用!',
272
+ })
256
273
  }
257
274
  row.selected = !row.selected
258
275
  }
@@ -297,7 +314,11 @@ const selectStatus = (item: any) => {
297
314
  const selectedAll: any = ref(false)
298
315
  const changeSelectAll = (v: any) => {
299
316
  if (selectedAll.value) {
300
- showToast('存在已使用或异常发票, 已自动过滤')
317
+ showToast({
318
+ type: 'text',
319
+ message: '存在已使用或异常发票, 已自动过滤',
320
+ teleport: '#iDOCRInvoice',
321
+ })
301
322
  }
302
323
  list.value.forEach((item: any) => {
303
324
  item.selected = selectStatus(item) && selectedAll.value
@@ -311,12 +332,17 @@ const changeItemCheckbox = () => {
311
332
  }
312
333
  const deleteSelectItem = () => {
313
334
  if (selectId.value.length <= 0) {
314
- showToast({ type: 'text', message: '请先选择发票' })
335
+ showToast({
336
+ type: 'text',
337
+ message: '请先选择发票',
338
+ teleport: '#iDOCRInvoice',
339
+ })
315
340
  return
316
341
  }
317
342
  showConfirmDialog({
318
343
  title: '提醒',
319
344
  message: '请确认是否需要移除选中项,移除后不可恢复!',
345
+ teleport: '#iDOCRInvoice',
320
346
  })
321
347
  .then(async () => {
322
348
  var urlencoded = new URLSearchParams()
@@ -325,7 +351,11 @@ const deleteSelectItem = () => {
325
351
  urlencoded.append('taskIds', idsStr)
326
352
  const res: any = await __deleteInvoice(urlencoded, token.value)
327
353
  if (res.code === 200) {
328
- showToast({ type: 'success', message: '移除成功' })
354
+ showToast({
355
+ type: 'success',
356
+ message: '移除成功',
357
+ teleport: '#iDOCRInvoice',
358
+ })
329
359
  getList()
330
360
  }
331
361
  })
@@ -345,6 +375,8 @@ const selectImg = async (type: number) => {
345
375
  fd = await takePhoto()
346
376
  }
347
377
  fd.append('batchId', batchId.value)
378
+ fd.append('businessLicense', businessLicense||'')
379
+ fd.append('taxCode', taxCode||'')
348
380
  showLoading.value = true
349
381
  showPopup.value = false
350
382
  try {
@@ -353,6 +385,7 @@ const selectImg = async (type: number) => {
353
385
  showToast({
354
386
  type: 'success',
355
387
  message: '上传成功',
388
+ teleport: '#iDOCRInvoice',
356
389
  })
357
390
  setTimeGetList()
358
391
  }
@@ -382,18 +415,23 @@ const openErrImg = (url: any) => {
382
415
  }
383
416
  const ok = () => {
384
417
  if (selectId.value.length <= 0) {
385
- showToast({ type: 'text', message: '请先选择发票' })
418
+ showToast({
419
+ type: 'text',
420
+ message: '请先选择发票',
421
+ teleport: '#iDOCRInvoice',
422
+ })
386
423
  return
387
424
  }
388
425
  if (!submitBtn.value) {
389
426
  showToast({
390
427
  type: 'text',
391
428
  message: '发票无效或已被使用,请进行确认',
429
+ teleport: '#iDOCRInvoice',
392
430
  })
393
431
  return
394
432
  }
395
433
  // showDeleteBtn.value = false
396
- const selectData = list.value
434
+ const selectData: Array<any> = list.value
397
435
  .filter((item: any) => item.selected)
398
436
  .map((item: any) => {
399
437
  VerificationOfTruth
@@ -401,6 +439,24 @@ const ok = () => {
401
439
  let obj: any = { ...item, ...data }
402
440
  return obj
403
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
+ }
404
460
  emit('ok', selectData, batchId.value)
405
461
  }
406
462
  const timeID: any = ref(null)
@@ -481,9 +537,12 @@ onMounted(() => {
481
537
  color: #333;
482
538
  border-radius: 2px;
483
539
  }
484
- div.person {
540
+ div.company {
485
541
  background-color: #ff8b26;
486
542
  }
543
+ div.err {
544
+ background-color: #d5001c;
545
+ }
487
546
  .title {
488
547
  color: #fff;
489
548
  display: flex;
@@ -1,8 +1,10 @@
1
1
  <template>
2
- <div class="OCRInvoice">
2
+ <div class="OCRInvoice" id="iDOCRInvoice">
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)
@@ -72,6 +74,7 @@ const handleClickText = async (text: any) => {
72
74
  showToast({
73
75
  type: 'success',
74
76
  message: '上传成功',
77
+ teleport: '#iDOCRInvoice',
75
78
  })
76
79
  emit('uploadSuccess', res.data)
77
80
  }