hookehuyr

优化订单卡组件显示

1 <template> 1 <template>
2 <view class="order-card-component"> 2 <view class="order-card-component">
3 - <view style="padding: 0.5rem;"> 3 + <view class="order-card-header">
4 <nut-row> 4 <nut-row>
5 <nut-col span="16"> 5 <nut-col span="16">
6 <view style="font-weight: bold; font-size: 34rpx;">家庭豪华连排三室套房</view> 6 <view style="font-weight: bold; font-size: 34rpx;">家庭豪华连排三室套房</view>
7 <view style="color: #7D7C7C; font-size: 24rpx;">两室 宜住3人 </view> 7 <view style="color: #7D7C7C; font-size: 24rpx;">两室 宜住3人 </view>
8 </nut-col> 8 </nut-col>
9 <nut-col span="8"> 9 <nut-col span="8">
10 - <image style="width: 100%; height: 3rem; border-radius: 10rpx;" mode="aspectFill" src="https://img.yzcdn.cn/vant/cat.jpeg" /> 10 + <image mode="aspectFill" src="https://img.yzcdn.cn/vant/cat.jpeg" />
11 </nut-col> 11 </nut-col>
12 </nut-row> 12 </nut-row>
13 </view> 13 </view>
14 - <view style="padding: 0 0.5rem;"><nut-tag color="#FA685D">待支付</nut-tag></view> 14 + <view class="order-card-status">
15 - <view style="padding: 0.5rem;"> 15 + <nut-tag :color="STATUS_COLOR[props.data.status]">{{ STATUS_TEXT[props.data.status] }}</nut-tag>
16 + </view>
17 + <view class="order-card-price">
16 <nut-row> 18 <nut-row>
17 <nut-col span="18"> 19 <nut-col span="18">
18 - <view style="height: 2rem; display: flex; align-items: center;"> 20 + <view class="order-card-price-text">
19 - <text style="color: #EB2E2E; font-size: 1.3rem; font-weight: bold;">¥980</text> 21 + <text class="left">¥980</text>
20 - <text style="color: #7D7C7C; text-decoration: line-through; font-size: 0.85rem; margin-left: 5px;">¥1280</text> 22 + <text class="right">¥1280</text>
21 </view> 23 </view>
22 </nut-col> 24 </nut-col>
23 - <nut-col span="6" style="text-align: right;"> 25 + <nut-col span="6" class="order-card-price-num">
24 - <text style="font-size: 28rpx;">x1</text> 26 + <text>x1</text>
25 </nut-col> 27 </nut-col>
26 </nut-row> 28 </nut-row>
27 </view> 29 </view>
28 <view class="calendar-select-page"> 30 <view class="calendar-select-page">
29 - <nut-row gutter=""> 31 + <nut-row gutter="10">
30 <nut-col span="9"> 32 <nut-col span="9">
31 - <view style="color: #7D7C7C; font-size: 0.8rem;">入住日期</view> 33 + <view class="check-in-text">入住日期</view>
32 - <view style="color: #7D7C7C; font-size: 0.85rem; font-weight: bold;">2023.12.07 星期四</view> 34 + <view class="check-in-info">2023.12.07 星期四</view>
33 </nut-col> 35 </nut-col>
34 - <nut-col span="5" style="padding: 0 10rpx;"> 36 + <nut-col span="5" class="book-days">
35 - <view style="color: #7D7C7C; margin-top: 15%; font-size: 0.8rem; text-align: center; background-color: #fff; padding: 0.25rem 0; border-radius: 0.5rem;"> 37 + <view class="book-days-text">共1晚</view>
36 - 共1晚
37 - </view>
38 </nut-col> 38 </nut-col>
39 <nut-col span="9" style="margin-left: 10rpx;"> 39 <nut-col span="9" style="margin-left: 10rpx;">
40 - <view style="color: #7D7C7C; font-size: 0.8rem;">退房日期</view> 40 + <view class="check-in-text">退房日期</view>
41 - <view style="color: #7D7C7C; font-size: 0.85rem; font-weight: bold;">2023.12.08 星期五</view> 41 + <view class="check-in-info">2023.12.08 星期五</view>
42 </nut-col> 42 </nut-col>
43 </nut-row> 43 </nut-row>
44 </view> 44 </view>
45 - <view style="padding: 0.5rem; padding-bottom: 0;"> 45 + <view class="order-card-control">
46 <nut-row> 46 <nut-row>
47 <nut-col span="6"> 47 <nut-col span="6">
48 - <view @tap="showOrderInfo('id')" style="display: flex; align-items: center; margin: 20rpx 0;height: 60rpx;"> 48 + <view class="order-info" @tap="showOrderInfo('id')">
49 - <text style="font-size: 26rpx; color: #7D7C7C;">入住信息</text>&nbsp; 49 + <text>入住信息</text>&nbsp;
50 <IconFont v-if="show_info" name="rect-up" size="12" color="#7D7C7C"></IconFont> 50 <IconFont v-if="show_info" name="rect-up" size="12" color="#7D7C7C"></IconFont>
51 <IconFont v-else name="rect-down" size="12" color="#7D7C7C"></IconFont> 51 <IconFont v-else name="rect-down" size="12" color="#7D7C7C"></IconFont>
52 </view> 52 </view>
53 </nut-col> 53 </nut-col>
54 <nut-col span="18"> 54 <nut-col span="18">
55 - <view style="display: flex; align-items: center;height: 100rpx; justify-content: flex-end;"> 55 + <view v-if="props.data.status !== 'cancel'" class="order-control">
56 <nut-button @tap="cancelOrder('id')" plain color="#6A4925" size="small">取消订单</nut-button>&nbsp; 56 <nut-button @tap="cancelOrder('id')" plain color="#6A4925" size="small">取消订单</nut-button>&nbsp;
57 - <nut-button @tap="payOrder('id')" color="#6A4925" size="small">立即支付</nut-button> 57 + <nut-button v-if="props.data.status !== 'enable'" @tap="payOrder('id')" color="#6A4925" size="small">立即支付</nut-button>
58 </view> 58 </view>
59 </nut-col> 59 </nut-col>
60 </nut-row> 60 </nut-row>
61 </view> 61 </view>
62 - <view style="display: flex; justify-content: flex-end; font-size: 23rpx; margin-bottom: 1rem; margin-right: 1rem;"> 62 + <view class="order-remain-time">
63 <text>支付剩余时间</text>&nbsp; 63 <text>支付剩余时间</text>&nbsp;
64 - <text style="font-size: 23rpx; color: red;">{{ formatTime(remain_time) }}</text> 64 + <text style="font-size: 23rpx; color: red;">
65 + {{ formatTime(remain_time) }}
66 + </text>
65 </view> 67 </view>
66 - <view v-if="show_info"> 68 + <view class="order-info-detail" v-if="show_info">
67 - <view style="border-bottom: 1px dashed #979797; padding: 0.5rem;"> 69 + <view class="order-info">
68 <nut-row> 70 <nut-row>
69 <nut-col span="12"> 71 <nut-col span="12">
70 - <view style="color: #7D7C7C; font-size: 0.85rem;">入住时间</view> 72 + <view class="check-in-text">入住时间</view>
71 </nut-col> 73 </nut-col>
72 <nut-col span="12"> 74 <nut-col span="12">
73 - <view style="color: #7D7C7C; font-size: 0.85rem; text-align: right;">12月7日 14:00后</view> 75 + <view class="check-in-info">12月7日 14:00后</view>
74 </nut-col> 76 </nut-col>
75 </nut-row> 77 </nut-row>
76 <nut-row> 78 <nut-row>
77 <nut-col span="12"> 79 <nut-col span="12">
78 - <view style="color: #7D7C7C; font-size: 0.85rem; margin: 0.25rem 0;">退房日期</view> 80 + <view class="check-out-text">退房日期</view>
79 </nut-col> 81 </nut-col>
80 <nut-col span="12"> 82 <nut-col span="12">
81 - <view style="color: #7D7C7C; font-size: 0.85rem; text-align: right; margin: 0.25rem 0;">12月8日 12:00前</view> 83 + <view class="check-out-info">12月8日 12:00前</view>
82 </nut-col> 84 </nut-col>
83 </nut-row> 85 </nut-row>
84 <nut-row> 86 <nut-row>
85 <nut-col span="12"> 87 <nut-col span="12">
86 - <view style="color: #7D7C7C; font-size: 0.85rem;">早餐</view> 88 + <view class="breakfast-text">早餐</view>
87 </nut-col> 89 </nut-col>
88 <nut-col span="12"> 90 <nut-col span="12">
89 - <view style="color: #7D7C7C; font-size: 0.85rem; text-align: right;">3份</view> 91 + <view class="breakfast-num">3份</view>
90 </nut-col> 92 </nut-col>
91 </nut-row> 93 </nut-row>
92 - <view style="font-size: 0.85rem; margin-top: 0.25rem;"> 94 + <view class="order-info-detail-tip">
93 - <view style="color: red; margin: auto; display: inline-block;">*</view> <view style="color: #7D7C7C; margin: auto; display: inline-block;">12月7日 20:00后未入住,订单将被取消</view> 95 + <view>12月7日 20:00后未入住,订单将被取消</view>
94 </view> 96 </view>
95 </view> 97 </view>
96 - <view style="padding: 0.5rem; font-size: 28rpx; color: #7D7C7C;"> 98 + <view class="order-detail">
97 - <nut-row style="margin-bottom: 10rpx;"> 99 + <nut-row class="wrapper">
98 <nut-col span="6">联系人:</nut-col> 100 <nut-col span="6">联系人:</nut-col>
99 - <nut-col span="18" style="text-align: right;">王二虎</nut-col> 101 + <nut-col span="18" class="right">王二虎</nut-col>
100 </nut-row> 102 </nut-row>
101 - <nut-row style="margin-bottom: 10rpx;"> 103 + <nut-row class="wrapper">
102 <nut-col span="6">联系电话:</nut-col> 104 <nut-col span="6">联系电话:</nut-col>
103 - <nut-col span="18" style="text-align: right;">18996999786</nut-col> 105 + <nut-col span="18" class="right">18996999786</nut-col>
104 </nut-row> 106 </nut-row>
105 - <nut-row style="margin-bottom: 10rpx;"> 107 + <nut-row class="wrapper">
106 <nut-col span="6">备注:</nut-col> 108 <nut-col span="6">备注:</nut-col>
107 - <nut-col span="18" style="text-align: right;"></nut-col> 109 + <nut-col span="18" class="right"></nut-col>
108 </nut-row> 110 </nut-row>
109 - <nut-row style="margin-bottom: 10rpx;"> 111 + <nut-row class="wrapper">
110 <nut-col span="6">下单时间:</nut-col> 112 <nut-col span="6">下单时间:</nut-col>
111 - <nut-col span="18" style="text-align: right;">2023-12-06</nut-col> 113 + <nut-col span="18" class="right">2023-12-06</nut-col>
112 </nut-row> 114 </nut-row>
113 - <nut-row style="margin-bottom: 10rpx;"> 115 + <nut-row class="wrapper">
114 <nut-col span="6">订单号:</nut-col> 116 <nut-col span="6">订单号:</nut-col>
115 - <nut-col span="18" style="text-align: right;">20231206</nut-col> 117 + <nut-col span="18" class="right">20231206</nut-col>
116 </nut-row> 118 </nut-row>
117 </view> 119 </view>
118 </view> 120 </view>
...@@ -124,6 +126,18 @@ import { ref, onMounted, onUnmounted } from 'vue' ...@@ -124,6 +126,18 @@ import { ref, onMounted, onUnmounted } from 'vue'
124 import Taro from '@tarojs/taro' 126 import Taro from '@tarojs/taro'
125 import { IconFont } from '@nutui/icons-vue-taro'; 127 import { IconFont } from '@nutui/icons-vue-taro';
126 128
129 +const STATUS_COLOR = {
130 + 'cancel': '#CECECE',
131 + 'no-pay': '#D5842D',
132 + 'enable': '#6A4925',
133 +}
134 +
135 +const STATUS_TEXT = {
136 + 'cancel': '已取消',
137 + 'enable': '待入住',
138 + 'no-pay': '待支付',
139 +}
140 +
127 /** 141 /**
128 * 格式化时间 142 * 格式化时间
129 * @param {*} seconds 143 * @param {*} seconds
...@@ -214,12 +228,122 @@ onUnmounted(() => { ...@@ -214,12 +228,122 @@ onUnmounted(() => {
214 border: 1px solid #f9f9f9; 228 border: 1px solid #f9f9f9;
215 border-radius: 0.5rem; 229 border-radius: 0.5rem;
216 overflow: hidden; 230 overflow: hidden;
231 + .order-card-header {
232 + padding: 0.5rem;
233 + image {
234 + width: 100%; height: 3rem; border-radius: 10rpx;
235 + }
236 + }
237 + .order-card-status {
238 + padding: 0 0.5rem;
239 + }
240 + .order-card-price {
241 + padding: 0.5rem;
242 + .order-card-price-text {
243 + height: 2rem;
244 + display: flex;
245 + align-items: center;
246 + .left {
247 + color: #EB2E2E;
248 + font-size: 1.3rem;
249 + font-weight: bold;
250 + }
251 + .right {
252 + color: #7D7C7C;
253 + text-decoration: line-through;
254 + font-size: 0.85rem;
255 + margin-left: 5px;
256 + }
257 + }
258 + .order-card-price-num {
259 + text-align: right;
260 + text {
261 + font-size: 28rpx;
262 + }
263 + }
264 + }
217 .calendar-select-page { 265 .calendar-select-page {
218 margin: 0 0.5rem; 266 margin: 0 0.5rem;
219 background-color: #F6ECE1; 267 background-color: #F6ECE1;
220 border-radius: 10rpx; 268 border-radius: 10rpx;
221 padding: 1rem 0; 269 padding: 1rem 0;
222 padding-left: 0.5rem; 270 padding-left: 0.5rem;
271 + .check-in-text {
272 + color: #7D7C7C; font-size: 0.8rem;
273 + }
274 + .check-in-info{
275 + color: #7D7C7C; font-size: 0.85rem; font-weight: bold;
276 + }
277 + .book-days {
278 + padding: 0 10rpx;
279 + .book-days-text {
280 + color: #7D7C7C; margin-top: 15%; font-size: 0.8rem; text-align: center; background-color: #fff; padding: 0.25rem 0; border-radius: 0.5rem;
281 + }
282 + }
283 + }
284 + .order-card-control {
285 + padding: 0.5rem;
286 + padding-bottom: 0;
287 + .order-info {
288 + display: flex; align-items: center; margin: 20rpx 0;height: 60rpx;
289 + text {
290 + font-size: 26rpx; color: #7D7C7C;
291 + }
292 + }
293 + .order-control {
294 + display: flex; align-items: center;height: 100rpx; justify-content: flex-end;
295 + }
296 + }
297 + .order-remain-time {
298 + display: flex;
299 + justify-content: flex-end;
300 + font-size: 23rpx;
301 + margin-bottom: 1rem;
302 + margin-right: 1rem;
303 + }
304 + .order-info-detail {
305 + .order-info {
306 + border-bottom: 1px dashed #979797; padding: 0.5rem;
307 + .check-in-text {
308 + color: #7D7C7C; font-size: 0.85rem;
309 + }
310 + .check-in-info {
311 + color: #7D7C7C; font-size: 0.85rem; text-align: right;
312 + }
313 + .check-out-text {
314 + color: #7D7C7C; font-size: 0.85rem; margin: 0.25rem 0;
315 + }
316 + .check-out-info {
317 + color: #7D7C7C; font-size: 0.85rem; text-align: right; margin: 0.25rem 0;
318 + }
319 + .breakfast-text {
320 + color: #7D7C7C; font-size: 0.85rem;
321 + }
322 + .breakfast-num {
323 + color: #7D7C7C; font-size: 0.85rem; text-align: right;
324 + }
325 + .order-info-detail-tip {
326 + font-size: 0.85rem; margin-top: 0.25rem;
327 + &::before {
328 + content: '*';
329 + color: red;
330 + margin: auto;
331 + display: inline-block;
332 + }
333 + view {
334 + color: #7D7C7C; margin: auto; display: inline-block;
335 + }
336 + }
337 + }
338 + .order-detail {
339 + padding: 0.5rem; font-size: 28rpx; color: #7D7C7C;
340 + .wrapper {
341 + margin-bottom: 10rpx;
342 + .right {
343 + text-align: right;
344 + }
345 + }
346 + }
223 } 347 }
224 } 348 }
225 </style> 349 </style>
......
1 <!-- 1 <!--
2 * @Date: 2023-12-13 11:13:13 2 * @Date: 2023-12-13 11:13:13
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-12-20 16:16:11 4 + * @LastEditTime: 2023-12-20 17:02:35
5 * @FilePath: /meihuaApp/src/pages/my/index.vue 5 * @FilePath: /meihuaApp/src/pages/my/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -77,6 +77,7 @@ const orderList = ref([ ...@@ -77,6 +77,7 @@ const orderList = ref([
77 time: '2023-12-13 11:13:13', 77 time: '2023-12-13 11:13:13',
78 price: 1200, 78 price: 1200,
79 remain_time: 10, 79 remain_time: 10,
80 + status: 'no-pay',
80 }, 81 },
81 { 82 {
82 id: 2, 83 id: 2,
...@@ -86,6 +87,7 @@ const orderList = ref([ ...@@ -86,6 +87,7 @@ const orderList = ref([
86 time: '2023-12-13 11:13:13', 87 time: '2023-12-13 11:13:13',
87 price: 1200, 88 price: 1200,
88 remain_time: 100, 89 remain_time: 100,
90 + status: 'enable',
89 }, 91 },
90 { 92 {
91 id: 3, 93 id: 3,
...@@ -95,6 +97,7 @@ const orderList = ref([ ...@@ -95,6 +97,7 @@ const orderList = ref([
95 time: '2023-12-13 11:13:13', 97 time: '2023-12-13 11:13:13',
96 price: 1200, 98 price: 1200,
97 remain_time: 100, 99 remain_time: 100,
100 + status: 'cancel',
98 }, 101 },
99 ]) 102 ])
100 103
......