diff --git a/src/views/mall/trade/afterSale/detail/index.vue b/src/views/mall/trade/afterSale/detail/index.vue index fd989338..7802a805 100644 --- a/src/views/mall/trade/afterSale/detail/index.vue +++ b/src/views/mall/trade/afterSale/detail/index.vue @@ -6,6 +6,7 @@ + @@ -38,21 +39,28 @@ {{ formatDate(formData.auditTime) }} - - - {{ formData.refundPrice }} + + {{ floatToFixed2(formData.refundPrice) }} + {{ formData.applyReason }} {{ formData.applyDescription }} - - {{ formData.applyPicUrls }} + + + @@ -60,13 +68,16 @@ - - 同意售后 - 拒绝售后 - 确认收货 - 拒绝收货 - 确认退款 + 同意售后 + + 拒绝售后 + + + 确认收货 + + 拒绝收货 + 确认退款 @@ -123,7 +134,9 @@ import * as AfterSaleApi from '@/api/mall/trade/afterSale/index' import { floatToFixed2 } from '@/utils' import { DICT_TYPE } from '@/utils/dict' import { formatDate } from '@/utils/formatTime' -import UpdateAuditReasonForm from '@/views/mall/trade/afterSale/components/UpdateAuditReasonForm.vue' +import UpdateAuditReasonForm from '@/views/mall/trade/afterSale/form/AfterSaleDisagreeForm.vue' +import { createImageViewer } from '@/components/ImageViewer' +import { isArray } from '@/utils/is' defineOptions({ name: 'TradeOrderDetailForm' }) @@ -141,34 +154,57 @@ const getDetail = async () => { formData.value = await AfterSaleApi.getAfterSale(id) } } - -/** 各种操作 TODO @puhui999:是不是每个一个方法好点,干净点 */ -const openForm = (type: string) => { - switch (type) { - case 'agree': - message.confirm('是否同意售后?').then(() => { - AfterSaleApi.agree(formData.value.id) - }) - break - case 'disagree': - updateAuditReasonFormRef.value?.open(formData.value) - break - case 'receive': - message.confirm('是否确认收货?').then(() => { - AfterSaleApi.receive(formData.value.id) - }) - break - case 'refuse': - message.confirm('是否拒绝收货?').then(() => { - AfterSaleApi.refuse(formData.value.id) - }) - break - case 'refund': - message.confirm('是否确认退款?').then(() => { - AfterSaleApi.refund(formData.value.id) - }) - break +/** + * 同意售后 + */ +const agree = () => { + message.confirm('是否同意售后?').then(() => { + AfterSaleApi.agree(formData.value.id) + }) +} +/** + * 拒绝售后 + */ +const disagree = () => { + updateAuditReasonFormRef.value?.open(formData.value) +} +/** + * 确认收货 + */ +const receive = () => { + message.confirm('是否确认收货?').then(() => { + AfterSaleApi.receive(formData.value.id) + }) +} +/** + * 拒绝收货 + */ +const refuse = () => { + message.confirm('是否拒绝收货?').then(() => { + AfterSaleApi.refuse(formData.value.id) + }) +} +/** + * 确认退款 + */ +const refund = () => { + message.confirm('是否确认退款?').then(() => { + AfterSaleApi.refund(formData.value.id) + }) +} +/** 图片预览 */ +const imagePreview = (args) => { + const urlList = [] + if (isArray(args)) { + args.forEach((item) => { + urlList.push(item.url) + }) + } else { + urlList.push(args) } + createImageViewer({ + urlList + }) } onMounted(async () => { await getDetail() diff --git a/src/views/mall/trade/afterSale/components/UpdateAuditReasonForm.vue b/src/views/mall/trade/afterSale/form/AfterSaleDisagreeForm.vue similarity index 94% rename from src/views/mall/trade/afterSale/components/UpdateAuditReasonForm.vue rename to src/views/mall/trade/afterSale/form/AfterSaleDisagreeForm.vue index 45f5d447..1fa2b0f5 100644 --- a/src/views/mall/trade/afterSale/components/UpdateAuditReasonForm.vue +++ b/src/views/mall/trade/afterSale/form/AfterSaleDisagreeForm.vue @@ -19,8 +19,7 @@