You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.7 KiB
75 lines
1.7 KiB
1 month ago
|
import apiService from './apiClient';
|
||
|
|
||
|
|
||
|
// 地址类型
|
||
|
interface Address {
|
||
|
address_id: number;
|
||
|
user_id: number;
|
||
|
receiver_first_name: string;
|
||
|
receiver_last_name: string;
|
||
|
country: string;
|
||
|
receiver_phone: string;
|
||
|
whatsapp_phone: string;
|
||
|
province: string | null;
|
||
|
city: string | null;
|
||
|
district: string | null;
|
||
|
detail_address: string | null;
|
||
|
is_default: number;
|
||
|
create_time: string;
|
||
|
update_time: string;
|
||
|
}
|
||
|
|
||
|
// 订单商品项类型
|
||
|
interface OrderItem {
|
||
|
offer_id: number;
|
||
|
sku_id: number;
|
||
|
product_name: string;
|
||
|
sku_image_url: string;
|
||
|
product_name_en: string;
|
||
|
product_name_fr: string;
|
||
|
product_name_ar: string;
|
||
|
quantity: number;
|
||
|
unit_price: number;
|
||
|
total_price: number;
|
||
|
attributes:{
|
||
|
attribute_name:string;
|
||
|
attribute_name_trans:string,
|
||
|
attribute_value:string,
|
||
|
attribute_value_trans:string,
|
||
|
value:string,
|
||
|
value_trans:string,
|
||
|
value_trans_ar:string,
|
||
|
value_trans_fr:string,
|
||
|
}[]
|
||
|
}
|
||
|
|
||
|
// 订单汇总类型
|
||
|
interface OrderSummary {
|
||
|
total_amount: number;
|
||
|
shipping_fee: number;
|
||
|
discount_amount: number;
|
||
|
actual_amount: number;
|
||
|
currency: string;
|
||
|
}
|
||
|
|
||
|
// 完整订单数据类型
|
||
|
export interface OrderData {
|
||
|
address: Address;
|
||
|
items: OrderItem[];
|
||
|
total_amount: number;
|
||
|
shipping_fee: number;
|
||
|
discount_amount: number;
|
||
|
actual_amount: number;
|
||
|
currency: string;
|
||
|
}
|
||
|
|
||
|
export interface OrderPreviewData {
|
||
|
"items":
|
||
|
{
|
||
|
"cart_item_id": number
|
||
|
}[],
|
||
|
}
|
||
|
|
||
|
export const ordersApi = {
|
||
|
getOrders: (data:OrderPreviewData) => apiService.post<OrderData>("/api/orders/preview",data),
|
||
|
};
|