af-mobile-client-vue3 1.4.67 → 1.4.69

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,202 +1,202 @@
1
- <script setup lang="ts">
2
- import CardHeader from '@af-mobile-client-vue3/components/data/CardContainer/CardHeader.vue'
3
- import { computed, ref } from 'vue'
4
- // import useBusinessStore from '@/stores/modules/business'
5
-
6
- interface PaymentMethod {
7
- label: string
8
- value: string
9
- icon: string
10
- color: string
11
- }
12
-
13
- const props = defineProps({
14
- modelValue: {
15
- type: String,
16
- required: true,
17
- },
18
- title: {
19
- type: String,
20
- default: '支付方式',
21
- },
22
- allowedMethods: {
23
- type: Array as () => string[],
24
- default: null,
25
- },
26
- icon: {
27
- type: String,
28
- default: 'fa-credit-card',
29
- },
30
- user: {
31
- type: Object,
32
- default: () => {},
33
- },
34
- })
35
-
36
- const emit = defineEmits(['update:modelValue'])
37
- const businessStore = props.user
38
- const userInfo = ref({ ...businessStore })
39
- const defaultMethods: PaymentMethod[] = [
40
- {
41
- value: '现金缴费',
42
- label: '现金缴费',
43
- icon: 'i-fa6-solid-money-bill-wave',
44
- color: 'red',
45
- },
46
- {
47
- value: '扫码支付',
48
- label: '扫码支付',
49
- icon: 'i-fa6-solid-qrcode',
50
- color: 'blue',
51
- },
52
- {
53
- value: '微信支付',
54
- label: '微信支付',
55
- icon: 'i-fa-brands-weixin',
56
- color: 'green',
57
- },
58
- {
59
- value: '支付宝支付',
60
- label: '支付宝支付',
61
- icon: 'i-fa-brands-alipay',
62
- color: 'blue',
63
- },
64
- ]
65
-
66
- const displayMethods = computed(() => {
67
- if (userInfo.value.f_orgid === '1767') {
68
- return defaultMethods.filter(method =>
69
- method.value === '微信支付',
70
- )
71
- }
72
- else {
73
- if (!props.allowedMethods) {
74
- return defaultMethods
75
- }
76
- return defaultMethods.filter(method =>
77
- props.allowedMethods.includes(method.value),
78
- )
79
- }
80
- })
81
-
82
- function handleSelect(value: string) {
83
- console.log(value)
84
- emit('update:modelValue', value)
85
- }
86
- </script>
87
-
88
- <template>
89
- <div class="payment-method-selector">
90
- <div class="payment-method-selector__header">
91
- <CardHeader :title="title" />
92
- </div>
93
- <div class="payment-method-selector__body">
94
- <div class="payment-method-selector__grid">
95
- <div
96
- v-for="method in displayMethods"
97
- :key="method.value"
98
- class="payment-method-selector__item"
99
- :class="{ 'payment-method-selector__item--active': modelValue === method.value }"
100
- @click="handleSelect(method.value)"
101
- >
102
- <div class="payment-method-selector__icon-wrap" :class="`payment-method-selector__icon-wrap--${method.color}`">
103
- <div class="payment-method-selector__icon" :class="[method.icon]" />
104
- </div>
105
- <span class="payment-method-selector__label" :class="{ 'payment-method-selector__label--active': modelValue === method.value }">
106
- {{ method.label }}
107
- </span>
108
- </div>
109
- </div>
110
- </div>
111
- </div>
112
- </template>
113
-
114
- <style lang="less" scoped>
115
- .payment-method-selector {
116
- &__header {
117
- margin-bottom: 12px;
118
- }
119
-
120
- &__grid {
121
- display: grid;
122
- grid-template-columns: repeat(2, 1fr);
123
- gap: 12px;
124
-
125
- @media (min-width: 768px) {
126
- grid-template-columns: repeat(4, 1fr);
127
- }
128
- }
129
-
130
- &__item {
131
- display: flex;
132
- align-items: center;
133
- padding: 8px;
134
- cursor: pointer;
135
- border: 1px solid #e5e7eb;
136
- border-radius: 8px;
137
- background-color: #fff;
138
- transition: all 0.2s ease;
139
-
140
- &:hover {
141
- background-color: #f9fafb;
142
- }
143
-
144
- &--active {
145
- background-color: #ebf5ff;
146
- border-color: #3b82f6;
147
- box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
148
- }
149
- }
150
-
151
- &__icon-wrap {
152
- width: 32px;
153
- height: 32px;
154
- border-radius: 50%;
155
- display: flex;
156
- align-items: center;
157
- justify-content: center;
158
- margin-right: 8px;
159
- flex-shrink: 0;
160
-
161
- &--green {
162
- background-color: #dcfce7;
163
-
164
- .payment-method-selector__icon {
165
- color: #16a34a;
166
- }
167
- }
168
-
169
- &--blue {
170
- background-color: #dbeafe;
171
-
172
- .payment-method-selector__icon {
173
- color: #2563eb;
174
- }
175
- }
176
-
177
- &--red {
178
- background-color: #fff0f0;
179
-
180
- .payment-method-selector__icon {
181
- color: #d32f2f;
182
- }
183
- }
184
- }
185
-
186
- &__icon {
187
- width: 16px;
188
- height: 16px;
189
- display: inline-block;
190
- }
191
-
192
- &__label {
193
- font-size: 12px;
194
- font-weight: 500;
195
- color: #6b7280;
196
-
197
- &--active {
198
- color: #2563eb;
199
- }
200
- }
201
- }
202
- </style>
1
+ <script setup lang="ts">
2
+ import CardHeader from '@af-mobile-client-vue3/components/data/CardContainer/CardHeader.vue'
3
+ import { computed, ref } from 'vue'
4
+ // import useBusinessStore from '@/stores/modules/business'
5
+
6
+ interface PaymentMethod {
7
+ label: string
8
+ value: string
9
+ icon: string
10
+ color: string
11
+ }
12
+
13
+ const props = defineProps({
14
+ modelValue: {
15
+ type: String,
16
+ required: true,
17
+ },
18
+ title: {
19
+ type: String,
20
+ default: '支付方式',
21
+ },
22
+ allowedMethods: {
23
+ type: Array as () => string[],
24
+ default: null,
25
+ },
26
+ icon: {
27
+ type: String,
28
+ default: 'fa-credit-card',
29
+ },
30
+ user: {
31
+ type: Object,
32
+ default: () => {},
33
+ },
34
+ })
35
+
36
+ const emit = defineEmits(['update:modelValue'])
37
+ const businessStore = props.user
38
+ const userInfo = ref({ ...businessStore })
39
+ const defaultMethods: PaymentMethod[] = [
40
+ {
41
+ value: '现金缴费',
42
+ label: '现金缴费',
43
+ icon: 'i-fa6-solid-money-bill-wave',
44
+ color: 'red',
45
+ },
46
+ {
47
+ value: '扫码支付',
48
+ label: '扫码支付',
49
+ icon: 'i-fa6-solid-qrcode',
50
+ color: 'blue',
51
+ },
52
+ {
53
+ value: '微信支付',
54
+ label: '微信支付',
55
+ icon: 'i-fa-brands-weixin',
56
+ color: 'green',
57
+ },
58
+ {
59
+ value: '支付宝支付',
60
+ label: '支付宝支付',
61
+ icon: 'i-fa-brands-alipay',
62
+ color: 'blue',
63
+ },
64
+ ]
65
+
66
+ const displayMethods = computed(() => {
67
+ if (userInfo.value.f_orgid === '1767') {
68
+ return defaultMethods.filter(method =>
69
+ method.value === '微信支付',
70
+ )
71
+ }
72
+ else {
73
+ if (!props.allowedMethods) {
74
+ return defaultMethods
75
+ }
76
+ return defaultMethods.filter(method =>
77
+ props.allowedMethods.includes(method.value),
78
+ )
79
+ }
80
+ })
81
+
82
+ function handleSelect(value: string) {
83
+ console.log(value)
84
+ emit('update:modelValue', value)
85
+ }
86
+ </script>
87
+
88
+ <template>
89
+ <div class="payment-method-selector">
90
+ <div class="payment-method-selector__header">
91
+ <CardHeader :title="title" />
92
+ </div>
93
+ <div class="payment-method-selector__body">
94
+ <div class="payment-method-selector__grid">
95
+ <div
96
+ v-for="method in displayMethods"
97
+ :key="method.value"
98
+ class="payment-method-selector__item"
99
+ :class="{ 'payment-method-selector__item--active': modelValue === method.value }"
100
+ @click="handleSelect(method.value)"
101
+ >
102
+ <div class="payment-method-selector__icon-wrap" :class="`payment-method-selector__icon-wrap--${method.color}`">
103
+ <div class="payment-method-selector__icon" :class="[method.icon]" />
104
+ </div>
105
+ <span class="payment-method-selector__label" :class="{ 'payment-method-selector__label--active': modelValue === method.value }">
106
+ {{ method.label }}
107
+ </span>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </template>
113
+
114
+ <style lang="less" scoped>
115
+ .payment-method-selector {
116
+ &__header {
117
+ margin-bottom: 12px;
118
+ }
119
+
120
+ &__grid {
121
+ display: grid;
122
+ grid-template-columns: repeat(2, 1fr);
123
+ gap: 12px;
124
+
125
+ @media (min-width: 768px) {
126
+ grid-template-columns: repeat(4, 1fr);
127
+ }
128
+ }
129
+
130
+ &__item {
131
+ display: flex;
132
+ align-items: center;
133
+ padding: 8px;
134
+ cursor: pointer;
135
+ border: 1px solid #e5e7eb;
136
+ border-radius: 8px;
137
+ background-color: #fff;
138
+ transition: all 0.2s ease;
139
+
140
+ &:hover {
141
+ background-color: #f9fafb;
142
+ }
143
+
144
+ &--active {
145
+ background-color: #ebf5ff;
146
+ border-color: #3b82f6;
147
+ box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.2);
148
+ }
149
+ }
150
+
151
+ &__icon-wrap {
152
+ width: 32px;
153
+ height: 32px;
154
+ border-radius: 50%;
155
+ display: flex;
156
+ align-items: center;
157
+ justify-content: center;
158
+ margin-right: 8px;
159
+ flex-shrink: 0;
160
+
161
+ &--green {
162
+ background-color: #dcfce7;
163
+
164
+ .payment-method-selector__icon {
165
+ color: #16a34a;
166
+ }
167
+ }
168
+
169
+ &--blue {
170
+ background-color: #dbeafe;
171
+
172
+ .payment-method-selector__icon {
173
+ color: #2563eb;
174
+ }
175
+ }
176
+
177
+ &--red {
178
+ background-color: #fff0f0;
179
+
180
+ .payment-method-selector__icon {
181
+ color: #d32f2f;
182
+ }
183
+ }
184
+ }
185
+
186
+ &__icon {
187
+ width: 16px;
188
+ height: 16px;
189
+ display: inline-block;
190
+ }
191
+
192
+ &__label {
193
+ font-size: 12px;
194
+ font-weight: 500;
195
+ color: #6b7280;
196
+
197
+ &--active {
198
+ color: #2563eb;
199
+ }
200
+ }
201
+ }
202
+ </style>
@@ -1,45 +1,45 @@
1
- <script setup lang="ts">
2
- import CardContainer from '@af-mobile-client-vue3/components/data/CardContainer/CardContainer.vue'
3
- import PaymentMethodSelector from './PaymentMethodSelector.vue'
4
-
5
- defineProps({
6
- modelValue: {
7
- type: String,
8
- required: true,
9
- },
10
- title: {
11
- type: String,
12
- default: '支付方式',
13
- },
14
- allowedMethods: {
15
- type: Array as () => string[],
16
- default: null,
17
- },
18
- className: {
19
- type: String,
20
- default: '',
21
- },
22
- user: {
23
- type: Object,
24
- default: () => {},
25
- },
26
- })
27
-
28
- const emit = defineEmits(['update:modelValue'])
29
-
30
- function handleUpdate(value: string) {
31
- emit('update:modelValue', value)
32
- }
33
- </script>
34
-
35
- <template>
36
- <CardContainer :class="className">
37
- <PaymentMethodSelector
38
- :model-value="modelValue"
39
- :title="title"
40
- :allowed-methods="allowedMethods"
41
- :user="user"
42
- @update:model-value="handleUpdate"
43
- />
44
- </CardContainer>
45
- </template>
1
+ <script setup lang="ts">
2
+ import CardContainer from '@af-mobile-client-vue3/components/data/CardContainer/CardContainer.vue'
3
+ import PaymentMethodSelector from './PaymentMethodSelector.vue'
4
+
5
+ defineProps({
6
+ modelValue: {
7
+ type: String,
8
+ required: true,
9
+ },
10
+ title: {
11
+ type: String,
12
+ default: '支付方式',
13
+ },
14
+ allowedMethods: {
15
+ type: Array as () => string[],
16
+ default: null,
17
+ },
18
+ className: {
19
+ type: String,
20
+ default: '',
21
+ },
22
+ user: {
23
+ type: Object,
24
+ default: () => {},
25
+ },
26
+ })
27
+
28
+ const emit = defineEmits(['update:modelValue'])
29
+
30
+ function handleUpdate(value: string) {
31
+ emit('update:modelValue', value)
32
+ }
33
+ </script>
34
+
35
+ <template>
36
+ <CardContainer :class="className">
37
+ <PaymentMethodSelector
38
+ :model-value="modelValue"
39
+ :title="title"
40
+ :allowed-methods="allowedMethods"
41
+ :user="user"
42
+ @update:model-value="handleUpdate"
43
+ />
44
+ </CardContainer>
45
+ </template>