mg-ocr-invoice 0.1.7 → 0.1.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.
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "mg-ocr-invoice",
3
3
  "private": false,
4
- "version": "0.1.7",
4
+ "version": "0.1.8",
5
5
  "type": "module",
6
6
  "types": "dist/types/index.d.ts",
7
7
  "module": "dist/index.es.js",
8
8
  "main": "dist/index.umd.js",
9
9
  "files": [
10
- "dist"
10
+ "dist",
11
+ "src/components"
11
12
  ],
12
13
  "scripts": {
13
14
  "dev": "vite",
@@ -0,0 +1,334 @@
1
+ <template>
2
+ <div class="Invoice">
3
+ <div class="top">
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 { showToast, Overlay, Loading, showFailToast } from 'vant'
118
+ import { ElInputNumber } from 'element-plus'
119
+ const { ids, invoiceData } = defineProps({
120
+ ids: {
121
+ type: Object,
122
+ required: true,
123
+ },
124
+ invoiceData: {
125
+ type: Object,
126
+ required: true,
127
+ },
128
+ })
129
+ const emit = defineEmits(['saveSuccess'])
130
+ document.title = '发票信息'
131
+ const showRequiredMsg = ref(false)
132
+ // const modules = ref([Pagination])
133
+ const showLoading = ref(false)
134
+ const close = () => {
135
+ emit('saveSuccess')
136
+ }
137
+ const editFlag = ref(false)
138
+ const submit = async () => {
139
+ if (!editFlag.value) {
140
+ emit('saveSuccess')
141
+ return
142
+ }
143
+ if (!invoiceData.invoiceNum) {
144
+ showRequiredMsg.value = true
145
+ return
146
+ } else {
147
+ showRequiredMsg.value = false
148
+ }
149
+ showLoading.value = true
150
+ try {
151
+ const res: any = await __updateInvoice({
152
+ ...ids,
153
+ invoiceNum: invoiceData.invoiceNum,
154
+ invoiceCode: invoiceData.invoiceCode,
155
+ })
156
+ if (res.code === 200) {
157
+ showToast({
158
+ type: 'success',
159
+ message: '保存成功',
160
+ })
161
+ emit('saveSuccess')
162
+ }
163
+ } catch (err: any) {
164
+ showFailToast(err.msg)
165
+ emit('saveSuccess')
166
+ }
167
+ showLoading.value = false
168
+ }
169
+ </script>
170
+
171
+ <style lang="scss" scoped>
172
+ ::v-deep {
173
+ .el-input-number {
174
+ width: 100%;
175
+ }
176
+ .el-input {
177
+ .el-input__wrapper {
178
+ width: 100%;
179
+ padding: 0 !important;
180
+ box-shadow: none;
181
+ }
182
+ .el-input__inner {
183
+ width: 100%;
184
+ text-align: left;
185
+ box-shadow: none;
186
+ padding: 0 !important;
187
+ }
188
+ }
189
+ }
190
+ * {
191
+ padding: 0;
192
+ margin: 0;
193
+ box-sizing: border-box;
194
+ }
195
+ .Invoice {
196
+ padding-bottom: 100px;
197
+ width: 100%;
198
+ min-height: 100%;
199
+ background-color: #f3f4f6;
200
+ .top {
201
+ width: 100%;
202
+ padding: 12px 4px;
203
+ img {
204
+ width: 100%;
205
+ height: 179px;
206
+ display: block;
207
+ }
208
+ }
209
+
210
+ .company {
211
+ height: inherit;
212
+ padding: 0 12px;
213
+ background-color: #fff;
214
+ .title {
215
+ padding: 18px 0;
216
+ font-size: 16px;
217
+ font-weight: 500;
218
+ display: flex;
219
+ align-items: center;
220
+ border-bottom: 1px dashed #e8e8e8;
221
+ margin-bottom: 18px;
222
+ i {
223
+ display: inline-block;
224
+ width: 4px;
225
+ height: 14px;
226
+ background: #266fe8;
227
+ border-radius: 2px;
228
+ }
229
+
230
+ span {
231
+ font-size: 16px;
232
+ padding-left: 8px;
233
+ }
234
+ }
235
+ .cardText {
236
+ .card {
237
+ margin-top: 8px;
238
+ border-radius: 4px;
239
+ background-color: #f6f6f6;
240
+ font-size: 14px;
241
+ .companyName {
242
+ padding: 15px;
243
+ }
244
+ .sellerInformation {
245
+ padding-left: 12px;
246
+ padding-bottom: 20px;
247
+ li {
248
+ list-style: none;
249
+ margin-bottom: 12px;
250
+ display: flex;
251
+ align-items: center;
252
+ i {
253
+ width: 4px;
254
+ height: 4px;
255
+ border-radius: 50%;
256
+ background-color: #266fe8;
257
+ }
258
+ .label {
259
+ width: 120px;
260
+ margin-left: 12px;
261
+ white-space: nowrap;
262
+ }
263
+ .value {
264
+ flex: 1;
265
+ }
266
+ }
267
+ }
268
+ }
269
+ }
270
+ .purchaser {
271
+ ul {
272
+ li {
273
+ display: flex;
274
+ font-size: 16px;
275
+ height: 50px;
276
+ align-items: center;
277
+ gap: 45px;
278
+ .label {
279
+ width: 80px;
280
+ white-space: nowrap;
281
+ position: relative;
282
+ .van-field__label--required {
283
+ position: absolute;
284
+ top: 0;
285
+ left: -8px;
286
+ }
287
+ }
288
+ .input {
289
+ flex-grow: 1;
290
+ color: #999999;
291
+
292
+ input {
293
+ width: 100%;
294
+ color: #999999;
295
+ outline: none;
296
+ font-size: 16px;
297
+ border: none;
298
+ }
299
+ .errColor {
300
+ color: red;
301
+ font-size: 12px;
302
+ }
303
+ }
304
+ }
305
+ }
306
+ }
307
+ }
308
+ .submit {
309
+ position: fixed;
310
+ bottom: 0;
311
+ left: 0;
312
+ width: 100%;
313
+ box-shadow: 0px -1px 12px 0px rgba(173, 173, 173, 0.1);
314
+ height: 90px;
315
+ display: flex;
316
+ justify-content: space-between;
317
+ align-items: center;
318
+ padding: 0 12px;
319
+ z-index: 2;
320
+ background-color: #fff;
321
+ span {
322
+ background-color: #266fe8;
323
+ width: 68%;
324
+ font-size: 15px;
325
+ color: #fff;
326
+ height: 44px;
327
+ text-align: center;
328
+ display: flex;
329
+ justify-content: center;
330
+ align-items: center;
331
+ }
332
+ }
333
+ }
334
+ </style>
@@ -0,0 +1,46 @@
1
+ export const const_invoiceStatus: any = {
2
+ invalid: '无效发票',
3
+ unused: '未使用',
4
+ using: '使用中',
5
+ used: '已使用',
6
+ }
7
+ export const const_realStatus: any = {
8
+ noNeed: '无需验真',
9
+ notCheck: '未验真',
10
+ checked: '已验真',
11
+ checkFail: '验真失败',
12
+ }
13
+ export const const_taskStatus: any = {
14
+ init: '初始状态',
15
+ upload_fail_cos: 'COS 上传失败',
16
+ upload_fail_nuonuo: '诺诺上传失败',
17
+ initiate_ocr_fail: '发起识别失败',
18
+ ocr_doing: '识别中',
19
+ ocr_fail: '识别失败',
20
+ ocr_success: '识别成功',
21
+ repeat: '数据库存在相同发票',
22
+ finish: '处理正常结束',
23
+ }
24
+ export const setClass = (type: any) => {
25
+ switch (type) {
26
+ case 'invalid':
27
+ return 'error'
28
+ case 'unused':
29
+ return 'warning'
30
+ case 'using':
31
+ return 'ok'
32
+ case 'used':
33
+ return 'default'
34
+
35
+ case 'noNeed':
36
+ return 'ok'
37
+ case 'notCheck':
38
+ return 'warning'
39
+ case 'checked':
40
+ return 'ok'
41
+ case 'checkFail':
42
+ return 'error'
43
+ default:
44
+ return 'ok'
45
+ }
46
+ }