From 69eb2c0f3a0306a4ab382ddeeb2e8a84da122292 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Wed, 6 Sep 2023 11:23:16 +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=20TODO?= =?UTF-8?q?=20=E6=8F=90=E5=88=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 73628d39309854e7c086a660efe7dc866a7faceb) --- src/api/mall/trade/order/index.ts | 4 +- src/config/axios/service.ts | 4 ++ src/utils/dict.ts | 1 - .../promotion/components/SpuAndSkuList.vue | 2 +- .../mall/trade/afterSale/detail/index.vue | 26 +++++++--- src/views/mall/trade/order/detail/index.vue | 52 ++++++++++--------- src/views/mall/trade/order/index.vue | 4 +- 7 files changed, 55 insertions(+), 38 deletions(-) diff --git a/src/api/mall/trade/order/index.ts b/src/api/mall/trade/order/index.ts index b2e4001e..730a57a6 100644 --- a/src/api/mall/trade/order/index.ts +++ b/src/api/mall/trade/order/index.ts @@ -51,10 +51,10 @@ export interface OrderVO { avatar?: string } // 订单操作日志 - orderLog?: orderLog[] + logs?: logs[] } -export interface orderLog { +export interface logs { content?: string createTime?: Date userType?: number diff --git a/src/config/axios/service.ts b/src/config/axios/service.ts index 1a4741b6..f126f26d 100644 --- a/src/config/axios/service.ts +++ b/src/config/axios/service.ts @@ -191,6 +191,10 @@ service.interceptors.response.use( } return Promise.reject('error') } else { + // 前端处理 data 为 null 的情况,进行提示 + if (data.msg !== '') { + ElNotification.error({ title: msg }) + } return data } }, diff --git a/src/utils/dict.ts b/src/utils/dict.ts index dd9b5cf6..979f405c 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -68,7 +68,6 @@ export const getBoolDictOptions = (dictType: string) => { */ export const getDictObj = (dictType: string, value: any): DictDataType | undefined => { const dictOptions: DictDataType[] = getDictOptions(dictType) - console.log(dictOptions) for (const dict of dictOptions) { if (dict.value === value + '') { return dict diff --git a/src/views/mall/promotion/components/SpuAndSkuList.vue b/src/views/mall/promotion/components/SpuAndSkuList.vue index db29de2d..1f8041bb 100644 --- a/src/views/mall/promotion/components/SpuAndSkuList.vue +++ b/src/views/mall/promotion/components/SpuAndSkuList.vue @@ -41,7 +41,7 @@ import { SpuProperty } from '@/views/mall/promotion/components/index' defineOptions({ name: 'PromotionSpuAndSkuList' }) const props = defineProps<{ - spuList: T[] // TODO 为了方便兼容后续可能有需要展示多个 spu 的情况暂时保持,如果后续都是只操作一个 spu 的话则可更改为接受一个 spu 或保持 + spuList: T[] ruleConfig: RuleConfig[] spuPropertyListP: SpuProperty[] }>() diff --git a/src/views/mall/trade/afterSale/detail/index.vue b/src/views/mall/trade/afterSale/detail/index.vue index fa4d0f91..643d2775 100644 --- a/src/views/mall/trade/afterSale/detail/index.vue +++ b/src/views/mall/trade/afterSale/detail/index.vue @@ -126,7 +126,7 @@ - {{ getDictLabel(DICT_TYPE.USER_TYPE, saleLog.userType)[0] }} + {{ getDictLabel(DICT_TYPE.USER_TYPE, saleLog.userType)[0] || '系' }} @@ -171,15 +171,17 @@ import { formatDate } from '@/utils/formatTime' import UpdateAuditReasonForm from '@/views/mall/trade/afterSale/form/AfterSaleDisagreeForm.vue' import { createImageViewer } from '@/components/ImageViewer' import { isArray } from '@/utils/is' +import { useTagsViewStore } from '@/store/modules/tagsView' defineOptions({ name: 'TradeAfterSaleDetail' }) const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 const { params } = useRoute() // 查询参数 +const { push, currentRoute } = useRouter() // 路由 const formData = ref({ order: {}, - afterSaleLog: [] + logs: [] }) const updateAuditReasonFormRef = ref() // 拒绝售后表单 Ref @@ -202,7 +204,12 @@ const updateStyles = (type: number) => { const getDetail = async () => { const id = params.orderId as unknown as number if (id) { - formData.value = await AfterSaleApi.getAfterSale(id) + const res = await AfterSaleApi.getAfterSale(id) + // 没有表单信息则关闭页面返回 + if (res === null) { + close() + } + formData.value = res } } @@ -261,7 +268,12 @@ const imagePreview = (args) => { urlList }) } - +const { delView } = useTagsViewStore() // 视图操作 +/** 关闭 tag */ +const close = () => { + delView(unref(currentRoute)) + push({ name: 'TradeAfterSale' }) +} onMounted(async () => { await getDetail() }) @@ -322,10 +334,10 @@ onMounted(async () => { background-color: #f7f8fa; &::before { - content: ''; /* 必须设置 content 属性 */ + content: ''; position: absolute; top: 10px; - left: 13px; /* 将伪元素水平居中 */ + left: 13px; border-width: 8px; /* 调整尖角大小 */ border-style: solid; border-color: transparent #f7f8fa transparent transparent; /* 尖角颜色,左侧朝向 */ diff --git a/src/views/mall/trade/order/detail/index.vue b/src/views/mall/trade/order/detail/index.vue index 232e1008..23a82525 100644 --- a/src/views/mall/trade/order/detail/index.vue +++ b/src/views/mall/trade/order/detail/index.vue @@ -40,12 +40,17 @@ - - 调整价格 - 备注 - 发货 - 修改地址 + + 调整价格 + + 备注 + + 发货 + + + 修改地址 + @@ -152,7 +157,7 @@ @@ -209,31 +217,25 @@ const updateStyles = (type: number) => { // 订单详情 const formData = ref({ - orderLog: [] // TODO @puhui999:orderLogs + logs: [] }) -// TODO @puhui999:这个最好也拆掉哈 const deliveryFormRef = ref() // 发货表单 Ref const updateRemarkForm = ref() // 订单备注表单 Ref const updateAddressFormRef = ref() // 收货地址表单 Ref const updatePriceFormRef = ref() // 订单调价表单 Ref -const openForm = (type: string) => { - switch (type) { - case 'remark': - updateRemarkForm.value?.open(formData.value) - break - case 'delivery': - deliveryFormRef.value?.open(formData.value) - break - case 'updateAddress': - updateAddressFormRef.value?.open(formData.value) - break - case 'updatePrice': - updatePriceFormRef.value?.open(formData.value) - break - } +const remark = () => { + updateRemarkForm.value?.open(formData.value) +} +const delivery = () => { + deliveryFormRef.value?.open(formData.value) +} +const updateAddress = () => { + updateAddressFormRef.value?.open(formData.value) +} +const updatePrice = () => { + updatePriceFormRef.value?.open(formData.value) } - /** 获得详情 */ const { params } = useRoute() // 查询参数 const getDetail = async () => { diff --git a/src/views/mall/trade/order/index.vue b/src/views/mall/trade/order/index.vue index 1f89e1de..d0f1b682 100644 --- a/src/views/mall/trade/order/index.vue +++ b/src/views/mall/trade/order/index.vue @@ -100,7 +100,7 @@ /> - +