add product
This commit is contained in:
+2
-38
@@ -1,15 +1,9 @@
|
||||
import type {
|
||||
CustomerPackageItem,
|
||||
CustomerPackageStatus,
|
||||
DeliveryOperationType,
|
||||
DeliveryStatus,
|
||||
FundOperationType,
|
||||
FundRecordStatus,
|
||||
GaoCustomerPackage,
|
||||
PackageConfigStatus,
|
||||
PaymentStatus,
|
||||
RefundStatus
|
||||
PackageConfigStatus
|
||||
} from "@/types/Package";
|
||||
import type { FundOperationType, FundRecordStatus } from "@/types/SalesOrder";
|
||||
|
||||
/** 生成套餐业务幂等请求号。每次新操作必须重新生成。 */
|
||||
export function createPackageRequestNo(): string {
|
||||
@@ -90,22 +84,6 @@ export function getCustomerPackageStatusText(status?: CustomerPackageStatus): st
|
||||
return ({ ACTIVE: "进行中", FULFILLED: "已履约", CANCELLED: "已取消" } as Record<string, string>)[status || ""] || "未知";
|
||||
}
|
||||
|
||||
export function getPaymentStatusText(status?: PaymentStatus): string {
|
||||
return ({ UNPAID: "未收款", PARTIALLY_PAID: "部分收款", PAID: "已收款" } as Record<string, string>)[status || ""] || "未知";
|
||||
}
|
||||
|
||||
export function getRefundStatusText(status?: RefundStatus): string {
|
||||
return ({ NOT_REQUIRED: "无需退款", PENDING: "待退款", REFUNDED: "已退款" } as Record<string, string>)[status || ""] || "未知";
|
||||
}
|
||||
|
||||
export function getDeliveryStatusText(status?: DeliveryStatus): string {
|
||||
return ({ PENDING: "待核销", VERIFIED: "已核销", REJECTED: "已拒绝", CANCELLED: "已撤销", REVOKED: "已冲正" } as Record<string, string>)[status || ""] || "未知";
|
||||
}
|
||||
|
||||
export function getDeliveryOperationText(type?: DeliveryOperationType): string {
|
||||
return type === "REVOKE" ? "发放冲正" : "正常发放";
|
||||
}
|
||||
|
||||
export function getFundOperationText(type?: FundOperationType): string {
|
||||
return ({ RECEIVE: "线下收款", REFUND: "退款", CONFIRM_NO_REFUND: "确认无需退款", REVOKE: "资金冲正" } as Record<string, string>)[type || ""] || "未知";
|
||||
}
|
||||
@@ -118,20 +96,6 @@ export function getPackageItemAvailableQuantity(item: CustomerPackageItem): stri
|
||||
return getPackageQuantityText(item.availableQuantity);
|
||||
}
|
||||
|
||||
/** 判断套餐是否存在可用于发放的已核销收款。免费套餐可直接发放。 */
|
||||
export function canCreatePackageDelivery(customerPackage?: Pick<GaoCustomerPackage, "saleAmount" | "paidAmount">): boolean {
|
||||
const saleAmount = customerPackage?.saleAmount || 0;
|
||||
const paidAmount = customerPackage?.paidAmount || 0;
|
||||
return saleAmount === 0 || 0 < paidAmount;
|
||||
}
|
||||
|
||||
/** 判断未付清套餐的发放操作是否必须由店长执行。 */
|
||||
export function isStoreManagerRequiredForPackageDelivery(customerPackage?: Pick<GaoCustomerPackage, "saleAmount" | "paidAmount">): boolean {
|
||||
const saleAmount = customerPackage?.saleAmount || 0;
|
||||
const paidAmount = customerPackage?.paidAmount || 0;
|
||||
return 0 < paidAmount && paidAmount < saleAmount;
|
||||
}
|
||||
|
||||
function toQuantityParts(value: number | string): { value: bigint; scale: number } | undefined {
|
||||
const normalized = normalizePackageQuantity(value);
|
||||
if (!normalized) {
|
||||
|
||||
Reference in New Issue
Block a user