Browse Source

refactor(types): 使用常量定义订单明细项状态类型

yz 1 month ago
parent
commit
59207d86f1
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/api/types/order.d.ts

+ 4 - 4
src/api/types/order.d.ts

@@ -1,10 +1,10 @@
-import { ORDER_TYPES, ORDER_STATUS } from '@/constants';
+import { ORDER_TYPES, ORDER_STATUS, ORDER_ITEM_STATUS } from '@/constants';
 import { AxiosResponse } from 'axios';
 
 /**
  * 订单类型枚举
  */
-export type OrderType = 0 | 1  // 0: 未知类型, 1: 普通订单;
+export type OrderType = typeof ORDER_TYPES[keyof typeof ORDER_TYPES];
 
 /**
  * 订单状态枚举
@@ -54,7 +54,7 @@ export interface OrderForm {
 /**
  * 订单明细项状态枚举
  */
-export type OrderItemStatus = 0 | 1 | 2 | 3;
+export type OrderItemStatus = typeof ORDER_ITEM_STATUS[keyof typeof ORDER_ITEM_STATUS]
 
 /**
  * 销售订单明细创建表单接口
@@ -197,4 +197,4 @@ export type CustomerAddressListResponse = AxiosResponse<ApiResponseData<Customer
 /**
  * 销售订单创建响应接口
  */
-export type SalesOrderCreateResponse = AxiosResponse<ApiResponseData<boolean>>;
+export type SalesOrderCreateResponse = AxiosResponse<ApiResponseData<boolean>>;