fix bug 4

This commit is contained in:
2026-07-16 17:30:06 +03:30
parent 7cf11cd62e
commit 59ad1106de
6 changed files with 189 additions and 42 deletions
@@ -8,6 +8,7 @@
:show-upload-list="false"
:action="uploadURL"
:headers="fileHeader"
:before-upload="beforeUpload"
@change="onChange"
>
<div class="banner-image-upload__empty">
@@ -18,7 +19,7 @@
<template v-else>
<BaseIcon icon="vuesax-linear:gallery-add" size="40" class="banner-image-upload__icon" />
<span class="banner-image-upload__cta">افزودن تصویر بنر</span>
<span class="banner-image-upload__hint">کلیک کنید — تصویر افقی با نسبت ۱۶:۹</span>
<span class="banner-image-upload__hint">حداکثر ۱ مگابایت — تبدیل خودکار به WebP — نسبت ۱۶:۹</span>
</template>
</div>
</a-upload>
@@ -32,6 +33,7 @@
:show-upload-list="false"
:action="uploadURL"
:headers="fileHeader"
:before-upload="beforeUpload"
@change="onChange"
>
<button type="button" class="banner-image-upload__btn banner-image-upload__btn--primary">
@@ -56,6 +58,8 @@ import { message } from 'ant-design-vue'
import { uploadURL } from '@root/config'
import { getToken } from '@/utils'
import { normalizeUploadFileResponse } from '@/utils/file'
import { createWebpBeforeUpload } from '@/utils/prepareImageForUpload'
import type { UploadProps } from 'ant-design-vue'
defineProps<{
imageUrl?: string | null
@@ -72,6 +76,10 @@ const fileHeader = computed(() => ({
Authorization: `Bearer ${getToken()}`,
}))
const beforeUpload: UploadProps['beforeUpload'] = createWebpBeforeUpload((msg) =>
message.error(msg)
)
function onChange({ file }: { file: { status?: string; response?: unknown } }) {
if (file.status === 'uploading') {
loading.value = true
@@ -733,8 +733,12 @@ const weightFieldLabel = computed(() => {
return weightFieldLabelForUnit(tradeWeightUnit.value)
})
// واحد حداقل تحویل فیزیکی: محصول وزنی → گرم/کیلوگرم، محصول تعدادی → عدد
// واحد حداقل تحویل فیزیکی: تعدادی → عدد، مقداری/وزنی → گرم/کیلوگرم
const physicalDeliveryUnit = computed(() => {
if (!isQuantityTrade.value && !isMeltedGroup.value) {
return 'عدد'
}
const productUnit = props.form.unit?.trim()
if (productUnit === 'کیلوگرم' || productUnit === 'گرم') {
return productUnit