feat: require payment method when submitting a preorder

Price depends on cash or check terms, so the customer chooses them before admin pricing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-15 11:24:52 +03:30
co-authored by Cursor
parent c225a58099
commit 881e6a2c87
10 changed files with 284 additions and 20 deletions
+10
View File
@@ -18,6 +18,8 @@ const {
showFullDialog,
submitting,
submitError,
settlementType,
checkTermMonths,
removeItem,
proceedToCheckout,
proceedAnyway,
@@ -43,6 +45,10 @@ function goToOrdering() {
:remaining-capacity="cartStore.remainingCapacity"
:is-empty="isEmpty"
:submitting="submitting"
:settlement-type="settlementType"
:check-term-months="checkTermMonths"
@update:settlement-type="settlementType = $event"
@update:check-term-months="checkTermMonths = $event"
@back="router.push('/')"
@remove="removeItem"
@checkout="proceedToCheckout"
@@ -59,6 +65,10 @@ function goToOrdering() {
:remaining-capacity="cartStore.remainingCapacity"
:is-empty="isEmpty"
:submitting="submitting"
:settlement-type="settlementType"
:check-term-months="checkTermMonths"
@update:settlement-type="settlementType = $event"
@update:check-term-months="checkTermMonths = $event"
@remove="removeItem"
@checkout="proceedToCheckout"
@select-company="goToOrdering()"
+13 -2
View File
@@ -10,7 +10,8 @@ import IconLightbulb from '@/components/icons/IconLightbulb.vue'
import IconLayoutGrid from '@/components/icons/IconLayoutGrid.vue'
import IconDiamond from '@/components/icons/IconDiamond.vue'
import { formatMeterage, formatNumber } from '@/utils/format'
import type { CartItem } from '@/types'
import type { CartItem, SettlementType } from '@/types'
import PreorderPaymentFields from '@/components/orders/PreorderPaymentFields.vue'
defineProps<{
items: CartItem[]
@@ -27,6 +28,8 @@ defineProps<{
remainingCapacity: number
isEmpty: boolean
submitting?: boolean
settlementType: SettlementType | null
checkTermMonths: number | null
}>()
const emit = defineEmits<{
@@ -34,6 +37,8 @@ const emit = defineEmits<{
checkout: []
selectCompany: []
back: []
'update:settlementType': [value: SettlementType]
'update:checkTermMonths': [value: number]
}>()
const router = useRouter()
@@ -180,6 +185,12 @@ const quickLinks = [
</span>
</div>
</div>
<PreorderPaymentFields
:settlement-type="settlementType"
:check-term-months="checkTermMonths"
@update:settlement-type="emit('update:settlementType', $event)"
@update:check-term-months="emit('update:checkTermMonths', $event)"
/>
<button
type="button"
class="cart-summary-card__cta"
@@ -190,7 +201,7 @@ const quickLinks = [
{{ submitting ? 'در حال ثبت…' : 'ثبت پیش‌سفارش' }}
</button>
<p class="cart-summary-card__note">
پس از ثبت سفارش، مدیریت قیمت‌گذاری می‌کند و فاکتور صادر می‌شود؛ سپس روش تسویه را انتخاب می‌کنید.
روش پرداخت الان ثبت می‌شود. مدیریت بعد از آن قیمت و متراژ را اعلام می‌کند.
</p>
</div>
+13 -2
View File
@@ -4,7 +4,8 @@ import EmptyState from '@/components/ui/EmptyState.vue'
import IconTrash from '@/components/icons/IconTrash.vue'
import IconChevronBack from '@/components/icons/IconChevronBack.vue'
import { formatMeterage, formatNumber } from '@/utils/format'
import type { CartItem } from '@/types'
import type { CartItem, SettlementType } from '@/types'
import PreorderPaymentFields from '@/components/orders/PreorderPaymentFields.vue'
defineProps<{
items: CartItem[]
@@ -21,6 +22,8 @@ defineProps<{
remainingCapacity: number
isEmpty: boolean
submitting?: boolean
settlementType: SettlementType | null
checkTermMonths: number | null
}>()
const emit = defineEmits<{
@@ -28,6 +31,8 @@ const emit = defineEmits<{
remove: [id: string]
checkout: []
selectCompany: []
'update:settlementType': [value: SettlementType]
'update:checkTermMonths': [value: number]
}>()
</script>
@@ -98,8 +103,14 @@ const emit = defineEmits<{
<strong>{{ formatMeterage(remainingCapacity) }}</strong>
</div>
</div>
<PreorderPaymentFields
:settlement-type="settlementType"
:check-term-months="checkTermMonths"
@update:settlement-type="emit('update:settlementType', $event)"
@update:check-term-months="emit('update:checkTermMonths', $event)"
/>
<p class="cart-mobile-page__hint">
پس از ثبت سفارش، کارشناسان قیمت‌گذاری می‌کنند و فاکتور برای شما صادر می‌شود.
پس از ثبت، مدیریت بر اساس همین روش پرداخت قیمت و متراژ را اعلام می‌کند.
</p>
<BaseButton block :loading="submitting" @click="emit('checkout')">ثبت پیش‌سفارش</BaseButton>
</div>