added charge for all product

This commit is contained in:
2026-07-11 11:42:12 +03:30
parent 65fe1c3996
commit 2647a50698
12 changed files with 463 additions and 478 deletions
@@ -131,20 +131,11 @@
</div>
</BasicActionSheet>
<BasicModal
<WalletChargeModal
v-model:visible="showWalletCharge"
width="30rem"
title="شارژ کیف پول"
@ok="charge"
:loading="loading"
@close="showWalletCharge = false"
>
<a-form :model="formCharge" ref="formChargeRef" autocomplete="off">
<a-form-item label="مقدار شارژ (ریال)" name="value" :rules="inputRules()">
<BasicInput v-model:value="formCharge.value" type="number" />
</a-form-item>
</a-form>
</BasicModal>
:customer-id="chargeCustomerId"
@success="refreshTable"
/>
</div>
</template>
@@ -167,9 +158,7 @@ import { cloneDeep } from 'lodash'
import type { Item } from '@/model/Item'
import type { Customer } from '@/model/customer'
import { createCustomer, deleteCustomer, updateCustomer } from '@/api/customer'
import type { Charge } from '@/model/wallet'
import customers from '@/router/routes/customers'
import { chargeWallet } from '@/api/wallet'
import WalletChargeModal from '@/pages/menuPages/customers/base/components/WalletChargeModal.vue'
//loading
const loading = ref<boolean>(false)
@@ -197,12 +186,11 @@ const confirmItems: Array<Item> = [
//wallet
const showWalletCharge = ref<boolean>(false)
const chargeCustomerId = ref<number | null>(null)
//form
const form = ref<Customer>({})
const formCharge = ref<Charge>({})
const formRef = ref<FormInstance>()
const formChargeRef = ref<FormInstance>()
const userInfo = ref<Customer>()
//info
@@ -234,23 +222,8 @@ async function add() {
}
async function walletCharge(val: Customer) {
chargeCustomerId.value = val.id
showWalletCharge.value = true
formCharge.value.customer_id = val.id
}
async function charge() {
formChargeRef.value?.validateFields().then(async () => {
try {
loading.value = true
await chargeMoneyWallet(formCharge.value)
message.success('افزایش اعتبار با موفقیت انجام شد')
showWalletCharge.value = false
} catch (e) {
console.log(e)
} finally {
loading.value = false
}
})
}
//reset data