2024-07-09 17:00:58 +08:00
|
|
|
|
<template>
|
|
|
|
|
<!-- 图片消息 -->
|
2024-07-09 17:24:33 +08:00
|
|
|
|
<template v-if="KeFuMessageContentTypeEnum.ORDER === message.contentType">
|
2024-07-09 17:00:58 +08:00
|
|
|
|
<div
|
|
|
|
|
:class="[
|
|
|
|
|
message.senderType === UserTypeEnum.MEMBER
|
|
|
|
|
? `ml-10px`
|
|
|
|
|
: message.senderType === UserTypeEnum.ADMIN
|
|
|
|
|
? `mr-10px`
|
|
|
|
|
: ''
|
|
|
|
|
]"
|
|
|
|
|
>
|
2024-07-09 17:24:33 +08:00
|
|
|
|
<div :key="getMessageContent.id" class="order-list-card-box mt-14px">
|
|
|
|
|
<div class="order-card-header flex items-center justify-between p-x-20px">
|
|
|
|
|
<div class="order-no">订单号:{{ getMessageContent.no }}</div>
|
|
|
|
|
<div :class="formatOrderColor(getMessageContent)" class="order-state font-26">
|
|
|
|
|
{{ formatOrderStatus(getMessageContent) }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-for="item in getMessageContent.items" :key="item.id" class="border-bottom">
|
|
|
|
|
<ProductItem
|
|
|
|
|
:num="item.count"
|
2024-07-10 14:34:12 +08:00
|
|
|
|
:picUrl="item.picUrl"
|
2024-07-09 17:24:33 +08:00
|
|
|
|
:price="item.price"
|
|
|
|
|
:skuText="item.properties.map((property: any) => property.valueName).join(' ')"
|
|
|
|
|
:title="item.spuName"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="pay-box mt-30px flex justify-end pr-20px">
|
|
|
|
|
<div class="flex items-center">
|
|
|
|
|
<div class="discounts-title pay-color"
|
2024-07-10 09:30:03 +08:00
|
|
|
|
>共 {{ getMessageContent?.productCount }} 件商品,总金额:
|
2024-07-09 17:24:33 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="discounts-money pay-color">
|
2024-07-10 09:30:03 +08:00
|
|
|
|
¥{{ fenToYuan(getMessageContent?.payPrice) }}
|
2024-07-09 17:24:33 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-07-09 17:00:58 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { KeFuMessageContentTypeEnum } from '../tools/constants'
|
|
|
|
|
import ProductItem from './ProductItem.vue'
|
|
|
|
|
import { UserTypeEnum } from '@/utils/constants'
|
|
|
|
|
import { KeFuMessageRespVO } from '@/api/mall/promotion/kefu/message'
|
2024-07-09 17:24:33 +08:00
|
|
|
|
import { fenToYuan } from '@/utils'
|
2024-07-09 17:00:58 +08:00
|
|
|
|
|
2024-07-09 17:24:33 +08:00
|
|
|
|
defineOptions({ name: 'OrderMessageItem' })
|
2024-07-09 17:00:58 +08:00
|
|
|
|
const props = defineProps<{
|
|
|
|
|
message: KeFuMessageRespVO
|
|
|
|
|
}>()
|
|
|
|
|
const getMessageContent = computed(() => JSON.parse(props.message.content))
|
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;
|
|
|
|
|
background-color: #e2e2e2;
|
|
|
|
|
|
|
|
|
|
.order-card-header {
|
2024-07-10 14:34:12 +08:00
|
|
|
|
height: 80px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
|
|
|
|
|
.order-no {
|
2024-07-10 14:34:12 +08:00
|
|
|
|
font-size: 26px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pay-box {
|
|
|
|
|
.discounts-title {
|
2024-07-10 14:34:12 +08:00
|
|
|
|
font-size: 24px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
line-height: normal;
|
|
|
|
|
color: #999999;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.discounts-money {
|
2024-07-10 14:34:12 +08:00
|
|
|
|
font-size: 24px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
line-height: normal;
|
|
|
|
|
color: #999;
|
|
|
|
|
font-family: OPPOSANS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pay-color {
|
|
|
|
|
color: #333;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.order-card-footer {
|
2024-07-10 14:34:12 +08:00
|
|
|
|
height: 100px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
|
|
|
|
|
.more-item-box {
|
2024-07-10 14:34:12 +08:00
|
|
|
|
padding: 20px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
|
|
|
|
|
.more-item {
|
2024-07-10 14:34:12 +08:00
|
|
|
|
height: 60px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
|
|
|
|
|
.title {
|
2024-07-10 14:34:12 +08:00
|
|
|
|
font-size: 26px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.more-btn {
|
|
|
|
|
color: #999999;
|
2024-07-10 14:34:12 +08:00
|
|
|
|
font-size: 24px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content {
|
2024-07-10 14:34:12 +08:00
|
|
|
|
width: 154px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
color: #333333;
|
2024-07-10 14:34:12 +08:00
|
|
|
|
font-size: 26px;
|
2024-07-09 17:24:33 +08:00
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.warning-color {
|
|
|
|
|
color: #faad14;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.danger-color {
|
|
|
|
|
color: #ff3000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.success-color {
|
|
|
|
|
color: #52c41a;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.info-color {
|
|
|
|
|
color: #999999;
|
|
|
|
|
}
|
|
|
|
|
</style>
|