| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345 |
- <template>
- <view class="container">
- <!-- 选择发车时间区域 -->
- <view class="time">
- <view class="time-title">
- 选择发车时间 <span>/ 开启校车之旅</span>
- </view>
- <view class="time-list">
- <view :class="currentIndex1 === index?'active':'time-list-item'" v-for="(item,index) in timeList"
- :key="index" @click="handleChangeCurrentIndex(index,1,item)">
- {{item}}
- </view>
- </view>
- </view>
- <!-- 选择预约车辆区域 -->
- <view class="bus">
- <view class="bus-title">
- 选择预约车辆 <span>/ 墨轩湖 - 综合楼</span>
- </view>
- <view class="bus-list" v-if="busList.length">
- <view :class="currentIndex2 === index?'active':'bus-list-item'" v-for="(item,index) in busList"
- :key="index" @click="handleChangeCurrentIndex(index,2,item)">
- {{item}}
- </view>
- </view>
- <view class="bus-list-nodata" v-else>
- <view class="nodata-img">
- <img src="../../static/no-bus.png" alt="">
- <view class="nodata-info">
- 请先选择发车时间
- </view>
- </view>
- </view>
- </view>
- <!-- 立即预约按钮区域 -->
- <view class="btn">
- <view class="btn-clock">
- <img src="../../static/clock.png">
- </view>
- <view class="btn-info">
- <view class="btn-info-title">
- 预约截止时间
- </view>
- <view class="btn-info-time">
- 2023-10-03 15:15:15
- </view>
- </view>
- <view class="btn-button" @click="handleSub">
- 立即预约
- </view>
- </view>
- <!-- 预约截止时间区域 -->
- <view class="info">
- <view class="info-title">
- 预约说明
- </view>
- <view class="info-detail">
- 预约成功后请提前5分钟到校车地点,若迟到需重新排队或预约;如有疑问请联系后勤。后勤电话:13689545487
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import {
- ref
- } from "vue"
- import {
- onLoad
- } from "@dcloudio/uni-app"
- import {
- myRequest
- } from "../../util/api.js"
- onLoad(() => {
- wxcode.value = uni.getStorageSync('wxcode')
- alert(wxcode.value)
- getUserInfo()
- })
- const wxcode = ref('')
- const currentIndex1 = ref(null)
- const currentIndex2 = ref(null)
- const currentTime = ref(null)
- const currentBus = ref(null)
- // 发车时间列表
- const timeList = ref([
- '2023-10-10 15:15:15', '2023-10-10 16:15:15', '2023-10-10 18:15:15'
- ])
- // 发车车辆列表
- const busList = ref(['车牌尾号:6601(63/63)', '车牌尾号:6661(63/63)', '车牌尾号:6001(63/63)'])
- // const busList = ref([])
- const getUserInfo = async () => {
- const res = await myRequest({
- url: '/carBook/useropenid.action',
- method: 'post',
- data: {
- wxcode: wxcode.value
- }
- })
- alert(JSON.stringify(res))
- console.log(res);
- }
- // 改变选中项回调
- const handleChangeCurrentIndex = (index, type, value) => {
- if (type === 1) {
- currentIndex1.value = index
- currentTime.value = value
- } else {
- currentIndex2.value = index
- currentBus.value = value
- }
- }
- // 立即预约按钮回调
- const handleSub = () => {
- if (!currentTime.value) {
- uni.showToast({
- title: '请先选择发车时间',
- icon: "none"
- })
- return
- }
- if (!currentBus.value) {
- uni.showToast({
- title: '请先选择预约车辆',
- icon: "none"
- })
- return
- }
- uni.showModal({
- title: '提示',
- content: '确定预约吗?',
- success: (res) => {
- if (res.confirm) {
- console.log(123);
- } else if (res.cancel) {
- }
- }
- });
- }
- </script>
- <style lang="scss" scoped>
- .container {
- padding: 0 30rpx;
- .time {
- .time-title {
- height: 128rpx;
- line-height: 128rpx;
- font-size: 30rpx;
- font-weight: bold;
- span {
- font-size: 24rpx;
- font-weight: 400;
- color: #B3B3B3;
- }
- }
- .time-list {
- display: grid;
- grid-template-columns: 1fr 1fr;
- grid-auto-rows: 100rpx;
- grid-gap: 30rpx 20rpx;
- .time-list-item {
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 26rpx;
- border: 1rpx solid #CCCCCC;
- border-radius: 12rpx;
- }
- .active {
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 26rpx;
- border: 1rpx solid #CCCCCC;
- border-radius: 12rpx;
- color: #fff;
- background-image: linear-gradient(#8684FF, #3D50E7);
- }
- .disable {
- background: #E6E6E6;
- }
- }
- }
- .bus {
- .bus-title {
- height: 128rpx;
- line-height: 128rpx;
- font-size: 30rpx;
- font-weight: bold;
- span {
- font-size: 24rpx;
- font-weight: 400;
- }
- }
- .bus-list {
- display: flex;
- flex-direction: column;
- .bus-list-item {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-bottom: 30rpx;
- height: 100rpx;
- font-size: 26rpx;
- border: 1rpx solid #CCCCCC;
- border-radius: 12rpx;
- }
- .active {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-bottom: 30rpx;
- height: 100rpx;
- font-size: 26rpx;
- border: 1rpx solid #CCCCCC;
- border-radius: 12rpx;
- color: #fff;
- background-image: linear-gradient(#8684FF, #3D50E7);
- }
- .disable {
- background: #E6E6E6;
- }
- }
- .bus-list-nodata {
- display: flex;
- flex-direction: column;
- align-items: center;
- color: #B3B3B3;
- .nodata-img {
- position: relative;
- width: 500rpx;
- height: 500rpx;
- img {
- width: 100%;
- height: 100%;
- }
- .nodata-info {
- position: absolute;
- left: 250rpx;
- bottom: 50rpx;
- transform: translateX(-50%);
- white-space: nowrap;
- }
- }
- }
- }
- .btn {
- position: relative;
- display: flex;
- margin-top: 50rpx;
- padding: 24rpx 30rpx;
- box-sizing: border-box;
- height: 115rpx;
- border-radius: 15rpx;
- box-shadow: 0px 0px 12rpx rgba(0, 0, 0, .12);
- .btn-clock {
- width: 61rpx;
- height: 61rpx;
- img {
- width: 100%;
- }
- }
- .btn-info {
- margin-left: 18rpx;
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: center;
- .btn-info-title {
- font-size: 28rpx;
- color: #5863F1;
- }
- .btn-info-time {
- font-size: 24rpx;
- color: #B3B3B3;
- }
- }
- .btn-button {
- position: absolute;
- right: 0;
- top: -7rpx;
- width: 257rpx;
- height: 130rpx;
- line-height: 130rpx;
- text-align: center;
- font-size: 30rpx;
- color: #fff;
- background: url(../../static/box.png);
- background-size: 100% 100%;
- }
- }
- .info {
- margin: 40rpx 0;
- .info-title {
- height: 41rpx;
- font-size: 28rpx;
- }
- .info-detail {
- margin-top: 5rpx;
- height: 70rpx;
- color: #B3B3B3;
- font-size: 24rpx;
- }
- }
- }
- </style>
|