From e45d43e96e5ab5fc3de701fab61536378cf6fc22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E7=8F=91?= Date: Mon, 22 Sep 2025 12:09:18 +0800 Subject: [PATCH] =?UTF-8?q?Improvement:=20=E8=AE=A2=E5=8D=95=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0payment=5Fmethod?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dto/order.dto.ts | 4 ++++ src/service/order.service.ts | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/dto/order.dto.ts b/src/dto/order.dto.ts index 428c58d..2fd278d 100644 --- a/src/dto/order.dto.ts +++ b/src/dto/order.dto.ts @@ -83,6 +83,10 @@ export class QueryOrderDTO { @ApiProperty({ type: 'enum', enum: ErpOrderStatus }) @Rule(RuleType.string().valid(...Object.values(ErpOrderStatus))) status: ErpOrderStatus; + + @ApiProperty() + @Rule(RuleType.string()) + payment_method: string; } export class QueryOrderSalesDTO { diff --git a/src/service/order.service.ts b/src/service/order.service.ts index 162a03a..4873648 100644 --- a/src/service/order.service.ts +++ b/src/service/order.service.ts @@ -549,6 +549,7 @@ export class OrderService { current, pageSize, customer_email, + payment_method, }, userId = undefined) { const parameters: any[] = []; @@ -571,6 +572,7 @@ export class OrderService { o.customer_note as customer_note, o.shipping as shipping, o.billing as billing, + o.payment_method as payment_method, cs.order_count as order_count, cs.total_spent as total_spent, COALESCE( @@ -632,6 +634,10 @@ export class OrderService { totalQuery += ` AND o.date_created <= ?`; parameters.push(endDate); } + if (payment_method) { + sqlQuery += ` AND o.payment_method like "%${payment_method}%" `; + totalQuery += ` AND o.payment_method like "%${payment_method}%" `; + } const user = await this.userModel.findOneBy({id: userId}); if (user?.permissions?.includes('order-10-days')) { sqlQuery += ` AND o.date_created >= ?`; -- 2.40.1