mg-ocr-invoice 0.1.7 → 0.1.9

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.
@@ -0,0 +1,145 @@
1
+ <template>
2
+ <div class="PaymentMode">
3
+ <div class="title">选择识别方式</div>
4
+ <div class="list">
5
+ <div
6
+ class="method-item"
7
+ @click="handleClickText(item.text)"
8
+ v-for="(item, index) in payList"
9
+ :key="item.id || index">
10
+ <div class="left-text">
11
+ <span class="icon-left">
12
+ <i class="iconfont" :class="item.leftIcon"></i>
13
+ </span>
14
+ <span class="text">{{ item.text }}</span>
15
+ </div>
16
+ <div class="right-icon">
17
+ <i class="iconfont icon-xiangyou"></i>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ <Overlay
23
+ style="display: flex; justify-content: center; align-items: center"
24
+ :show="showLoading">
25
+ <Loading class="loading" color="#0094ff">上传中...</Loading>
26
+ </Overlay>
27
+ </template>
28
+
29
+ <script setup lang="ts">
30
+ import { ref } from 'vue'
31
+ import '@/utils/disableZoom'
32
+ import { selectPhoto, takePhoto } from '@/utils/upload'
33
+ import { __uploadInvoice } from '@/api/invoice'
34
+ import { showToast, Overlay, Loading, showFailToast } from 'vant'
35
+ const props = defineProps(['multiple', 'batchId'])
36
+ const emit = defineEmits(['uploadSuccess'])
37
+ const payList: any = [
38
+ {
39
+ text: '拍照',
40
+ leftIcon: 'icon-xiangji',
41
+ },
42
+ {
43
+ text: '相册',
44
+ leftIcon: 'icon-xiangce',
45
+ },
46
+ // {
47
+ // text: '微信',
48
+ // leftIcon: 'icon-weixin3',
49
+ // },
50
+ // {
51
+ // text: '支付宝',
52
+ // leftIcon: 'icon-zhifubao',
53
+ // },
54
+ ]
55
+ document.title = '请选择添加费用方式'
56
+ const showLoading = ref(false)
57
+ const handleClickText = async (text: any) => {
58
+ let fd: any
59
+ if (text == '拍照') {
60
+ fd = await takePhoto()
61
+ }
62
+ if (text == '相册') {
63
+ fd = await selectPhoto(props.multiple)
64
+ }
65
+ if (props.batchId) {
66
+ fd.append('batchId', props.batchId)
67
+ }
68
+ console.log(props.batchId,'props.batchIdprops.batchIdprops.batchId')
69
+ showLoading.value = true
70
+ try {
71
+ const res: any = await __uploadInvoice(fd)
72
+ if (res.code === 200) {
73
+ showToast({
74
+ type: 'success',
75
+ message: '上传成功',
76
+ })
77
+ emit('uploadSuccess', res.data)
78
+ }
79
+ } catch (err: any) {
80
+ console.log(err)
81
+ showFailToast(err.msg)
82
+ }
83
+ showLoading.value = false
84
+ }
85
+ </script>
86
+ <style scoped lang="scss">
87
+ .PaymentMode {
88
+ width: 100%;
89
+ height: 100%;
90
+ padding: 20px 12px 0;
91
+ background-color: #f3f4f6;
92
+ .title {
93
+ font-size: 14px;
94
+ font-weight: 600;
95
+ }
96
+ .list {
97
+ .method-item {
98
+ width: 100%;
99
+ height: 60px;
100
+ background-color: #fff;
101
+ margin-top: 12px;
102
+ display: flex;
103
+ align-items: center;
104
+ justify-content: space-between;
105
+ padding: 0 12px;
106
+ .left-text {
107
+ // display: flex;
108
+ // align-items: center;
109
+ // gap: 11px;
110
+ // font-size: 16px;
111
+ // font-weight: 700;
112
+ display: grid;
113
+ grid-auto-flow: column;
114
+ grid-template-columns: auto;
115
+ grid-template-rows: auto;
116
+ grid-gap: 11px;
117
+ font-size: 16px;
118
+ font-weight: 700;
119
+ span {
120
+ align-self: center;
121
+ }
122
+ .icon-left {
123
+ i {
124
+ font-size: 22px;
125
+ font-weight: initial;
126
+ }
127
+ }
128
+ }
129
+ .right-icon {
130
+ background-color: rgba(38, 111, 232, 0.1);
131
+ border-radius: 50%;
132
+ width: 24px;
133
+ height: 24px;
134
+ display: flex;
135
+ justify-content: center;
136
+ align-items: center;
137
+ i {
138
+ color: #266fe8;
139
+ font-size: 12px;
140
+ }
141
+ }
142
+ }
143
+ }
144
+ }
145
+ </style>
@@ -0,0 +1,5 @@
1
+ import Invoice from './Invoice/index.vue'
2
+ import InvoiceList from './InvoiceList/index.vue'
3
+ import PaymentMode from './PaymentMode/index.vue'
4
+ import OCRInvoice from './OCRInvoice/index.vue'
5
+ export { Invoice, InvoiceList, PaymentMode, OCRInvoice }