Showing
1 changed file
with
38 additions
and
6 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-01-15 16:25:51 | 2 | * @Date: 2024-01-15 16:25:51 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-01-15 17:30:46 | 4 | + * @LastEditTime: 2024-01-16 15:39:18 |
| 5 | * @FilePath: /xysBooking/src/views/submit.vue | 5 | * @FilePath: /xysBooking/src/views/submit.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| 8 | <template> | 8 | <template> |
| 9 | <div class="submit-page"> | 9 | <div class="submit-page"> |
| 10 | - <div class="visit-time"> | 10 | + <div @click="goToBooking" class="visit-time"> |
| 11 | <div>参访时间</div> | 11 | <div>参访时间</div> |
| 12 | - <div>2024-01-10 05:00-08:00 <van-icon name="arrow" /></div> | 12 | + <div>{{ date }} {{ time }} <van-icon name="arrow" /></div> |
| 13 | </div> | 13 | </div> |
| 14 | - <div class="add-visitors"> | 14 | + <div @click="goToVisitor" class="add-visitors"> |
| 15 | <div><van-icon name="plus" /> 添加参观者</div> | 15 | <div><van-icon name="plus" /> 添加参观者</div> |
| 16 | </div> | 16 | </div> |
| 17 | <div class="visitors-list"> | 17 | <div class="visitors-list"> |
| ... | @@ -31,10 +31,10 @@ | ... | @@ -31,10 +31,10 @@ |
| 31 | <div class="submit-wrapper"> | 31 | <div class="submit-wrapper"> |
| 32 | <div class="left"> | 32 | <div class="left"> |
| 33 | <div style="margin-left: 1rem; display: flex;align-items: center;"> | 33 | <div style="margin-left: 1rem; display: flex;align-items: center;"> |
| 34 | - 订单金额 <div style="color: #FF1919;display: inline-block;">¥<div style="font-size: 1.5rem;display: inline-block;">50</div></div> | 34 | + 订单金额 <div style="color: #FF1919;display: inline-block;">¥<div style="font-size: 1.5rem;display: inline-block;"> {{ total }}</div></div> |
| 35 | </div> | 35 | </div> |
| 36 | </div> | 36 | </div> |
| 37 | - <div class="right">提交订单</div> | 37 | + <div @click="submitBtn" class="right">提交订单</div> |
| 38 | </div> | 38 | </div> |
| 39 | </div> | 39 | </div> |
| 40 | </template> | 40 | </template> |
| ... | @@ -47,10 +47,14 @@ import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@ | ... | @@ -47,10 +47,14 @@ import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@ |
| 47 | //import { } from '@/utils/generateModules.js' | 47 | //import { } from '@/utils/generateModules.js' |
| 48 | //import { } from '@/utils/generateIcons.js' | 48 | //import { } from '@/utils/generateIcons.js' |
| 49 | //import { } from '@/composables' | 49 | //import { } from '@/composables' |
| 50 | +import { useGo } from '@/hooks/useGo' | ||
| 51 | +import { showSuccessToast, showFailToast, showToast } from 'vant'; | ||
| 50 | const $route = useRoute(); | 52 | const $route = useRoute(); |
| 51 | const $router = useRouter(); | 53 | const $router = useRouter(); |
| 52 | useTitle($route.meta.title); | 54 | useTitle($route.meta.title); |
| 53 | 55 | ||
| 56 | +const go = useGo(); | ||
| 57 | + | ||
| 54 | const visitorList = ref([{ id: '1', name: '张雨燕1', idCard: '3101******234' }, { id: '2', name: '张雨燕2', idCard: '3101******234' }, { id: '3',name: '张雨燕3', idCard: '3101******234' }, { id: '4',name: '张雨燕4', idCard: '3101******234' }]); | 58 | const visitorList = ref([{ id: '1', name: '张雨燕1', idCard: '3101******234' }, { id: '2', name: '张雨燕2', idCard: '3101******234' }, { id: '3',name: '张雨燕3', idCard: '3101******234' }, { id: '4',name: '张雨燕4', idCard: '3101******234' }]); |
| 55 | 59 | ||
| 56 | const checked_visitors = ref([]); | 60 | const checked_visitors = ref([]); |
| ... | @@ -61,6 +65,34 @@ const addVisitor = (item) => { | ... | @@ -61,6 +65,34 @@ const addVisitor = (item) => { |
| 61 | checked_visitors.value.push(item.id); | 65 | checked_visitors.value.push(item.id); |
| 62 | } | 66 | } |
| 63 | } | 67 | } |
| 68 | + | ||
| 69 | +const date = $route.query.date; | ||
| 70 | +const time = $route.query.time; | ||
| 71 | +const price = $route.query.price; | ||
| 72 | + | ||
| 73 | +const total = computed(() => { | ||
| 74 | + return price * checked_visitors.value.length; | ||
| 75 | +}) | ||
| 76 | + | ||
| 77 | +const goToBooking = () => { | ||
| 78 | + go('/booking'); | ||
| 79 | +} | ||
| 80 | +const goToVisitor = () => { | ||
| 81 | + go('/addVisitor'); | ||
| 82 | +} | ||
| 83 | + | ||
| 84 | +const submitBtn = () => { | ||
| 85 | + if (!checked_visitors.value.length) { | ||
| 86 | + showToast('请先添加参观者!') | ||
| 87 | + } else { | ||
| 88 | + // TODO: 提交订单跳转到支付页面 | ||
| 89 | + go('/success'); | ||
| 90 | + } | ||
| 91 | +} | ||
| 92 | + | ||
| 93 | +onMounted(() => { | ||
| 94 | + | ||
| 95 | +}); | ||
| 64 | </script> | 96 | </script> |
| 65 | 97 | ||
| 66 | <style lang="less" scoped> | 98 | <style lang="less" scoped> | ... | ... |
-
Please register or login to post a comment