Add customer multi-level referral profit editor and related settings UI.

Expose enable_customer_level_profit in config and let admins edit per-customer level percents from the customers table/mobile sheets.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-10 16:48:53 +03:30
co-authored by Cursor
parent 4dde172ed7
commit de97d7caa6
12 changed files with 252 additions and 21 deletions
@@ -108,6 +108,15 @@
<template #title><span>ویرایش</span></template>
<Icon icon="vuesax-linear:edit" color="#4572E9" />
</a-tooltip>
<a-tooltip
v-if="customerLevelProfitEnabled"
placement="bottom"
class="cursor-pointer"
@click="openLevelProfit(record)"
>
<template #title><span>سود چندسطحی معرف</span></template>
<Icon icon="vuesax-linear:hierarchy-2" color="#ca8a04" />
</a-tooltip>
<a-tooltip
:key="record.trade_active"
placement="bottom"
@@ -157,11 +166,18 @@
@confirmUser="openConfirmUser"
@sendSms="openDirectSms"
@editAccounting="openAccountingCodeEdit"
@levelProfit="openLevelProfit"
/>
</div>
<CustomerDirectSmsModal v-model:visible="directSmsVisible" :customer="directSmsCustomer" />
<CustomerLevelProfitModal
v-model:visible="levelProfitVisible"
:customer="levelProfitCustomer"
@success="fetch"
/>
<CustomerAccountingCodeModal
v-model:visible="accountingCodeVisible"
:customer="accountingCodeCustomer"
@@ -234,6 +250,7 @@ import {
import { buildCustomerColumns } from '@/pages/menuPages/customers/base/hooks/customerColumns'
import CustomerMobileCardList from '@/pages/menuPages/customers/base/components/CustomerMobileCardList.vue'
import CustomerDirectSmsModal from '@/pages/menuPages/customers/base/components/CustomerDirectSmsModal.vue'
import CustomerLevelProfitModal from '@/pages/menuPages/customers/base/components/CustomerLevelProfitModal.vue'
import CustomerAccountingCodeModal from '@/pages/menuPages/customers/base/components/CustomerAccountingCodeModal.vue'
import Icon from '@core/components/BaseIcon/src/Icon.vue'
import useBaseTable from '@core/components/BaseTable/hooks/useBaseTable'
@@ -251,6 +268,7 @@ import {
pargarEnabledSetting,
accountingProviderSetting,
customerDirectSmsEnabledSetting,
customerLevelProfitEnabledSetting,
initAccountingSettingsFromApi,
initWalletSettingsFromApi
} from '@/utils/config'
@@ -272,6 +290,9 @@ const pargarRegisterVisible = ref(false)
const pargarCustomer = ref<Customer>()
const pargarEnabled = pargarEnabledSetting
const customerDirectSmsEnabled = customerDirectSmsEnabledSetting
const customerLevelProfitEnabled = customerLevelProfitEnabledSetting
const levelProfitVisible = ref(false)
const levelProfitCustomer = ref<Customer | null>(null)
const accountingCodeVisible = ref(false)
const accountingCodeCustomer = ref<Customer | null>(null)
const accountingEnabled = computed(() => {
@@ -329,6 +350,11 @@ function openDirectSms(user: Customer) {
directSmsVisible.value = true
}
function openLevelProfit(user: Customer) {
levelProfitCustomer.value = user
levelProfitVisible.value = true
}
async function changeCustomerActivationFunction(id: number) {
try {
loading.value = true