Improvement: 订单请求接口添加payment_method相关内容
This commit is contained in:
parent
a386a0d2f3
commit
e45d43e96e
|
|
@ -83,6 +83,10 @@ export class QueryOrderDTO {
|
||||||
@ApiProperty({ type: 'enum', enum: ErpOrderStatus })
|
@ApiProperty({ type: 'enum', enum: ErpOrderStatus })
|
||||||
@Rule(RuleType.string().valid(...Object.values(ErpOrderStatus)))
|
@Rule(RuleType.string().valid(...Object.values(ErpOrderStatus)))
|
||||||
status: ErpOrderStatus;
|
status: ErpOrderStatus;
|
||||||
|
|
||||||
|
@ApiProperty()
|
||||||
|
@Rule(RuleType.string())
|
||||||
|
payment_method: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class QueryOrderSalesDTO {
|
export class QueryOrderSalesDTO {
|
||||||
|
|
|
||||||
|
|
@ -549,6 +549,7 @@ export class OrderService {
|
||||||
current,
|
current,
|
||||||
pageSize,
|
pageSize,
|
||||||
customer_email,
|
customer_email,
|
||||||
|
payment_method,
|
||||||
}, userId = undefined) {
|
}, userId = undefined) {
|
||||||
const parameters: any[] = [];
|
const parameters: any[] = [];
|
||||||
|
|
||||||
|
|
@ -571,6 +572,7 @@ export class OrderService {
|
||||||
o.customer_note as customer_note,
|
o.customer_note as customer_note,
|
||||||
o.shipping as shipping,
|
o.shipping as shipping,
|
||||||
o.billing as billing,
|
o.billing as billing,
|
||||||
|
o.payment_method as payment_method,
|
||||||
cs.order_count as order_count,
|
cs.order_count as order_count,
|
||||||
cs.total_spent as total_spent,
|
cs.total_spent as total_spent,
|
||||||
COALESCE(
|
COALESCE(
|
||||||
|
|
@ -632,6 +634,10 @@ export class OrderService {
|
||||||
totalQuery += ` AND o.date_created <= ?`;
|
totalQuery += ` AND o.date_created <= ?`;
|
||||||
parameters.push(endDate);
|
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});
|
const user = await this.userModel.findOneBy({id: userId});
|
||||||
if (user?.permissions?.includes('order-10-days')) {
|
if (user?.permissions?.includes('order-10-days')) {
|
||||||
sqlQuery += ` AND o.date_created >= ?`;
|
sqlQuery += ` AND o.date_created >= ?`;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue