diff --git a/src/api/user.ts b/src/api/user.ts new file mode 100644 index 0000000..903558e --- /dev/null +++ b/src/api/user.ts @@ -0,0 +1,27 @@ +export interface WardrobeItem { + buyerId: number + categories: string[] + designFor: 'female' | 'male' | 'all' + page: number + size: number +} +export const fetchMyWardrobe = (data: WardrobeItem): Promise => { + return request({ + url: '/buyer/buyer/order/assets/page', + method: 'post', + data + }) +} + +export interface OrderItem { + status: number + page: number + size: number +} +export const fetchMyOrders = (data: OrderItem): Promise => { + return request({ + url: '/buyer/buyer/order/page', + method: 'post', + data + }) +} diff --git a/src/lang/en.ts b/src/lang/en.ts index 2303846..ee75b00 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -127,5 +127,73 @@ export default { singapore: 'Singapore', unitedKingdom: 'United Kingdom' } + }, + Wardrobe: { + title: 'My Wardrobe', + subtitle: 'Your digital pieces, all in one place', + common: { + all: 'All', + currencyHkd: 'HKD' + }, + tabs: { + ariaLabel: 'Wardrobe tabs', + assets: 'Assets', + orders: 'Orders' + }, + sort: { + label: 'Sort by', + placeholder: 'Select', + default: 'Default', + dateAdded: 'Date Added', + selectedFirst: 'Selected First' + }, + assets: { + filters: 'Filters', + clear: 'Clear', + categories: 'Categories', + gender: 'Gender', + selectedCount: '{count} Selected', + selectAll: 'Select All', + deselectAll: 'Deselect All', + downloadSelected: 'Download Selected', + genders: { + male: 'Male', + female: 'Female' + } + }, + orders: { + moreItems: '+{count} more', + statuses: { + all: 'All', + paid: 'Paid', + unpaid: 'Unpaid', + cancelled: 'Canceled' + }, + statusBadges: { + paid: 'PAID', + unpaid: 'UNPAID', + cancelled: 'CANCELED' + }, + actions: { + invoice: 'Invoice', + completePayment: 'Complete Payment', + buyAgain: 'Buy Again' + } + }, + empty: { + title: 'Nothing in Wardrobe yet', + description: 'Explore the digital item and add pieces to your collection.', + action: 'Explore Digital Items' + } + }, + ClothesCategories: { + blouses: 'Blouse', + dress: 'Dress', + trousers: 'Trousers', + skirt: 'Skirt', + tops: 'Tops', + bottoms: 'Bottoms', + outwear: 'Outwear', + others: 'Others' } } diff --git a/src/lang/zh-cn.ts b/src/lang/zh-cn.ts index 5787c9b..56100c3 100644 --- a/src/lang/zh-cn.ts +++ b/src/lang/zh-cn.ts @@ -127,5 +127,73 @@ export default { singapore: '新加坡', unitedKingdom: '英国' } + }, + Wardrobe: { + title: '我的衣橱', + subtitle: '你的数字单品尽在此处', + common: { + all: '全部', + currencyHkd: 'HKD' + }, + tabs: { + ariaLabel: '衣橱标签页', + assets: '资产', + orders: '订单' + }, + sort: { + label: '排序', + placeholder: '请选择', + default: '默认', + dateAdded: '添加日期', + selectedFirst: '已选优先' + }, + assets: { + filters: '筛选', + clear: '清除', + categories: '类别', + gender: '性别', + selectedCount: '已选择 {count} 件', + selectAll: '全选', + deselectAll: '取消全选', + downloadSelected: '下载已选', + genders: { + male: '男', + female: '女' + } + }, + orders: { + moreItems: '还有 {count} 件', + statuses: { + all: '全部', + paid: '已支付', + unpaid: '待支付', + cancelled: '已取消' + }, + statusBadges: { + paid: '已支付', + unpaid: '待支付', + cancelled: '已取消' + }, + actions: { + invoice: '发票', + completePayment: '完成付款', + buyAgain: '再次购买' + } + }, + empty: { + title: '衣橱暂无内容', + description: '探索数字单品,并添加到你的收藏。', + action: '探索数字单品' + } + }, + ClothesCategories: { + blouses: '衬衫', + dress: '连衣裙', + trousers: '裤子', + skirt: '短裙', + tops: '上装', + bottoms: '下装', + outwear: '外套', + others: '其他' } } diff --git a/src/utils/ClothesCategory.ts b/src/utils/ClothesCategory.ts new file mode 100644 index 0000000..cd8d276 --- /dev/null +++ b/src/utils/ClothesCategory.ts @@ -0,0 +1,71 @@ +import { computed } from 'vue' +import { useI18n } from 'vue-i18n' +import i18n from '@/lang' + +type Translate = (key: string) => string + +const clothesCategoryConfigs = [ + { + key: 'blouses', + value: 'blouses' + }, + { + key: 'dress', + value: 'dress' + }, + { + key: 'trousers', + value: 'trousers' + }, + { + key: 'skirt', + value: 'skirt' + }, + { + key: 'tops', + value: 'tops' + }, + { + key: 'bottoms', + value: 'bottoms' + }, + { + key: 'outwear', + value: 'outwear' + }, + { + key: 'others', + value: 'others' + } +] as const + +export type ClothesCategoryValue = (typeof clothesCategoryConfigs)[number]['value'] + +export interface ClothesCategory { + name: string + label: string + value: ClothesCategoryValue +} + +export const createClothesCategories = (t: Translate = i18n.global.t): ClothesCategory[] => + clothesCategoryConfigs.map(({ key, value }) => ({ + name: t(`ClothesCategories.${key}`), + label: t(`ClothesCategories.${key}`), + value + })) + +export const ClothesCategories: ClothesCategory[] = clothesCategoryConfigs.map(({ key, value }) => ({ + get name() { + return i18n.global.t(`ClothesCategories.${key}`) + }, + get label() { + return i18n.global.t(`ClothesCategories.${key}`) + }, + value +})) + +export const useClothesCategories = () => { + const { t } = useI18n({ useScope: 'global' }) + + return computed(() => createClothesCategories(t)) +} diff --git a/src/views/wardrobe/Assets.vue b/src/views/wardrobe/Assets.vue index fc32b2f..b114e39 100644 --- a/src/views/wardrobe/Assets.vue +++ b/src/views/wardrobe/Assets.vue @@ -3,12 +3,14 @@