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' } 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'), component: () => import('@/views/mall/trade/afterSale/detail/index.vue'),
name: 'TradeAfterSaleDetail', name: 'TradeAfterSaleDetail',
meta: { title: '退款详情', icon: 'ep:view', activeMenu: '/mall/trade/after-sale' } meta: { title: '退款详情', icon: 'ep:view', activeMenu: '/mall/trade/after-sale' }

View File

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

View File

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