| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- <template>
- <view class="container">
- <!-- 每一个订单区域 -->
- <uni-swipe-action>
- <uni-swipe-action-item v-for="item in orderList" :key="item.id">
- <!-- 右侧选项内容区域 -->
- <template v-slot:right>
- <view class="order_right" @click="handleDelete(item)">
- <img class="img" src="../../static/my/delete.png" />
- </view>
- </template>
- <view class="order_box" @click="goPageOrderDetail(item.type)">
- <!-- 标题区域 -->
- <view class="box_header">
- <img class="img" src="../../static/my/hotel.png" />
- <view class="title">{{ item.hotelName }}</view>
- <view class="type type2" v-if="item.type === 1">
- 待付款,剩余
- <uv-count-down :time="countDownTime" format="mm:ss" @change="change" @finish="finish"></uv-count-down>
- </view>
- <view class="type" v-if="item.type === 2">支付超时</view>
- <view class="type" v-if="item.type === 3">已支付</view>
- <view class="type" v-if="item.type === 4">已取消</view>
- <view class="type" v-if="item.type === 5">已退单</view>
- <view class="type" v-if="item.type === 6">待入住</view>
- <view class="type" v-if="item.type === 7">已入住</view>
- <view class="type" v-if="item.type === 8">已退款</view>
- <view class="type" v-if="item.type === 9">已消费</view>
- </view>
- <!-- 酒店信息区域 -->
- <view class="box_info">
- <img class="img" :src="item.imgUrl" />
- <view class="info_right">
- <view class="info_right_item">1间,大床房</view>
- <view class="info_right_item">2023-07-26 - 2023-07-27</view>
- <view class="info_right_item">总价:¥229.00</view>
- </view>
- </view>
- <!-- 按钮区域 -->
- <view class="box_btn" v-if="item.type === 1 || item.type === 2">
- <view class="btn_item" v-if="item.type === 1" @click="goPagePay">预定</view>
- <view class="btn_item" v-if="item.type === 2" @click="goPageDetail">再次预定</view>
- </view>
- </view>
- </uni-swipe-action-item>
- </uni-swipe-action>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- /* type
- 1 为待付款 2 为支付超时,
- 3 为已支付 4 为已取消,
- 5 为已退单 6 为待入住,
- 7 为已入住 8 为已退款,
- 9 为已消费 */
- orderList: [
- {
- id: 1,
- hotelName: '靖安乡宿',
- type: 1,
- imgUrl: '../../static/my/test.png'
- },
- {
- id: 2,
- hotelName: '开心乡宿',
- type: 2,
- imgUrl: '../../static/my/test.png'
- },
- {
- id: 3,
- hotelName: '健康乡宿',
- type: 3,
- imgUrl: '../../static/my/test.png'
- },
- {
- id: 4,
- hotelName: '幸福乡宿',
- type: 4,
- imgUrl: '../../static/my/test.png'
- },
- {
- id: 5,
- hotelName: '靖安乡宿',
- type: 5,
- imgUrl: '../../static/my/test.png'
- },
- {
- id: 6,
- hotelName: '开心乡宿',
- type: 6,
- imgUrl: '../../static/my/test.png'
- },
- {
- id: 7,
- hotelName: '健康乡宿',
- type: 7,
- imgUrl: '../../static/my/test.png'
- },
- {
- id: 8,
- hotelName: '幸福乡宿',
- type: 8,
- imgUrl: '../../static/my/test.png'
- },
- {
- id: 9,
- hotelName: '幸福乡宿',
- type: 9,
- imgUrl: '../../static/my/test.png'
- }
- ],
- // 倒计时时间(毫秒)
- countDownTime: 1000 * 60 * 15
- }
- },
- methods: {
- // 倒计时变化时触发
- change(e) {
- // console.log(e)
- },
- // 倒计时结束回调
- finish() {
- uni.showModal({
- title: '提示',
- content: '订单已超过可支付时间,请重新下单',
- showCancel: false,
- success: (res) => {
- if (res.confirm) {
- uni.switchTab({
- url: '/pages/home/home'
- })
- }
- }
- })
- },
- // 点击预定按钮回调
- goPagePay() {
- uni.navigateTo({
- url: '/pages/pay/pay'
- })
- },
- // 点击再次预定按钮回调
- goPageDetail() {
- uni.navigateTo({
- url: '/pages/detail/detail'
- })
- },
- // 点击每一个订单回调
- goPageOrderDetail(type) {
- uni.navigateTo({
- url: `/pages/orderDetail/orderDetail?type=${type}`
- })
- },
- // 右侧选项内容删除按钮回调
- handleDelete(item) {
- console.log(item.name)
- uni.showModal({
- title: '提示',
- content: '确定删除吗?删除后不可恢复',
- success: (res) => {
- if (res.confirm) {
- uni.showToast({
- title: '删除成功',
- icon: 'success'
- })
- }
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .container {
- box-sizing: border-box;
- padding: 0 20rpx 40rpx;
- min-height: 100vh;
- background-color: #f2f3f5;
- overflow-y: auto;
- .order_right {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-top: 20rpx;
- width: 126rpx;
- background-color: #d43030;
- .img {
- width: 50rpx;
- height: 50rpx;
- }
- }
- .order_box {
- margin-top: 20rpx;
- box-sizing: border-box;
- padding: 0 22rpx;
- width: 710rpx;
- border-radius: 15rpx;
- background-color: #fff;
- .box_header {
- display: flex;
- align-items: center;
- height: 94rpx;
- .img {
- width: 47rpx;
- height: 47rpx;
- }
- .title {
- margin-left: 16rpx;
- font-size: 32rpx;
- font-weight: bold;
- }
- .type {
- display: flex;
- align-items: center;
- margin-left: auto;
- color: #808080;
- font-size: 28rpx;
- }
- .type2 {
- color: #ff5733;
- }
- }
- .box_info {
- display: flex;
- height: 140rpx;
- .img {
- width: 100rpx;
- height: 100rpx;
- border-radius: 9rpx;
- }
- .info_right {
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- margin-top: -5rpx;
- margin-left: 18rpx;
- height: 120rpx;
- color: #808080;
- font-size: 28rpx;
- .info_right_item {
- flex: 1;
- }
- }
- }
- .box_btn {
- display: flex;
- justify-content: flex-end;
- margin-top: -10rpx;
- height: 100rpx;
- .btn_item {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-left: 20rpx;
- width: 178rpx;
- height: 68rpx;
- border-radius: 64rpx;
- color: #808080;
- font-size: 28rpx;
- border: 1rpx solid #808080;
- }
- }
- }
- }
- // 修改倒计时字体颜色
- ::v-deep .uv-count-down .uv-count-down__text {
- color: #ff5733;
- }
- </style>
|