mg-ocr-invoice 0.3.5 → 0.3.6

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.
@@ -1,4 +1,3 @@
1
- import 'vant/lib/index.css';
2
1
  import '@/utils/disableZoom';
3
2
  declare const _default: import("vue").DefineComponent<{
4
3
  listId: {
@@ -12,9 +11,11 @@ declare const _default: import("vue").DefineComponent<{
12
11
  catchList: {};
13
12
  businessLicense: {
14
13
  required: false;
14
+ type: StringConstructor;
15
15
  };
16
16
  taxCode: {
17
17
  required: false;
18
+ type: StringConstructor;
18
19
  };
19
20
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
21
  ok: (...args: any[]) => void;
@@ -31,9 +32,11 @@ declare const _default: import("vue").DefineComponent<{
31
32
  catchList: {};
32
33
  businessLicense: {
33
34
  required: false;
35
+ type: StringConstructor;
34
36
  };
35
37
  taxCode: {
36
38
  required: false;
39
+ type: StringConstructor;
37
40
  };
38
41
  }>> & {
39
42
  onOk?: ((...args: any[]) => any) | undefined;
@@ -1,2 +1,3 @@
1
1
  import './styles/mu-invoice.css';
2
2
  import 'element-plus/dist/index.css';
3
+ import 'vant/lib/index.css';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mg-ocr-invoice",
3
3
  "private": false,
4
- "version": "0.3.5",
4
+ "version": "0.3.6",
5
5
  "type": "module",
6
6
  "types": "dist/types/index.d.ts",
7
7
  "module": "dist/index.es.js",
@@ -23,7 +23,7 @@
23
23
  "element-plus": "^2.3.7",
24
24
  "js-cookie": "^3.0.5",
25
25
  "swiper": "^9.3.2",
26
- "vant": "^4.4.1",
26
+ "vant": "^4.0.9",
27
27
  "vconsole": "^3.15.1",
28
28
  "vue": "^3.2.47"
29
29
  },
@@ -176,7 +176,6 @@
176
176
  </template>
177
177
  <!-- 异常发票, 已使用的, 使用中的, 识别失败 禁止提交 -->
178
178
  <script setup lang="ts">
179
- import 'vant/lib/index.css'
180
179
  import { ref, onMounted, computed } from 'vue'
181
180
  import {
182
181
  Popup,
@@ -185,6 +184,7 @@ import {
185
184
  showToast,
186
185
  showConfirmDialog,
187
186
  Overlay,
187
+ showImagePreview
188
188
  } from 'vant'
189
189
  import '@/utils/disableZoom'
190
190
  import { selectPhoto, takePhoto } from '@/utils/upload'
@@ -196,14 +196,12 @@ import {
196
196
  import {
197
197
  const_invoiceStatus,
198
198
  const_realStatus,
199
- const_taskStatus,
200
199
  const_invoiceExceptionInfo,
201
200
  setClass,
202
201
  VerificationOfTruth,
203
202
  } from './const'
204
- import { showImagePreview } from 'vant'
205
203
  const emit = defineEmits(['edit', 'ok'])
206
- const { listId, multiple, catchList, businessLicense, taxCode }:any = defineProps({
204
+ const $props = defineProps({
207
205
  listId: {
208
206
  required: false,
209
207
  type: String,
@@ -215,17 +213,19 @@ const { listId, multiple, catchList, businessLicense, taxCode }:any = defineProp
215
213
  catchList: {},
216
214
  businessLicense: {
217
215
  required: false,
216
+ type: String,
218
217
  },
219
218
  taxCode: {
220
219
  required: false,
220
+ type: String,
221
221
  },
222
222
  })
223
223
  const token: any = ref(sessionStorage.getItem('token'))
224
224
  const showLoading = ref(false)
225
225
  const showPopup = ref(false)
226
226
  const list: any = ref<Array<any>>([])
227
- if (catchList) {
228
- list.value = catchList
227
+ if ($props.catchList) {
228
+ list.value = $props.catchList
229
229
  }
230
230
  const batchId = ref('')
231
231
  const selectId = computed(() => {
@@ -237,7 +237,7 @@ const selectId = computed(() => {
237
237
  const getList = async () => {
238
238
  return new Promise(async (resolve, reject) => {
239
239
  const data: any = {}
240
- data.batchId = listId
240
+ data.batchId = $props.listId
241
241
  if (!data.batchId) return
242
242
  try {
243
243
  const res: any = await __getUploadInvoiceList(data, token.value)
@@ -301,15 +301,6 @@ const selectStatus = (item: any) => {
301
301
  } else {
302
302
  return false
303
303
  }
304
- // if (item.invoiceStatus==='unused') {
305
- // return true
306
- // } else if (item.manualModify) {
307
- // return true
308
- // } else if (!item.invoiceExceptionInfo) {
309
- // return true
310
- // } else {
311
- // return false
312
- // }
313
304
  }
314
305
  const selectedAll: any = ref(false)
315
306
  const changeSelectAll = (v: any) => {
@@ -370,13 +361,13 @@ const add = () => {
370
361
  const selectImg = async (type: number) => {
371
362
  let fd: FormData
372
363
  if (type === 1) {
373
- fd = await selectPhoto(multiple)
364
+ fd = await selectPhoto($props.multiple)
374
365
  } else {
375
366
  fd = await takePhoto()
376
367
  }
377
368
  fd.append('batchId', batchId.value)
378
- fd.append('businessLicense', businessLicense||'')
379
- fd.append('taxCode', taxCode||'')
369
+ fd.append('businessLicense', $props.businessLicense || '')
370
+ fd.append('taxCode', $props.taxCode || '')
380
371
  showLoading.value = true
381
372
  showPopup.value = false
382
373
  try {
@@ -2,18 +2,22 @@
2
2
  <div class="OCRInvoice" id="iDOCRInvoice">
3
3
  <div v-if="activePage === 1" class="box">
4
4
  <PaymentMode
5
- :batchId="batchId"
6
- :businessLicense="businessLicense || computed_params.businessLicense"
7
- :taxCode="taxCode || computed_params.taxCode"
8
- :multiple="multiple"
5
+ :batchId="$props.batchId"
6
+ :businessLicense="
7
+ $props.businessLicense || computed_params.businessLicense
8
+ "
9
+ :taxCode="$props.taxCode || computed_params.taxCode"
10
+ :multiple="$props.multiple"
9
11
  @uploadSuccess="uploadSuccess"></PaymentMode>
10
12
  </div>
11
13
  <div v-if="activePage === 2" class="box">
12
14
  <InvoiceList
13
- :multiple="multiple"
15
+ :multiple="$props.multiple"
14
16
  :listId="listId"
15
- :businessLicense="businessLicense || computed_params.businessLicense"
16
- :taxCode="taxCode || computed_params.taxCode"
17
+ :businessLicense="
18
+ $props.businessLicense || computed_params.businessLicense
19
+ "
20
+ :taxCode="$props.taxCode || computed_params.taxCode"
17
21
  :catchList="catchList"
18
22
  @ok="submit"
19
23
  @edit="edit">
@@ -31,13 +35,8 @@
31
35
  import { ref, onMounted, computed } from 'vue'
32
36
  import { PaymentMode, Invoice, InvoiceList } from '@/components/index'
33
37
  import { getUrlParams } from '@/utils/getUrlParams'
34
- import { showToast } from 'vant'
35
38
  import Cookies from 'js-cookie'
36
- // import eruda from 'eruda'
37
- // eruda.init()
38
39
  import VConsole from 'vconsole'
39
- // import { data as dataObj } from './const'
40
-
41
40
  const setLog = () => {
42
41
  if (getUrlParams(window.location.href).log == 1) {
43
42
  const vConsole = new VConsole()
@@ -45,15 +44,7 @@ const setLog = () => {
45
44
  }
46
45
  setLog()
47
46
  const emit = defineEmits(['submit'])
48
- const {
49
- token,
50
- multiple,
51
- Base_URL,
52
- OCR_AuthDomain,
53
- batchId,
54
- taxCode,
55
- businessLicense,
56
- } = defineProps({
47
+ const $props = defineProps({
57
48
  token: {
58
49
  required: false,
59
50
  type: String,
@@ -86,15 +77,15 @@ const initToken = () => {
86
77
  const params = getUrlParams(window.location.href)
87
78
  const linkToken = params.token
88
79
  console.log(linkToken, 'linkToken')
89
- Cookies.set('token', linkToken || token)
80
+ Cookies.set('token', linkToken || $props.token)
90
81
  }
91
82
  const init_Base_URL = () => {
92
83
  const params = getUrlParams(window.location.href)
93
84
  Cookies.set(
94
85
  'OCR_Base_URL',
95
- params.Base_URL || Base_URL || 'https://invoice.imugua.team/'
86
+ params.Base_URL || $props.Base_URL || 'https://invoice.imugua.team/'
96
87
  )
97
- Cookies.set('OCR_AuthDomain', params.OCR_AuthDomain || OCR_AuthDomain)
88
+ Cookies.set('OCR_AuthDomain', params.OCR_AuthDomain || $props.OCR_AuthDomain)
98
89
  }
99
90
  const activePage = ref(0)
100
91
  const listId: any = ref(null)
@@ -1,25 +0,0 @@
1
- import '@/utils/disableZoom';
2
- declare const _default: import("vue").DefineComponent<{
3
- ids: {
4
- type: ObjectConstructor;
5
- required: true;
6
- };
7
- invoiceData: {
8
- type: ObjectConstructor;
9
- required: true;
10
- };
11
- }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
- saveSuccess: (...args: any[]) => void;
13
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
14
- ids: {
15
- type: ObjectConstructor;
16
- required: true;
17
- };
18
- invoiceData: {
19
- type: ObjectConstructor;
20
- required: true;
21
- };
22
- }>> & {
23
- onSaveSuccess?: ((...args: any[]) => any) | undefined;
24
- }, {}, {}>;
25
- export default _default;
@@ -1,345 +0,0 @@
1
- <template>
2
- <div class="Invoice">
3
- <div class="top" @click="openPreViewImg">
4
- <img :src="invoiceData.attachmentLink" alt="" />
5
- </div>
6
- <div class="company">
7
- <div class="title"><i></i> <span>公司</span></div>
8
- <div class="cardText">
9
- <p style="font-size: 13px; color: #888888">销售方</p>
10
- <div class="card">
11
- <div class="companyName">{{ invoiceData.sellerName }}</div>
12
- <div class="sellerInformation">
13
- <ul>
14
- <li>
15
- <i></i>
16
- <span class="label"> 纳税人识别号:</span>
17
- <span class="value">{{ invoiceData.sellerId }}</span>
18
- </li>
19
- <li>
20
- <i></i>
21
- <span class="label">地址、电话:</span>
22
- <span class="value">{{ invoiceData.sellerContact }}</span>
23
- </li>
24
- <li>
25
- <i></i>
26
- <span class="label">开户银行及账户:</span>
27
- <span class="value">{{ invoiceData.sellerAccount }}</span>
28
- </li>
29
- </ul>
30
- </div>
31
- </div>
32
- </div>
33
-
34
- <div class="purchaser">
35
- <ul>
36
- <li>
37
- <div class="label">购买方:</div>
38
- <div class="input">{{ invoiceData.payerName }}</div>
39
- </li>
40
- <li>
41
- <div class="label">发票类型:</div>
42
- <div class="input">{{ invoiceData.description }}</div>
43
- </li>
44
- <li>
45
- <div class="label">费用类型:</div>
46
- <div class="input">其他费</div>
47
- </li>
48
- <li>
49
- <div class="label">票面金额:</div>
50
- <div class="input">
51
- {{
52
- invoiceData.priceTaxTotalFigure || invoiceData.noTaxAmountTotal
53
- }}
54
- </div>
55
- </li>
56
- <li>
57
- <div class="label">发票代码:</div>
58
- <div class="input">
59
- <ElInputNumber
60
- :min="0"
61
- :controls="false"
62
- @input="editFlag = true"
63
- v-model.trim="invoiceData.invoiceCode"></ElInputNumber>
64
- </div>
65
- </li>
66
- <li>
67
- <div class="label">
68
- <span class="van-field__label--required"></span>发票号码:
69
- </div>
70
- <div class="input">
71
- <ElInputNumber
72
- :min="0"
73
- :controls="false"
74
- @input="editFlag = true"
75
- v-model.trim="invoiceData.invoiceNum"></ElInputNumber>
76
- <!-- <input type="text" v-model.trim="invoiceData.invoiceNum" /> -->
77
- <div v-if="showRequiredMsg" class="errColor">
78
- 发票号码不能为空!
79
- </div>
80
- </div>
81
- </li>
82
- <li>
83
- <div class="label">校验码:</div>
84
- <div class="input">{{ invoiceData.checkCode }}</div>
85
- </li>
86
- <li>
87
- <div class="label">开票日期:</div>
88
- <div class="input">{{ invoiceData.invoiceDate }}</div>
89
- </li>
90
- </ul>
91
- </div>
92
- </div>
93
- <div class="submit">
94
- <span
95
- style="width: 30%; background-color: #07c160; color: #fff"
96
- @click="close"
97
- >返回</span
98
- >
99
- <span @click="submit">保存</span>
100
- </div>
101
- </div>
102
- <Overlay
103
- style="
104
- display: flex;
105
- justify-content: center;
106
- align-items: center;
107
- z-index: 999;
108
- "
109
- :show="showLoading">
110
- <Loading class="loading" color="#0094ff">保存中...</Loading>
111
- </Overlay>
112
- </template>
113
- <script setup lang="ts">
114
- import { ref } from 'vue'
115
- import '@/utils/disableZoom'
116
- import { __updateInvoice } from '@/api/invoice'
117
- import {
118
- showToast,
119
- Overlay,
120
- Loading,
121
- showFailToast,
122
- showImagePreview,
123
- } from 'vant'
124
- import { ElInputNumber } from 'element-plus'
125
- const { ids, invoiceData } = defineProps({
126
- ids: {
127
- type: Object,
128
- required: true,
129
- },
130
- invoiceData: {
131
- type: Object,
132
- required: true,
133
- },
134
- })
135
- const emit = defineEmits(['saveSuccess'])
136
- document.title = '发票信息'
137
- const showRequiredMsg = ref(false)
138
- // const modules = ref([Pagination])
139
- const showLoading = ref(false)
140
- const close = () => {
141
- emit('saveSuccess')
142
- }
143
- const openPreViewImg = () => {
144
- showImagePreview([invoiceData.attachmentLink])
145
- }
146
- const editFlag = ref(false)
147
- const submit = async () => {
148
- if (!editFlag.value) {
149
- emit('saveSuccess')
150
- return
151
- }
152
- if (!invoiceData.invoiceNum) {
153
- showRequiredMsg.value = true
154
- return
155
- } else {
156
- showRequiredMsg.value = false
157
- }
158
- showLoading.value = true
159
- try {
160
- const res: any = await __updateInvoice({
161
- ...ids,
162
- invoiceNum: invoiceData.invoiceNum,
163
- invoiceCode: invoiceData.invoiceCode,
164
- })
165
- if (res.code === 200) {
166
- showToast({
167
- type: 'success',
168
- message: '保存成功',
169
- teleport:'#iDOCRInvoice'
170
-
171
- })
172
- emit('saveSuccess')
173
- }
174
- } catch (err: any) {
175
- showFailToast(err.msg)
176
- emit('saveSuccess')
177
- }
178
- showLoading.value = false
179
- }
180
- </script>
181
-
182
- <style lang="scss" scoped>
183
- ::v-deep {
184
- .el-input-number {
185
- width: 100%;
186
- }
187
- .el-input {
188
- .el-input__wrapper {
189
- width: 100%;
190
- padding: 0 !important;
191
- box-shadow: none;
192
- }
193
- .el-input__inner {
194
- width: 100%;
195
- text-align: left;
196
- box-shadow: none;
197
- padding: 0 !important;
198
- }
199
- }
200
- }
201
- * {
202
- padding: 0;
203
- margin: 0;
204
- box-sizing: border-box;
205
- }
206
- .Invoice {
207
- padding-bottom: 100px;
208
- width: 100%;
209
- min-height: 100%;
210
- background-color: #f3f4f6;
211
- .top {
212
- width: 100%;
213
- padding: 12px 4px;
214
- img {
215
- width: 100%;
216
- height: 179px;
217
- display: block;
218
- }
219
- }
220
-
221
- .company {
222
- height: inherit;
223
- padding: 0 12px;
224
- background-color: #fff;
225
- .title {
226
- padding: 18px 0;
227
- font-size: 16px;
228
- font-weight: 500;
229
- display: flex;
230
- align-items: center;
231
- border-bottom: 1px dashed #e8e8e8;
232
- margin-bottom: 18px;
233
- i {
234
- display: inline-block;
235
- width: 4px;
236
- height: 14px;
237
- background: #266fe8;
238
- border-radius: 2px;
239
- }
240
-
241
- span {
242
- font-size: 16px;
243
- padding-left: 8px;
244
- }
245
- }
246
- .cardText {
247
- .card {
248
- margin-top: 8px;
249
- border-radius: 4px;
250
- background-color: #f6f6f6;
251
- font-size: 14px;
252
- .companyName {
253
- padding: 15px;
254
- }
255
- .sellerInformation {
256
- padding-left: 12px;
257
- padding-bottom: 20px;
258
- li {
259
- list-style: none;
260
- margin-bottom: 12px;
261
- display: flex;
262
- align-items: center;
263
- i {
264
- width: 4px;
265
- height: 4px;
266
- border-radius: 50%;
267
- background-color: #266fe8;
268
- }
269
- .label {
270
- width: 120px;
271
- margin-left: 12px;
272
- white-space: nowrap;
273
- }
274
- .value {
275
- flex: 1;
276
- }
277
- }
278
- }
279
- }
280
- }
281
- .purchaser {
282
- ul {
283
- li {
284
- display: flex;
285
- font-size: 16px;
286
- height: 50px;
287
- align-items: center;
288
- gap: 45px;
289
- .label {
290
- width: 80px;
291
- white-space: nowrap;
292
- position: relative;
293
- .van-field__label--required {
294
- position: absolute;
295
- top: 0;
296
- left: -8px;
297
- }
298
- }
299
- .input {
300
- flex-grow: 1;
301
- color: #999999;
302
-
303
- input {
304
- width: 100%;
305
- color: #999999;
306
- outline: none;
307
- font-size: 16px;
308
- border: none;
309
- }
310
- .errColor {
311
- color: red;
312
- font-size: 12px;
313
- }
314
- }
315
- }
316
- }
317
- }
318
- }
319
- .submit {
320
- position: fixed;
321
- bottom: 0;
322
- left: 0;
323
- width: 100%;
324
- box-shadow: 0px -1px 12px 0px rgba(173, 173, 173, 0.1);
325
- height: 90px;
326
- display: flex;
327
- justify-content: space-between;
328
- align-items: center;
329
- padding: 0 12px;
330
- z-index: 2;
331
- background-color: #fff;
332
- span {
333
- background-color: #266fe8;
334
- width: 68%;
335
- font-size: 15px;
336
- color: #fff;
337
- height: 44px;
338
- text-align: center;
339
- display: flex;
340
- justify-content: center;
341
- align-items: center;
342
- }
343
- }
344
- }
345
- </style>