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.
@@ -0,0 +1,141 @@
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 { multiple } = defineProps(['multiple'])
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(multiple)
64
+ }
65
+ showLoading.value = true
66
+ try {
67
+ const res: any = await __uploadInvoice(fd)
68
+ if (res.code === 200) {
69
+ showToast({
70
+ type: 'success',
71
+ message: '上传成功',
72
+ })
73
+ emit('uploadSuccess', res.data)
74
+ }
75
+ } catch (err: any) {
76
+ console.log(err)
77
+ showFailToast(err.msg)
78
+ }
79
+ showLoading.value = false
80
+ }
81
+ </script>
82
+ <style scoped lang="scss">
83
+ .PaymentMode {
84
+ width: 100%;
85
+ height: 100%;
86
+ padding: 20px 12px 0;
87
+ background-color: #f3f4f6;
88
+ .title {
89
+ font-size: 14px;
90
+ font-weight: 600;
91
+ }
92
+ .list {
93
+ .method-item {
94
+ width: 100%;
95
+ height: 60px;
96
+ background-color: #fff;
97
+ margin-top: 12px;
98
+ display: flex;
99
+ align-items: center;
100
+ justify-content: space-between;
101
+ padding: 0 12px;
102
+ .left-text {
103
+ // display: flex;
104
+ // align-items: center;
105
+ // gap: 11px;
106
+ // font-size: 16px;
107
+ // font-weight: 700;
108
+ display: grid;
109
+ grid-auto-flow: column;
110
+ grid-template-columns: auto;
111
+ grid-template-rows: auto;
112
+ grid-gap: 11px;
113
+ font-size: 16px;
114
+ font-weight: 700;
115
+ span {
116
+ align-self: center;
117
+ }
118
+ .icon-left {
119
+ i {
120
+ font-size: 22px;
121
+ font-weight: initial;
122
+ }
123
+ }
124
+ }
125
+ .right-icon {
126
+ background-color: rgba(38, 111, 232, 0.1);
127
+ border-radius: 50%;
128
+ width: 24px;
129
+ height: 24px;
130
+ display: flex;
131
+ justify-content: center;
132
+ align-items: center;
133
+ i {
134
+ color: #266fe8;
135
+ font-size: 12px;
136
+ }
137
+ }
138
+ }
139
+ }
140
+ }
141
+ </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 }