Commit c325b858 authored by wxf's avatar wxf

feat: 核销预约码

parent 435baf1b
{ {
"pages": [ "pages": [
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "首页", "navigationBarTitleText": "首页",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/person/person", "path": "pages/person/person",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/webview/webview", "path": "pages/webview/webview",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/search/search", "path": "pages/search/search",
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
"usingComponents": { "usingComponents": {
"van-tab": "../../wxcomponents/vant/tab/index", "van-tab": "../../wxcomponents/vant/tab/index",
"van-tabs": "../../wxcomponents/vant/tabs/index" "van-tabs": "../../wxcomponents/vant/tabs/index"
} }
} }
}, },
{ {
"path": "pages/product/product", "path": "pages/product/product",
"style": { "style": {
"navigationBarTitleText": "", "navigationBarTitleText": "",
"navigationBarBackgroundColor": "#ffffff", "navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
} }
}, },
{ {
"path": "pages/library/ContentLibrary", "path": "pages/library/ContentLibrary",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/goodsDetail/goodsDetail", "path": "pages/goodsDetail/goodsDetail",
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
}, },
{ {
"path": "pages/rightsDetail/rightsDetail", "path": "pages/rightsDetail/rightsDetail",
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }
}, },
{ {
"path": "pages/naming/naming", "path": "pages/naming/naming",
"style": { "style": {
"navigationBarTitleText": "宝宝取名", "navigationBarTitleText": "宝宝取名",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/naming/namingResult", "path": "pages/naming/namingResult",
"style": { "style": {
"navigationBarTitleText": "AI-宝宝取名", "navigationBarTitleText": "AI-宝宝取名",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "custom" "navigationStyle": "custom"
} }
} }
], ],
"subPackages": [ "subPackages": [
{ {
"root": "reservation", "root": "reservation",
"pages": [ "pages": [
{ {
"path": "home/index", "path": "home/index",
"style": { "style": {
"navigationBarTitleText": "飞鹤奶粉" "navigationBarTitleText": "飞鹤奶粉"
} }
}, },
{ {
"path": "subscribe/index", "path": "subscribe/index",
"style": { "style": {
"navigationBarTitleText": "预约信息" "navigationBarTitleText": "预约信息"
} }
}, },
{ {
"path": "record/index", "path": "record/index",
"style": { "style": {
"navigationBarTitleText": "工业游预约记录" "navigationBarTitleText": "工业游预约记录"
} }
}, },
{ {
"path": "record/detail", "path": "record/detail",
"style": { "style": {
"navigationBarTitleText": "预约详情" "navigationBarTitleText": "预约详情"
} }
}, },
{ {
"path": "status/index", "path": "status/index",
"style": { "style": {
"navigationBarTitleText": "预约状态" "navigationBarTitleText": "预约状态"
} }
} },
] {
} "path": "sign/index",
], "style": {
"globalStyle": { "navigationBarTitleText": "签到"
"navigationBarTextStyle": "black", }
"navigationBarTitleText": "uni-app", }
"navigationBarBackgroundColor": "#F8F8F8", ]
"backgroundColor": "#F8F8F8", }
"navigationStyle": "default" ],
}, "globalStyle": {
"uniIdRouter": {} "navigationBarTextStyle": "black",
} "navigationBarTitleText": "uni-app",
\ No newline at end of file "navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"navigationStyle": "default"
},
"uniIdRouter": {}
}
<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,99 +37,97 @@ ...@@ -33,99 +37,97 @@
</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"; name: 'record-detail',
import fhButton from "../components/fh-button.vue"; })
import { // 获取参数
ref const id = ref(0)
} from 'vue' const detail = ref({
import { title: '', // 预约标题
reservationDetail, reservation_date: '', // 预约日期
reservationCancel reservation_start_time: '', // 预约开始时间
} from '@/api/reservation' reservation_end_time: '', // 预约结束时间
defineOptions({ week: '', // 星期
name: 'record-detail', qrcode: '', // 预约二维码
}) realname: '', // 预约人姓名
// 获取参数 telephone: '', // 预约人手机号
const id = ref(0) visitor_number: '', // 访客人数
const detail = ref({ })
title: '', // 预约标题 let yi = null
reservation_date: '', // 预约日期 onLoad((options) => {
reservation_start_time: '', // 预约开始时间 id.value = options.id
reservation_end_time: '', // 预约结束时间 console.log(id.value)
week: '', // 星期 options.id && getDetail()
qrcode: '', // 预约二维码 })
realname: '', // 预约人姓名 onUnload(() => {
telephone: '', // 预约人手机号 clearInterval(yi)
visitor_number: '', // 访客人数 })
const getDetail = () => {
}) reservationDetail({
let yi = null; id: id.value,
onLoad((options) => { }).then((res) => {
id.value = options.id detail.value = res.data
console.log(id.value) // 翻译星期
options.id && getDetail() detail.value.week = [
}) '周日',
onUnload(() => { '周一',
clearInterval(yi); '周二',
'周三',
'周四',
'周五',
'周六',
][Number(detail.value.week)]
if (detail.value.is_check == 0) {
lunxunGetDetail()
} else {
}
}) })
const getDetail = () => { }
const lunxunGetDetail = () => {
yi = setInterval(function () {
reservationDetail({ reservationDetail({
id: id.value, id: id.value,
}).then((res) => { }).then((res) => {
detail.value = res.data if (res.data.is_check == 1) {
// 翻译星期 detail.value.is_check = 1
detail.value.week = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'][Number(detail.value.week)] clearInterval(yi)
if(detail.value.is_check == 0){ yi = null
lunxunGetDetail(); // 跳转到成功页面
}else{ uni.navigateTo({
url: '/reservation/sign/index',
}
})
}
const lunxunGetDetail = () => {
yi = setInterval(function(){
reservationDetail({
id: id.value,
}).then((res) => {
if(res.data.is_check == 1){
detail.value.is_check = 1;
clearInterval(yi);
}
})
}, 1000);
}
const cancelReservation = () => {
console.log('取消预约')
reservationCancel({
id: id.value,
}).then((res) => {
console.log(res)
if (res.code == 0) {
uni.showToast({
title: '取消成功',
icon: 'success',
})
uni.navigateBack()
} else {
uni.showToast({
title: res.msg,
icon: 'none',
}) })
} }
}) })
} }, 1000)
}
const cancelReservation = () => {
console.log('取消预约')
reservationCancel({
id: id.value,
}).then((res) => {
console.log(res)
if (res.code == 0) {
uni.showToast({
title: '取消成功',
icon: 'success',
})
uni.navigateBack()
} else {
uni.showToast({
title: res.msg,
icon: 'none',
})
}
})
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@import './index.less'; @import './index.less';
</style> </style>
\ No newline at end of file
// 声明字体
@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