Skip to main content

Bán hàng

Mô tả

Các API hỗ trợ:

API


GET /api/orders

Lấy danh sách các đơn hàng, hỗ trợ các tham số filter sau:

Tên trườngKiểu dữ liệuMô tả
codestringMã đơn hàng
merchant_product_idstringMã hàng hóa
statusstringTrạng thái đơn hàng
created_fromstringTừ ngày
created_tostringĐến ngày
sortintegerTên trường sắp xếp
orderintegerThứ tự sắp xếp
pageintegerTrang
sizeintegerSố bản ghi trên trang

Trạng thái bao gồm: 0 (Đã thanh toán) | 1 (Giữ hàng) | 9 (Hủy)

GET /api/orders?page=1&size=100&sort=code&order=asc&code=01032400000148&merchant_product_id=&status=9&created_from=2024-01-01T10%3A00%3A00Z&created_to=2024-09-01T10%3A00%3A00Z

Response Body
{
"code": 200,
"message": "Success",
"result": [
{
"id": "84e37196-4cae-4391-be4b-6e4dc31a159a",
"code": "01032400000148",
"customer_id": "18e0911a-95fb-4017-abb1-3e761a719fef",
"customer_name": "customer a",
"customer_phone_number": "123123123",
"total_quantity": 2,
"subtotal": 10000000.0,
"discount": 0.0,
"total": 10000000.0,
"paid_at": null,
"status": 9,
"cancel_reason": "123",
"merchant_id": "00000000-0000-0000-0000-000000000004",
"deleted": 0,
"created_at": "2024-03-01T03:02:40.000Z",
"created_by": "admin",
"updated_at": "2024-03-06T08:12:10.000Z",
"updated_by": "admin"
}
],
"page": 1,
"page_size": 100,
"total": 1
}

GET /api/orders/{id}

Lấy chi tiết 1 đơn hàng.

GET /api/orders/84e37196-4cae-4391-be4b-6e4dc31a159a

Response Body
{
"code": 200,
"message": "Thành công",
"result": [
{
"id": "df217110-0cb7-46d1-91bb-6a4f8be42ad7",
"order_id": "84e37196-4cae-4391-be4b-6e4dc31a159a",
"product_id": "8dfdd64c-578b-41ff-8f5e-64ab63279aff",
"merchant_product_id": "393550",
"product_name": "Andie Relaxed Shirt_2775TAND-ALFL",
"product_category": "Read to wear",
"col_1": "1",
"col_2": "2",
"col_3": "3",
"col_4": "4",
"col_5": null,
"col_6": null,
"col_7": null,
"col_8": null,
"col_9": null,
"col_10": null,
"price": 5000000.0,
"quantity": 2,
"discount": 0.0,
"total": 0.0,
"merchant_id": "00000000-0000-0000-0000-000000000004",
"deleted": 0,
"created_at": "2024-03-01T03:02:40.000Z",
"created_by": "admin",
"updated_at": null,
"updated_by": null
}
]
}

POST /api/orders

Tạo mới đơn hàng.

Request Body

  • coupon_code: (string) Mã coupon.

  • customer_id: (string) Mã khách hàng.

  • order_details: (array) Danh sách sản phẩm.

  • merchant_product_id: (string) Mã hàng hóa.

  • serial: (string) Mã serial.

  • status: (string) Trạng thái đơn hàng.

Trạng thái bao gồm: 0 (Đã thanh toán) | 1 (Giữ hàng)

Request Body
{
"coupon_code": "coupon_test",
"customer_id": "619295b1-17af-4873-829c-660973aa03e0",
"order_details": [
{
"merchant_product_id": "405746",
"serial": 10
}
],
"status": 0
}

POST /api/orders