index.vue 3.37 KB
<!--
 * @Date: 2024-01-15 18:28:25
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2024-01-30 15:18:54
 * @FilePath: /xyxBooking-weapp/src/pages/success/index.vue
 * @Description: 预约成功提示页面
-->
<template>
  <view class="success-page">
    <view style="">
      <view class="text-prompts">
        <image src="https://cdn.ipadbiz.cn/xys/booking/%E6%88%90%E5%8A%9F@2x.png" mode="widthFix" />
        <view class="text">预约成功</view>
      </view>
      <view class="appointment-information">
        <view class="number-of-visitors">参观人数:<text>{{ billInfo?.total_qty }} 人</text></view>
        <view class="visit-time">参访时间:<text>{{ billInfo?.datetime }}</text></view>
        <view class="payment-amount">支付金额:<text>¥ {{ billInfo?.total_amt }}</text></view>
      </view>
      <view class="appointment-notice">
        <view style="margin-bottom: 0.25rem;"><nut-icon name="tips" />&nbsp;温馨提示</view>
        <view style="font-size: 0.85rem;">1. 一人一码,或拿身份证,扫码或识别身份证成功后进入</view>
        <view style="font-size: 0.85rem;">2. 若您无法按时参观,请提前在预约记录中取消您的预约</view>
      </view>
    </view>
    <view class="success-btn">
      <view @tap="goToHome" class="btn-item btn-left">首页</view>
      <view @tap="goToDetail" class="btn-item btn-right">详情</view>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue'
import Taro, { useDidShow, useRouter as useTaroRouter } from '@tarojs/taro'
import { useGo } from '@/hooks/useGo'
import { billInfoAPI } from '@/api/index'
import { formatDatetime } from '@/utils/tools';

const router = useTaroRouter();
const go = useGo();

const goToHome = () => {
  go('/index')
}
const goToDetail = () => {
  go('/bookingDetail', { pay_id: router.params.pay_id });
}

const billInfo = ref({});

useDidShow(async () => {
  // 获取订单详情
  const { code, data } = await billInfoAPI({ pay_id: router.params.pay_id });
  if (code) {
    data.datetime = data && formatDatetime(data);
    billInfo.value = data;
  }
})
</script>

<style lang="less">
.success-page {
  position: relative;
  background-color: #FFF;
  min-height: 100vh;
  
  .text-prompts {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 35vh;
    flex-direction: column;
    image {
      width: 60vw;
    }
    .text {
      color: #A67939;
      font-size: 1.25rem;
      margin-top: 1rem;
    }
  }
  .appointment-information {
    padding: 2rem 1rem;
    border-bottom: 1px dashed #A67939;
    line-height: 2;
    .number-of-visitors {
      text {
        color: #A67939;
      }
    }
    .visit-time {
      text {
        color: #A67939;
      }
    }
    .payment-amount {
      text {
        color: #A67939;
      }
    }
  }
  
  .appointment-notice {
      padding: 1rem;
      color: #666;
  }
  
  .success-btn {
      position: fixed;
      bottom: 2rem;
      width: 100vw;
      display: flex;
      justify-content: space-around;
      
      .btn-item {
          width: 40%;
          text-align: center;
          padding: 0.8rem 0;
          border-radius: 8px;
          font-size: 1.1rem;
      }
      
      .btn-left {
          border: 1px solid #A67939;
          color: #A67939;
      }
      
      .btn-right {
          background-color: #A67939;
          color: #FFF;
      }
  }
}
</style>