Lịch sử bán hàng
Mô tả
Các API hỗ trợ:
- GET /orders: Danh sách đơn
- GET /orders/{id}: Chi tiết đơn
- GET /orderDetails: Dòng hàng
- GET /orderDetails/{id}/items: Serial và RFID
API
GET /api/orders
Danh sách đơn hàng:
Tham số query:
| Tên trường | Kiểu dữ liệu | Mô tả | Bắt buộc |
|---|---|---|---|
code | string | Mã đơn hàng | Không |
merchant_product_id | string | Mã hàng hóa | Không |
status | string | 0 đã TT | 1 giữ | 9 hủy | Không |
created_from | string | yyyy-MM-dd'T'HH:mm:ss | Không |
created_to | string | yyyy-MM-dd'T'HH:mm:ss | Không |
page | integer | Trang | Không |
size | integer | Số bản ghi trên trang | Không |
sort | string | Tên trường sắp xếp | Không |
order | string | asc / desc | Không |
GET /api/orders?page=1&size=10
result là các cột đơn, kèm returned_quantity và hóa đơn einvoice_pattern, einvoice_no, einvoice_lookup_code, einvoice_link_view, einvoice_tax_authority_code, einvoice_status.
Response Body
{
"code": 200,
"message": "Success",
"result": [
{
"id": "{uuid}",
"code": "DH00001",
"customer_id": "{uuid}",
"customer_name": "Nguyen A",
"customer_phone_number": "0900000000",
"total_quantity": 1,
"subtotal": 500000,
"discount": 0,
"tax_total": 0,
"total": 500000,
"payment_method": "cash",
"cash_received": 500000,
"card_last4": null,
"card_txn": null,
"invoice_vat": 0,
"invoice_pattern": null,
"pickup_invoice": 0,
"paid_at": "2026-10-13T09:00:00",
"status": 0,
"cancel_reason": null,
"cancelled_at": null,
"returned_quantity": 0,
"einvoice_pattern": null,
"einvoice_no": null,
"einvoice_lookup_code": null,
"einvoice_link_view": null,
"einvoice_tax_authority_code": null,
"einvoice_status": null,
"created_at": "2026-10-13T09:00:00",
"created_by": "merchant_user",
"updated_at": null,
"updated_by": null
}
],
"page": 1,
"page_size": 10,
"total": 1
}
GET /api/orders/{id}
Chi tiết một đơn. Cùng các cột với danh sách.
GET /api/orders/\{id\}
Response Body
{
"code": 200,
"message": "Success",
"result": {
"id": "{uuid}",
"code": "DH00001",
"customer_id": "{uuid}",
"customer_name": "Nguyen A",
"customer_phone_number": "0900000000",
"total_quantity": 1,
"subtotal": 500000,
"discount": 0,
"tax_total": 0,
"total": 500000,
"payment_method": "cash",
"cash_received": 500000,
"card_last4": null,
"card_txn": null,
"invoice_vat": 0,
"invoice_pattern": null,
"pickup_invoice": 0,
"paid_at": "2026-10-13T09:00:00",
"status": 0,
"cancel_reason": null,
"cancelled_at": null,
"returned_quantity": 0,
"einvoice_pattern": null,
"einvoice_no": null,
"einvoice_lookup_code": null,
"einvoice_link_view": null,
"einvoice_tax_authority_code": null,
"einvoice_status": null,
"created_at": "2026-10-13T09:00:00",
"created_by": "merchant_user",
"updated_at": null,
"updated_by": null
}
}
GET /api/orderDetails
Dòng hàng của một đơn.
Tham số query:
| Tên trường | Kiểu dữ liệu | Mô tả | Bắt buộc |
|---|---|---|---|
order_id | string | Id đơn | Không |
page | integer | Trang | Không |
size | integer | Số bản ghi trên trang | Không |
sort | string | Tên trường sắp xếp | Không |
order | string | asc / desc | Không |
GET /api/orderDetails?order_id=\{uuid\}&page=1&size=20
Response Body
{
"code": 200,
"message": "Success",
"result": [
{
"id": "{uuid}",
"order_id": "{uuid}",
"product_id": "{uuid}",
"merchant_product_id": "408798",
"product_name": "Andie Shirt",
"product_category": "Ready",
"col_1": null,
"col_2": null,
"col_3": null,
"col_4": null,
"col_5": null,
"col_6": null,
"col_7": null,
"col_8": null,
"col_9": null,
"col_10": null,
"price": 500000,
"quantity": 1,
"discount": 0,
"coupon_amount": 0,
"total": 500000,
"created_at": "2026-10-13T09:00:00",
"created_by": "merchant_user",
"updated_at": null,
"updated_by": null
}
],
"page": 1,
"page_size": 20,
"total": 1
}
GET /api/orderDetails/{id}/items
Serial và RFID của một dòng đơn. id là id dòng orderDetails.
GET /api/orderDetails/\{id\}/items
result: id, product_id, merchant_product_id, serial, rfid, discount_amount, coupon_amount, tax_rate, vat_amount, total, warehouse_id, created_at, created_by.
Response Body
{
"code": 200,
"message": "Success",
"result": [
{
"id": "{uuid}",
"product_id": "{uuid}",
"merchant_product_id": "408798",
"serial": 1,
"rfid": "E280…",
"discount_amount": 0,
"coupon_amount": 0,
"tax_rate": 8,
"vat_amount": 0,
"total": 500000,
"warehouse_id": "{uuid}",
"created_at": "2026-10-13T09:00:00",
"created_by": "merchant_user"
}
]
}