From 63b17eede0177de4462a995f32430aca6ed1a9d3 Mon Sep 17 00:00:00 2001 From: dzq Date: Thu, 12 Jun 2025 16:15:11 +0800 Subject: [PATCH] =?UTF-8?q?feat(shop):=20=E6=96=B0=E5=A2=9E=E5=95=86?= =?UTF-8?q?=E5=BA=97=E5=8D=A1=E7=89=87=E8=A7=86=E5=9B=BE=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E8=A1=A8=E5=8D=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加商店卡片视图组件,支持图片展示和模式状态显示 - 扩展商店接口DTO,增加封面图、运行模式和借呗支付字段 - 优化商店表单,增加封面图上传和运行模式选择功能 - 移除不再使用的商品模式相关代码 - 添加运行模式和借呗支付的文字映射工具函数 --- src/api/shop/shop.ts | 57 +++- src/views/cabinet/shop/card.vue | 263 ++++++++++++++++++ src/views/cabinet/shop/shop-form-modal.vue | 122 +++++++- .../edit-cabinet-drawer.vue | 8 +- .../smart-cabinet-card-form-modal.vue | 8 +- 5 files changed, 438 insertions(+), 20 deletions(-) create mode 100644 src/views/cabinet/shop/card.vue diff --git a/src/api/shop/shop.ts b/src/api/shop/shop.ts index 3805665..33548ed 100644 --- a/src/api/shop/shop.ts +++ b/src/api/shop/shop.ts @@ -6,6 +6,10 @@ export interface ShopQuery extends BasePageQuery { corpid?: string; /** 归属类型(0-借还柜 1-固资通) */ belongType?: number; + /** 运行模式(0-支付模式 1-审批模式 2-借还模式 3-会员模式 4-耗材模式) */ + mode?: number; + /** 借呗支付(1-正常使用 0-禁止使用) */ + balanceEnable?: number; } /** 商店DTO */ @@ -13,16 +17,28 @@ export interface ShopDTO { shopId: number; shopName: string; corpid?: string; + /** 封面图URL */ + coverImg?: string; /** 归属类型(0-借还柜 1-固资通) */ belongType?: number; + /** 运行模式(0-支付模式 1-审批模式 2-借还模式 3-会员模式 4-耗材模式) */ + mode?: number; + /** 借呗支付(1-正常使用 0-禁止使用) */ + balanceEnable?: number; } /** 新增商店命令 */ export interface AddShopCommand { shopName: string; corpid: string; + /** 封面图URL */ + coverImg?: string; /** 归属类型(0-借还柜 1-固资通) */ belongType?: number; + /** 运行模式(0-支付模式 1-审批模式 2-借还模式 3-会员模式 4-耗材模式) */ + mode?: number; + /** 借呗支付(1-正常使用 0-禁止使用) */ + balanceEnable?: number; } /** 更新商店命令 */ @@ -30,9 +46,48 @@ export interface UpdateShopCommand { corpid: string; shopId: number; shopName: string; + /** 封面图URL */ + coverImg?: string; /** 归属类型(0-借还柜 1-固资通) */ belongType?: number; -} + /** 运行模式(0-支付模式 1-审批模式 2-借还模式 3-会员模式 4-耗材模式) */ + mode?: number; + /** 借呗支付(1-正常使用 0-禁止使用) */ + balanceEnable?: number; +}; + +// 运行模式文字映射 +const modeTextMap = { + 0: '支付模式', + 1: '审批模式', + 2: '借还模式', + 3: '会员模式', + 4: '耗材模式' +}; + +// 借呗支付状态文字映射 +const balanceEnableTextMap = { + 0: '禁止使用', + 1: '正常使用' +}; + +/** + * 将运行模式数值转换为文字描述 + * @param mode 运行模式数值 + * @returns 对应的文字描述,未知值返回空字符串 + */ +export const getModeText = (mode?: number): string => { + return mode !== undefined ? modeTextMap[mode] || '' : ''; +}; + +/** + * 将借呗支付状态转换为文字描述 + * @param balanceEnable 借呗支付状态数值 + * @returns 对应的文字描述,未知值返回空字符串 + */ +export const getBalanceEnableText = (balanceEnable?: number): string => { + return balanceEnable !== undefined ? balanceEnableTextMap[balanceEnable] || '' : ''; +}; /** 获取商店列表 */ export const getShopList = (params?: ShopQuery) => { diff --git a/src/views/cabinet/shop/card.vue b/src/views/cabinet/shop/card.vue new file mode 100644 index 0000000..458414e --- /dev/null +++ b/src/views/cabinet/shop/card.vue @@ -0,0 +1,263 @@ + + + + + diff --git a/src/views/cabinet/shop/shop-form-modal.vue b/src/views/cabinet/shop/shop-form-modal.vue index b215823..440df77 100644 --- a/src/views/cabinet/shop/shop-form-modal.vue +++ b/src/views/cabinet/shop/shop-form-modal.vue @@ -1,8 +1,10 @@ \ No newline at end of file + + + + \ No newline at end of file diff --git a/src/views/cabinet/smart-cabinet-card/edit-cabinet-drawer.vue b/src/views/cabinet/smart-cabinet-card/edit-cabinet-drawer.vue index d9e3c40..5dfe313 100644 --- a/src/views/cabinet/smart-cabinet-card/edit-cabinet-drawer.vue +++ b/src/views/cabinet/smart-cabinet-card/edit-cabinet-drawer.vue @@ -104,12 +104,12 @@ watch(() => props.cabinetInfo, (newVal) => { - + - + diff --git a/src/views/cabinet/smart-cabinet-card/smart-cabinet-card-form-modal.vue b/src/views/cabinet/smart-cabinet-card/smart-cabinet-card-form-modal.vue index 5d1db79..4fb89bb 100644 --- a/src/views/cabinet/smart-cabinet-card/smart-cabinet-card-form-modal.vue +++ b/src/views/cabinet/smart-cabinet-card/smart-cabinet-card-form-modal.vue @@ -103,12 +103,12 @@ const templateOptions = Object.entries(CabinetImgMap).map(([value, item]) => ({ - + - +