fix bugs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<a-form
|
||||
:model="form"
|
||||
:model="modelValue"
|
||||
ref="formRef"
|
||||
autocomplete="off"
|
||||
class="wallet-charge-form"
|
||||
@@ -8,7 +8,7 @@
|
||||
>
|
||||
<a-form-item label="نوع عملیات" name="direction">
|
||||
<a-radio-group
|
||||
v-model:value="form.direction"
|
||||
v-model:value="modelValue.direction"
|
||||
button-style="solid"
|
||||
class="wallet-charge-form__direction w-full"
|
||||
>
|
||||
@@ -29,29 +29,29 @@
|
||||
</div>
|
||||
|
||||
<a-form-item name="talabBedehi">
|
||||
<a-checkbox v-model:checked="form.talabBedehi">طلب/بدهی</a-checkbox>
|
||||
<a-checkbox v-model:checked="modelValue.talabBedehi">طلب/بدهی</a-checkbox>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :label="amountLabel" name="amountAbs" :rules="amountRules">
|
||||
<BasicInput
|
||||
v-model:value="form.amountAbs"
|
||||
v-model:value="modelValue.amountAbs"
|
||||
:addon-before="unit"
|
||||
:type="variant === 'money' ? 'price' : 'number'"
|
||||
:place-holder="amountPlaceholder"
|
||||
/>
|
||||
<div v-if="variant === 'money' && Number(form.amountAbs) > 10" class="wallet-charge-form__hint">
|
||||
معادل {{ usePrice(Number(form.amountAbs) / 10, true, 'تومان') }}
|
||||
<div v-if="variant === 'money' && Number(modelValue.amountAbs) > 10" class="wallet-charge-form__hint">
|
||||
معادل {{ usePrice(Number(modelValue.amountAbs) / 10, true, 'تومان') }}
|
||||
</div>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :label="noteLabel" name="note" :rules="inputRules()">
|
||||
<BasicInput v-model:value="form.note" :place-holder="notePlaceholder" />
|
||||
<BasicInput v-model:value="modelValue.note" :place-holder="notePlaceholder" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { computed, ref } from 'vue'
|
||||
import type { FormInstance } from 'ant-design-vue'
|
||||
import type { Charge } from '@/model/wallet'
|
||||
import { inputRules } from '@/utils/inputRules'
|
||||
@@ -62,32 +62,10 @@ const props = defineProps<{
|
||||
modelValue: Charge
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: Charge]
|
||||
}>()
|
||||
|
||||
const form = ref<Charge>({ ...props.modelValue })
|
||||
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(value) => {
|
||||
form.value = { ...value }
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
watch(
|
||||
form,
|
||||
(value) => {
|
||||
emit('update:modelValue', { ...value })
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
|
||||
const unit = computed(() => (props.variant === 'money' ? 'ریال' : 'گرم'))
|
||||
const isDischarge = computed(() => form.value.direction === 'discharge')
|
||||
const isDischarge = computed(() => props.modelValue.direction === 'discharge')
|
||||
|
||||
const formClass = computed(() =>
|
||||
isDischarge.value ? 'wallet-charge-form--discharge' : 'wallet-charge-form--charge'
|
||||
|
||||
@@ -229,7 +229,7 @@
|
||||
@ok="chargeMoneyWallet"
|
||||
@close="showMoneyWalletCharge = false"
|
||||
>
|
||||
<WalletChargeForm ref="moneyChargeFormRef" v-model="formCharge" variant="money" />
|
||||
<WalletChargeForm ref="moneyChargeFormRef" :model-value="formCharge" variant="money" />
|
||||
</BasicActionSheet>
|
||||
<BasicModal
|
||||
v-else
|
||||
@@ -241,7 +241,7 @@
|
||||
:loading="loading"
|
||||
@close="showMoneyWalletCharge = false"
|
||||
>
|
||||
<WalletChargeForm ref="moneyChargeFormRef" v-model="formCharge" variant="money" />
|
||||
<WalletChargeForm ref="moneyChargeFormRef" :model-value="formCharge" variant="money" />
|
||||
</BasicModal>
|
||||
|
||||
<BasicActionSheet
|
||||
@@ -258,7 +258,7 @@
|
||||
@ok="chargeGoldWallet"
|
||||
@close="showGoldWalletCharge = false"
|
||||
>
|
||||
<WalletChargeForm ref="goldChargeFormRef" v-model="formCharge" variant="gold" />
|
||||
<WalletChargeForm ref="goldChargeFormRef" :model-value="formCharge" variant="gold" />
|
||||
</BasicActionSheet>
|
||||
<BasicModal
|
||||
v-else
|
||||
@@ -270,7 +270,7 @@
|
||||
:loading="loading"
|
||||
@close="showGoldWalletCharge = false"
|
||||
>
|
||||
<WalletChargeForm ref="goldChargeFormRef" v-model="formCharge" variant="gold" />
|
||||
<WalletChargeForm ref="goldChargeFormRef" :model-value="formCharge" variant="gold" />
|
||||
</BasicModal>
|
||||
<BasicInfoModal
|
||||
v-model:visible="userInfoOrderVisible"
|
||||
|
||||
Reference in New Issue
Block a user