store.ts 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. // 상점 도메인 공유 타입 (Backend Response DTO 와 동기)
  2. export type ProductType = 1|2; // 1=Physical 실물, 2=Digital 쿠폰
  3. export type SortKey = 'latest'|'sales'|'price_asc'|'price_desc';
  4. export type OrderStatus = 1|2|3|4|5|6|7|8;
  5. // 1=Pending, 2=Paid, 3=Preparing, 4=Shipped, 5=Delivered, 6=Cancelled, 7=Refunded, 8=Exchanged
  6. export type ShipmentStatus = 1|2|3|4|5;
  7. // 1=Preparing, 2=Pickup, 3=InTransit, 4=Delivered, 5=Failed
  8. // 할인 모드: 0=None, 1=Percent, 2=Amount (Backend DiscountType enum 미러)
  9. export type DiscountType = 0|1|2;
  10. export interface ProductListRow {
  11. id: number;
  12. gameID: number;
  13. gameName: string;
  14. gamePublisher: string;
  15. name: string;
  16. thumbnail: string|null;
  17. type: ProductType;
  18. price: number;
  19. discountType: DiscountType;
  20. discountValue: number;
  21. salePrice: number;
  22. stock: number;
  23. saleStartAt: string|null;
  24. saleEndAt: string|null;
  25. }
  26. export interface ProductListResponse {
  27. total: number;
  28. list: ProductListRow[];
  29. }
  30. export interface GameOption {
  31. id: number;
  32. korName: string;
  33. }
  34. export interface GameListResponse {
  35. list: GameOption[];
  36. }
  37. export interface RelatedProductRow {
  38. id: number;
  39. name: string;
  40. thumbnail: string|null;
  41. type: ProductType;
  42. price: number;
  43. discountType: DiscountType;
  44. discountValue: number;
  45. salePrice: number;
  46. }
  47. export interface ProductDetail {
  48. id: number;
  49. gameID: number;
  50. gameKorName: string;
  51. gameEngName: string|null;
  52. gamePublisher: string;
  53. gameThumbnail: string|null;
  54. gameBigImage: string|null;
  55. gameDescription: string|null;
  56. gameLink: string|null;
  57. name: string;
  58. description: string|null;
  59. thumbnail: string|null;
  60. type: ProductType;
  61. price: number;
  62. discountType: DiscountType;
  63. discountValue: number;
  64. salePrice: number;
  65. stock: number;
  66. minPurchase: number;
  67. maxPurchase: number;
  68. saleStartAt: string|null;
  69. saleEndAt: string|null;
  70. requireDonationChannel: boolean;
  71. relatedProducts: RelatedProductRow[];
  72. }
  73. export type RefundType = 1|2|3|4;
  74. // 1=Cancel, 2=Return, 3=Exchange, 4=Refund
  75. export type RefundStatus = 1|2|3|4;
  76. // 1=Requested, 2=Approved, 3=Rejected, 4=Completed
  77. export type RefundReasonType = 1|2|3|4|5|6|7;
  78. // 1=ChangedMind, 2=OptionChange, 3=ProductDefect, 4=ProductInfoMismatch, 5=DeliveryDelay, 6=WrongDelivery, 7=Other
  79. export const REFUND_REASON_LABEL: Record<RefundReasonType, string> = {
  80. 1: '단순 변심',
  81. 2: '옵션/사이즈 변경',
  82. 3: '상품 불량/파손',
  83. 4: '상품 정보와 다름',
  84. 5: '배송 지연/누락',
  85. 6: '오배송',
  86. 7: '기타'
  87. };
  88. export const REFUND_TYPE_LABEL: Record<RefundType, string> = {
  89. 1: '주문 취소',
  90. 2: '반품',
  91. 3: '교환',
  92. 4: '환불'
  93. };
  94. export const REFUND_STATUS_LABEL: Record<RefundStatus, string> = {
  95. 1: '접수',
  96. 2: '승인됨',
  97. 3: '거부됨',
  98. 4: '처리완료'
  99. };
  100. export interface OrderRefundRow {
  101. id: number;
  102. type: RefundType;
  103. reasonType: RefundReasonType;
  104. status: RefundStatus;
  105. amount: number;
  106. reason: string;
  107. adminMemo: string|null;
  108. requestedAt: string;
  109. resolvedAt: string|null;
  110. }
  111. export interface OrderListRow {
  112. id: number;
  113. orderNumber: string;
  114. totalAmount: number;
  115. status: OrderStatus;
  116. channelID: number|null;
  117. channelName: string|null;
  118. hasPhysical: boolean;
  119. hasDigital: boolean;
  120. createdAt: string;
  121. paidAt: string|null;
  122. itemCount: number;
  123. firstItemName: string;
  124. firstItemThumbnail: string|null;
  125. shipmentStatus: ShipmentStatus|null;
  126. hasActiveRefundRequest: boolean;
  127. }
  128. export interface OrderListResponse {
  129. total: number;
  130. list: OrderListRow[];
  131. }
  132. export interface OrderDetailItem {
  133. id: number;
  134. productID: number;
  135. productName: string;
  136. productThumbnail: string|null;
  137. type: ProductType;
  138. quantity: number;
  139. unitPrice: number;
  140. issuedCouponCodeID: number|null;
  141. }
  142. export interface OrderDetailShipment {
  143. id: number;
  144. status: ShipmentStatus;
  145. carrier: string|null;
  146. trackingNumber: string|null;
  147. shippingFee: number;
  148. shippedAt: string|null;
  149. deliveredAt: string|null;
  150. }
  151. export interface OrderDetail {
  152. id: number;
  153. orderNumber: string;
  154. totalAmount: number;
  155. platformFeeAmount: number;
  156. gameRevenueAmount: number;
  157. channelRewardAmount: number;
  158. status: OrderStatus;
  159. channelID: number|null;
  160. channelName: string|null;
  161. createdAt: string;
  162. paidAt: string|null;
  163. items: OrderDetailItem[];
  164. shipment: OrderDetailShipment|null;
  165. refunds: OrderRefundRow[];
  166. }
  167. export interface InventoryRow {
  168. id: number;
  169. orderItemID: number;
  170. couponCodeID: number;
  171. productID: number;
  172. productName: string;
  173. productThumbnail: string|null;
  174. couponName: string;
  175. gameName: string;
  176. acquiredAt: string;
  177. usedAt: string|null;
  178. expiresAt: string|null;
  179. isExpired: boolean;
  180. code: string|null;
  181. }
  182. export interface InventoryListResponse {
  183. total: number;
  184. list: InventoryRow[];
  185. }
  186. export interface InventoryGroupRow {
  187. productID: number;
  188. productName: string;
  189. productThumbnail: string|null;
  190. gameName: string;
  191. totalCount: number;
  192. unusedCount: number;
  193. earliestAcquiredAt: string;
  194. }
  195. export interface InventoryGroupsResponse {
  196. total: number;
  197. list: InventoryGroupRow[];
  198. }
  199. export interface UseCouponResponse {
  200. code: string;
  201. usedAt: string;
  202. }
  203. export interface PlaceOrderItem {
  204. productID: number;
  205. quantity: number;
  206. }
  207. export interface PlaceOrderRequest {
  208. channelID: number|null;
  209. items: PlaceOrderItem[];
  210. }
  211. export interface PlaceOrderResponse {
  212. orderID: number;
  213. orderNumber: string;
  214. totalAmount: number;
  215. platformFeeAmount: number;
  216. gameRevenueAmount: number;
  217. channelRewardAmount: number;
  218. hasPhysical: boolean;
  219. hasDigital: boolean;
  220. }
  221. export interface ChannelSearchRow {
  222. id: number;
  223. sid: string;
  224. name: string;
  225. handle: string|null;
  226. thumbnailUrl: string|null;
  227. subscriberCount: number;
  228. isVerified: boolean;
  229. donationCode: string|null;
  230. }
  231. export interface ChannelSearchResponse {
  232. total: number;
  233. list: ChannelSearchRow[];
  234. }
  235. export const ORDER_STATUS_LABEL: Record<OrderStatus, string> = {
  236. 1: '결제 전',
  237. 2: '결제완료',
  238. 3: '준비중',
  239. 4: '배송중',
  240. 5: '배송완료',
  241. 6: '취소',
  242. 7: '환불',
  243. 8: '교환'
  244. };
  245. export const SHIPMENT_STATUS_LABEL: Record<ShipmentStatus, string> = {
  246. 1: '준비중',
  247. 2: '집화',
  248. 3: '배송중',
  249. 4: '배송완료',
  250. 5: '실패'
  251. };
  252. export const SORT_OPTIONS: { value: SortKey; label: string }[] = [
  253. { value: 'latest', label: '최신순' },
  254. { value: 'sales', label: '판매량순' },
  255. { value: 'price_asc', label: '낮은 가격순' },
  256. { value: 'price_desc', label: '높은 가격순' }
  257. ];