Commit c325b858 authored by wxf's avatar wxf

feat: 核销预约码

parent 435baf1b
...@@ -107,6 +107,12 @@ ...@@ -107,6 +107,12 @@
"style": { "style": {
"navigationBarTitleText": "预约状态" "navigationBarTitleText": "预约状态"
} }
},
{
"path": "sign/index",
"style": {
"navigationBarTitleText": "签到"
}
} }
] ]
} }
......
<template> <template>
<view class="record record-detail"> <view class="record record-detail">
<view class="record-bg" :style="{ backgroundImage: `url(${baseUrl}/farqbxzczytcami/images/bg-6.png)` }"></view> <view
class="record-bg"
:style="{
backgroundImage: `url(${baseUrl}/farqbxzczytcami/images/bg-6.png)`,
}"
></view>
<view class="record-content"> <view class="record-content">
<view class="tips">请凭下方预约二维码现场签到进场</view> <view class="tips">请凭下方预约二维码现场签到进场</view>
<view class="card detail"> <view class="card detail">
<view class="title">{{ detail.title }}</view> <view class="title">{{ detail.title }}</view>
<view class="date"> <view class="date">
{{ detail.reservation_date }} {{ detail.week }}{{ detail.reservation_start_time }} - {{ detail.reservation_date }} {{ detail.week
}}{{ detail.reservation_start_time }} -
{{ detail.reservation_end_time }} {{ detail.reservation_end_time }}
</view> </view>
<view class="line"></view> <view class="line"></view>
<view class="info"> <view class="info"> 预约人:{{ detail.realname }} </view>
预约人:{{ detail.realname }} <view class="info"> 手机:{{ detail.telephone }} </view>
</view> <view class="info"> 访客人数:{{ detail.visitor_number }}</view>
<view class="info">
手机:{{ detail.telephone }}
</view>
<view class="info">
访客人数:{{ detail.visitor_number }}
</view>
<view class="qrcode"> <view class="qrcode">
<image :src="detail.qrcode" mode="widthFix" /> <image :src="detail.qrcode" mode="widthFix" />
</view> </view>
</view> </view>
<view v-if="detail.is_check == 0" class="buttons" @click="cancelReservation"> <view
v-if="detail.is_check == 0"
class="buttons"
@click="cancelReservation"
>
<fh-button type="plain" @click="cancelReservation"> <fh-button type="plain" @click="cancelReservation">
取消预约 取消预约
</fh-button> </fh-button>
...@@ -33,27 +37,17 @@ ...@@ -33,27 +37,17 @@
</template> </template>
<script setup> <script setup>
import { import { baseUrl } from '@/reservation/config'
baseUrl import { onLoad, onUnload } from '@dcloudio/uni-app'
} from '@/reservation/config' import fhButton from '../components/fh-button.vue'
import { import { ref } from 'vue'
onLoad, import { reservationDetail, reservationCancel } from '@/api/reservation'
onUnload defineOptions({
} from "@dcloudio/uni-app";
import fhButton from "../components/fh-button.vue";
import {
ref
} from 'vue'
import {
reservationDetail,
reservationCancel
} from '@/api/reservation'
defineOptions({
name: 'record-detail', name: 'record-detail',
}) })
// 获取参数 // 获取参数
const id = ref(0) const id = ref(0)
const detail = ref({ const detail = ref({
title: '', // 预约标题 title: '', // 预约标题
reservation_date: '', // 预约日期 reservation_date: '', // 预约日期
reservation_start_time: '', // 预约开始时间 reservation_start_time: '', // 预约开始时间
...@@ -63,48 +57,56 @@ ...@@ -63,48 +57,56 @@
realname: '', // 预约人姓名 realname: '', // 预约人姓名
telephone: '', // 预约人手机号 telephone: '', // 预约人手机号
visitor_number: '', // 访客人数 visitor_number: '', // 访客人数
})
}) let yi = null
let yi = null; onLoad((options) => {
onLoad((options) => {
id.value = options.id id.value = options.id
console.log(id.value) console.log(id.value)
options.id && getDetail() options.id && getDetail()
}) })
onUnload(() => { onUnload(() => {
clearInterval(yi); clearInterval(yi)
})
}) const getDetail = () => {
const getDetail = () => {
reservationDetail({ reservationDetail({
id: id.value, id: id.value,
}).then((res) => { }).then((res) => {
detail.value = res.data detail.value = res.data
// 翻译星期 // 翻译星期
detail.value.week = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][Number(detail.value.week)] detail.value.week = [
if(detail.value.is_check == 0){ '周日',
lunxunGetDetail(); '周一',
}else{ '周二',
'周三',
'周四',
'周五',
'周六',
][Number(detail.value.week)]
if (detail.value.is_check == 0) {
lunxunGetDetail()
} else {
} }
}) })
} }
const lunxunGetDetail = () => { const lunxunGetDetail = () => {
yi = setInterval(function(){ yi = setInterval(function () {
reservationDetail({ reservationDetail({
id: id.value, id: id.value,
}).then((res) => { }).then((res) => {
if(res.data.is_check == 1){ if (res.data.is_check == 1) {
detail.value.is_check = 1; detail.value.is_check = 1
clearInterval(yi); clearInterval(yi)
} yi = null
// 跳转到成功页面
uni.navigateTo({
url: '/reservation/sign/index',
}) })
}, 1000);
} }
})
}, 1000)
}
const cancelReservation = () => { const cancelReservation = () => {
console.log('取消预约') console.log('取消预约')
reservationCancel({ reservationCancel({
id: id.value, id: id.value,
...@@ -123,9 +125,9 @@ ...@@ -123,9 +125,9 @@
}) })
} }
}) })
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import './index.less'; @import './index.less';
</style> </style>
// 声明字体
@font-face {
font-family: 'fz';
src: url('https://factory-walk-uat.feihe.com/farqbxzczytcami/images/fz.ttf')
format('truetype');
}
@font-face {
font-family: 'fz-bold';
src: url('https://factory-walk-uat.feihe.com/farqbxzczytcami/images/fz-bold.ttf')
format('truetype');
}
.record {
background: #eee;
width: 100%;
height: 100vh;
overflow: hidden;
&-bg {
width: 100%;
height: 600rpx;
background-size: 100% auto;
background-repeat: no-repeat;
background-position: top center;
}
&-content {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 1;
padding: 52rpx;
box-sizing: border-box;
.card {
height: 682rpx;
margin-top: 120rpx;
overflow-y: auto;
background: #fff;
box-shadow: 0rpx 19rpx 37rpx 0rpx rgba(0, 0, 0, 0.04);
border-radius: 26rpx;
padding: 37rpx 86rpx;
box-sizing: border-box;
font-family: 'fz';
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
.title {
font-size: 52rpx;
color: #d3a358;
line-height: 67rpx;
text-align: left;
position: absolute;
z-index: 1;
top: 50rpx;
left: calc(50% - 102rpx);
}
.image {
width: 484rpx;
height: 484rpx;
margin: -40rpx auto 0 -20rpx;
image {
width: 100%;
height: 100%;
}
}
.desc {
font-size: 30rpx;
color: #000000;
line-height: 45rpx;
text-align: center;
font-style: normal;
position: absolute;
bottom: 50rpx;
}
}
}
.buttons {
position: absolute;
left: 0;
width: 100%;
padding: 0 52rpx;
box-sizing: border-box;
bottom: 100rpx;
}
}
<template>
<view class="record">
<view
class="record-bg"
:style="{
backgroundImage: `url(${baseUrl}/farqbxzczytcami/images/bg-6.png)`,
}"
></view>
<view class="record-content">
<view class="card">
<view class="title">签到成功!</view>
<view class="image">
<image src="@/assets/reservation-images/sign.png" mode="widthFix" />
</view>
<view class="desc"
>您已签到成功 <br />
请尽情体验您的飞鹤之旅吧~</view
>
</view>
<view class="buttons">
<!-- <view style="margin-bottom: 37rpx" @click.stop="handleDetail">
<fh-button>查看预约详情</fh-button>
</view> -->
<view @click.stop="handleHome">
<fh-button>返回首页</fh-button>
</view>
</view>
</view>
</view>
</template>
<script setup>
import { baseUrl } from '@/reservation/config'
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import fhButton from '../components/fh-button.vue'
defineOptions({
name: 'record',
})
const id = ref(0)
onLoad((options) => {
id.value = options.id
console.log(id.value)
})
const handleDetail = () => {
uni.redirectTo({
url: '/reservation/record/detail?id=' + id.value,
})
}
const handleHome = () => {
uni.reLaunch({ url: '/reservation/home/index' })
}
</script>
<style lang="less" scoped>
@import './index.less';
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment