mg-ocr-invoice 0.4.8 → 0.4.10

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.
Files changed (30) hide show
  1. package/dist/index.es.js +10618 -11509
  2. package/dist/index.umd.js +41 -41
  3. package/dist/style.css +9 -1
  4. package/dist/types/components/InoviceConfirmDialog/InoviceConfirmDialog.vue.d.ts +114 -0
  5. package/dist/types/components/Invoice/index.vue.d.ts +1 -0
  6. package/dist/types/components/InvoiceList/Skeleton.vue.d.ts +14 -0
  7. package/dist/types/components/InvoiceList/const.d.ts +1 -1
  8. package/dist/types/components/InvoiceList/index.vue.d.ts +1 -0
  9. package/dist/types/components/InvoicePopup/InvoicePopup.vue.d.ts +61 -0
  10. package/dist/types/components/Loading/index.vue.d.ts +11 -0
  11. package/dist/types/components/Message/index.vue.d.ts +32 -0
  12. package/dist/types/components/OCRInvoice/const.d.ts +0 -2
  13. package/dist/types/index.d.ts +0 -1
  14. package/dist/types/main.d.ts +0 -1
  15. package/dist/types/utils/common.d.ts +3 -0
  16. package/dist/types/utils/components.d.ts +35 -0
  17. package/dist/types/utils/upload.d.ts +0 -1
  18. package/package.json +3 -4
  19. package/src/components/InoviceConfirmDialog/InoviceConfirmDialog.vue +273 -0
  20. package/src/components/Invoice/index.vue +327 -271
  21. package/src/components/InvoiceList/Skeleton.vue +121 -0
  22. package/src/components/InvoiceList/index.vue +451 -402
  23. package/src/components/InvoicePopup/InvoicePopup.vue +217 -0
  24. package/src/components/Loading/index.vue +60 -0
  25. package/src/components/Message/index.vue +108 -0
  26. package/src/components/OCRInvoice/const.ts +0 -4
  27. package/src/components/OCRInvoice/index.vue +5 -7
  28. package/src/components/PaymentMode/index.vue +25 -38
  29. package/dist/types/styles/vantimpCss.d.ts +0 -15
  30. package/dist/types/utils/getUrlParams.d.ts +0 -1
@@ -0,0 +1,217 @@
1
+ <template>
2
+ <div
3
+ class="OCR-overlay"
4
+ :style="{ zIndex: z_index }"
5
+ :class="{ 'OCR-show': $props.modelValue }"></div>
6
+ <div
7
+ class="OCR-action-sheet"
8
+ :style="{ zIndex: z_index }"
9
+ :class="{ 'OCR-show': $props.modelValue }">
10
+ <div class="OCR-action-sheet-header">
11
+ <h3 class="OCR-action-sheet-title">
12
+ {{ $props.title || '请选择操作' }}
13
+ </h3>
14
+ <span @click="close" class="gg-close OCR-action-sheet-close"></span>
15
+ </div>
16
+ <div v-if="$slots.content" class="OCR-action-sheet-content">
17
+ <slot name="content"></slot>
18
+ </div>
19
+ <div class="OCR-action-sheet-content" v-else>
20
+ <div
21
+ class="OCR-action-sheet-item"
22
+ @click.stopp="selectRow(item)"
23
+ :key="index"
24
+ v-for="(item, index) in $props.options">
25
+ <slot :item="item" name="OCR-action-sheet-item"
26
+ ><div>{{ item.name }}</div></slot
27
+ >
28
+ </div>
29
+ </div>
30
+ <div v-if="$slots.footer">
31
+ <slot name="footer"></slot>
32
+ </div>
33
+ <div v-else class="OCR-action-sheet-cancel" @click="close">取消</div>
34
+ </div>
35
+ </template>
36
+ <script setup lang="ts">
37
+ import { OCR_getMaxZIndex } from '@/utils/common'
38
+ import { onUnmounted, ref, watch } from 'vue'
39
+ const $props: any = defineProps({
40
+ modelValue: {
41
+ type: Boolean,
42
+ required: true,
43
+ },
44
+ title: {
45
+ type: String,
46
+ default() {
47
+ return '选择操作'
48
+ },
49
+ },
50
+ options: {
51
+ type: Array,
52
+ default() {
53
+ return []
54
+ },
55
+ },
56
+ zIndex: {
57
+ type: Number,
58
+ default() {
59
+ return OCR_getMaxZIndex() + 1
60
+ },
61
+ },
62
+ })
63
+ const emits = defineEmits(['onClose', 'onSelect', 'update:modelValue'])
64
+ const z_index = ref(OCR_getMaxZIndex() + 1)
65
+ watch(
66
+ () => $props.modelValue,
67
+ (val) => {
68
+ if (val) {
69
+ document.body.style.overflow = 'hidden'
70
+ z_index.value = OCR_getMaxZIndex() + 1
71
+ } else {
72
+ document.body.style.overflow = ''
73
+ }
74
+ }
75
+ )
76
+ onUnmounted(() => {
77
+ document.body.style.overflow = ''
78
+ })
79
+ const close = () => {
80
+ emits('update:modelValue', false)
81
+ }
82
+ const selectRow = (data: any) => {
83
+ emits('onSelect', JSON.parse(JSON.stringify(data)))
84
+ close()
85
+ }
86
+ </script>
87
+ <style scoped>
88
+ /* ActionSheet 组件样式 */
89
+ .OCR-action-sheet {
90
+ position: fixed;
91
+ bottom: 0;
92
+ left: 0;
93
+ right: 0;
94
+ background: #f7f8fa;
95
+ border-radius: 24px 24px 0 0;
96
+ transform: translateY(100%);
97
+ transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
98
+ box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.1);
99
+ max-width: 100%;
100
+ max-height: 80%;
101
+ margin: 0 auto;
102
+ overflow: hidden;
103
+ /* padding-bottom: 67px; */
104
+ display: flex;
105
+ flex-direction: column;
106
+ }
107
+
108
+ .OCR-action-sheet.OCR-show {
109
+ transform: translateY(0);
110
+ }
111
+
112
+ .OCR-action-sheet-header {
113
+ display: grid;
114
+ grid-template-columns: 1fr auto 1fr;
115
+ position: relative;
116
+ align-items: center;
117
+ border-bottom: 1px solid #f5f5f5;
118
+ padding: 17px 12px;
119
+ background-color: #fff;
120
+ }
121
+
122
+ .OCR-action-sheet-title {
123
+ font-size: 18px;
124
+ color: #333;
125
+ font-weight: 500;
126
+ grid-column: 2;
127
+ }
128
+
129
+ .OCR-action-sheet-close {
130
+ grid-column: 3;
131
+ justify-self: end;
132
+ }
133
+
134
+ .OCR-action-sheet-content {
135
+ /* padding: 10px 0; */
136
+ height: inherit;
137
+ overflow-y: auto;
138
+ min-height: 50px;
139
+ background-color: #fff;
140
+ }
141
+
142
+ .OCR-action-sheet-item {
143
+ height: 50px;
144
+ font-size: 16px;
145
+ color: #333;
146
+ cursor: pointer;
147
+ display: flex;
148
+ align-items: center;
149
+ justify-content: center;
150
+ gap: 15px;
151
+ transition: background 0.2s;
152
+ }
153
+
154
+ .OCR-action-sheet-item:hover {
155
+ background: #f9f9f9;
156
+ }
157
+
158
+ .OCR-action-sheet-item.disabled {
159
+ color: #c8c9cc;
160
+ cursor: not-allowed;
161
+ }
162
+
163
+ .OCR-action-sheet-cancel {
164
+ /* margin-top: 8px; */
165
+ padding: 18px 0;
166
+ width: 100%;
167
+ text-align: center;
168
+ font-size: 16px;
169
+ color: #333;
170
+ cursor: pointer;
171
+ border-top: 9px solid #f5f5f5;
172
+ font-weight: 500;
173
+ transition: background 0.2s;
174
+ /* position: absolute; */
175
+ bottom: 0;
176
+ left: 0;
177
+ width: 100%;
178
+ background-color: #fff;
179
+ }
180
+
181
+ .OCR-action-sheet-cancel:hover {
182
+ background: #f9f9f9;
183
+ }
184
+
185
+ .OCR-overlay {
186
+ position: fixed;
187
+ top: 0;
188
+ left: 0;
189
+ right: 0;
190
+ bottom: 0;
191
+ background: rgba(0, 0, 0, 0.5);
192
+ z-index: 999;
193
+ opacity: 0;
194
+ visibility: hidden;
195
+ transition: opacity 0.3s ease;
196
+ }
197
+
198
+ .OCR-overlay.OCR-show {
199
+ opacity: 1;
200
+ visibility: visible;
201
+ }
202
+
203
+ @media (max-width: 600px) {
204
+ h1 {
205
+ font-size: 2rem;
206
+ }
207
+
208
+ .actions {
209
+ grid-template-columns: 1fr;
210
+ }
211
+
212
+ .OCR-action-sheet {
213
+ max-width: 100%;
214
+ border-radius: 16px 16px 0 0;
215
+ }
216
+ }
217
+ </style>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <div
3
+ class="fullscreen-loader"
4
+ :class="{ mask: attrs.showMask !== false }"
5
+ :style="attrs.style">
6
+ <div class="OCR-loading"></div>
7
+ <div v-if="attrs.loadingText" class="loading-text">
8
+ {{ attrs.loadingText }}
9
+ </div>
10
+ <slot v-else name="loadingText">
11
+ <div class="loading-text">{{ attrs.loadingText }}</div>
12
+ </slot>
13
+ </div>
14
+ </template>
15
+ <script lang="ts" setup>
16
+ import { useAttrs } from 'vue'
17
+
18
+ const attrs: any = useAttrs()
19
+ </script>
20
+ <style scoped>
21
+ .fullscreen-loader {
22
+ position: fixed;
23
+ top: 0;
24
+ left: 0;
25
+ width: 100%;
26
+ height: 100%;
27
+ display: flex;
28
+ flex-direction: column;
29
+ justify-content: center;
30
+ align-items: center;
31
+ z-index: 9999;
32
+ }
33
+ .mask {
34
+ background-color: rgba(0, 0, 0, 0.3);
35
+ }
36
+ .loading-text {
37
+ margin-top: 12px;
38
+ color: #1b67e4;
39
+ }
40
+ .OCR-loading {
41
+ width: 50px;
42
+ padding: 8px;
43
+ aspect-ratio: 1;
44
+ border-radius: 50%;
45
+ background: #1b67e4;
46
+ --_m: conic-gradient(#0000 10%, #000), linear-gradient(#000 0 0) content-box;
47
+ -webkit-mask: var(--_m);
48
+ mask: var(--_m);
49
+ -webkit-mask-composite: source-out;
50
+ mask-composite: subtract;
51
+ animation: l3 1s infinite linear;
52
+ }
53
+ @keyframes l3 {
54
+ to {
55
+ transform: rotate(1turn);
56
+ }
57
+ }
58
+
59
+
60
+ </style>
@@ -0,0 +1,108 @@
1
+ <template>
2
+ <div
3
+ class="OCR-toast-container"
4
+ :class="['OCR-toast-' + $props.position]"
5
+ :style="attrs.style">
6
+ <div class="OCR-text-content">
7
+ <div class="OCR-toast-icon" v-if="$props.type">
8
+ <i :class="[iconCalss]"></i>
9
+ </div>
10
+ <div class="OCR-toast-text">{{ $props.message }}</div>
11
+ </div>
12
+ </div>
13
+ </template>
14
+ <script lang="ts" setup>
15
+ import { computed, useAttrs } from 'vue'
16
+ const attrs: any = useAttrs()
17
+ const $props = defineProps({
18
+ position: {
19
+ type: String,
20
+ default() {
21
+ return 'center'
22
+ },
23
+ },
24
+ type: {
25
+ type: String,
26
+ default() {
27
+ return ''
28
+ },
29
+ },
30
+ message: {
31
+ type: String,
32
+ default() {
33
+ return ''
34
+ },
35
+ },
36
+ })
37
+ const iconCalss = computed(() => {
38
+ if (!$props.type) {
39
+ return ''
40
+ } else {
41
+ }
42
+ const obj: any = {
43
+ success: 'gg-check-o',
44
+ error: 'gg-close-o',
45
+ warning: 'gg-close-o',
46
+ loading: 'OCR-loading',
47
+ }
48
+ return obj[$props.type]
49
+ })
50
+ </script>
51
+ <style scoped>
52
+ .OCR-toast-container {
53
+ position: fixed;
54
+ width: 100%;
55
+ padding: 0 16px;
56
+ display: flex;
57
+ align-items: center;
58
+ justify-content: center;
59
+ }
60
+ .OCR-toast-container .OCR-text-content {
61
+ color: #fff;
62
+ width: initial;
63
+ background: rgba(0, 0, 0, 0.85);
64
+ border-radius: 20px;
65
+ padding: 16px;
66
+ /* box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2); */
67
+ backdrop-filter: blur(10px);
68
+ max-height: 100px;
69
+ overflow: hidden;
70
+ font-size: 14px;
71
+ display: flex;
72
+ flex-direction: column;
73
+ align-items: center;
74
+ gap: 8px;
75
+ }
76
+ .OCR-toast-top {
77
+ top: 50%;
78
+ left: 0;
79
+ }
80
+ .OCR-toast-center {
81
+ top: 50%;
82
+ left: 50%;
83
+ transform: translate(-50%, -50%);
84
+ }
85
+ .OCR-toast-bottom {
86
+ }
87
+
88
+ .OCR-loading {
89
+ display: inline-block;
90
+ width: 22px;
91
+ padding: 3px;
92
+ aspect-ratio: 1;
93
+ border-radius: 50%;
94
+ background: #1b67e4;
95
+ --_m: conic-gradient(#0000 10%, #000), linear-gradient(#000 0 0) content-box;
96
+ -webkit-mask: var(--_m);
97
+ mask: var(--_m);
98
+ -webkit-mask-composite: source-out;
99
+ mask-composite: subtract;
100
+ animation: l3 1s infinite linear;
101
+ }
102
+ @keyframes l3 {
103
+ to {
104
+ transform: rotate(1turn);
105
+ }
106
+ }
107
+
108
+ </style>
@@ -1,7 +1,5 @@
1
1
  export const data = {
2
2
  angle: '0',
3
- attachmentLink:
4
- 'https://filegw.nuonuo.com/U1ylUBa5YlUHWOpta7hoLSC6QX9pEcu8Kcy-JnCnHTGn6PYXKNdZosH32iDDaLWGzhkY0N88rGOaS4w2krdeCw.png',
5
3
  description: '增值税专用发票',
6
4
  invoiceType: 'vat_special_invoice',
7
5
  invoiceRootType: '专票',
@@ -59,8 +57,6 @@ export const data = {
59
57
  status: 'entered',
60
58
  invoiceStatus: 'unused',
61
59
  realStatus: 'checked',
62
- fileUrlKey:
63
- 'https://invoice-sit-1251881907.cos.ap-nanjing.myqcloud.com/f8c6ff4af53241269c39dbd70f59cf6a.png?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDwtmcPMRRMAe9d4Sju00wq7KQPKAvZ6Yt%26q-sign-time%3D1693876509%3B1693876689%26q-key-time%3D1693876509%3B1693876689%26q-header-list%3Dhost%26q-url-param-list%3D%26q-signature%3Dd49201f59ae86085771f52b2df0b13f40556e848',
64
60
  invoiceCompanyType: '公司',
65
61
  taxRate: '1%',
66
62
  taskStatus: 'repeat',
@@ -36,9 +36,9 @@
36
36
  </div>
37
37
  </template>
38
38
  <script lang="ts" setup>
39
- import { ref, onMounted, computed, watch } from 'vue'
39
+ import { ref, onMounted, computed } from 'vue'
40
40
  import { PaymentMode, Invoice, InvoiceList } from '@/components/index'
41
- import { getUrlParams } from '@/utils/getUrlParams'
41
+ import { getUrlParams } from '@/utils/common'
42
42
  import Cookies from 'js-cookie'
43
43
  import VConsole from 'vconsole'
44
44
  const setLog = () => {
@@ -122,7 +122,6 @@ const submit = (data: any, id: string) => {
122
122
  emit('submit', data, id)
123
123
  }
124
124
  onMounted(() => {
125
- console.log($props.teleport, 'teleport')
126
125
  Cookies.set('teleport', $props.teleport || '')
127
126
  initToken()
128
127
  init_Base_URL()
@@ -131,11 +130,10 @@ onMounted(() => {
131
130
  <style lang="scss" scoped>
132
131
  .OCRInvoice {
133
132
  width: 100%;
134
- height: 100vh;
133
+ height: 100%;
135
134
  .box {
136
- width: 100%;
137
- min-height: 100%;
138
- height: 100%;
135
+ width: 100%;
136
+ height: 100%;
139
137
  }
140
138
  }
141
139
  </style>
@@ -14,26 +14,20 @@
14
14
  <span class="text">{{ item.text }}</span>
15
15
  </div>
16
16
  <div class="right-icon">
17
- <i class="iconfont icon-xiangyou"></i>
17
+ <i class="gg-chevron-right"></i>
18
18
  </div>
19
19
  </div>
20
20
  </div>
21
21
  </div>
22
- <Overlay
23
- :z-index="9527"
24
- style="display: flex; justify-content: center; align-items: center"
25
- :show="showLoading">
26
- <Loading class="loading" color="#0094ff">上传中...</Loading>
27
- </Overlay>
28
22
  </template>
29
23
 
30
24
  <script setup lang="ts">
31
- import { computed, ref, watch } from 'vue'
25
+ import { computed } from 'vue'
32
26
  import '@/utils/disableZoom'
33
27
  import { selectPhoto, takePhoto } from '@/utils/upload'
34
28
  import { __uploadInvoice } from '@/api/invoice'
35
- import { showToast, Overlay, Loading } from 'vant'
36
- import Cookies from 'js-cookie'
29
+ import { showLoading, showMessage } from '@/utils/components'
30
+
37
31
  const props = defineProps([
38
32
  'multiple',
39
33
  'batchId',
@@ -46,33 +40,29 @@ const emit = defineEmits(['uploadSuccess'])
46
40
  const payList: any = [
47
41
  {
48
42
  text: '拍照',
49
- leftIcon: 'icon-xiangji',
43
+ leftIcon: 'gg-smart-home-wash-machine',
50
44
  },
51
45
  {
52
46
  text: '相册',
53
- leftIcon: 'icon-xiangce',
47
+ leftIcon: 'gg-image',
54
48
  },
55
- // {
56
- // text: '微信',
57
- // leftIcon: 'icon-weixin3',
58
- // },
59
- // {
60
- // text: '支付宝',
61
- // leftIcon: 'icon-zhifubao',
62
- // },
63
49
  ]
64
- document.title = '请选择添加费用方式'
65
50
  const paramsObj = computed(() => {
66
51
  return Object.assign({}, props.allParams, props.allUrlParams)
67
52
  })
68
- const showLoading = ref(false)
53
+
69
54
  const handleClickText = async (text: any) => {
70
- let fd: any
55
+ let files = []
71
56
  if (text == '拍照') {
72
- fd = await takePhoto()
57
+ files = await takePhoto()
73
58
  }
74
59
  if (text == '相册') {
75
- fd = await selectPhoto(props.multiple)
60
+ files = await selectPhoto(props.multiple)
61
+ }
62
+ console.log(files)
63
+ let fd = new FormData()
64
+ for (let i = 0; i < files.length; i++) {
65
+ fd.append('invoiceFiles', files[i])
76
66
  }
77
67
  let newData: any = {
78
68
  businessLicense: props.businessLicense || '',
@@ -85,29 +75,26 @@ const handleClickText = async (text: any) => {
85
75
  for (const key in newData) {
86
76
  fd.append(key, newData[key])
87
77
  }
88
- console.log(newData,'newData')
89
- showLoading.value = true
78
+ const ld = showLoading()
79
+ ld.show()
90
80
  try {
91
81
  const res: any = await __uploadInvoice(fd)
92
82
  if (res.code === 200) {
93
- showToast({
94
- type: 'success',
95
- message: '上传成功',
96
- teleport: Cookies.get('teleport') || null,
97
- zIndex: 9527,
98
- })
83
+ // showMessage({
84
+ // type: 'success',
85
+ // message: '上传成功',
86
+ // duration: 1000,
87
+ // })
99
88
  emit('uploadSuccess', res.data)
100
89
  }
101
90
  } catch (err: any) {
102
91
  console.log(err)
103
- showToast({
104
- type: 'fail',
92
+ showMessage({
93
+ type: 'error',
105
94
  message: err.msg,
106
- teleport: Cookies.get('teleport') || null,
107
- zIndex: 9527,
108
95
  })
109
96
  }
110
- showLoading.value = false
97
+ ld.hide()
111
98
  }
112
99
  </script>
113
100
  <style scoped lang="scss">
@@ -1,15 +0,0 @@
1
- import 'vant/lib/overlay/index.css';
2
- import 'vant/lib/loading/index.css';
3
- import 'vant/lib/image-preview/index.css';
4
- import 'vant/lib/cell-group/index.css';
5
- import 'vant/lib/field/index.css';
6
- import 'vant/lib/form/style/index';
7
- import 'vant/lib/icon/index.css';
8
- import 'vant/lib/button/index.css';
9
- import 'vant/lib/action-sheet/index.css';
10
- import 'vant/lib/cell/index.css';
11
- import 'vant/lib/popup/index.css';
12
- import 'vant/lib/skeleton/index.css';
13
- import 'vant/lib/dialog/index.css';
14
- import 'vant/es/toast/index.css';
15
- import 'vant/lib/skeleton-paragraph/index.css';
@@ -1 +0,0 @@
1
- export declare function getUrlParams(url: string): any;