2024-07-09 17:00:58 +08:00
|
|
|
|
<template>
|
2024-08-25 19:08:33 +08:00
|
|
|
|
<div v-if="isObject(getMessageContent)" @click="openDetail(getMessageContent.id)" style="cursor: pointer;">
|
2024-07-17 18:40:01 +08:00
|
|
|
|
<div :key="getMessageContent.id" class="order-list-card-box mt-14px">
|
2024-08-22 09:47:17 +08:00
|
|
|
|
<div class="order-card-header flex items-center justify-between p-x-5px">
|
2024-07-17 18:40:01 +08:00
|
|
|
|
<div class="order-no">订单号:{{ getMessageContent.no }}</div>
|
|
|
|
|
<div :class="formatOrderColor(getMessageContent)" class="order-state font-16">
|
|
|
|
|
{{ formatOrderStatus(getMessageContent) }}
|
2024-07-09 17:24:33 +08:00
|
|
|
|
</div>
|
2024-07-17 18:40:01 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div v-for="item in getMessageContent.items" :key="item.id" class="border-bottom">
|
|
|
|
|
<ProductItem
|
2024-08-25 19:08:33 +08:00
|
|
|
|
:spu-id="item.spuId"
|
2024-07-17 18:40:01 +08:00
|
|
|
|
:num="item.count"
|
|
|
|
|
:picUrl="item.picUrl"
|
|
|
|
|
:price="item.price"
|
|
|
|
|
:skuText="item.properties.map((property: any) => property.valueName).join(' ')"
|
|
|
|
|
:title="item.spuName"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-08-22 09:47:17 +08:00
|
|
|
|
<div class="pay-box flex justify-end pr-5px">
|
2024-07-17 18:40:01 +08:00
|
|
|
|
<div class="flex items-center">
|
|
|
|
|
<div class="discounts-title pay-color"
|
|
|
|
|
>共 {{ getMessageContent?.productCount }} 件商品,总金额:
|
|
|
|
|
</div>
|
|
|
|
|
<div class="discounts-money pay-color">
|
|
|
|
|
¥{{ fenToYuan(getMessageContent?.payPrice) }}
|
|
|
|
|
</div>
|
2024-07-09 17:24:33 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-07-09 17:00:58 +08:00
|
|
|
|
</div>
|
2024-07-17 17:22:19 +08:00
|
|
|
|
</div>
|
2024-07-09 17:00:58 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2024-07-17 18:40:01 +08:00
|
|
|
|
import { fenToYuan, jsonParse } from '@/utils'
|
2024-07-09 17:00:58 +08:00
|
|
|
|
import { KeFuMessageRespVO } from '@/api/mall/promotion/kefu/message'
|
2024-07-17 18:40:01 +08:00
|
|
|
|
import { isObject } from '@/utils/is'
|
|
|
|
|
import ProductItem from '@/views/mall/promotion/kefu/components/message/ProductItem.vue'
|
2024-07-09 17:00:58 +08:00
|
|
|
|
|
2024-08-25 19:08:33 +08:00
|
|
|
|
const { push } = useRouter()
|
|
|
|
|
|
2024-07-17 17:22:19 +08:00
|
|
|
|
defineOptions({ name: 'OrderItem' })
|
2024-07-09 17:00:58 +08:00
|
|
|
|
const props = defineProps<{
|
2024-07-17 18:03:34 +08:00
|
|
|
|
message?: KeFuMessageRespVO
|
|
|
|
|
order?: any
|
2024-07-09 17:00:58 +08:00
|
|
|
|
}>()
|
2024-07-17 17:22:19 +08:00
|
|
|
|
|
2024-07-17 18:03:34 +08:00
|
|
|
|
const getMessageContent = computed(() =>
|
2024-07-17 18:40:01 +08:00
|
|
|
|
typeof props.message !== 'undefined' ? jsonParse(props!.message!.content) : props.order
|
2024-07-17 18:03:34 +08:00
|
|
|
|
)
|
2024-07-09 17:24:33 +08:00
|
|
|
|
|
2024-08-25 19:08:33 +08:00
|
|
|
|
/** 查看订单详情 */
|
|
|
|
|
const openDetail = (id: number) => {
|
|
|
|
|
console.log(getMessageContent)
|
|
|
|
|
push({ name: 'TradeOrderDetail', params: { id } })
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-09 17:24:33 +08:00
|
|
|
|
/**
|
|
|
|
|
* 格式化订单状态的颜色
|
|
|
|
|
*
|
|
|
|
|
* @param order 订单
|
|
|
|
|
* @return {string} 颜色的 class 名称
|
|
|
|
|
*/
|
2024-07-10 14:34:12 +08:00
|
|
|
|
function formatOrderColor(order: any) {
|
2024-07-09 17:24:33 +08:00
|
|
|
|
if (order.status === 0) {
|
|
|
|
|
return 'info-color'
|
|
|
|
|
}
|
|
|
|
|
if (order.status === 10 || order.status === 20 || (order.status === 30 && !order.commentStatus)) {
|
|
|
|
|
return 'warning-color'
|
|
|
|
|
}
|
|
|
|
|
if (order.status === 30 && order.commentStatus) {
|
|
|
|
|
return 'success-color'
|
|
|
|
|
}
|
|
|
|
|
return 'danger-color'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 格式化订单状态
|
|
|
|
|
*
|
|
|
|
|
* @param order 订单
|
|
|
|
|
*/
|
2024-07-10 14:34:12 +08:00
|
|
|
|
function formatOrderStatus(order: any) {
|
2024-07-09 17:24:33 +08:00
|
|
|
|
if (order.status === 0) {
|
|
|
|
|
return '待付款'
|
|
|
|
|
}
|
|
|
|
|
if (order.status === 10 && order.deliveryType === 1) {
|
|
|
|
|
return '待发货'
|
|
|
|
|
}
|
|
|
|
|
if (order.status === 10 && order.deliveryType === 2) {
|
|
|
|
|
return '待核销'
|
|
|
|
|
}
|
|
|
|
|
if (order.status === 20) {
|
|
|
|
|
return '待收货'
|
|
|
|
|
}
|
|
|
|
|
if (order.status === 30 && !order.commentStatus) {
|
|
|
|
|
return '待评价'
|
|
|
|
|
}
|
|
|
|
|
if (order.status === 30 && order.commentStatus) {
|
|
|
|
|
return '已完成'
|
|
|
|
|
}
|
|
|
|
|
return '已关闭'
|
|
|
|
|
}
|
2024-07-09 17:00:58 +08:00
|
|
|
|
</script>
|
2024-07-09 17:24:33 +08:00
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.order-list-card-box {
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
padding: 10px;
|
2024-08-25 19:08:33 +08:00
|
|
|
|
border: 1px var(--el-border-color) solid;
|
2024-08-22 09:47:17 +08:00
|
|
|
|
background-color: var(--app-content-bg-color);
|
2024-07-09 17:24:33 +08:00
|
|
|
|
|
|
|
|
|
.order-card-header {
|
2024-07-17 15:17:58 +08:00
|
|
|
|
height: 28px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
|
|
|
|
|
.order-no {
|
2024-08-22 09:47:17 +08:00
|
|
|
|
font-size: 10px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pay-box {
|
2024-08-22 09:47:17 +08:00
|
|
|
|
padding-top: 10px;
|
|
|
|
|
|
2024-07-09 17:24:33 +08:00
|
|
|
|
.discounts-title {
|
2024-07-17 15:17:58 +08:00
|
|
|
|
font-size: 16px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
line-height: normal;
|
|
|
|
|
color: #999999;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.discounts-money {
|
2024-07-17 15:17:58 +08:00
|
|
|
|
font-size: 16px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
line-height: normal;
|
|
|
|
|
color: #999;
|
|
|
|
|
font-family: OPPOSANS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pay-color {
|
2024-08-22 09:47:17 +08:00
|
|
|
|
font-size: 13px;
|
|
|
|
|
color: var(--left-menu-text-color);
|
2024-07-09 17:24:33 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.warning-color {
|
|
|
|
|
color: #faad14;
|
2024-08-22 09:47:17 +08:00
|
|
|
|
font-size: 11px;
|
|
|
|
|
font-weight: bold;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.danger-color {
|
|
|
|
|
color: #ff3000;
|
2024-08-22 09:47:17 +08:00
|
|
|
|
font-size: 11px;
|
|
|
|
|
font-weight: bold;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.success-color {
|
|
|
|
|
color: #52c41a;
|
2024-08-22 09:47:17 +08:00
|
|
|
|
font-size: 11px;
|
|
|
|
|
font-weight: bold;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.info-color {
|
|
|
|
|
color: #999999;
|
2024-08-22 09:47:17 +08:00
|
|
|
|
font-size: 11px;
|
|
|
|
|
font-weight: bold;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
}
|
|
|
|
|
</style>
|