feat: show preorder payment method during pricing
Admins need the customer's cash or check term before they set the price. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -107,6 +107,7 @@ export interface Order {
|
||||
companyName: string
|
||||
companyId: string
|
||||
settlementMethod: SettlementMethod | null
|
||||
checkTermMonths?: number | null
|
||||
totalAmount: number | null
|
||||
meterage: number
|
||||
status: OrderStatus
|
||||
|
||||
+12
-1
@@ -11,10 +11,21 @@ const CASH_PHASE_RAW_STATUSES = new Set([
|
||||
export function settlementMethodLabel(method?: string | null): string {
|
||||
if (!method) return 'انتخابنشده'
|
||||
if (method === 'check') return 'چکی'
|
||||
if (method === 'cash_check') return 'نقدی-چکی'
|
||||
if (method === 'cash_check') return 'نصف نقد، نصف چکی'
|
||||
return 'نقدی'
|
||||
}
|
||||
|
||||
export function settlementPlanLabel(
|
||||
method?: string | null,
|
||||
checkTermMonths?: number | null,
|
||||
): string {
|
||||
const base = settlementMethodLabel(method)
|
||||
if ((method === 'check' || method === 'cash_check') && checkTermMonths) {
|
||||
return `${base} · چک ${checkTermMonths} ماهه`
|
||||
}
|
||||
return base
|
||||
}
|
||||
|
||||
export function orderShowsCashActions(
|
||||
order: { settlementMethod?: SettlementMethod | null; rawStatus?: string },
|
||||
): boolean {
|
||||
|
||||
@@ -13,6 +13,7 @@ import { confirm } from '@/composables/useConfirm'
|
||||
import { useToast } from '@/composables/useToast'
|
||||
import AdminCurrencyInput from '@/components/ui/AdminCurrencyInput.vue'
|
||||
import { PRE_INVOICE_RAW_STATUSES } from '@/utils/orderStatus'
|
||||
import { settlementPlanLabel } from '@/utils/settlement'
|
||||
import type { OrderItem, Product, RawOrderStatus } from '@/types'
|
||||
|
||||
const route = useRoute()
|
||||
@@ -184,6 +185,10 @@ async function savePricing() {
|
||||
toast.error('سفارش باید حداقل یک قلم داشته باشد.')
|
||||
return
|
||||
}
|
||||
if (!order.value.settlementMethod && !order.value.settlementType) {
|
||||
toast.error('مشتری هنوز روش پرداخت را مشخص نکرده است.')
|
||||
return
|
||||
}
|
||||
|
||||
saving.value = true
|
||||
try {
|
||||
@@ -285,6 +290,15 @@ async function sendInvoice() {
|
||||
<strong class="pricing-page__order-id">{{ displayOrder.orderNumber }}</strong>
|
||||
<p class="pricing-page__customer">{{ displayOrder.customerName }}</p>
|
||||
<StatusBadge :status="displayOrder.status" />
|
||||
<p class="pricing-page__customer">
|
||||
روش پرداخت:
|
||||
{{
|
||||
settlementPlanLabel(
|
||||
displayOrder.settlementMethod ?? displayOrder.settlementType,
|
||||
displayOrder.checkTermMonths,
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="admin-summary-grid">
|
||||
|
||||
@@ -211,7 +211,10 @@ function runMenuAction(action: 'detail' | 'pricing' | 'checks' | 'cash' | 'final
|
||||
>
|
||||
<td>{{ order.orderNumber }}</td>
|
||||
<td>{{ order.customerName }}</td>
|
||||
<td>{{ settlementLabel(order.settlementMethod) }}</td>
|
||||
<td>
|
||||
{{ settlementLabel(order.settlementMethod) }}
|
||||
<template v-if="order.checkTermMonths"> · {{ order.checkTermMonths }} ماهه</template>
|
||||
</td>
|
||||
<td>{{ order.totalAmount ? formatCurrency(order.totalAmount) : '—' }}</td>
|
||||
<td>{{ formatMeterage(order.meterage) }}</td>
|
||||
<td><StatusBadge :status="order.status" /></td>
|
||||
|
||||
@@ -209,7 +209,10 @@ function onCashReceiptAction() {
|
||||
</div>
|
||||
<div class="order-detail__info-row">
|
||||
<span class="order-detail__info-label">روش تسویه</span>
|
||||
<span class="order-detail__info-value">{{ settlementLabel(order.settlementMethod) }}</span>
|
||||
<span class="order-detail__info-value">
|
||||
{{ settlementLabel(order.settlementMethod) }}
|
||||
<template v-if="order.checkTermMonths"> · چک {{ order.checkTermMonths }} ماهه</template>
|
||||
</span>
|
||||
</div>
|
||||
<div class="order-detail__info-row">
|
||||
<span class="order-detail__info-label">متراژ کل</span>
|
||||
|
||||
Reference in New Issue
Block a user