This commit is contained in:
SelfRidicule 2024-03-07 16:52:08 +08:00
parent 4e88613799
commit a8fc49b797
8 changed files with 115 additions and 16 deletions

View File

@ -135,11 +135,20 @@ export function roomContentAddVisitorRq(data) {
}); });
} }
// 取消预约 // 会议室-取消预约
export function cancelOrderRq(data) { export function cancelOrderRq(data) {
return request({ return request({
url: '/api/roomContent/cancelOrder', url: '/api/roomContent/cancelOrder',
method: "post", method: "post",
data data
}); });
}
// 会议室-支付订单
export function meetingRoomPayOrderRq(data) {
return request({
url: '/api/roomContent/payOrder',
method: "post",
data
});
} }

View File

@ -189,7 +189,7 @@ Page({
console.log('saveMeetingRecordRq', res); console.log('saveMeetingRecordRq', res);
if (res.code == 0) { if (res.code == 0) {
wx.redirectTo({ wx.redirectTo({
url: "/pages/meeting/pay/waitPay/waitPay", url: "/pages/meeting/pay/waitPay/waitPay?id=" + res.reservationId,
}) })
} else { } else {
// 错误提示 // 错误提示

View File

@ -1,4 +1,3 @@
// pages/meeting/pay/waitComplete/waitComplete.js
Page({ Page({
/** /**
@ -12,7 +11,10 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
let _this = this;
_this.setData({
...options
})
}, },
// 跳转-会议预约记录 // 跳转-会议预约记录

View File

@ -1,23 +1,105 @@
import Notify from '@vant/weapp/notify/notify';
import {
meetingRoomPayOrderRq,
selectReservationByIdRq,
} from "../../../../api/meeting/meetingRoom.js"
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
countdownTime: 5 * 60 * 1000 // 单位毫秒 countdownTime: 0, // 单位毫秒
timeData: {},
showPay: false,
detail: {}
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
let _this = this;
_this.setData({
...options
})
// 获取详细信息
_this.getDetail();
}, },
// 跳转-完成页面 // 获取详细信息
jumpComplete() { getDetail() {
wx.reLaunch({ let _this = this;
url: '/pages/meeting/pay/waitComplete/waitComplete', selectReservationByIdRq(_this.data.id).then(res => {
let detail = res.data;
// 支付时间 = 订单创建时间 + 5分钟
let payTime = new Date(detail.createTime).getTime() + 5 * 60 * 1000
// 当前时间
let nowTime = new Date().getTime();
// 还剩多长时间
let residueTime = payTime - nowTime;
// 订单时间过期
if (residueTime < 0) {
residueTime = 1
}
_this.setData({
detail,
countdownTime: residueTime, // 单位毫秒
})
})
},
// 时间改变
changeTime(e) {
let _this = this;
this.setData({
timeData: e.detail,
});
// 倒计时
let hours = e.detail.hours
let minutes = e.detail.minutes
let seconds = e.detail.seconds
// 倒计时结束
if (hours <= 0 && minutes <= 0 && seconds <= 0) {
// 消息提示
Notify({
message: '订单已过期!',
color: '#FB4B4B',
background: '#FBE9E9',
duration: 5000,
});
_this.setData({
showPay: false,
});
} else {
_this.setData({
showPay: true,
});
}
},
// 确认支付
payComplete() {
let _this = this;
meetingRoomPayOrderRq({
id: _this.data.id
}).then(res => {
console.log('meetingRoomPayOrderRq', res);
if (res.code == 0) {
wx.reLaunch({
url: '/pages/meeting/pay/waitComplete/waitComplete',
})
} else {
// 消息提示
Notify({
message: res.msg,
color: '#FB4B4B',
background: '#FBE9E9',
duration: 3000,
});
}
}) })
}, },

View File

@ -1,6 +1,7 @@
{ {
"usingComponents": { "usingComponents": {
"van-count-down": "@vant/weapp/count-down/index" "van-count-down": "@vant/weapp/count-down/index",
"van-notify": "@vant/weapp/notify/index"
}, },
"navigationBarTitleText": "支付订单" "navigationBarTitleText": "支付订单"
} }

View File

@ -2,12 +2,17 @@
<!-- 订单信息 --> <!-- 订单信息 -->
<view class="msgView"> <view class="msgView">
<van-count-down class="time" time="{{ countdownTime }}" format="支付剩余时间: mm分ss秒" /> <van-count-down class="time" time="{{ countdownTime }}" use-slot bind:change="changeTime">
<view class="price">¥200.00</view> 支付剩余时间: {{ timeData.minutes }}分{{ timeData.seconds }}秒
</van-count-down>
<view class="price">¥{{detail.orderMoney}}</view>
<view class="title">支付金额</view> <view class="title">支付金额</view>
</view> </view>
<!-- 确认支付 --> <!-- 确认支付 -->
<view class="submitBtn" bind:tap="jumpComplete">确认支付</view> <view class="submitBtn" bind:tap="payComplete" wx:if="{{showPay}}">确认支付</view>
<!-- 消息提示 -->
<van-notify id="van-notify" />
</view> </view>

View File

@ -153,7 +153,7 @@ Page({
jumpPay(e) { jumpPay(e) {
console.log('jumpPay', e); console.log('jumpPay', e);
wx.navigateTo({ wx.navigateTo({
url: "/pages/meeting/pay/waitPay/waitPay?id=" + e.currentTarget.dataset.id url: "/pages/meeting/pay/waitPay/waitPay?id=" + e.currentTarget.dataset.id + "&type=meetingRoom"
}) })
}, },

View File

@ -238,7 +238,7 @@ Page({
jumpPay(e) { jumpPay(e) {
console.log('jumpPay', e); console.log('jumpPay', e);
wx.navigateTo({ wx.navigateTo({
url: "/pages/meeting/pay/waitPay/waitPay?id=" + e.currentTarget.dataset.id url: "/pages/meeting/pay/waitPay/waitPay?id=" + e.currentTarget.dataset.id + "&type=meetingRoom"
}) })
}, },