Showing
2 changed files
with
150 additions
and
1 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2023-06-13 13:26:46 | 2 | * @Date: 2023-06-13 13:26:46 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-01-16 10:07:28 | 4 | + * @LastEditTime: 2024-01-16 11:41:28 |
| 5 | * @FilePath: /xysBooking/src/route.js | 5 | * @FilePath: /xysBooking/src/route.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| ... | @@ -56,6 +56,13 @@ export default [ | ... | @@ -56,6 +56,13 @@ export default [ |
| 56 | }, | 56 | }, |
| 57 | }, | 57 | }, |
| 58 | { | 58 | { |
| 59 | + path: '/bookingList', | ||
| 60 | + component: () => import('@/views/bookingList.vue'), | ||
| 61 | + meta: { | ||
| 62 | + title: '预约记录', | ||
| 63 | + }, | ||
| 64 | + }, | ||
| 65 | + { | ||
| 59 | path: '/auth', | 66 | path: '/auth', |
| 60 | component: () => import('@/views/auth.vue'), | 67 | component: () => import('@/views/auth.vue'), |
| 61 | meta: { | 68 | meta: { | ... | ... |
src/views/bookingList.vue
0 → 100644
| 1 | +<!-- | ||
| 2 | + * @Date: 2024-01-16 11:37:10 | ||
| 3 | + * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 4 | + * @LastEditTime: 2024-01-16 13:17:42 | ||
| 5 | + * @FilePath: /xysBooking/src/views/bookingList.vue | ||
| 6 | + * @Description: 文件描述 | ||
| 7 | +--> | ||
| 8 | +<template> | ||
| 9 | + <div class="booking-list-page"> | ||
| 10 | + <div v-for="(item, index) in bookingList" :key="index" class="booking-list-item"> | ||
| 11 | + <div class="booking-list-item-header"> | ||
| 12 | + <div>{{ item.booking_time }}</div> | ||
| 13 | + <div :class="[formatStatus(item.status).key, 'status']">{{ formatStatus(item.status).value }}</div> | ||
| 14 | + </div> | ||
| 15 | + <div class="booking-list-item-body"> | ||
| 16 | + <div class="booking-num"> | ||
| 17 | + <div class="num-body">预约人数:<span>{{ item.num }} 人</span></div> | ||
| 18 | + <div><van-icon name="arrow" /></div> | ||
| 19 | + </div> | ||
| 20 | + <div class="booking-price">支付金额:<span>¥ {{ item.price }}</span></div> | ||
| 21 | + <div class="booking-time">下单时间:<span>{{ item.order_time }}</span></div> | ||
| 22 | + </div> | ||
| 23 | + </div> | ||
| 24 | + </div> | ||
| 25 | +</template> | ||
| 26 | + | ||
| 27 | +<script setup> | ||
| 28 | +import { ref } from 'vue' | ||
| 29 | +import { useRoute, useRouter } from 'vue-router' | ||
| 30 | + | ||
| 31 | +import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js' | ||
| 32 | +//import { } from '@/utils/generateModules.js' | ||
| 33 | +//import { } from '@/utils/generateIcons.js' | ||
| 34 | +//import { } from '@/composables' | ||
| 35 | +const $route = useRoute(); | ||
| 36 | +const $router = useRouter(); | ||
| 37 | +useTitle($route.meta.title); | ||
| 38 | + | ||
| 39 | +const bookingList = ref([{ | ||
| 40 | + id: '1', | ||
| 41 | + booking_time: '2024-01-10 05:00-08:00', | ||
| 42 | + status: 'success', | ||
| 43 | + num: '2', | ||
| 44 | + price: '50', | ||
| 45 | + order_time: '2024-01-09 13:09', | ||
| 46 | +}, { | ||
| 47 | + id: '2', | ||
| 48 | + booking_time: '2024-01-11 05:00-08:00', | ||
| 49 | + status: 'cancel', | ||
| 50 | + num: '2', | ||
| 51 | + price: '350', | ||
| 52 | + order_time: '2024-01-09 13:09', | ||
| 53 | +}, { | ||
| 54 | + id: '3', | ||
| 55 | + booking_time: '2024-01-12 05:00-08:00', | ||
| 56 | + status: 'used', | ||
| 57 | + num: '2', | ||
| 58 | + price: '150', | ||
| 59 | + order_time: '2024-01-09 13:09', | ||
| 60 | +}]); | ||
| 61 | + | ||
| 62 | +const formatStatus = (status) => { | ||
| 63 | + switch (status) { | ||
| 64 | + case 'success': | ||
| 65 | + return { | ||
| 66 | + key: 'success', | ||
| 67 | + value: '预约成功' | ||
| 68 | + } | ||
| 69 | + case 'cancel': | ||
| 70 | + return { | ||
| 71 | + key: 'cancel', | ||
| 72 | + value: '已取消' | ||
| 73 | + } | ||
| 74 | + case 'used': | ||
| 75 | + return { | ||
| 76 | + key: 'used', | ||
| 77 | + value: '已使用' | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | +} | ||
| 81 | +</script> | ||
| 82 | + | ||
| 83 | +<style lang="less" scoped> | ||
| 84 | +.booking-list-page { | ||
| 85 | + padding: 1rem; | ||
| 86 | + .booking-list-item { | ||
| 87 | + background-color: #FFF; | ||
| 88 | + border-radius: 8px; | ||
| 89 | + margin-bottom: 1rem; | ||
| 90 | + .booking-list-item-header { | ||
| 91 | + display: flex; | ||
| 92 | + justify-content: space-between; | ||
| 93 | + align-items: center; | ||
| 94 | + padding: 1rem; | ||
| 95 | + border-bottom: 1px dashed #f0f0f0; | ||
| 96 | + .status { | ||
| 97 | + font-size: 0.75rem; | ||
| 98 | + padding: 5px 8px; | ||
| 99 | + border-radius: 5px; | ||
| 100 | + } | ||
| 101 | + .success { | ||
| 102 | + color: #A67939; | ||
| 103 | + background-color: #FBEEDC; | ||
| 104 | + } | ||
| 105 | + .cancel { | ||
| 106 | + color: #929292; | ||
| 107 | + background-color: #E6E6E6; | ||
| 108 | + } | ||
| 109 | + .used { | ||
| 110 | + color: #477F3D; | ||
| 111 | + background-color: #E5EFE3; | ||
| 112 | + } | ||
| 113 | + } | ||
| 114 | + .booking-list-item-body { | ||
| 115 | + padding: 1rem; | ||
| 116 | + line-height: 1.7; | ||
| 117 | + .booking-num { | ||
| 118 | + display: flex; | ||
| 119 | + justify-content: space-between; | ||
| 120 | + .num-body { | ||
| 121 | + color: #959595; | ||
| 122 | + span { | ||
| 123 | + color: #1E1E1E; | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + .booking-price { | ||
| 128 | + color: #959595; | ||
| 129 | + span { | ||
| 130 | + color: #1E1E1E; | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + .booking-time { | ||
| 134 | + color: #959595; | ||
| 135 | + span { | ||
| 136 | + color: #1E1E1E; | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | +} | ||
| 142 | +</style> |
-
Please register or login to post a comment