added pdf in withdraw and deposit and fix bug
This commit is contained in:
@@ -10,6 +10,13 @@
|
||||
<template #unCheckedChildren>غیرفعال</template>
|
||||
</a-switch>
|
||||
|
||||
<ZaarboxPriceKeyField
|
||||
v-else-if="isZaarboxPriceKey"
|
||||
:model-value="modelValue"
|
||||
:disabled="disabled"
|
||||
@update:value="emit('update:value', $event)"
|
||||
/>
|
||||
|
||||
<a-select
|
||||
v-else-if="fieldType === 'select'"
|
||||
:value="modelValue || undefined"
|
||||
@@ -54,6 +61,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import ZaarboxPriceKeyField from './ZaarboxPriceKeyField.vue'
|
||||
import {
|
||||
isSwitchOn,
|
||||
parseSelectOptions,
|
||||
@@ -83,6 +91,8 @@ const fieldType = computed<SettingFieldType>(() =>
|
||||
})
|
||||
)
|
||||
|
||||
const isZaarboxPriceKey = computed(() => props.settingKey === 'zaarbox_price_key')
|
||||
|
||||
const selectItems = computed(() =>
|
||||
parseSelectOptions({
|
||||
key: props.settingKey,
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<a-select
|
||||
:value="modelValue || undefined"
|
||||
:disabled="disabled"
|
||||
:loading="loading"
|
||||
allow-clear
|
||||
show-search
|
||||
placeholder="انتخاب محصول زرباکس"
|
||||
class="w-full"
|
||||
option-filter-prop="label"
|
||||
@update:value="onSelectChange"
|
||||
>
|
||||
<a-select-option
|
||||
v-for="item in allOptions"
|
||||
:key="item.key"
|
||||
:value="item.key"
|
||||
:label="`${item.name} ${item.key}`"
|
||||
>
|
||||
<div class="leading-snug">
|
||||
<div>{{ item.name }}</div>
|
||||
<div class="text-xs text-gray-400 direction-ltr text-right">{{ item.key }}</div>
|
||||
</div>
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { getZaarboxProducts, type ZaarboxProductOption } from '@/api/price'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
modelValue: string
|
||||
disabled?: boolean
|
||||
}>(),
|
||||
{ disabled: false }
|
||||
)
|
||||
|
||||
const emit = defineEmits<{ 'update:value': [value: string] }>()
|
||||
|
||||
const loading = ref(false)
|
||||
const options = ref<ZaarboxProductOption[]>([])
|
||||
|
||||
const allOptions = computed(() => {
|
||||
const current = (props.modelValue ?? '').trim()
|
||||
if (!current || options.value.some((item) => item.key === current)) {
|
||||
return options.value
|
||||
}
|
||||
|
||||
return [
|
||||
{ key: current, name: current, id: '', category: '', active: true },
|
||||
...options.value,
|
||||
]
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
void loadOptions()
|
||||
})
|
||||
|
||||
async function loadOptions() {
|
||||
loading.value = true
|
||||
try {
|
||||
const response = await getZaarboxProducts()
|
||||
options.value = response?.data?.items ?? []
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
options.value = []
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onSelectChange(val: string | undefined) {
|
||||
emit('update:value', val ?? '')
|
||||
}
|
||||
</script>
|
||||
@@ -289,7 +289,7 @@ const SETTING_GROUPS: Array<{
|
||||
id: 'general',
|
||||
title: 'عمومی و اطلاعات اپ',
|
||||
icon: 'vuesax-linear:home-2',
|
||||
match: (k) => /^(name_|app_|admin_|server_|bace_|key$|color_|logo_|title_pwa|title_fav|metal_type)/.test(k)
|
||||
match: (k) => /^(name_|app_|admin_|server_|bace_|key$|color_|logo_|title_pwa|title_fav|metal_type|unit$)/.test(k)
|
||||
},
|
||||
{
|
||||
id: 'pricing',
|
||||
|
||||
@@ -75,6 +75,7 @@ const KEY_TYPE_FALLBACK: Record<string, SettingFieldType> = {
|
||||
external_order_api_enabled: 'switch',
|
||||
store_status: 'select',
|
||||
credit_rial_price_unit: 'select',
|
||||
zaarbox_price_key: 'select',
|
||||
node_client_id: 'text',
|
||||
node_shared_secret: 'text',
|
||||
support_messenger_id: 'text',
|
||||
@@ -99,6 +100,7 @@ const SELECT_OPTIONS_BY_KEY: Record<string, string> = {
|
||||
payping_gateway_name: 'sepal,',
|
||||
credit_rial_price_unit: 'gram,mesghal,unit',
|
||||
store_status: 'باز,بسته',
|
||||
unit: 'گرم,کیلوگرم',
|
||||
support_messenger: 'bale,telegram,whatsapp,rubika,eitaa,soroush'
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user