用户端跨城订单界面优化
CI / verify (pull_request) Has been cancelled

This commit is contained in:
2026-07-17 09:06:53 +08:00
parent e9537ce052
commit 00b52b9aaa
3 changed files with 73 additions and 20 deletions
@@ -75,7 +75,6 @@ export class TradeService {
city.localMinQty,
city.crossMinQty,
);
if (!check.ok) throw new BadRequestException(check.message);
const unitPrice = Number(product.price);
const productAmount = unitPrice * body.quantity;
@@ -96,6 +95,10 @@ export class TradeService {
payAmount: productAmount,
benefitAmount: benefitPerUnit * body.quantity,
city: serializeBigInt(city),
/** 起购未满足时仍返回预览,供确认页改数量;下单接口仍会硬校验 */
quantityOk: check.ok,
quantityMessage: check.ok ? null : (check.message ?? null),
minQty: deliveryType === 'LOCAL' ? city.localMinQty : city.crossMinQty,
};
}
@@ -110,6 +113,9 @@ export class TradeService {
req: Request,
) {
const preview = await this.preview(userId, body);
if (preview.quantityOk === false) {
throw new BadRequestException(preview.quantityMessage || '购买数量不满足起购要求');
}
const address = await this.prisma.userAddress.findFirst({
where: { id: BigInt(body.addressId), userId },
});