fix SalesOrderDetail.vue unit
This commit is contained in:
@@ -132,20 +132,20 @@
|
|||||||
<span>订单数量</span>
|
<span>订单数量</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="metric">
|
<div class="metric">
|
||||||
<strong :class="getAvailableQuantityClass(item)" v-text="getPackageQuantityText(item.availableBaseQuantity)" />
|
<strong :class="getAvailableQuantityClass(item)" v-text="getItemQuantityText(item, item.availableBaseQuantity)" />
|
||||||
<span>可履约(基础)</span>
|
<span>可履约</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="metric">
|
<div class="metric">
|
||||||
<strong v-text="getPackageQuantityText(item.pendingBaseQuantity)" />
|
<strong v-text="getItemQuantityText(item, item.pendingBaseQuantity)" />
|
||||||
<span>待核销(基础)</span>
|
<span>待核销</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="metric">
|
<div class="metric">
|
||||||
<strong :class="getFulfilledQuantityClass(item)" v-text="getPackageQuantityText(item.fulfilledBaseQuantity)" />
|
<strong :class="getFulfilledQuantityClass(item)" v-text="getItemQuantityText(item, item.fulfilledBaseQuantity)" />
|
||||||
<span>已履约(基础)</span>
|
<span>已履约</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="metric">
|
<div class="metric">
|
||||||
<strong :class="getRemainingQuantityClass(item)" v-text="getPackageQuantityText(item.remainingBaseQuantity)" />
|
<strong :class="getRemainingQuantityClass(item)" v-text="getItemQuantityText(item, item.remainingBaseQuantity)" />
|
||||||
<span>剩余(基础)</span>
|
<span>剩余</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -230,7 +230,7 @@ import ProductSkuSnapshotTags from "@/components/ProductSkuSnapshotTags.vue";
|
|||||||
import { useNavBarStore } from "@/store/navBarStore";
|
import { useNavBarStore } from "@/store/navBarStore";
|
||||||
import type { GaoSalesOrderItem, GaoSalesPaymentStatus, SalesOrder } from "@/types/SalesOrder";
|
import type { GaoSalesOrderItem, GaoSalesPaymentStatus, SalesOrder } from "@/types/SalesOrder";
|
||||||
import type { PhotoItem } from "@/types/Photo";
|
import type { PhotoItem } from "@/types/Photo";
|
||||||
import { formatPackageAmount, getPackageQuantityText } from "@/utils/package";
|
import { convertPackageQuantity, formatPackageAmount, getPackageQuantityText } from "@/utils/package";
|
||||||
import { getAttachmentReadURL } from "@/utils/attachment";
|
import { getAttachmentReadURL } from "@/utils/attachment";
|
||||||
import { getErrorMessage } from "@/utils/error";
|
import { getErrorMessage } from "@/utils/error";
|
||||||
import { getProductPhotoURL } from "@/utils/product";
|
import { getProductPhotoURL } from "@/utils/product";
|
||||||
@@ -310,6 +310,19 @@ function getRemainingAmountClass(amount?: number | null): "green" | "red" | "gra
|
|||||||
return amount === 0 ? "green" : "red";
|
return amount === 0 ? "green" : "red";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getItemUnitName(item: GaoSalesOrderItem): string {
|
||||||
|
return item.unitSnapshot || "基础单位";
|
||||||
|
}
|
||||||
|
|
||||||
|
function getItemQuantityText(item: GaoSalesOrderItem, baseQuantity?: number | string): string {
|
||||||
|
const quantity = convertPackageQuantity(
|
||||||
|
String(baseQuantity ?? "0"),
|
||||||
|
"1",
|
||||||
|
item.baseQuantityPerUnitSnapshot ?? "1"
|
||||||
|
);
|
||||||
|
return getPackageQuantityText(quantity ?? baseQuantity);
|
||||||
|
}
|
||||||
|
|
||||||
function getAvailableQuantityClass(item: GaoSalesOrderItem): "green" | "orange" {
|
function getAvailableQuantityClass(item: GaoSalesOrderItem): "green" | "orange" {
|
||||||
return Number(item.availableBaseQuantity || 0) === 0 ? "green" : "orange";
|
return Number(item.availableBaseQuantity || 0) === 0 ? "green" : "orange";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user