changes 1
This commit is contained in:
@@ -18,12 +18,6 @@ const {
|
||||
showFullDialog,
|
||||
submitting,
|
||||
submitError,
|
||||
addressPickerOpen,
|
||||
addresses,
|
||||
selectedAddressId,
|
||||
newAddress,
|
||||
addressBusy,
|
||||
confirmAddressAndOrder,
|
||||
removeItem,
|
||||
proceedToCheckout,
|
||||
proceedAnyway,
|
||||
@@ -71,49 +65,6 @@ function goToOrdering() {
|
||||
@back="goToOrdering"
|
||||
/>
|
||||
|
||||
<div
|
||||
v-if="addressPickerOpen"
|
||||
class="dialog-overlay"
|
||||
@click.self="addressPickerOpen = false"
|
||||
>
|
||||
<div class="dialog card">
|
||||
<h3>آدرس ارسال</h3>
|
||||
<p class="text-sm">یکی از آدرسهای ذخیرهشده را انتخاب کنید، یا آدرس تازه بنویسید.</p>
|
||||
<ul v-if="addresses.length" class="address-pick">
|
||||
<li v-for="row in addresses" :key="row.id">
|
||||
<label class="address-card" :class="{ 'is-on': selectedAddressId === row.id && !newAddress.trim() }">
|
||||
<input v-model="selectedAddressId" type="radio" :value="row.id" @change="newAddress = ''" />
|
||||
<span class="address-card__body">
|
||||
<span class="address-card__title">
|
||||
<strong>{{ row.label || 'آدرس' }}</strong>
|
||||
<em v-if="row.isDefault">پیشفرض</em>
|
||||
</span>
|
||||
<small>{{ row.text }}</small>
|
||||
</span>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
<label class="address-new" :class="{ 'is-on': Boolean(newAddress.trim()) }">
|
||||
<span>آدرس جدید</span>
|
||||
<textarea
|
||||
v-model="newAddress"
|
||||
rows="3"
|
||||
maxlength="500"
|
||||
placeholder="خیابان، پلاک، واحد…"
|
||||
@input="selectedAddressId = ''"
|
||||
/>
|
||||
</label>
|
||||
<div class="dialog-actions">
|
||||
<BaseButton variant="outline" :disabled="addressBusy" @click="addressPickerOpen = false">
|
||||
انصراف
|
||||
</BaseButton>
|
||||
<BaseButton :loading="addressBusy || submitting" @click="confirmAddressAndOrder">
|
||||
ثبت سفارش
|
||||
</BaseButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="showFullDialog" class="dialog-overlay" @click.self="showFullDialog = false">
|
||||
<div class="dialog card">
|
||||
<h3>سقف متراژ تکمیل شد</h3>
|
||||
@@ -148,115 +99,6 @@ function goToOrdering() {
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
|
||||
.address-pick {
|
||||
list-style: none;
|
||||
margin: 12px 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.address-card {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
min-width: 0;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid #e7e5e4;
|
||||
border-radius: 14px;
|
||||
background: #fafaf9;
|
||||
}
|
||||
|
||||
.address-card.is-on {
|
||||
border-color: #1e293b;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.address-card input {
|
||||
margin-top: 4px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.address-card__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.address-card__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.address-card__title strong {
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.address-card__title em {
|
||||
flex-shrink: 0;
|
||||
padding: 1px 8px;
|
||||
border-radius: 999px;
|
||||
background: #1e293b;
|
||||
color: #fff;
|
||||
font-style: normal;
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
|
||||
.address-card small {
|
||||
display: block;
|
||||
color: var(--color-text-muted);
|
||||
line-height: 1.7;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.address-new {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
margin-top: 4px;
|
||||
padding: 12px;
|
||||
border: 1px dashed #cbd5e1;
|
||||
border-radius: 16px;
|
||||
background: #f8fafc;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.address-new.is-on {
|
||||
border-style: solid;
|
||||
border-color: #1e293b;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.address-new span {
|
||||
font-weight: 700;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.address-new textarea {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
min-height: 88px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
font: inherit;
|
||||
line-height: 1.7;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.address-new textarea:focus {
|
||||
outline: none;
|
||||
border-color: #1e293b;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.cart-view {
|
||||
flex: 1 0 auto;
|
||||
|
||||
@@ -8,7 +8,7 @@ import FormErrorBanner from '@/components/ui/FormErrorBanner.vue'
|
||||
import EmptyState from '@/components/ui/EmptyState.vue'
|
||||
import IconChevronBack from '@/components/icons/IconChevronBack.vue'
|
||||
import { formatCurrency, formatDate, formatNumber, toPersianDigits } from '@/utils/format'
|
||||
import { calculateCheckRass } from '@/utils/checkRass'
|
||||
import { calculateCheckRass, invoiceAnchorDate } from '@/utils/checkRass'
|
||||
import { confirm } from '@/composables/useConfirm'
|
||||
import { useRequirePricedOrder } from '@/composables/useRequirePricedOrder'
|
||||
import type { CheckData } from '@/types'
|
||||
@@ -58,8 +58,10 @@ const checks = computed<CheckData[]>(() => {
|
||||
})
|
||||
|
||||
const rass = computed(() => {
|
||||
if (orderStore.draftChecks.length > 0) return orderStore.getDraftRass()
|
||||
return calculateCheckRass(checks.value, new Date())
|
||||
const anchor = order.value ? invoiceAnchorDate(order.value) : undefined
|
||||
if (orderStore.draftChecks.length > 0) return orderStore.getDraftRass(anchor)
|
||||
if (!anchor) return calculateCheckRass([], new Date(0))
|
||||
return calculateCheckRass(checks.value, anchor)
|
||||
})
|
||||
|
||||
const invoiceAmount = computed(() => order.value?.finalAmount ?? 0)
|
||||
|
||||
@@ -76,6 +76,7 @@ const suggestionsForHome = computed(() => {
|
||||
...item,
|
||||
composition: item.composition?.trim() || product?.composition?.trim() || '',
|
||||
widthCm: item.widthCm ?? product?.widthCm,
|
||||
weightGrams: item.weightGrams ?? product?.weightGrams,
|
||||
colors: item.colors?.length ? item.colors : product?.colors ?? [],
|
||||
colorImages: item.colorImages?.some(Boolean)
|
||||
? item.colorImages
|
||||
|
||||
@@ -5,7 +5,6 @@ import { useMediaQuery } from '@vueuse/core'
|
||||
import { useOrderStore } from '@/stores/order'
|
||||
import type { Order } from '@/types'
|
||||
import BaseButton from '@/components/ui/BaseButton.vue'
|
||||
import BaseInput from '@/components/ui/BaseInput.vue'
|
||||
import CurrencyInput from '@/components/ui/CurrencyInput.vue'
|
||||
import PersianDateInput from '@/components/ui/PersianDateInput.vue'
|
||||
import TimeInput from '@/components/ui/TimeInput.vue'
|
||||
@@ -22,7 +21,7 @@ import {
|
||||
parseFormattedNumber,
|
||||
} from '@/utils/format'
|
||||
import { validateImageFile, fileToBase64 } from '@/utils/validation'
|
||||
import { daysUntilDue } from '@/utils/checkRass'
|
||||
import { daysFromBase, invoiceAnchorDate } from '@/utils/checkRass'
|
||||
import {
|
||||
FORM_VALIDATION_SUMMARY,
|
||||
clearFieldError,
|
||||
@@ -56,7 +55,6 @@ const showOrderDetails = ref(route.query.receipt === '1')
|
||||
const receiptAmount = ref('')
|
||||
const receiptDate = ref('')
|
||||
const receiptTime = ref('')
|
||||
const trackingNumber = ref('')
|
||||
const destinationAccountId = ref('')
|
||||
const receiptImage = ref('')
|
||||
const fieldErrors = ref<FieldErrors>({})
|
||||
@@ -103,10 +101,6 @@ watch(receiptDate, () => {
|
||||
fieldErrors.value = clearFieldError(fieldErrors.value, 'receiptDate')
|
||||
if (!hasFieldErrors(fieldErrors.value)) formError.value = ''
|
||||
})
|
||||
watch(trackingNumber, () => {
|
||||
fieldErrors.value = clearFieldError(fieldErrors.value, 'trackingNumber')
|
||||
if (!hasFieldErrors(fieldErrors.value)) formError.value = ''
|
||||
})
|
||||
watch(destinationAccountId, () => {
|
||||
fieldErrors.value = clearFieldError(fieldErrors.value, 'destinationAccountId')
|
||||
if (!hasFieldErrors(fieldErrors.value)) formError.value = ''
|
||||
@@ -269,9 +263,6 @@ async function submitReceipt() {
|
||||
if (!receiptDate.value) {
|
||||
errors.receiptDate = 'تاریخ واریز الزامی است.'
|
||||
}
|
||||
if (!trackingNumber.value.trim()) {
|
||||
errors.trackingNumber = 'شماره پیگیری الزامی است.'
|
||||
}
|
||||
if (!destinationAccountId.value) {
|
||||
errors.destinationAccountId = 'حساب مقصد را انتخاب کنید.'
|
||||
}
|
||||
@@ -287,7 +278,6 @@ async function submitReceipt() {
|
||||
amount,
|
||||
transferDate: receiptDate.value,
|
||||
transferTime: receiptTime.value || '12:00',
|
||||
trackingNumber: trackingNumber.value,
|
||||
destinationAccountId: destinationAccountId.value,
|
||||
receiptImage: receiptImage.value || undefined,
|
||||
})
|
||||
@@ -464,7 +454,7 @@ async function submitReceipt() {
|
||||
<span>مبلغ</span>
|
||||
<span>{{ formatCurrency(order.cashReceipt.amount) }}</span>
|
||||
</div>
|
||||
<div class="detail-row">
|
||||
<div v-if="order.cashReceipt.trackingNumber" class="detail-row">
|
||||
<span>شماره پیگیری</span>
|
||||
<span>{{ order.cashReceipt.trackingNumber }}</span>
|
||||
</div>
|
||||
@@ -492,7 +482,7 @@ async function submitReceipt() {
|
||||
</div>
|
||||
<div class="detail-row">
|
||||
<span>سررسید</span>
|
||||
<span>{{ formatDate(check.dueDate) }} ({{ daysUntilDue(check.dueDate) }} روز)</span>
|
||||
<span>{{ formatDate(check.dueDate) }} ({{ daysFromBase(check.dueDate, invoiceAnchorDate(order)) }} روز)</span>
|
||||
</div>
|
||||
<img v-if="check.frontImage" :src="check.frontImage" class="check-img" alt="چک" />
|
||||
</div>
|
||||
@@ -550,13 +540,6 @@ async function submitReceipt() {
|
||||
placeholder="مثلاً ۱۴:۳۰"
|
||||
hint="با گام ۵ دقیقه"
|
||||
/>
|
||||
<BaseInput
|
||||
v-model="trackingNumber"
|
||||
label="شماره پیگیری"
|
||||
inputmode="numeric"
|
||||
dir="ltr"
|
||||
:error="fieldErrors.trackingNumber"
|
||||
/>
|
||||
<AppSelect
|
||||
v-model="destinationAccountId"
|
||||
label="حساب مقصد"
|
||||
|
||||
@@ -10,6 +10,7 @@ import IconFilter from '@/components/icons/IconFilter.vue'
|
||||
import IconMoreVertical from '@/components/icons/IconMoreVertical.vue'
|
||||
import IconChevronLeft from '@/components/icons/IconChevronLeft.vue'
|
||||
import { formatDateTime, formatNumber } from '@/utils/format'
|
||||
import { orderFabricLabel } from '@/utils/orderFabric'
|
||||
import type { Order } from '@/types'
|
||||
import type { DesktopOrderFilterId } from '@/utils/orderStatusGroups'
|
||||
|
||||
@@ -122,6 +123,7 @@ const emit = defineEmits<{
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">شماره سفارش</th>
|
||||
<th scope="col">پارچه</th>
|
||||
<th scope="col">شرکت</th>
|
||||
<th scope="col">مبلغ فاکتور (تومان)</th>
|
||||
<th scope="col">وضعیت</th>
|
||||
@@ -132,6 +134,7 @@ const emit = defineEmits<{
|
||||
<tbody>
|
||||
<tr v-for="order in paginatedOrders" :key="order.id">
|
||||
<td class="orders-table__number">{{ order.orderNumber }}</td>
|
||||
<td class="orders-table__fabric">{{ orderFabricLabel(order.items) || '—' }}</td>
|
||||
<td>{{ order.companyName }}</td>
|
||||
<td class="orders-table__amount">
|
||||
{{ order.finalAmount ? formatNumber(order.finalAmount) : '—' }}
|
||||
|
||||
@@ -9,6 +9,7 @@ import IconParLogo from '@/components/icons/IconParLogo.vue'
|
||||
import IconFamBaftLogo from '@/components/icons/IconFamBaftLogo.vue'
|
||||
import AuthThemeToggle from '@/components/ui/AuthThemeToggle.vue'
|
||||
import { formatCurrency, formatNumber, toPersianDigits } from '@/utils/format'
|
||||
import { orderFabricLabel } from '@/utils/orderFabric'
|
||||
import type { Order } from '@/types'
|
||||
|
||||
defineProps<{
|
||||
@@ -62,6 +63,10 @@ const emit = defineEmits<{
|
||||
<div class="order-card__content">
|
||||
<span class="order-card__label">سفارش شماره</span>
|
||||
<strong class="order-card__number">{{ order.orderNumber }}</strong>
|
||||
<template v-if="orderFabricLabel(order.items)">
|
||||
<span class="order-card__label">پارچه</span>
|
||||
<strong class="order-card__fabric">{{ orderFabricLabel(order.items) }}</strong>
|
||||
</template>
|
||||
<p class="order-card__company">{{ order.companyName }}</p>
|
||||
<p v-if="order.finalAmount" class="order-card__amount">
|
||||
{{ formatCurrency(order.finalAmount) }}
|
||||
@@ -214,6 +219,14 @@ const emit = defineEmits<{
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.order-card__fabric {
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 6px;
|
||||
color: var(--color-text);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.order-card__company {
|
||||
margin: 0 0 6px;
|
||||
font-size: 0.875rem;
|
||||
|
||||
Reference in New Issue
Block a user