Showing
5 changed files
with
97 additions
and
14 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-01-16 10:06:47 | 2 | * @Date: 2024-01-16 10:06:47 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-01-16 11:28:46 | 4 | + * @LastEditTime: 2024-01-16 15:59:42 |
| 5 | * @FilePath: /xysBooking/src/components/qrCode.vue | 5 | * @FilePath: /xysBooking/src/components/qrCode.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -9,6 +9,9 @@ | ... | @@ -9,6 +9,9 @@ |
| 9 | <div class="qr-code-page"> | 9 | <div class="qr-code-page"> |
| 10 | <div v-if="has_qrcode" class="show-qrcode"> | 10 | <div v-if="has_qrcode" class="show-qrcode"> |
| 11 | <div class="qrcode-content"> | 11 | <div class="qrcode-content"> |
| 12 | + <div class="user-status"> | ||
| 13 | + <div :class="[formatStatus(props.status).key, 'status']">{{ formatStatus(props.status).value }}</div> | ||
| 14 | + </div> | ||
| 12 | <div class="user-info">{{ userinfo.name }} {{ userinfo.id }}</div> | 15 | <div class="user-info">{{ userinfo.name }} {{ userinfo.id }}</div> |
| 13 | <div class="user-qrcode"> | 16 | <div class="user-qrcode"> |
| 14 | <div class="left" @click="prevCode"> | 17 | <div class="left" @click="prevCode"> |
| ... | @@ -54,6 +57,13 @@ const $route = useRoute(); | ... | @@ -54,6 +57,13 @@ const $route = useRoute(); |
| 54 | const $router = useRouter(); | 57 | const $router = useRouter(); |
| 55 | useTitle($route.meta.title); | 58 | useTitle($route.meta.title); |
| 56 | 59 | ||
| 60 | +const props = defineProps({ | ||
| 61 | + status: { | ||
| 62 | + type: String, | ||
| 63 | + default: '' | ||
| 64 | + } | ||
| 65 | +}); | ||
| 66 | + | ||
| 57 | const id_number = ref('511522190103214279'); | 67 | const id_number = ref('511522190103214279'); |
| 58 | 68 | ||
| 59 | const formatId = computed(() => { | 69 | const formatId = computed(() => { |
| ... | @@ -123,6 +133,26 @@ const refreshBtn = () => { | ... | @@ -123,6 +133,26 @@ const refreshBtn = () => { |
| 123 | console.warn('refreshBtn'); | 133 | console.warn('refreshBtn'); |
| 124 | } | 134 | } |
| 125 | 135 | ||
| 136 | +const formatStatus = (status) => { | ||
| 137 | + switch (status) { | ||
| 138 | + case 'success': | ||
| 139 | + return { | ||
| 140 | + key: 'success', | ||
| 141 | + value: '预约成功' | ||
| 142 | + } | ||
| 143 | + case 'cancel': | ||
| 144 | + return { | ||
| 145 | + key: 'cancel', | ||
| 146 | + value: '已取消' | ||
| 147 | + } | ||
| 148 | + case 'used': | ||
| 149 | + return { | ||
| 150 | + key: 'used', | ||
| 151 | + value: '已使用' | ||
| 152 | + } | ||
| 153 | + } | ||
| 154 | +} | ||
| 155 | + | ||
| 126 | onMounted(() => { | 156 | onMounted(() => { |
| 127 | 157 | ||
| 128 | }) | 158 | }) |
| ... | @@ -141,6 +171,25 @@ onMounted(() => { | ... | @@ -141,6 +171,25 @@ onMounted(() => { |
| 141 | background-color: #FFF; | 171 | background-color: #FFF; |
| 142 | border-radius: 5px; | 172 | border-radius: 5px; |
| 143 | box-shadow: 0rem 0rem 0.92rem 0rem rgba(106,106,106,0.27); | 173 | box-shadow: 0rem 0rem 0.92rem 0rem rgba(106,106,106,0.27); |
| 174 | + .user-status { | ||
| 175 | + .status { | ||
| 176 | + font-size: 0.75rem; | ||
| 177 | + padding: 5px 8px; | ||
| 178 | + border-radius: 5px; | ||
| 179 | + } | ||
| 180 | + .success { | ||
| 181 | + color: #A67939; | ||
| 182 | + background-color: #FBEEDC; | ||
| 183 | + } | ||
| 184 | + .cancel { | ||
| 185 | + color: #929292; | ||
| 186 | + background-color: #E6E6E6; | ||
| 187 | + } | ||
| 188 | + .used { | ||
| 189 | + color: #477F3D; | ||
| 190 | + background-color: #E5EFE3; | ||
| 191 | + } | ||
| 192 | + } | ||
| 144 | .user-info { | 193 | .user-info { |
| 145 | color: #A6A6A6; | 194 | color: #A6A6A6; |
| 146 | font-size: 1.15rem; | 195 | font-size: 1.15rem; | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-01-15 17:39:29 | 2 | * @Date: 2024-01-15 17:39:29 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-01-16 15:46:02 | 4 | + * @LastEditTime: 2024-01-16 15:48:05 |
| 5 | * @FilePath: /xysBooking/src/views/addVisitor.vue | 5 | * @FilePath: /xysBooking/src/views/addVisitor.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -39,6 +39,12 @@ | ... | @@ -39,6 +39,12 @@ |
| 39 | @confirm="onConfirm" | 39 | @confirm="onConfirm" |
| 40 | /> | 40 | /> |
| 41 | </van-popup> | 41 | </van-popup> |
| 42 | + | ||
| 43 | + <van-toast v-model:show="show_error" style=""> | ||
| 44 | + <template #message> | ||
| 45 | + {{ error_message }} | ||
| 46 | + </template> | ||
| 47 | + </van-toast> | ||
| 42 | </div> | 48 | </div> |
| 43 | </template> | 49 | </template> |
| 44 | 50 | ||
| ... | @@ -60,12 +66,16 @@ const username = ref(''); | ... | @@ -60,12 +66,16 @@ const username = ref(''); |
| 60 | const idCode = ref(''); | 66 | const idCode = ref(''); |
| 61 | const isError = ref(false); | 67 | const isError = ref(false); |
| 62 | 68 | ||
| 69 | +const show_error = ref(false); | ||
| 70 | +const error_message = ref(''); | ||
| 71 | + | ||
| 63 | const checkUsername = () => { | 72 | const checkUsername = () => { |
| 64 | let flag = true; | 73 | let flag = true; |
| 65 | if (username.value) { | 74 | if (username.value) { |
| 66 | 75 | ||
| 67 | } else { | 76 | } else { |
| 68 | - showFailToast('参观者名称不能为空'); | 77 | + show_error.value = true; |
| 78 | + error_message.value = '参观者名称不能为空'; | ||
| 69 | flag = false; | 79 | flag = false; |
| 70 | } | 80 | } |
| 71 | return flag; | 81 | return flag; |
| ... | @@ -76,7 +86,8 @@ const checkIdCode = () => { | ... | @@ -76,7 +86,8 @@ const checkIdCode = () => { |
| 76 | if (res.status) { | 86 | if (res.status) { |
| 77 | 87 | ||
| 78 | } else { | 88 | } else { |
| 79 | - showFailToast(res.msg); | 89 | + show_error.value = true; |
| 90 | + error_message.value = res.msg; | ||
| 80 | flag = false; | 91 | flag = false; |
| 81 | } | 92 | } |
| 82 | return flag; | 93 | return flag; | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-01-16 13:19:23 | 2 | * @Date: 2024-01-16 13:19:23 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-01-16 13:32:10 | 4 | + * @LastEditTime: 2024-01-16 16:01:04 |
| 5 | * @FilePath: /xysBooking/src/views/bookingDetail.vue | 5 | * @FilePath: /xysBooking/src/views/bookingDetail.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| 9 | <div class="booking-detail-page"> | 9 | <div class="booking-detail-page"> |
| 10 | - <qrCode></qrCode> | 10 | + <qrCode status="success"></qrCode> |
| 11 | <div class="detail-wrapper"> | 11 | <div class="detail-wrapper"> |
| 12 | <div class="detail-item"> | 12 | <div class="detail-item"> |
| 13 | <div>参访时间:</div> | 13 | <div>参访时间:</div> |
| ... | @@ -31,8 +31,8 @@ | ... | @@ -31,8 +31,8 @@ |
| 31 | </div> | 31 | </div> |
| 32 | </div> | 32 | </div> |
| 33 | <div style="height: 5rem;"></div> | 33 | <div style="height: 5rem;"></div> |
| 34 | - <div class="cancel-wrapper"> | 34 | + <div v-if="status === '预约成功'" class="cancel-wrapper"> |
| 35 | - <div class="cancel-btn ">取消预约</div> | 35 | + <div @click="cancelBooking" class="cancel-btn ">取消预约</div> |
| 36 | </div> | 36 | </div> |
| 37 | </div> | 37 | </div> |
| 38 | </template> | 38 | </template> |
| ... | @@ -40,16 +40,36 @@ | ... | @@ -40,16 +40,36 @@ |
| 40 | <script setup> | 40 | <script setup> |
| 41 | import { ref } from 'vue' | 41 | import { ref } from 'vue' |
| 42 | import { useRoute, useRouter } from 'vue-router' | 42 | import { useRoute, useRouter } from 'vue-router' |
| 43 | - | 43 | +import { useGo } from '@/hooks/useGo' |
| 44 | import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js' | 44 | import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js' |
| 45 | //import { } from '@/utils/generateModules.js' | 45 | //import { } from '@/utils/generateModules.js' |
| 46 | //import { } from '@/utils/generateIcons.js' | 46 | //import { } from '@/utils/generateIcons.js' |
| 47 | //import { } from '@/composables' | 47 | //import { } from '@/composables' |
| 48 | import qrCode from '@/components/qrCode'; | 48 | import qrCode from '@/components/qrCode'; |
| 49 | +import { showConfirmDialog } from 'vant'; | ||
| 50 | +import { showSuccessToast, showFailToast } from 'vant'; | ||
| 49 | const $route = useRoute(); | 51 | const $route = useRoute(); |
| 50 | const $router = useRouter(); | 52 | const $router = useRouter(); |
| 51 | useTitle($route.meta.title); | 53 | useTitle($route.meta.title); |
| 52 | 54 | ||
| 55 | +const go = useGo(); | ||
| 56 | + | ||
| 57 | +const status = ref('预约成功'); | ||
| 58 | + | ||
| 59 | +const cancelBooking = (item) => { | ||
| 60 | + showConfirmDialog({ | ||
| 61 | + title: '温馨提示', | ||
| 62 | + message: '是否取消预约?', | ||
| 63 | + confirmButtonColor: '#A67939', | ||
| 64 | + }) | ||
| 65 | + .then(() => { | ||
| 66 | + // on confirm | ||
| 67 | + showSuccessToast('取消成功'); | ||
| 68 | + }) | ||
| 69 | + .catch(() => { | ||
| 70 | + // on cancel | ||
| 71 | + }); | ||
| 72 | +} | ||
| 53 | </script> | 73 | </script> |
| 54 | 74 | ||
| 55 | <style lang="less" scoped> | 75 | <style lang="less" scoped> | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-01-16 11:37:10 | 2 | * @Date: 2024-01-16 11:37:10 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-01-16 13:17:42 | 4 | + * @LastEditTime: 2024-01-16 16:02:56 |
| 5 | * @FilePath: /xysBooking/src/views/bookingList.vue | 5 | * @FilePath: /xysBooking/src/views/bookingList.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| 9 | <div class="booking-list-page"> | 9 | <div class="booking-list-page"> |
| 10 | - <div v-for="(item, index) in bookingList" :key="index" class="booking-list-item"> | 10 | + <div @click="() => { go('/bookingDetail', { id: 'test' }) }" v-for="(item, index) in bookingList" :key="index" class="booking-list-item"> |
| 11 | <div class="booking-list-item-header"> | 11 | <div class="booking-list-item-header"> |
| 12 | <div>{{ item.booking_time }}</div> | 12 | <div>{{ item.booking_time }}</div> |
| 13 | <div :class="[formatStatus(item.status).key, 'status']">{{ formatStatus(item.status).value }}</div> | 13 | <div :class="[formatStatus(item.status).key, 'status']">{{ formatStatus(item.status).value }}</div> |
| ... | @@ -27,7 +27,7 @@ | ... | @@ -27,7 +27,7 @@ |
| 27 | <script setup> | 27 | <script setup> |
| 28 | import { ref } from 'vue' | 28 | import { ref } from 'vue' |
| 29 | import { useRoute, useRouter } from 'vue-router' | 29 | import { useRoute, useRouter } from 'vue-router' |
| 30 | - | 30 | +import { useGo } from '@/hooks/useGo' |
| 31 | import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js' | 31 | import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js' |
| 32 | //import { } from '@/utils/generateModules.js' | 32 | //import { } from '@/utils/generateModules.js' |
| 33 | //import { } from '@/utils/generateIcons.js' | 33 | //import { } from '@/utils/generateIcons.js' |
| ... | @@ -36,6 +36,8 @@ const $route = useRoute(); | ... | @@ -36,6 +36,8 @@ const $route = useRoute(); |
| 36 | const $router = useRouter(); | 36 | const $router = useRouter(); |
| 37 | useTitle($route.meta.title); | 37 | useTitle($route.meta.title); |
| 38 | 38 | ||
| 39 | +const go = useGo(); | ||
| 40 | + | ||
| 39 | const bookingList = ref([{ | 41 | const bookingList = ref([{ |
| 40 | id: '1', | 42 | id: '1', |
| 41 | booking_time: '2024-01-10 05:00-08:00', | 43 | booking_time: '2024-01-10 05:00-08:00', | ... | ... |
| ... | @@ -10,7 +10,7 @@ | ... | @@ -10,7 +10,7 @@ |
| 10 | <div class="title"> | 10 | <div class="title"> |
| 11 | <div class="text">参观者信息</div> | 11 | <div class="text">参观者信息</div> |
| 12 | </div> | 12 | </div> |
| 13 | - <div class="add-visitors"> | 13 | + <div @click="() => { go('/addVisitor') }" class="add-visitors"> |
| 14 | <div><van-icon name="plus" /> 添加参观者</div> | 14 | <div><van-icon name="plus" /> 添加参观者</div> |
| 15 | </div> | 15 | </div> |
| 16 | <div class="visitors-list"> | 16 | <div class="visitors-list"> |
| ... | @@ -30,6 +30,7 @@ | ... | @@ -30,6 +30,7 @@ |
| 30 | <script setup> | 30 | <script setup> |
| 31 | import { ref } from 'vue' | 31 | import { ref } from 'vue' |
| 32 | import { useRoute, useRouter } from 'vue-router' | 32 | import { useRoute, useRouter } from 'vue-router' |
| 33 | +import { useGo } from '@/hooks/useGo' | ||
| 33 | 34 | ||
| 34 | import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js' | 35 | import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js' |
| 35 | //import { } from '@/utils/generateModules.js' | 36 | //import { } from '@/utils/generateModules.js' |
| ... | @@ -37,7 +38,7 @@ import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@ | ... | @@ -37,7 +38,7 @@ import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@ |
| 37 | //import { } from '@/composables' | 38 | //import { } from '@/composables' |
| 38 | import { showConfirmDialog } from 'vant'; | 39 | import { showConfirmDialog } from 'vant'; |
| 39 | import { showSuccessToast, showFailToast } from 'vant'; | 40 | import { showSuccessToast, showFailToast } from 'vant'; |
| 40 | - | 41 | +const go = useGo(); |
| 41 | const $route = useRoute(); | 42 | const $route = useRoute(); |
| 42 | const $router = useRouter(); | 43 | const $router = useRouter(); |
| 43 | useTitle($route.meta.title); | 44 | useTitle($route.meta.title); | ... | ... |
-
Please register or login to post a comment