change configuration & add talabBedehi

This commit is contained in:
2026-05-25 10:49:08 +03:30
parent 5f5d9aef6a
commit 06568c5858
9 changed files with 255 additions and 107 deletions
+30 -8
View File
@@ -15,7 +15,7 @@
<component :is="selectedComponent" class="mr-5" />-->
<!-- <BasicShowContext title="پروژه ها"> <Search /> </BasicShowContext>-->
</div>
<!-- </BasicMainCard>-->n
<!-- </BasicMainCard>-->
<BasicModal
v-model:visible="addUserVisible"
width="50rem"
@@ -366,6 +366,9 @@
@close="showMoneyWalletCharge = false"
>
<a-form :model="formCharge" ref="formChargeRef" autocomplete="off">
<a-form-item name="talabBedehi">
<a-checkbox v-model:checked="formCharge.talabBedehi">طلب/بدهی</a-checkbox>
</a-form-item>
<a-form-item label="مقدار شارژ " name="value" :rules="inputRules()">
<BasicInput addon-before="ریال" v-model:value="formCharge.value" type="price"/>
<div v-show="formCharge.value > 10">
@@ -386,6 +389,9 @@
@close="showGoldWalletCharge = false"
>
<a-form :model="formCharge" ref="formChargeRef" autocomplete="off">
<a-form-item name="talabBedehi">
<a-checkbox v-model:checked="formCharge.talabBedehi">طلب/بدهی</a-checkbox>
</a-form-item>
<a-form-item label="مقدار شارژ " name="value" :rules="inputRules()">
<BasicInput addon-before="گرم" v-model:value="formCharge.value" type="number"/>
<!-- <div v-show="formCharge.value > 10">
@@ -734,22 +740,39 @@ async function add() {
loading.value = false;
}
function resetFormCharge(customerId: number) {
formCharge.value = {
customer_id: customerId,
value: undefined,
note: undefined,
talabBedehi: false
};
}
function buildChargePayload(): Charge {
return {
value: formCharge.value.value,
note: formCharge.value.note,
customer_id: formCharge.value.customer_id,
talabBedehi: formCharge.value.talabBedehi === true
};
}
async function walletMoneyCharge(val: Customer) {
resetFormCharge(val.id);
showMoneyWalletCharge.value = true;
formCharge.value.customer_id = val.id;
}
async function walletGoldCharge(val: Customer) {
resetFormCharge(val.id);
showGoldWalletCharge.value = true;
formCharge.value.customer_id = val.id;
}
async function chargeMoneyWallet() {
formChargeRef.value?.validateFields().then(async () => {
try {
loading.value = true;
await chargeWallet(formCharge.value, "money");
formCharge.value.value = undefined;
await chargeWallet(buildChargePayload(), "money");
message.success("افزایش اعتبار با موفقیت انجام شد");
showMoneyWalletCharge.value = false;
} catch (e) {
@@ -764,10 +787,9 @@ async function chargeGoldWallet() {
formChargeRef.value?.validateFields().then(async () => {
try {
loading.value = true;
await chargeWallet(formCharge.value, "gold");
formCharge.value.value = undefined;
await chargeWallet(buildChargePayload(), "gold");
message.success("افزایش اعتبار با موفقیت انجام شد");
showMoneyWalletCharge.value = false;
showGoldWalletCharge.value = false;
} catch (e) {
console.log(e);
} finally {