From 46fd154e3a77189b9ad748e57e13ab7f2b6aae93 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 3 Sep 2023 01:44:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=AE=A2=E5=8D=95=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E5=92=8C=E5=94=AE=E5=90=8E=E9=80=80=E6=AC=BE=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E5=B1=95=E7=A4=BA=E6=A0=B7=E5=BC=8F=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mall/trade/order/index.ts | 3 +- src/utils/dict.ts | 20 +++-- .../mall/trade/afterSale/detail/index.vue | 78 +++++++++++++++++-- src/views/mall/trade/order/detail/index.vue | 74 +++++++++++++++++- 4 files changed, 161 insertions(+), 14 deletions(-) diff --git a/src/api/mall/trade/order/index.ts b/src/api/mall/trade/order/index.ts index d4a22944..b2e4001e 100644 --- a/src/api/mall/trade/order/index.ts +++ b/src/api/mall/trade/order/index.ts @@ -51,12 +51,13 @@ export interface OrderVO { avatar?: string } // 订单操作日志 - orderLog: orderLog[] + orderLog?: orderLog[] } export interface orderLog { content?: string createTime?: Date + userType?: number } export interface OrderItemRespVO { diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 6b163628..661d83a1 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -60,13 +60,20 @@ export const getBoolDictOptions = (dictType: string) => { return dictOption } -export const getDictObj = (dictType: string, value: any) => { +/** + * 获取指定字典类型的指定值对应的字典对象 + * @param dictType 字典类型 + * @param value 字典值 + * @return DictDataType 字典对象 + */ +export const getDictObj = (dictType: string, value: any): DictDataType | undefined => { const dictOptions: DictDataType[] = getDictOptions(dictType) - dictOptions.forEach((dict: DictDataType) => { - if (dict.value === value.toString()) { + console.log(dictOptions) + for (const dict of dictOptions) { + if (dict.value === value + '') { return dict } - }) + } } /** @@ -74,12 +81,13 @@ export const getDictObj = (dictType: string, value: any) => { * * @param dictType 字典类型 * @param value 字典数据的值 + * @return 字典名称 */ -export const getDictLabel = (dictType: string, value: any) => { +export const getDictLabel = (dictType: string, value: any): string => { const dictOptions: DictDataType[] = getDictOptions(dictType) const dictLabel = ref('') dictOptions.forEach((dict: DictDataType) => { - if (dict.value === value) { + if (dict.value === value + '') { dictLabel.value = dict.label } }) diff --git a/src/views/mall/trade/afterSale/detail/index.vue b/src/views/mall/trade/afterSale/detail/index.vue index 190a4b33..fa4d0f91 100644 --- a/src/views/mall/trade/afterSale/detail/index.vue +++ b/src/views/mall/trade/afterSale/detail/index.vue @@ -131,9 +131,7 @@ :timestamp="formatDate(saleLog.createTime)" placement="top" > - - 用户类型: - +
售后状态(之前): 操作明细:{{ saleLog.content }} - +
+ @@ -160,7 +166,7 @@