fix some bugs
This commit is contained in:
@@ -7,11 +7,11 @@
|
||||
<div class="pargar-wallet-sync__copy min-w-0 flex-1">
|
||||
<p class="pargar-wallet-sync__title">همگامسازی با پرگار</p>
|
||||
<p class="pargar-wallet-sync__hint">
|
||||
{{
|
||||
canSync
|
||||
? 'اول اسنادِ اعمالنشده، بعد همترازی مانده — خودکار از پرگار کیف عوض نمیشود'
|
||||
: 'ابتدا کد حسابداری پرگار را برای این مشتری ثبت کنید'
|
||||
}}
|
||||
{{
|
||||
canSync
|
||||
? 'موجودی را با ماندهٔ پرگار یکی میکند — تاریخچهٔ اسناد روی کیف replay نمیشود'
|
||||
: 'ابتدا کد حسابداری پرگار را برای این مشتری ثبت کنید'
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -21,10 +21,10 @@
|
||||
size="small"
|
||||
class="pargar-wallet-sync__btn"
|
||||
:loading="loading"
|
||||
:disabled="!canSync"
|
||||
:disabled="!canSync || loading"
|
||||
@click="$emit('sync')"
|
||||
>
|
||||
همگامسازی مانده و اسناد
|
||||
همگامسازی مانده از پرگار
|
||||
</a-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -113,6 +113,47 @@
|
||||
:color="record.trade_active === 1 ? '#54AD06' : '#ad0627'"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-tooltip
|
||||
:key="`co-${record.conditional_order_active}-${record.id}`"
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="changeConditionalOrderActiveFunction(record.id)"
|
||||
>
|
||||
<template #title>
|
||||
<span>
|
||||
{{
|
||||
record.conditional_order_active
|
||||
? 'محدود کردن سفارش شرطی'
|
||||
: 'مجاز کردن سفارش شرطی'
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
<Icon
|
||||
:icon="
|
||||
record.conditional_order_active
|
||||
? 'vuesax-linear:timer'
|
||||
: 'vuesax-linear:timer-pause'
|
||||
"
|
||||
:color="record.conditional_order_active ? '#54AD06' : '#ad0627'"
|
||||
/>
|
||||
</a-tooltip>
|
||||
<a-tooltip
|
||||
placement="bottom"
|
||||
class="cursor-pointer"
|
||||
@click="openConditionalOrderLimit(record)"
|
||||
>
|
||||
<template #title>
|
||||
<span>
|
||||
سقف سفارش شرطی
|
||||
{{
|
||||
record.conditional_order_limit
|
||||
? `(${record.conditional_order_limit})`
|
||||
: '(نامحدود)'
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
<Icon icon="vuesax-linear:slider-horizontal" color="#4572E9" />
|
||||
</a-tooltip>
|
||||
<a-tooltip
|
||||
v-if="customerDirectSmsEnabled"
|
||||
placement="bottom"
|
||||
@@ -211,6 +252,8 @@ import {
|
||||
changeCustomerActivation,
|
||||
changeCustomerArchive,
|
||||
changeCustomerOrderActivation,
|
||||
changeCustomerConditionalOrderActive,
|
||||
updateCustomerConditionalOrderLimit,
|
||||
confirmUser,
|
||||
getCustomerTable
|
||||
} from '@/api/customer'
|
||||
@@ -384,6 +427,49 @@ async function changeCustomerOrderActivationFunction(id: number) {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function changeConditionalOrderActiveFunction(id: number) {
|
||||
try {
|
||||
loading.value = true
|
||||
await changeCustomerConditionalOrderActive(id)
|
||||
await fetch()
|
||||
message.success('مجوز سفارش شرطی بهروز شد')
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function openConditionalOrderLimit(customer: Customer) {
|
||||
const current = customer.conditional_order_limit
|
||||
Modal.confirm({
|
||||
title: 'سقف تعداد سفارش شرطی',
|
||||
content: `برای «${customer.name || customer.id}» عدد سقف را وارد کنید (خالی = نامحدود). فعلی: ${
|
||||
current ? current : 'نامحدود'
|
||||
}`,
|
||||
okText: 'ذخیره',
|
||||
cancelText: 'انصراف',
|
||||
centered: true,
|
||||
zIndex: MODAL_ABOVE_ACTION_SHEET_Z_INDEX,
|
||||
onOk: async () => {
|
||||
const raw = window.prompt(
|
||||
'سقف تعداد تریگر pending (خالی = نامحدود):',
|
||||
current != null ? String(current) : ''
|
||||
)
|
||||
if (raw === null) return
|
||||
const trimmed = raw.trim()
|
||||
const limit = trimmed === '' ? null : Number(trimmed)
|
||||
if (limit !== null && (!Number.isFinite(limit) || limit < 1)) {
|
||||
message.error('عدد نامعتبر است')
|
||||
return Promise.reject()
|
||||
}
|
||||
await updateCustomerConditionalOrderLimit(customer.id, limit)
|
||||
await fetch()
|
||||
message.success('سقف سفارش شرطی ذخیره شد')
|
||||
},
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
|
||||
Reference in New Issue
Block a user