1
1
<template >
2
2
<!-- 图片消息 -->
3
- <template v-if =" KeFuMessageContentTypeEnum .PRODUCT === message .contentType " >
3
+ <template v-if =" KeFuMessageContentTypeEnum .ORDER === message .contentType " >
4
4
<div
5
5
:class =" [
6
6
message.senderType === UserTypeEnum.MEMBER
10
10
: ''
11
11
]"
12
12
>
13
- <ProductItem
14
- :img =" getMessageContent.picUrl"
15
- :price =" getMessageContent.price"
16
- :skuText =" getMessageContent.introduction"
17
- :title =" getMessageContent.spuName"
18
- :titleWidth =" 400"
19
- priceColor =" #FF3000"
20
- />
13
+ <div :key =" getMessageContent.id" class =" order-list-card-box mt-14px" >
14
+ <div class =" order-card-header flex items-center justify-between p-x-20px" >
15
+ <div class =" order-no" >订单号:{{ getMessageContent.no }}</div >
16
+ <div :class =" formatOrderColor(getMessageContent)" class =" order-state font-26" >
17
+ {{ formatOrderStatus(getMessageContent) }}
18
+ </div >
19
+ </div >
20
+ <div v-for =" item in getMessageContent.items" :key =" item.id" class =" border-bottom" >
21
+ <ProductItem
22
+ :img =" item.picUrl"
23
+ :num =" item.count"
24
+ :price =" item.price"
25
+ :skuText =" item.properties.map((property: any) => property.valueName).join(' ')"
26
+ :title =" item.spuName"
27
+ />
28
+ </div >
29
+ <div class =" pay-box mt-30px flex justify-end pr-20px" >
30
+ <div class =" flex items-center" >
31
+ <div class =" discounts-title pay-color"
32
+ >共 {{ getMessageContent.productCount }} 件商品,总金额:
33
+ </div >
34
+ <div class =" discounts-money pay-color" >
35
+ ¥{{ fenToYuan(getMessageContent.payPrice) }}
36
+ </div >
37
+ </div >
38
+ </div >
39
+ </div >
21
40
</div >
22
41
</template >
23
42
</template >
@@ -27,10 +46,137 @@ import { KeFuMessageContentTypeEnum } from '../tools/constants'
27
46
import ProductItem from ' ./ProductItem.vue'
28
47
import { UserTypeEnum } from ' @/utils/constants'
29
48
import { KeFuMessageRespVO } from ' @/api/mall/promotion/kefu/message'
49
+ import { fenToYuan } from ' @/utils'
30
50
31
- defineOptions ({ name: ' ImageMessageItem ' })
51
+ defineOptions ({ name: ' OrderMessageItem ' })
32
52
const props = defineProps <{
33
53
message: KeFuMessageRespVO
34
54
}>()
35
55
const getMessageContent = computed (() => JSON .parse (props .message .content ))
56
+
57
+ /**
58
+ * 格式化订单状态的颜色
59
+ *
60
+ * @param order 订单
61
+ * @return {string} 颜色的 class 名称
62
+ */
63
+ function formatOrderColor(order ) {
64
+ if (order .status === 0 ) {
65
+ return ' info-color'
66
+ }
67
+ if (order .status === 10 || order .status === 20 || (order .status === 30 && ! order .commentStatus )) {
68
+ return ' warning-color'
69
+ }
70
+ if (order .status === 30 && order .commentStatus ) {
71
+ return ' success-color'
72
+ }
73
+ return ' danger-color'
74
+ }
75
+
76
+ /**
77
+ * 格式化订单状态
78
+ *
79
+ * @param order 订单
80
+ */
81
+ function formatOrderStatus(order ) {
82
+ if (order .status === 0 ) {
83
+ return ' 待付款'
84
+ }
85
+ if (order .status === 10 && order .deliveryType === 1 ) {
86
+ return ' 待发货'
87
+ }
88
+ if (order .status === 10 && order .deliveryType === 2 ) {
89
+ return ' 待核销'
90
+ }
91
+ if (order .status === 20 ) {
92
+ return ' 待收货'
93
+ }
94
+ if (order .status === 30 && ! order .commentStatus ) {
95
+ return ' 待评价'
96
+ }
97
+ if (order .status === 30 && order .commentStatus ) {
98
+ return ' 已完成'
99
+ }
100
+ return ' 已关闭'
101
+ }
36
102
</script >
103
+
104
+ <style lang="scss" scoped>
105
+ .order-list-card-box {
106
+ border-radius : 10px ;
107
+ padding : 10px ;
108
+ background-color : #e2e2e2 ;
109
+
110
+ .order-card-header {
111
+ height : 80 rpx;
112
+
113
+ .order-no {
114
+ font-size : 26 rpx;
115
+ font-weight : 500 ;
116
+ }
117
+ }
118
+
119
+ .pay-box {
120
+ .discounts-title {
121
+ font-size : 24 rpx;
122
+ line-height : normal ;
123
+ color : #999999 ;
124
+ }
125
+
126
+ .discounts-money {
127
+ font-size : 24 rpx;
128
+ line-height : normal ;
129
+ color : #999 ;
130
+ font-family : OPPOSANS;
131
+ }
132
+
133
+ .pay-color {
134
+ color : #333 ;
135
+ }
136
+ }
137
+
138
+ .order-card-footer {
139
+ height : 100 rpx;
140
+
141
+ .more-item-box {
142
+ padding : 20 rpx;
143
+
144
+ .more-item {
145
+ height : 60 rpx;
146
+
147
+ .title {
148
+ font-size : 26 rpx;
149
+ }
150
+ }
151
+ }
152
+
153
+ .more-btn {
154
+ color : #999999 ;
155
+ font-size : 24 rpx;
156
+ }
157
+
158
+ .content {
159
+ width : 154 rpx;
160
+ color : #333333 ;
161
+ font-size : 26 rpx;
162
+ font-weight : 500 ;
163
+ }
164
+ }
165
+ }
166
+
167
+ .warning-color {
168
+ color : #faad14 ;
169
+ }
170
+
171
+ .danger-color {
172
+ color : #ff3000 ;
173
+ }
174
+
175
+ .success-color {
176
+ color : #52c41a ;
177
+ }
178
+
179
+ .info-color {
180
+ color : #999999 ;
181
+ }
182
+ </style >
0 commit comments