mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-07-17 04:15:07 +08:00
订单列表:列表重构 ② and 完善订单详情
This commit is contained in:
@ -1,251 +1,271 @@
|
||||
<template>
|
||||
<Dialog v-model="dialogVisible" :scroll="true" :title="dialogTitle" width="65%">
|
||||
<ContentWrap>
|
||||
<!-- 订单信息 -->
|
||||
<el-descriptions title="订单信息">
|
||||
<el-descriptions-item label="订单号: ">{{ order.no }}</el-descriptions-item>
|
||||
<el-descriptions-item label="配送方式: ">物流配送</el-descriptions-item>
|
||||
<ContentWrap>
|
||||
<!-- 订单信息 -->
|
||||
<el-descriptions title="订单信息">
|
||||
<el-descriptions-item label="订单号: ">{{ orderInfo.no }}</el-descriptions-item>
|
||||
<el-descriptions-item label="配送方式: ">物流配送</el-descriptions-item>
|
||||
<!-- TODO 芋艿:待实现 -->
|
||||
<el-descriptions-item label="营销活动: ">物流配送</el-descriptions-item>
|
||||
<!-- TODO 芋艿:待实现 -->
|
||||
<el-descriptions-item label="订单类型: ">
|
||||
<dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="orderInfo.type" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="收货人: ">{{ orderInfo.receiverName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="买家留言: ">{{ orderInfo.userRemark }}</el-descriptions-item>
|
||||
<el-descriptions-item label="订单来源: ">
|
||||
<dict-tag :type="DICT_TYPE.TERMINAL" :value="orderInfo.terminal" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="联系电话: ">{{ orderInfo.receiverMobile }}</el-descriptions-item>
|
||||
<el-descriptions-item label="商家备注: ">{{ orderInfo.remark }}</el-descriptions-item>
|
||||
<el-descriptions-item label="支付单号: ">{{ orderInfo.payOrderId }}</el-descriptions-item>
|
||||
<el-descriptions-item label="付款方式: ">
|
||||
<dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE_TYPE" :value="orderInfo.payChannelCode" />
|
||||
</el-descriptions-item>
|
||||
<!-- <el-descriptions-item label="买家: ">{{ orderInfo.user.nickname }}</el-descriptions-item> -->
|
||||
<!-- TODO 芋艿:待实现:跳转会员 -->
|
||||
<el-descriptions-item label="收货地址: ">
|
||||
{{ orderInfo.receiverAreaName }} {{ orderInfo.receiverDetailAddress }}
|
||||
<el-link
|
||||
v-clipboard:copy="orderInfo.receiverAreaName + ' ' + orderInfo.receiverDetailAddress"
|
||||
v-clipboard:success="clipboardSuccess"
|
||||
icon="ep:document-copy"
|
||||
type="primary"
|
||||
/>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<!-- 订单状态 -->
|
||||
<el-descriptions :column="1" title="订单状态">
|
||||
<el-descriptions-item label="订单状态: ">
|
||||
<!-- TODO xiaobai:status 一定有值哈,不用判断 -->
|
||||
<dict-tag
|
||||
v-if="orderInfo.status !== ''"
|
||||
:type="DICT_TYPE.TRADE_ORDER_STATUS"
|
||||
:value="orderInfo.status"
|
||||
/>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-class-name="no-colon">
|
||||
<el-button size="small" type="primary">调整价格</el-button>
|
||||
<!-- TODO 芋艿:待实现 -->
|
||||
<el-descriptions-item label="营销活动: ">物流配送</el-descriptions-item>
|
||||
<el-button size="small" type="primary">备注</el-button>
|
||||
<!-- TODO 芋艿:待实现 -->
|
||||
<el-descriptions-item label="订单类型: ">
|
||||
<dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="order.type" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="收货人: ">{{ order.receiverName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="买家留言: ">{{ order.userRemark }}</el-descriptions-item>
|
||||
<el-descriptions-item label="订单来源: ">
|
||||
<dict-tag :type="DICT_TYPE.TERMINAL" :value="order.terminal" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="联系电话: ">{{ order.receiverMobile }}</el-descriptions-item>
|
||||
<el-descriptions-item label="商家备注: ">{{ order.remark }}</el-descriptions-item>
|
||||
<el-descriptions-item label="支付单号: ">{{ order.payOrderId }}</el-descriptions-item>
|
||||
<el-descriptions-item label="付款方式: ">
|
||||
<dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE_TYPE" :value="order.payChannelCode" />
|
||||
</el-descriptions-item>
|
||||
<!-- <el-descriptions-item label="买家: ">{{ order.user.nickname }}</el-descriptions-item> -->
|
||||
<!-- TODO 芋艿:待实现:跳转会员 -->
|
||||
<el-descriptions-item label="收货地址: ">
|
||||
{{ order.receiverAreaName }} {{ order.receiverDetailAddress }}
|
||||
<el-link
|
||||
v-clipboard:copy="order.receiverAreaName + ' ' + order.receiverDetailAddress"
|
||||
v-clipboard:success="clipboardSuccess"
|
||||
icon="ep:document-copy"
|
||||
type="primary"
|
||||
/>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<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>
|
||||
<!-- TODO 芋艿:待实现 -->
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label><span style="color: red">提醒: </span></template>
|
||||
买家付款成功后,货款将直接进入您的商户号(微信、支付宝)<br />
|
||||
请及时关注你发出的包裹状态,确保可以配送至买家手中 <br />
|
||||
如果买家表示没收到货或货物有问题,请及时联系买家处理,友好协商
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<!-- 订单状态 -->
|
||||
<el-descriptions :column="1" title="订单状态">
|
||||
<el-descriptions-item label="订单状态: ">
|
||||
<!-- TODO xiaobai:status 一定有值哈,不用判断 -->
|
||||
<dict-tag
|
||||
v-if="order.status !== ''"
|
||||
:type="DICT_TYPE.TRADE_ORDER_STATUS"
|
||||
:value="order.status"
|
||||
/>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label-class-name="no-colon">
|
||||
<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>
|
||||
<!-- 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>
|
||||
<!-- TODO 芋艿:待实现 -->
|
||||
<el-button size="small" type="primary">打印发货单</el-button>
|
||||
<!-- TODO 芋艿:待实现 -->
|
||||
<el-button size="small" type="primary">确认收货</el-button>
|
||||
<!-- TODO 芋艿:待实现 -->
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label><span style="color: red">提醒: </span></template>
|
||||
买家付款成功后,货款将直接进入您的商户号(微信、支付宝)<br />
|
||||
请及时关注你发出的包裹状态,确保可以配送至买家手中 <br />
|
||||
如果买家表示没收到货或货物有问题,请及时联系买家处理,友好协商
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<!-- 物流信息 TODO -->
|
||||
|
||||
<!-- 物流信息 TODO -->
|
||||
<!-- 商品信息 -->
|
||||
<el-descriptions title="商品信息">
|
||||
<el-descriptions-item labelClassName="no-colon">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="15">
|
||||
<el-table :data="orderInfo.items" border>
|
||||
<el-table-column label="商品" prop="spuName" width="auto">
|
||||
<template #default="{ row }">
|
||||
{{ row.spuName }}
|
||||
<el-tag v-for="property in row.properties" :key="property.propertyId">
|
||||
{{ property.propertyName }}: {{ property.valueName }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品原价(元)" prop="price" width="150">
|
||||
<template #default="{ row }">{{ formatToFraction(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 }">{{ formatToFraction(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>
|
||||
</el-col>
|
||||
<el-col :span="10" />
|
||||
</el-row>
|
||||
</el-descriptions-item>
|
||||
<!-- 占位 -->
|
||||
<!-- <el-descriptions-item v-for="item in 5" label-class-name="no-colon" :key="item" /> -->
|
||||
</el-descriptions>
|
||||
<el-descriptions :column="6">
|
||||
<el-descriptions-item label="商品总额: ">
|
||||
{{ formatToFraction(orderInfo.totalPrice) }}元
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="运费金额: ">
|
||||
{{ formatToFraction(orderInfo.deliveryPrice) }}元
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="订单调价: ">
|
||||
{{ formatToFraction(orderInfo.adjustPrice) }}元
|
||||
</el-descriptions-item>
|
||||
|
||||
<!-- 商品信息 -->
|
||||
<el-descriptions title="商品信息">
|
||||
<el-descriptions-item labelClassName="no-colon">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="15">
|
||||
<el-table :data="order.items" border>
|
||||
<el-table-column label="商品" prop="spuName" width="auto">
|
||||
<template #default="{ row }">
|
||||
{{ row.spuName }}
|
||||
<el-tag v-for="property in row.properties" :key="property.propertyId">
|
||||
{{ property.propertyName }}: {{ property.valueName }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品原价(元)" prop="price" width="150">
|
||||
<template #default="{ row }">{{ formatToFraction(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 }">{{ formatToFraction(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>
|
||||
</el-col>
|
||||
<el-col :span="10" />
|
||||
</el-row>
|
||||
</el-descriptions-item>
|
||||
<!-- 占位 -->
|
||||
<!-- <el-descriptions-item v-for="item in 5" label-class-name="no-colon" :key="item" /> -->
|
||||
</el-descriptions>
|
||||
<el-descriptions column="6">
|
||||
<el-descriptions-item label="商品总额: ">
|
||||
{{ formatToFraction(order.totalPrice) }}元
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="运费金额: ">
|
||||
{{ formatToFraction(order.deliveryPrice) }}元
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="订单调价: ">
|
||||
{{ formatToFraction(order.adjustPrice) }}元
|
||||
<el-descriptions-item>
|
||||
<template #label><span style="color: red">商品优惠: </span></template>
|
||||
<!-- 没理解TODO orderInfo.totalPrice - orderInfo.totalPrice -->
|
||||
{{ formatToFraction(orderInfo.totalPrice - orderInfo.totalPrice) }}元
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label><span style="color: red">订单优惠: </span></template>
|
||||
{{ formatToFraction(orderInfo.discountPrice) }}元
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label><span style="color: red">积分抵扣: </span></template>
|
||||
{{ formatToFraction(orderInfo.pointPrice) }}元
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item v-for="item in 5" :key="item" label-class-name="no-colon" />
|
||||
<!-- 占位 -->
|
||||
<el-descriptions-item label="应付金额: ">
|
||||
{{ formatToFraction(orderInfo.payPrice) }}元
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<!-- TODO 芋艿:需要改改 -->
|
||||
<div v-for="group in detailGroups" :key="group.title">
|
||||
<el-descriptions :title="group.title" v-bind="group.groupProps">
|
||||
<!-- 订单操作日志 -->
|
||||
<el-descriptions-item v-if="group.key === 'orderLog'" labelClassName="no-colon">
|
||||
<el-timeline>
|
||||
<el-timeline-item
|
||||
v-for="activity in detailInfo[group.key]"
|
||||
:key="activity.timestamp"
|
||||
:timestamp="activity.timestamp"
|
||||
>
|
||||
{{ activity.content }}
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item>
|
||||
<template #label><span style="color: red">商品优惠: </span></template>
|
||||
<!-- 没理解TODO order.totalPrice - order.totalPrice -->
|
||||
{{ formatToFraction(order.totalPrice - order.totalPrice) }}元
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label><span style="color: red">订单优惠: </span></template>
|
||||
{{ formatToFraction(order.discountPrice) }}元
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template #label><span style="color: red">积分抵扣: </span></template>
|
||||
{{ formatToFraction(order.pointPrice) }}元
|
||||
</el-descriptions-item>
|
||||
|
||||
<el-descriptions-item v-for="item in 5" :key="item" label-class-name="no-colon" />
|
||||
<!-- 占位 -->
|
||||
<el-descriptions-item label="应付金额: ">
|
||||
{{ formatToFraction(order.payPrice) }}元
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<!-- TODO 芋艿:需要改改 -->
|
||||
<div v-for="group in detailGroups" :key="group.title">
|
||||
<el-descriptions :title="group.title" v-bind="group.groupProps">
|
||||
<!-- 订单操作日志 -->
|
||||
<el-descriptions-item v-if="group.key === 'orderLog'" labelClassName="no-colon">
|
||||
<el-timeline>
|
||||
<el-timeline-item
|
||||
v-for="activity in detailInfo[group.key]"
|
||||
:key="activity.timestamp"
|
||||
:timestamp="activity.timestamp"
|
||||
<!-- 物流信息 -->
|
||||
<!-- TODO @xiaobai:改成一个包裹哈;目前只允许发货一次 -->
|
||||
<el-descriptions-item v-if="group.key === 'expressInfo'" labelClassName="no-colon">
|
||||
<!-- 循环包裹物流信息 -->
|
||||
<div v-show="(pkgInfo = detailInfo[group.key]) !== null" style="border: 1px dashed">
|
||||
<!-- 包裹详情 -->
|
||||
<el-descriptions class="m-5">
|
||||
<el-descriptions-item
|
||||
v-for="(pkgChild, pkgCIdx) in group.children"
|
||||
:key="`pkgChild_${pkgCIdx}`"
|
||||
:label="pkgChild.label"
|
||||
v-bind="pkgChild.childProps"
|
||||
>
|
||||
{{ activity.content }}
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
</el-descriptions-item>
|
||||
<!-- 包裹商品列表 -->
|
||||
<template v-if="pkgChild.valueKey === 'goodsList' && pkgInfo[pkgChild.valueKey]">
|
||||
<div
|
||||
v-for="(goodInfo, goodInfoIdx) in pkgInfo[pkgChild.valueKey]"
|
||||
:key="`goodInfo_${goodInfoIdx}`"
|
||||
style="display: flex"
|
||||
>
|
||||
<el-image
|
||||
:src="goodInfo.imgUrl"
|
||||
style="width: 100px; height: 100px; flex: none"
|
||||
/>
|
||||
<el-descriptions :column="1">
|
||||
<el-descriptions-item labelClassName="no-colon"
|
||||
>{{ goodInfo.name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="数量"
|
||||
>{{ goodInfo.count }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 物流信息 -->
|
||||
<!-- TODO @xiaobai:改成一个包裹哈;目前只允许发货一次 -->
|
||||
<el-descriptions-item v-if="group.key === 'expressInfo'" labelClassName="no-colon">
|
||||
<!-- 循环包裹物流信息 -->
|
||||
<div v-show="(pkgInfo = detailInfo[group.key]) !== null" style="border: 1px dashed">
|
||||
<!-- 包裹详情 -->
|
||||
<el-descriptions class="m-5">
|
||||
<el-descriptions-item
|
||||
v-for="(pkgChild, pkgCIdx) in group.children"
|
||||
:key="`pkgChild_${pkgCIdx}`"
|
||||
:label="pkgChild.label"
|
||||
v-bind="pkgChild.childProps"
|
||||
>
|
||||
<!-- 包裹商品列表 -->
|
||||
<template v-if="pkgChild.valueKey === 'goodsList' && pkgInfo[pkgChild.valueKey]">
|
||||
<div
|
||||
v-for="(goodInfo, goodInfoIdx) in pkgInfo[pkgChild.valueKey]"
|
||||
:key="`goodInfo_${goodInfoIdx}`"
|
||||
style="display: flex"
|
||||
>
|
||||
<el-image
|
||||
:src="goodInfo.imgUrl"
|
||||
style="width: 100px; height: 100px; flex: none"
|
||||
/>
|
||||
<el-descriptions :column="1">
|
||||
<el-descriptions-item labelClassName="no-colon"
|
||||
>{{ goodInfo.name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="数量"
|
||||
>{{ goodInfo.count }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 包裹物流详情 -->
|
||||
<template v-else-if="pkgChild.valueKey === 'wlxq'">
|
||||
<el-row :gutter="10">
|
||||
<el-col :offset="1" :span="6">
|
||||
<el-timeline>
|
||||
<el-timeline-item
|
||||
v-for="(activity, index) in pkgInfo[pkgChild.valueKey]"
|
||||
:key="index"
|
||||
:timestamp="activity.timestamp"
|
||||
>
|
||||
{{ activity.content }}
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ pkgInfo[pkgChild.valueKey] }}
|
||||
</template>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</ContentWrap>
|
||||
</Dialog>
|
||||
<!-- 包裹物流详情 -->
|
||||
<template v-else-if="pkgChild.valueKey === 'wlxq'">
|
||||
<el-row :gutter="10">
|
||||
<el-col :offset="1" :span="6">
|
||||
<el-timeline>
|
||||
<el-timeline-item
|
||||
v-for="(activity, index) in pkgInfo[pkgChild.valueKey]"
|
||||
:key="index"
|
||||
:timestamp="activity.timestamp"
|
||||
>
|
||||
{{ activity.content }}
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ pkgInfo[pkgChild.valueKey] }}
|
||||
</template>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
</ContentWrap>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import * as TradeOrderApi from '@/api/mall/trade/order'
|
||||
import { formatToFraction } from '@/utils'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
|
||||
defineOptions({ name: 'TradeOrderDetailForm' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('订单详情') // 弹窗的标题
|
||||
|
||||
const open = () => {
|
||||
dialogVisible.value = true
|
||||
}
|
||||
defineExpose({ open })
|
||||
|
||||
const { query } = useRoute()
|
||||
const queryParams = reactive({
|
||||
id: query.id
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
const order = ref<any>({
|
||||
const { params } = useRoute() // 查询参数
|
||||
// const loading = ref(false)
|
||||
const orderInfo = ref<TradeOrderApi.OrderVO>({
|
||||
no: '',
|
||||
createTime: null,
|
||||
type: null,
|
||||
terminal: null,
|
||||
userId: null,
|
||||
userIp: '',
|
||||
userRemark: '',
|
||||
status: null,
|
||||
productCount: null,
|
||||
finishTime: null,
|
||||
cancelTime: null,
|
||||
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: [],
|
||||
user: {}
|
||||
}) // 详情数据
|
||||
})
|
||||
|
||||
const detailGroups = ref([
|
||||
{
|
||||
@ -311,23 +331,25 @@ const detailInfo = ref({
|
||||
],
|
||||
goodsInfo: [] // 商品详情tableData
|
||||
})
|
||||
// 暂考虑一次性加载详情页面所有数据 TODO
|
||||
const getlist = async () => {
|
||||
// dialogVisible.value = true
|
||||
// loading.value = true
|
||||
// try {
|
||||
// const res = await TradeOrderApi.getOrderDetail(queryParams.id as unknown as number)
|
||||
// order.value = res
|
||||
// console.log(order)
|
||||
// } catch {
|
||||
// message.error('获取详情数据失败')
|
||||
// } finally {
|
||||
// loading.value = false
|
||||
// }
|
||||
|
||||
/** 获得详情 */
|
||||
const getDetail = async () => {
|
||||
const id = params.orderId as unknown as number
|
||||
if (id) {
|
||||
const res = (await TradeOrderApi.getOrder(id)) as TradeOrderApi.OrderVO
|
||||
// TODO 测试使用
|
||||
res.user = {
|
||||
id: 247,
|
||||
nickname: '小妮子'
|
||||
}
|
||||
orderInfo.value = res
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await getlist()
|
||||
await getDetail()
|
||||
})
|
||||
|
||||
const clipboardSuccess = () => {
|
||||
message.success('复制成功')
|
||||
}
|
||||
|
@ -111,20 +111,31 @@
|
||||
<el-table-column fixed="left" type="expand">
|
||||
<template #default="scope">
|
||||
<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 }">
|
||||
{{ row.spuName }}
|
||||
<el-tag v-for="property in row.properties" :key="property.propertyId">
|
||||
{{ property.propertyName }}: {{ property.valueName }}
|
||||
</el-tag>
|
||||
<div class="flex items-center">
|
||||
<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 }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品原价(元)" prop="price" width="150">
|
||||
<template #default="{ row }">{{ formatToFraction(row.price) }}</template>
|
||||
<el-table-column label="商品原价" prop="price" width="150">
|
||||
<template #default="{ row }">{{ formatToFraction(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 }">{{ formatToFraction(row.payPrice) }}</template>
|
||||
<el-table-column label="合计" prop="payPrice" width="150">
|
||||
<template #default="{ row }">{{ formatToFraction(row.payPrice) }}元</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售后状态" prop="afterSaleStatus" width="120">
|
||||
<template #default="{ row }">
|
||||
@ -134,22 +145,33 @@
|
||||
/>
|
||||
</template>
|
||||
</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>
|
||||
{{ formatToFraction(scope.row.payPrice) + '元' }}
|
||||
</template>
|
||||
</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">
|
||||
<template #default> 快递</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="160">
|
||||
<template #default="{ row }">
|
||||
<template #default>
|
||||
<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" />
|
||||
详情
|
||||
</el-button>
|
||||
<el-dropdown @command="(command) => handleCommand(command, row)">
|
||||
<el-dropdown @command="(command) => handleCommand(command, scope.row)">
|
||||
<el-button link type="primary">
|
||||
<Icon icon="ep:d-arrow-right" />
|
||||
更多
|
||||
@ -187,13 +209,6 @@
|
||||
<dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="row.type" />
|
||||
</template>
|
||||
</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">
|
||||
<template #default="{ row }">
|
||||
<dict-tag v-if="row.terminal" :type="DICT_TYPE.TERMINAL" :value="row.terminal" />
|
||||
@ -242,28 +257,26 @@
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
<TradeOrderDetailForm ref="tradeOrderDetailFormRef" />
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="Order" setup>
|
||||
import TradeOrderDetailForm from './detail/index.vue'
|
||||
import type { FormInstance, TableColumnCtx } from 'element-plus'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import * as TradeOrderApi from '@/api/mall/trade/order'
|
||||
import { OrderItemRespVO, OrderVO } from '@/api/mall/trade/order'
|
||||
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
||||
import { formatToFraction } from '@/utils'
|
||||
import { testData } from './testData'
|
||||
import { createImageViewer } from '@/components/ImageViewer'
|
||||
|
||||
// const message = useMessage() // 消息弹窗
|
||||
// const { t } = useI18n() // 国际化
|
||||
const { currentRoute, push } = useRouter() // 路由跳转
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const total = ref(2) // 列表的总页数
|
||||
const list = ref<OrderVO[]>([]) // 列表的数据
|
||||
const tradeOrderDetailFormRef = ref<InstanceType<typeof TradeOrderDetailForm>>()
|
||||
const openForm = () => {
|
||||
tradeOrderDetailFormRef.value?.open()
|
||||
const openForm = (id) => {
|
||||
push('/trade/order/detail/' + id)
|
||||
}
|
||||
/** 商品图预览 */
|
||||
const imagePreview = (imgUrl: string) => {
|
||||
@ -280,7 +293,7 @@ interface SpanMethodProps {
|
||||
}
|
||||
|
||||
const spanMethod = ({ rowIndex, columnIndex }: SpanMethodProps) => {
|
||||
const colIndex = [5, 6, 7]
|
||||
const colIndex = [5, 6, 7, 8]
|
||||
// 处理列
|
||||
if (colIndex.includes(columnIndex)) {
|
||||
// 处理被合并的行
|
||||
@ -348,9 +361,18 @@ const searchList = ref([
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
// const data = await TradeOrderApi.getOrderPage(queryParams)
|
||||
// list.value = data.list
|
||||
// total.value = data.total
|
||||
const data = await TradeOrderApi.getOrderPage(queryParams)
|
||||
const list_ = data.list as OrderVO[]
|
||||
// TODO 测试使用
|
||||
list_.forEach((item) => {
|
||||
item.user = {
|
||||
id: 247,
|
||||
nickname: '小妮子'
|
||||
}
|
||||
})
|
||||
|
||||
list.value = list_
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
@ -368,9 +390,17 @@ const resetQuery = () => {
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 监听路由变化更新列表,解决商品保存后,列表不刷新的问题。
|
||||
watch(
|
||||
() => currentRoute.value,
|
||||
() => {
|
||||
getList()
|
||||
}
|
||||
)
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
list.value = testData
|
||||
// list.value = testData
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
@ -18,7 +18,7 @@ export const testData: OrderVO = [
|
||||
remark: '',
|
||||
payOrderId: 10002,
|
||||
payed: false,
|
||||
payTime: null,
|
||||
payTime: new Date('2023-08-17T12:30:00'),
|
||||
payChannelCode: 'wx_app',
|
||||
originalPrice: 80,
|
||||
orderPrice: 80,
|
||||
@ -32,26 +32,27 @@ export const testData: OrderVO = [
|
||||
deliveryStatus: 0,
|
||||
deliveryTime: null,
|
||||
receiveTime: null,
|
||||
receiverName: 'Jane Smith',
|
||||
receiverMobile: '987-654-3210',
|
||||
receiverName: '李四',
|
||||
receiverMobile: '19855568989',
|
||||
receiverAreaId: 4002,
|
||||
receiverPostCode: 54321,
|
||||
receiverDetailAddress: '456 Elm St, Apt 2C',
|
||||
receiverDetailAddress: '翻斗花园',
|
||||
afterSaleStatus: 0,
|
||||
refundPrice: 0,
|
||||
couponId: null,
|
||||
couponPrice: 0,
|
||||
pointPrice: 0,
|
||||
receiverAreaName: 'Townsville',
|
||||
receiverAreaName: '北京市朝阳区',
|
||||
items: [
|
||||
{
|
||||
id: 103,
|
||||
userId: 1002,
|
||||
orderId: 2,
|
||||
spuId: 5003,
|
||||
spuName: 'Widget C',
|
||||
spuName: '毛绒鸭子',
|
||||
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,
|
||||
originalPrice: 40,
|
||||
originalUnitPrice: 40,
|
||||
@ -61,8 +62,8 @@ export const testData: OrderVO = [
|
||||
orderDividePrice: 40,
|
||||
afterSaleStatus: 0,
|
||||
properties: [
|
||||
{ propertyId: 7001, propertyName: 'Color', valueId: 8004, valueName: 'Green' },
|
||||
{ propertyId: 7002, propertyName: 'Size', valueId: 8002, valueName: 'Medium' }
|
||||
{ propertyId: 7001, propertyName: '颜色', valueId: 8004, valueName: '黄色' },
|
||||
{ propertyId: 7002, propertyName: '尺寸', valueId: 8002, valueName: '小鸭子' }
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -70,9 +71,10 @@ export const testData: OrderVO = [
|
||||
userId: 1002,
|
||||
orderId: 2,
|
||||
spuId: 5004,
|
||||
spuName: 'Widget D',
|
||||
spuName: '毛绒鸭子',
|
||||
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,
|
||||
originalPrice: 40,
|
||||
originalUnitPrice: 40,
|
||||
@ -82,14 +84,14 @@ export const testData: OrderVO = [
|
||||
orderDividePrice: 40,
|
||||
afterSaleStatus: 0,
|
||||
properties: [
|
||||
{ propertyId: 7003, propertyName: 'Color', valueId: 8005, valueName: 'Yellow' },
|
||||
{ propertyId: 7002, propertyName: 'Size', valueId: 8002, valueName: 'Medium' }
|
||||
{ propertyId: 7001, propertyName: '颜色', valueId: 8004, valueName: '黄色' },
|
||||
{ propertyId: 7002, propertyName: '尺寸', valueId: 8002, valueName: '大鸭子' }
|
||||
]
|
||||
}
|
||||
],
|
||||
user: {
|
||||
id: 1002,
|
||||
nickname: 'janesmith',
|
||||
nickname: '小妮子',
|
||||
avatar: 'https://example.com/images/avatar.jpg'
|
||||
}
|
||||
},
|
||||
@ -124,26 +126,26 @@ export const testData: OrderVO = [
|
||||
deliveryStatus: 2,
|
||||
deliveryTime: new Date('2023-08-18T10:30:00'),
|
||||
receiveTime: new Date('2023-08-19T11:30:00'),
|
||||
receiverName: 'Sarah Johnson',
|
||||
receiverMobile: '555-123-4567',
|
||||
receiverName: '张三',
|
||||
receiverMobile: '13988886656',
|
||||
receiverAreaId: 4003,
|
||||
receiverPostCode: 67890,
|
||||
receiverDetailAddress: '789 Oak Ave',
|
||||
receiverDetailAddress: '成华大道',
|
||||
afterSaleStatus: 0,
|
||||
refundPrice: 0,
|
||||
couponId: 2001,
|
||||
couponPrice: 5,
|
||||
pointPrice: 0,
|
||||
receiverAreaName: 'Villageville',
|
||||
receiverAreaName: '四川省成都市',
|
||||
items: [
|
||||
{
|
||||
id: 105,
|
||||
userId: 1003,
|
||||
orderId: 3,
|
||||
spuId: 5005,
|
||||
spuName: 'Widget E',
|
||||
spuName: '华为',
|
||||
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,
|
||||
originalPrice: 20,
|
||||
originalUnitPrice: 20,
|
||||
@ -153,14 +155,14 @@ export const testData: OrderVO = [
|
||||
orderDividePrice: 15,
|
||||
afterSaleStatus: 0,
|
||||
properties: [
|
||||
{ propertyId: 7001, propertyName: 'Color', valueId: 8006, valueName: 'Black' },
|
||||
{ propertyId: 7002, propertyName: 'Size', valueId: 8002, valueName: 'Medium' }
|
||||
{ propertyId: 7001, propertyName: '颜色', valueId: 8006, valueName: '紫色' },
|
||||
{ propertyId: 7002, propertyName: '选配', valueId: 8002, valueName: '标配' }
|
||||
]
|
||||
}
|
||||
],
|
||||
user: {
|
||||
id: 1003,
|
||||
nickname: 'sarahjohnson',
|
||||
nickname: '无敌最俊朗',
|
||||
avatar: 'https://example.com/images/avatar.jpg'
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user