订单列表:列表重构 ② and 完善订单详情

This commit is contained in:
puhui999 2023-08-21 22:39:21 +08:00
parent 161feab244
commit 345c09ee6c
6 changed files with 434 additions and 364 deletions

View File

@ -1,52 +1,52 @@
import request from '@/config/axios' import request from '@/config/axios'
export interface OrderVO { export interface OrderVO {
id?: number // 订单编号 id?: number | null // 订单编号
no?: string // 订单流水号 no?: string // 订单流水号
createTime?: Date // 下单时间 createTime?: Date | null // 下单时间
type?: number // 订单类型 type?: number | null // 订单类型
terminal?: number // 订单来源 terminal?: number | null // 订单来源
userId?: number // 用户编号 userId?: number | null // 用户编号
userIp?: string // 用户 IP userIp?: string // 用户 IP
userRemark?: string // 用户备注 userRemark?: string // 用户备注
status?: number // 订单状态 status?: number | null // 订单状态
productCount?: number // 购买的商品数量 productCount?: number | null // 购买的商品数量
finishTime?: Date // 订单完成时间 finishTime?: Date | null // 订单完成时间
cancelTime?: Date // 订单取消时间 cancelTime?: Date | null // 订单取消时间
cancelType?: number // 取消类型 cancelType?: number | null // 取消类型
remark?: string // 商家备注 remark?: string // 商家备注
payOrderId: number // 支付订单编号 payOrderId: number | null // 支付订单编号
payed?: boolean // 是否已支付 payed?: boolean // 是否已支付
payTime?: Date // 付款时间 payTime?: Date | null // 付款时间
payChannelCode?: string // 支付渠道 payChannelCode?: string // 支付渠道
originalPrice?: number // 商品原价(总) originalPrice?: number | null // 商品原价(总)
orderPrice?: number // 订单原价(总) orderPrice?: number | null // 订单原价(总)
discountPrice?: number // 订单优惠(总) discountPrice?: number | null // 订单优惠(总)
deliveryPrice?: number // 运费金额 deliveryPrice?: number | null // 运费金额
adjustPrice?: number // 订单调价(总) adjustPrice?: number | null // 订单调价(总)
payPrice?: number // 应付金额(总) payPrice?: number | null // 应付金额(总)
deliveryType?: number // 发货方式 deliveryType?: number | null // 发货方式
deliveryTemplateId?: number // 配送模板编号 deliveryTemplateId?: number | null // 配送模板编号
logisticsId?: number // 发货物流公司编号 logisticsId?: number | null | null // 发货物流公司编号
logisticsNo?: string // 发货物流单号 logisticsNo?: string // 发货物流单号
deliveryStatus?: number // 发货状态 deliveryStatus?: number | null // 发货状态
deliveryTime?: Date // 发货时间 deliveryTime?: Date | null // 发货时间
receiveTime?: Date // 收货时间 receiveTime?: Date | null // 收货时间
receiverName?: string // 收件人名称 receiverName?: string // 收件人名称
receiverMobile?: string // 收件人手机 receiverMobile?: string // 收件人手机
receiverAreaId?: number // 收件人地区编号 receiverAreaId?: number | null // 收件人地区编号
receiverPostCode?: number // 收件人邮编 receiverPostCode?: number | null // 收件人邮编
receiverDetailAddress?: string // 收件人详细地址 receiverDetailAddress?: string // 收件人详细地址
afterSaleStatus?: number // 售后状态 afterSaleStatus?: number | null // 售后状态
refundPrice?: number // 退款金额 refundPrice?: number | null // 退款金额
couponId?: number // 优惠劵编号 couponId?: number | null // 优惠劵编号
couponPrice?: number // 优惠劵减免金额 couponPrice?: number | null // 优惠劵减免金额
pointPrice?: number // 积分抵扣的金额 pointPrice?: number | null // 积分抵扣的金额
receiverAreaName?: string //收件人地区名字 receiverAreaName?: string //收件人地区名字
items?: OrderItemRespVO[] // 订单项列表 items?: OrderItemRespVO[] // 订单项列表
//用户信息 //用户信息
user?: { user?: {
id?: number id?: number | null
nickname?: string nickname?: string
avatar?: string avatar?: string
} }
@ -54,33 +54,33 @@ export interface OrderVO {
export interface OrderItemRespVO { export interface OrderItemRespVO {
// ========== 订单项基本信息 ========== // ========== 订单项基本信息 ==========
id?: number // 编号 id?: number | null // 编号
userId?: number // 用户编号 userId?: number | null // 用户编号
orderId?: number // 订单编号 orderId?: number | null // 订单编号
// ========== 商品基本信息 ========== // ========== 商品基本信息 ==========
spuId?: number // 商品 SPU 编号 spuId?: number | null // 商品 SPU 编号
spuName?: string //商品 SPU 名称 spuName?: string //商品 SPU 名称
skuId?: number // 商品 SKU 编号 skuId?: number | null // 商品 SKU 编号
picUrl?: string //商品图片 picUrl?: string //商品图片
count?: number //购买数量 count?: number | null //购买数量
// ========== 价格 + 支付基本信息 ========== // ========== 价格 + 支付基本信息 ==========
originalPrice?: number //商品原价(总) originalPrice?: number | null //商品原价(总)
originalUnitPrice?: number //商品原价(单) originalUnitPrice?: number | null //商品原价(单)
discountPrice?: number //商品优惠(总) discountPrice?: number | null //商品优惠(总)
payPrice?: number //商品实付金额(总) payPrice?: number | null //商品实付金额(总)
orderPartPrice?: number //子订单分摊金额(总) orderPartPrice?: number | null //子订单分摊金额(总)
orderDividePrice?: number //分摊后子订单实付金额(总) orderDividePrice?: number | null //分摊后子订单实付金额(总)
// ========== 营销基本信息 ========== // ========== 营销基本信息 ==========
// TODO 芋艿:在捉摸一下 // TODO 芋艿:在捉摸一下
// ========== 售后基本信息 ========== // ========== 售后基本信息 ==========
afterSaleStatus?: number // 售后状态 afterSaleStatus?: number | null // 售后状态
properties?: ProductPropertiesVO[] //属性数组 properties?: ProductPropertiesVO[] //属性数组
} }
export interface ProductPropertiesVO { export interface ProductPropertiesVO {
propertyId?: number // 属性的编号 propertyId?: number | null // 属性的编号
propertyName?: string // 属性的名称 propertyName?: string // 属性的名称
valueId?: number //属性值的编号 valueId?: number | null //属性值的编号
valueName?: string // 属性值的名称 valueName?: string // 属性值的名称
} }
@ -90,8 +90,8 @@ export const getOrderPage = async (params) => {
} }
// 查询交易订单详情 // 查询交易订单详情
export const getOrder = async (id: number) => { export const getOrder = async (id: number | null) => {
return await request.get({ url: `/trade/order/get?id=` + id }) return await request.get({ url: `/trade/order/get-detail?id=` + id })
} }
// 新增交易订单 // 新增交易订单
@ -105,6 +105,6 @@ export const updateOrder = async (data: OrderVO) => {
} }
// 删除交易订单 // 删除交易订单
export const deleteOrder = async (id: number) => { export const deleteOrder = async (id: number | null) => {
return await request.delete({ url: `/trade/order/delete?id=` + id }) return await request.delete({ url: `/trade/order/delete?id=` + id })
} }

View File

@ -349,7 +349,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
{ {
path: '/property', path: '/property',
component: Layout, component: Layout,
name: 'property', name: 'Property',
meta: { meta: {
hidden: true hidden: true
}, },
@ -411,6 +411,22 @@ const remainingRouter: AppRouteRecordRaw[] = [
} }
] ]
}, },
{
path: '/trade/order',
component: Layout,
name: 'Detail',
meta: {
hidden: true
},
children: [
{
path: 'detail/:orderId(\\d+)',
component: () => import('@/views/mall/trade/order/detail/index.vue'),
name: 'TradeOrderDetailForm',
meta: { title: '订单详情', icon: '', activeMenu: '/trade/trade/order' }
}
]
},
{ {
path: '/pay', path: '/pay',
component: Layout, component: Layout,

View File

@ -130,7 +130,7 @@ export enum DICT_TYPE {
BPM_OA_LEAVE_TYPE = 'bpm_oa_leave_type', BPM_OA_LEAVE_TYPE = 'bpm_oa_leave_type',
// ========== PAY 模块 ========== // ========== PAY 模块 ==========
PAY_CHANNEL_CODE = 'pay_channel_code', // 支付渠道编码类型 PAY_CHANNEL_CODE_TYPE = 'pay_channel_code_type', // 支付渠道编码类型
PAY_ORDER_STATUS = 'pay_order_status', // 商户支付订单状态 PAY_ORDER_STATUS = 'pay_order_status', // 商户支付订单状态
PAY_REFUND_STATUS = 'pay_refund_status', // 退款订单状态 PAY_REFUND_STATUS = 'pay_refund_status', // 退款订单状态
PAY_NOTIFY_STATUS = 'pay_notify_status', // 商户支付回调状态 PAY_NOTIFY_STATUS = 'pay_notify_status', // 商户支付回调状态

View File

@ -1,33 +1,32 @@
<template> <template>
<Dialog v-model="dialogVisible" :scroll="true" :title="dialogTitle" width="65%">
<ContentWrap> <ContentWrap>
<!-- 订单信息 --> <!-- 订单信息 -->
<el-descriptions title="订单信息"> <el-descriptions title="订单信息">
<el-descriptions-item label="订单号: ">{{ order.no }}</el-descriptions-item> <el-descriptions-item label="订单号: ">{{ orderInfo.no }}</el-descriptions-item>
<el-descriptions-item label="配送方式: ">物流配送</el-descriptions-item> <el-descriptions-item label="配送方式: ">物流配送</el-descriptions-item>
<!-- TODO 芋艿待实现 --> <!-- TODO 芋艿待实现 -->
<el-descriptions-item label="营销活动: ">物流配送</el-descriptions-item> <el-descriptions-item label="营销活动: ">物流配送</el-descriptions-item>
<!-- TODO 芋艿待实现 --> <!-- TODO 芋艿待实现 -->
<el-descriptions-item label="订单类型: "> <el-descriptions-item label="订单类型: ">
<dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="order.type" /> <dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="orderInfo.type" />
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="收货人: ">{{ order.receiverName }}</el-descriptions-item> <el-descriptions-item label="收货人: ">{{ orderInfo.receiverName }}</el-descriptions-item>
<el-descriptions-item label="买家留言: ">{{ order.userRemark }}</el-descriptions-item> <el-descriptions-item label="买家留言: ">{{ orderInfo.userRemark }}</el-descriptions-item>
<el-descriptions-item label="订单来源: "> <el-descriptions-item label="订单来源: ">
<dict-tag :type="DICT_TYPE.TERMINAL" :value="order.terminal" /> <dict-tag :type="DICT_TYPE.TERMINAL" :value="orderInfo.terminal" />
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="联系电话: ">{{ order.receiverMobile }}</el-descriptions-item> <el-descriptions-item label="联系电话: ">{{ orderInfo.receiverMobile }}</el-descriptions-item>
<el-descriptions-item label="商家备注: ">{{ order.remark }}</el-descriptions-item> <el-descriptions-item label="商家备注: ">{{ orderInfo.remark }}</el-descriptions-item>
<el-descriptions-item label="支付单号: ">{{ order.payOrderId }}</el-descriptions-item> <el-descriptions-item label="支付单号: ">{{ orderInfo.payOrderId }}</el-descriptions-item>
<el-descriptions-item label="付款方式: "> <el-descriptions-item label="付款方式: ">
<dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE_TYPE" :value="order.payChannelCode" /> <dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE_TYPE" :value="orderInfo.payChannelCode" />
</el-descriptions-item> </el-descriptions-item>
<!-- <el-descriptions-item label="买家: ">{{ order.user.nickname }}</el-descriptions-item> --> <!-- <el-descriptions-item label="买家: ">{{ orderInfo.user.nickname }}</el-descriptions-item> -->
<!-- TODO 芋艿待实现跳转会员 --> <!-- TODO 芋艿待实现跳转会员 -->
<el-descriptions-item label="收货地址: "> <el-descriptions-item label="收货地址: ">
{{ order.receiverAreaName }} {{ order.receiverDetailAddress }} {{ orderInfo.receiverAreaName }} {{ orderInfo.receiverDetailAddress }}
<el-link <el-link
v-clipboard:copy="order.receiverAreaName + ' ' + order.receiverDetailAddress" v-clipboard:copy="orderInfo.receiverAreaName + ' ' + orderInfo.receiverDetailAddress"
v-clipboard:success="clipboardSuccess" v-clipboard:success="clipboardSuccess"
icon="ep:document-copy" icon="ep:document-copy"
type="primary" type="primary"
@ -40,9 +39,9 @@
<el-descriptions-item label="订单状态: "> <el-descriptions-item label="订单状态: ">
<!-- TODO xiaobaistatus 一定有值哈不用判断 --> <!-- TODO xiaobaistatus 一定有值哈不用判断 -->
<dict-tag <dict-tag
v-if="order.status !== ''" v-if="orderInfo.status !== ''"
:type="DICT_TYPE.TRADE_ORDER_STATUS" :type="DICT_TYPE.TRADE_ORDER_STATUS"
:value="order.status" :value="orderInfo.status"
/> />
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label-class-name="no-colon"> <el-descriptions-item label-class-name="no-colon">
@ -52,14 +51,8 @@
<!-- TODO 芋艿待实现 --> <!-- TODO 芋艿待实现 -->
<el-button size="small" type="primary">发货</el-button> <el-button size="small" type="primary">发货</el-button>
<!-- TODO 芋艿待实现 --> <!-- TODO 芋艿待实现 -->
<el-button size="small" type="primary">关闭订单</el-button>
<!-- TODO 芋艿待实现 -->
<el-button size="small" type="primary">修改地址</el-button> <el-button size="small" type="primary">修改地址</el-button>
<!-- TODO 芋艿待实现 --> <!-- TODO 芋艿待实现 -->
<el-button size="small" type="primary">打印电子面单</el-button>
<!-- TODO 芋艿待实现 -->
<el-button size="small" type="primary">打印发货单</el-button>
<!-- TODO 芋艿待实现 -->
<el-button size="small" type="primary">确认收货</el-button> <el-button size="small" type="primary">确认收货</el-button>
<!-- TODO 芋艿待实现 --> <!-- TODO 芋艿待实现 -->
</el-descriptions-item> </el-descriptions-item>
@ -78,7 +71,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="order.items" border> <el-table :data="orderInfo.items" 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 }}
@ -110,35 +103,35 @@
<!-- 占位 --> <!-- 占位 -->
<!-- <el-descriptions-item v-for="item in 5" label-class-name="no-colon" :key="item" /> --> <!-- <el-descriptions-item v-for="item in 5" label-class-name="no-colon" :key="item" /> -->
</el-descriptions> </el-descriptions>
<el-descriptions column="6"> <el-descriptions :column="6">
<el-descriptions-item label="商品总额: "> <el-descriptions-item label="商品总额: ">
{{ formatToFraction(order.totalPrice) }} {{ formatToFraction(orderInfo.totalPrice) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="运费金额: "> <el-descriptions-item label="运费金额: ">
{{ formatToFraction(order.deliveryPrice) }} {{ formatToFraction(orderInfo.deliveryPrice) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="订单调价: "> <el-descriptions-item label="订单调价: ">
{{ formatToFraction(order.adjustPrice) }} {{ formatToFraction(orderInfo.adjustPrice) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template #label><span style="color: red">商品优惠: </span></template> <template #label><span style="color: red">商品优惠: </span></template>
<!-- 没理解TODO order.totalPrice - order.totalPrice --> <!-- 没理解TODO orderInfo.totalPrice - orderInfo.totalPrice -->
{{ formatToFraction(order.totalPrice - order.totalPrice) }} {{ formatToFraction(orderInfo.totalPrice - orderInfo.totalPrice) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template #label><span style="color: red">订单优惠: </span></template> <template #label><span style="color: red">订单优惠: </span></template>
{{ formatToFraction(order.discountPrice) }} {{ formatToFraction(orderInfo.discountPrice) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item> <el-descriptions-item>
<template #label><span style="color: red">积分抵扣: </span></template> <template #label><span style="color: red">积分抵扣: </span></template>
{{ formatToFraction(order.pointPrice) }} {{ formatToFraction(orderInfo.pointPrice) }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item v-for="item in 5" :key="item" label-class-name="no-colon" /> <el-descriptions-item v-for="item in 5" :key="item" label-class-name="no-colon" />
<!-- 占位 --> <!-- 占位 -->
<el-descriptions-item label="应付金额: "> <el-descriptions-item label="应付金额: ">
{{ formatToFraction(order.payPrice) }} {{ formatToFraction(orderInfo.payPrice) }}
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
@ -219,33 +212,60 @@
</el-descriptions> </el-descriptions>
</div> </div>
</ContentWrap> </ContentWrap>
</Dialog>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import * as TradeOrderApi from '@/api/mall/trade/order'
import { formatToFraction } from '@/utils' import { formatToFraction } from '@/utils'
import { DICT_TYPE } from '@/utils/dict' import { DICT_TYPE } from '@/utils/dict'
defineOptions({ name: 'TradeOrderDetailForm' }) defineOptions({ name: 'TradeOrderDetailForm' })
const message = useMessage() // const message = useMessage() //
const dialogVisible = ref(false) // const { params } = useRoute() //
const dialogTitle = ref('订单详情') // // const loading = ref(false)
const orderInfo = ref<TradeOrderApi.OrderVO>({
const open = () => { no: '',
dialogVisible.value = true createTime: null,
} type: null,
defineExpose({ open }) terminal: null,
userId: null,
const { query } = useRoute() userIp: '',
const queryParams = reactive({ userRemark: '',
id: query.id status: null,
}) productCount: null,
finishTime: null,
const loading = ref(false) cancelTime: null,
const order = ref<any>({ cancelType: null,
remark: '',
payOrderId: null,
payed: false,
payTime: null,
payChannelCode: '',
originalPrice: null,
orderPrice: null,
discountPrice: null,
deliveryPrice: null,
adjustPrice: null,
payPrice: null,
deliveryTemplateId: null,
logisticsId: null,
logisticsNo: '',
deliveryStatus: null,
deliveryTime: null,
receiveTime: null,
receiverName: '',
receiverMobile: '',
receiverAreaId: null,
receiverPostCode: null,
receiverDetailAddress: '',
afterSaleStatus: null,
refundPrice: null,
couponPrice: null,
pointPrice: null,
receiverAreaName: '',
items: [], items: [],
user: {} user: {}
}) // })
const detailGroups = ref([ const detailGroups = ref([
{ {
@ -311,23 +331,25 @@ const detailInfo = ref({
], ],
goodsInfo: [] // tableData goodsInfo: [] // tableData
}) })
// TODO
const getlist = async () => { /** 获得详情 */
// dialogVisible.value = true const getDetail = async () => {
// loading.value = true const id = params.orderId as unknown as number
// try { if (id) {
// const res = await TradeOrderApi.getOrderDetail(queryParams.id as unknown as number) const res = (await TradeOrderApi.getOrder(id)) as TradeOrderApi.OrderVO
// order.value = res // TODO 使
// console.log(order) res.user = {
// } catch { id: 247,
// message.error('') nickname: '小妮子'
// } finally {
// loading.value = false
// }
} }
orderInfo.value = res
}
}
onMounted(async () => { onMounted(async () => {
await getlist() await getDetail()
}) })
const clipboardSuccess = () => { const clipboardSuccess = () => {
message.success('复制成功') message.success('复制成功')
} }

View File

@ -111,20 +111,31 @@
<el-table-column fixed="left" type="expand"> <el-table-column fixed="left" type="expand">
<template #default="scope"> <template #default="scope">
<el-table :data="scope.row.items" :span-method="spanMethod" border style="width: 100%"> <el-table :data="scope.row.items" :span-method="spanMethod" border style="width: 100%">
<el-table-column label="商品" prop="spuName"> <el-table-column label="商品信息" min-width="300" prop="spuName">
<template #default="{ row }"> <template #default="{ row }">
{{ row.spuName }} <div class="flex items-center">
<el-tag v-for="property in row.properties" :key="property.propertyId"> <el-image
:src="row.picUrl"
class="w-30px h-30px mr-10px"
@click="imagePreview(row.picUrl)"
/>
<span class="mr-10px">{{ row.spuName }}</span>
<el-tag
v-for="property in row.properties"
:key="property.propertyId"
class="mr-10px"
>
{{ property.propertyName }}: {{ property.valueName }} {{ property.propertyName }}: {{ property.valueName }}
</el-tag> </el-tag>
</div>
</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 }">{{ formatToFraction(row.price) }}</template> <template #default="{ row }">{{ formatToFraction(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 }">{{ formatToFraction(row.payPrice) }}</template> <template #default="{ row }">{{ formatToFraction(row.payPrice) }}</template>
</el-table-column> </el-table-column>
<el-table-column label="售后状态" prop="afterSaleStatus" width="120"> <el-table-column label="售后状态" prop="afterSaleStatus" width="120">
<template #default="{ row }"> <template #default="{ row }">
@ -134,22 +145,33 @@
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="实际支付(元)" min-width="120" prop="payPrice"> <el-table-column align="center" label="实际支付" min-width="120" prop="payPrice">
<template #default> <template #default>
{{ formatToFraction(scope.row.payPrice) + '元' }} {{ formatToFraction(scope.row.payPrice) + '元' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="买家/收货人" min-width="120">
<template #default>
<div class="flex flex-col">
<span>买家{{ scope.row.user.nickname }}</span>
<span>
收货人{{ scope.row.receiverName }} {{ scope.row.receiverMobile }}
{{ scope.row.receiverAreaName }} {{ scope.row.receiverDetailAddress }}
</span>
</div>
</template>
</el-table-column>
<el-table-column align="center" label="配送方式" prop="deliveryType" width="120"> <el-table-column align="center" label="配送方式" prop="deliveryType" width="120">
<template #default> 快递</template> <template #default> 快递</template>
</el-table-column> </el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="160"> <el-table-column align="center" fixed="right" label="操作" width="160">
<template #default="{ row }"> <template #default>
<div class="flex justify-center items-center"> <div class="flex justify-center items-center">
<el-button link type="primary" @click="openForm"> <el-button link type="primary" @click="openForm(scope.row.id)">
<Icon icon="ep:notification" /> <Icon icon="ep:notification" />
详情 详情
</el-button> </el-button>
<el-dropdown @command="(command) => handleCommand(command, row)"> <el-dropdown @command="(command) => handleCommand(command, scope.row)">
<el-button link type="primary"> <el-button link type="primary">
<Icon icon="ep:d-arrow-right" /> <Icon icon="ep:d-arrow-right" />
更多 更多
@ -187,13 +209,6 @@
<dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="row.type" /> <dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="row.type" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="用户信息" min-width="100">
<template #default="{ row }">
<el-button link type="primary">
{{ row.userId }}{{ '[' + row.user.nickname + ']' }}
</el-button>
</template>
</el-table-column>
<el-table-column align="center" label="订单来源" min-width="145"> <el-table-column align="center" label="订单来源" min-width="145">
<template #default="{ row }"> <template #default="{ row }">
<dict-tag v-if="row.terminal" :type="DICT_TYPE.TERMINAL" :value="row.terminal" /> <dict-tag v-if="row.terminal" :type="DICT_TYPE.TERMINAL" :value="row.terminal" />
@ -242,28 +257,26 @@
@pagination="getList" @pagination="getList"
/> />
</ContentWrap> </ContentWrap>
<TradeOrderDetailForm ref="tradeOrderDetailFormRef" />
</template> </template>
<script lang="ts" name="Order" setup> <script lang="ts" name="Order" setup>
import TradeOrderDetailForm from './detail/index.vue'
import type { FormInstance, TableColumnCtx } from 'element-plus' import type { FormInstance, TableColumnCtx } from 'element-plus'
import { dateFormatter } from '@/utils/formatTime' import { dateFormatter } from '@/utils/formatTime'
import * as TradeOrderApi from '@/api/mall/trade/order'
import { OrderItemRespVO, OrderVO } from '@/api/mall/trade/order' import { OrderItemRespVO, OrderVO } from '@/api/mall/trade/order'
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import { formatToFraction } from '@/utils' import { formatToFraction } from '@/utils'
import { testData } from './testData'
import { createImageViewer } from '@/components/ImageViewer' import { createImageViewer } from '@/components/ImageViewer'
// const message = useMessage() // // const message = useMessage() //
// const { t } = useI18n() // // const { t } = useI18n() //
const { currentRoute, push } = useRouter() //
const loading = ref(true) // const loading = ref(true) //
const total = ref(2) // const total = ref(2) //
const list = ref<OrderVO[]>([]) // const list = ref<OrderVO[]>([]) //
const tradeOrderDetailFormRef = ref<InstanceType<typeof TradeOrderDetailForm>>() const openForm = (id) => {
const openForm = () => { push('/trade/order/detail/' + id)
tradeOrderDetailFormRef.value?.open()
} }
/** 商品图预览 */ /** 商品图预览 */
const imagePreview = (imgUrl: string) => { const imagePreview = (imgUrl: string) => {
@ -280,7 +293,7 @@ interface SpanMethodProps {
} }
const spanMethod = ({ rowIndex, columnIndex }: SpanMethodProps) => { const spanMethod = ({ rowIndex, columnIndex }: SpanMethodProps) => {
const colIndex = [5, 6, 7] const colIndex = [5, 6, 7, 8]
// //
if (colIndex.includes(columnIndex)) { if (colIndex.includes(columnIndex)) {
// //
@ -348,9 +361,18 @@ const searchList = ref([
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
try { try {
// const data = await TradeOrderApi.getOrderPage(queryParams) const data = await TradeOrderApi.getOrderPage(queryParams)
// list.value = data.list const list_ = data.list as OrderVO[]
// total.value = data.total // TODO 使
list_.forEach((item) => {
item.user = {
id: 247,
nickname: '小妮子'
}
})
list.value = list_
total.value = data.total
} finally { } finally {
loading.value = false loading.value = false
} }
@ -368,9 +390,17 @@ const resetQuery = () => {
handleQuery() handleQuery()
} }
//
watch(
() => currentRoute.value,
() => {
getList()
}
)
/** 初始化 **/ /** 初始化 **/
onMounted(() => { onMounted(() => {
list.value = testData // list.value = testData
getList() getList()
}) })
</script> </script>

View File

@ -18,7 +18,7 @@ export const testData: OrderVO = [
remark: '', remark: '',
payOrderId: 10002, payOrderId: 10002,
payed: false, payed: false,
payTime: null, payTime: new Date('2023-08-17T12:30:00'),
payChannelCode: 'wx_app', payChannelCode: 'wx_app',
originalPrice: 80, originalPrice: 80,
orderPrice: 80, orderPrice: 80,
@ -32,26 +32,27 @@ export const testData: OrderVO = [
deliveryStatus: 0, deliveryStatus: 0,
deliveryTime: null, deliveryTime: null,
receiveTime: null, receiveTime: null,
receiverName: 'Jane Smith', receiverName: '李四',
receiverMobile: '987-654-3210', receiverMobile: '19855568989',
receiverAreaId: 4002, receiverAreaId: 4002,
receiverPostCode: 54321, receiverPostCode: 54321,
receiverDetailAddress: '456 Elm St, Apt 2C', receiverDetailAddress: '翻斗花园',
afterSaleStatus: 0, afterSaleStatus: 0,
refundPrice: 0, refundPrice: 0,
couponId: null, couponId: null,
couponPrice: 0, couponPrice: 0,
pointPrice: 0, pointPrice: 0,
receiverAreaName: 'Townsville', receiverAreaName: '北京市朝阳区',
items: [ items: [
{ {
id: 103, id: 103,
userId: 1002, userId: 1002,
orderId: 2, orderId: 2,
spuId: 5003, spuId: 5003,
spuName: 'Widget C', spuName: '毛绒鸭子',
skuId: 6003, skuId: 6003,
picUrl: 'https://example.com/images/widget_c.jpg', picUrl:
'http://127.0.0.1:48080/admin-api/infra/file/5/get/20220723041544165856414464011_BIG.jpg',
count: 1, count: 1,
originalPrice: 40, originalPrice: 40,
originalUnitPrice: 40, originalUnitPrice: 40,
@ -61,8 +62,8 @@ export const testData: OrderVO = [
orderDividePrice: 40, orderDividePrice: 40,
afterSaleStatus: 0, afterSaleStatus: 0,
properties: [ properties: [
{ propertyId: 7001, propertyName: 'Color', valueId: 8004, valueName: 'Green' }, { propertyId: 7001, propertyName: '颜色', valueId: 8004, valueName: '黄色' },
{ propertyId: 7002, propertyName: 'Size', valueId: 8002, valueName: 'Medium' } { propertyId: 7002, propertyName: '尺寸', valueId: 8002, valueName: '小鸭子' }
] ]
}, },
{ {
@ -70,9 +71,10 @@ export const testData: OrderVO = [
userId: 1002, userId: 1002,
orderId: 2, orderId: 2,
spuId: 5004, spuId: 5004,
spuName: 'Widget D', spuName: '毛绒鸭子',
skuId: 6004, skuId: 6004,
picUrl: 'https://example.com/images/widget_d.jpg', picUrl:
'http://127.0.0.1:48080/admin-api/infra/file/5/get/20220723041544165856414464011_BIG.jpg',
count: 1, count: 1,
originalPrice: 40, originalPrice: 40,
originalUnitPrice: 40, originalUnitPrice: 40,
@ -82,14 +84,14 @@ export const testData: OrderVO = [
orderDividePrice: 40, orderDividePrice: 40,
afterSaleStatus: 0, afterSaleStatus: 0,
properties: [ properties: [
{ propertyId: 7003, propertyName: 'Color', valueId: 8005, valueName: 'Yellow' }, { propertyId: 7001, propertyName: '颜色', valueId: 8004, valueName: '黄色' },
{ propertyId: 7002, propertyName: 'Size', valueId: 8002, valueName: 'Medium' } { propertyId: 7002, propertyName: '尺寸', valueId: 8002, valueName: '大鸭子' }
] ]
} }
], ],
user: { user: {
id: 1002, id: 1002,
nickname: 'janesmith', nickname: '小妮子',
avatar: 'https://example.com/images/avatar.jpg' avatar: 'https://example.com/images/avatar.jpg'
} }
}, },
@ -124,26 +126,26 @@ export const testData: OrderVO = [
deliveryStatus: 2, deliveryStatus: 2,
deliveryTime: new Date('2023-08-18T10:30:00'), deliveryTime: new Date('2023-08-18T10:30:00'),
receiveTime: new Date('2023-08-19T11:30:00'), receiveTime: new Date('2023-08-19T11:30:00'),
receiverName: 'Sarah Johnson', receiverName: '张三',
receiverMobile: '555-123-4567', receiverMobile: '13988886656',
receiverAreaId: 4003, receiverAreaId: 4003,
receiverPostCode: 67890, receiverPostCode: 67890,
receiverDetailAddress: '789 Oak Ave', receiverDetailAddress: '成华大道',
afterSaleStatus: 0, afterSaleStatus: 0,
refundPrice: 0, refundPrice: 0,
couponId: 2001, couponId: 2001,
couponPrice: 5, couponPrice: 5,
pointPrice: 0, pointPrice: 0,
receiverAreaName: 'Villageville', receiverAreaName: '四川省成都市',
items: [ items: [
{ {
id: 105, id: 105,
userId: 1003, userId: 1003,
orderId: 3, orderId: 3,
spuId: 5005, spuId: 5005,
spuName: 'Widget E', spuName: '华为',
skuId: 6005, skuId: 6005,
picUrl: 'https://example.com/images/widget_e.jpg', picUrl: 'http://127.0.0.1:48080/admin-api/infra/file/5/get/sj.jpg',
count: 1, count: 1,
originalPrice: 20, originalPrice: 20,
originalUnitPrice: 20, originalUnitPrice: 20,
@ -153,14 +155,14 @@ export const testData: OrderVO = [
orderDividePrice: 15, orderDividePrice: 15,
afterSaleStatus: 0, afterSaleStatus: 0,
properties: [ properties: [
{ propertyId: 7001, propertyName: 'Color', valueId: 8006, valueName: 'Black' }, { propertyId: 7001, propertyName: '颜色', valueId: 8006, valueName: '紫色' },
{ propertyId: 7002, propertyName: 'Size', valueId: 8002, valueName: 'Medium' } { propertyId: 7002, propertyName: '选配', valueId: 8002, valueName: '标配' }
] ]
} }
], ],
user: { user: {
id: 1003, id: 1003,
nickname: 'sarahjohnson', nickname: '无敌最俊朗',
avatar: 'https://example.com/images/avatar.jpg' avatar: 'https://example.com/images/avatar.jpg'
} }
} }