trade:完善退款详情

This commit is contained in:
YunaiV 2023-10-02 15:44:26 +08:00
parent 4fddbccea1
commit bb08f6f54f
3 changed files with 47 additions and 44 deletions

View File

@ -405,7 +405,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
meta: { title: '订单详情', icon: 'ep:view', activeMenu: '/mall/trade/order' }
},
{
path: 'after-sale/detail/:orderId(\\d+)',
path: 'after-sale/detail/:id(\\d+)',
component: () => import('@/views/mall/trade/afterSale/detail/index.vue'),
name: 'TradeAfterSaleDetail',
meta: { title: '退款详情', icon: 'ep:view', activeMenu: '/mall/trade/after-sale' }

View File

@ -6,7 +6,6 @@
<el-descriptions-item label="配送方式: ">
<dict-tag :type="DICT_TYPE.TRADE_DELIVERY_TYPE" :value="formData.order.deliveryType" />
</el-descriptions-item>
<!-- TODO 营销活动待实现 -->
<el-descriptions-item label="订单类型: ">
<dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="formData.order.type" />
</el-descriptions-item>
@ -29,8 +28,7 @@
<el-descriptions-item label="付款方式: ">
<dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE" :value="formData.order.payChannelCode" />
</el-descriptions-item>
<!-- TODO 芋艿待实现跳转会员 -->
<!-- <el-descriptions-item label="买家: ">{{ formData.user.nickname }}</el-descriptions-item> -->
<el-descriptions-item label="买家: ">{{ formData?.user?.nickname }}</el-descriptions-item>
</el-descriptions>
<!-- 售后信息 -->
@ -46,7 +44,7 @@
<dict-tag :type="DICT_TYPE.TRADE_AFTER_SALE_WAY" :value="formData.way" />
</el-descriptions-item>
<el-descriptions-item label="退款金额: ">
{{ floatToFixed2(formData.refundPrice) }}
{{ fenToYuan(formData.refundPrice) }}
</el-descriptions-item>
<el-descriptions-item label="退款原因: ">{{ formData.applyReason }}</el-descriptions-item>
<el-descriptions-item label="补充描述: ">
@ -92,7 +90,7 @@
<el-descriptions-item labelClassName="no-colon">
<el-row :gutter="20">
<el-col :span="15">
<el-table :data="formData.items" border>
<el-table :data="[formData.orderItem]" border>
<el-table-column label="商品" prop="spuName" width="auto">
<template #default="{ row }">
{{ row.spuName }}
@ -102,19 +100,11 @@
</template>
</el-table-column>
<el-table-column label="商品原价" prop="price" width="150">
<template #default="{ row }">{{ floatToFixed2(row.price) }}</template>
<template #default="{ row }">{{ fenToYuan(row.price) }} </template>
</el-table-column>
<el-table-column label="数量" prop="count" width="100" />
<el-table-column label="合计" prop="payPrice" width="150">
<template #default="{ row }">{{ floatToFixed2(row.payPrice) }}</template>
</el-table-column>
<el-table-column label="售后状态" prop="afterSaleStatus" width="120">
<template #default="{ row }">
<dict-tag
:type="DICT_TYPE.TRADE_ORDER_ITEM_AFTER_SALE_STATUS"
:value="row.afterSaleStatus"
/>
</template>
<template #default="{ row }">{{ fenToYuan(row.payPrice) }} </template>
</el-table-column>
</el-table>
</el-col>
@ -122,6 +112,8 @@
</el-row>
</el-descriptions-item>
</el-descriptions>
<!-- 操作日志 -->
<el-descriptions title="售后日志">
<el-descriptions-item labelClassName="no-colon">
<el-timeline>
@ -153,7 +145,7 @@
</template>
<script lang="ts" setup>
import * as AfterSaleApi from '@/api/mall/trade/afterSale/index'
import { floatToFixed2 } from '@/utils'
import { fenToYuan } from '@/utils'
import { DICT_TYPE, getDictLabel, getDictObj } from '@/utils/dict'
import { formatDate } from '@/utils/formatTime'
import UpdateAuditReasonForm from '@/views/mall/trade/afterSale/form/AfterSaleDisagreeForm.vue'
@ -191,7 +183,7 @@ const getUserTypeColor = (type: number) => {
/** 获得详情 */
const getDetail = async () => {
const id = params.orderId as unknown as number
const id = params.id as unknown as number
if (id) {
const res = await AfterSaleApi.getAfterSale(id)
//
@ -204,44 +196,56 @@ const getDetail = async () => {
}
/** 同意售后 */
const agree = () => {
message.confirm('是否同意售后?').then(() => {
AfterSaleApi.agree(formData.value.id)
const agree = async () => {
try {
//
await message.confirm('是否同意售后?')
await AfterSaleApi.agree(formData.value.id)
//
message.success(t('common.success'))
getDetail()
})
await getDetail()
} catch {}
}
/** 拒绝售后 */
const disagree = () => {
const disagree = async () => {
updateAuditReasonFormRef.value?.open(formData.value)
}
/** 确认收货 */
const receive = () => {
message.confirm('是否确认收货?').then(() => {
AfterSaleApi.receive(formData.value.id)
const receive = async () => {
try {
//
await message.confirm('是否确认收货?')
await AfterSaleApi.receive(formData.value.id)
//
message.success(t('common.success'))
getDetail()
})
await getDetail()
} catch {}
}
/** 拒绝收货 */
const refuse = () => {
message.confirm('是否拒绝收货?').then(() => {
AfterSaleApi.refuse(formData.value.id)
const refuse = async () => {
try {
//
await message.confirm('是否拒绝收货?')
await AfterSaleApi.refuse(formData.value.id)
//
message.success(t('common.success'))
getDetail()
})
await getDetail()
} catch {}
}
/** 确认退款 */
const refund = () => {
message.confirm('是否确认退款?').then(() => {
AfterSaleApi.refund(formData.value.id)
const refund = async () => {
try {
//
await message.confirm('是否确认退款?')
await AfterSaleApi.refund(formData.value.id)
//
message.success(t('common.success'))
getDetail()
})
await getDetail()
} catch {}
}
/** 图片预览 */

View File

@ -135,17 +135,16 @@
</el-table-column>
<el-table-column align="center" label="订单金额" prop="refundPrice">
<template #default="scope">
<span>{{ floatToFixed2(scope.row.refundPrice) }}</span>
<span>{{ fenToYuan(scope.row.refundPrice) }} </span>
</template>
</el-table-column>
<!-- TODO 芋艿未来要加个会员链接 -->
<el-table-column align="center" label="买家" prop="user.nickname" />
<el-table-column align="center" label="申请时间" prop="createTime" width="180">
<template #default="scope">
<span>{{ formatDate(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="售后状态">
<el-table-column align="center" label="售后状态" width="100">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TRADE_AFTER_SALE_STATUS" :value="scope.row.status" />
</template>
@ -177,7 +176,7 @@ import { formatDate } from '@/utils/formatTime'
import { createImageViewer } from '@/components/ImageViewer'
import { TabsPaneContext } from 'element-plus'
import { cloneDeep } from 'lodash-es'
import { floatToFixed2 } from '@/utils'
import { fenToYuan } from '@/utils'
defineOptions({ name: 'TradeAfterSale' })
@ -240,7 +239,7 @@ const tabClick = async (tab: TabsPaneContext) => {
/** 处理退款 */
const openAfterSaleDetail = (id: number) => {
push({ name: 'TradeAfterSaleDetail', params: { orderId: id } })
push({ name: 'TradeAfterSaleDetail', params: { id } })
}
/** 查看订单详情 */