mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 13:09:38 +08:00
1
This commit is contained in:
parent
4e88613799
commit
a8fc49b797
@ -135,7 +135,7 @@ export function roomContentAddVisitorRq(data) {
|
||||
});
|
||||
}
|
||||
|
||||
// 取消预约
|
||||
// 会议室-取消预约
|
||||
export function cancelOrderRq(data) {
|
||||
return request({
|
||||
url: '/api/roomContent/cancelOrder',
|
||||
@ -143,3 +143,12 @@ export function cancelOrderRq(data) {
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
// 会议室-支付订单
|
||||
export function meetingRoomPayOrderRq(data) {
|
||||
return request({
|
||||
url: '/api/roomContent/payOrder',
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
@ -189,7 +189,7 @@ Page({
|
||||
console.log('saveMeetingRecordRq', res);
|
||||
if (res.code == 0) {
|
||||
wx.redirectTo({
|
||||
url: "/pages/meeting/pay/waitPay/waitPay",
|
||||
url: "/pages/meeting/pay/waitPay/waitPay?id=" + res.reservationId,
|
||||
})
|
||||
} else {
|
||||
// 错误提示
|
||||
|
@ -1,4 +1,3 @@
|
||||
// pages/meeting/pay/waitComplete/waitComplete.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
@ -12,7 +11,10 @@ Page({
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
let _this = this;
|
||||
_this.setData({
|
||||
...options
|
||||
})
|
||||
},
|
||||
|
||||
// 跳转-会议预约记录
|
||||
|
@ -1,24 +1,106 @@
|
||||
import Notify from '@vant/weapp/notify/notify';
|
||||
|
||||
import {
|
||||
meetingRoomPayOrderRq,
|
||||
selectReservationByIdRq,
|
||||
} from "../../../../api/meeting/meetingRoom.js"
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
countdownTime: 5 * 60 * 1000 // 单位毫秒
|
||||
countdownTime: 0, // 单位毫秒
|
||||
timeData: {},
|
||||
showPay: false,
|
||||
detail: {}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
let _this = this;
|
||||
_this.setData({
|
||||
...options
|
||||
})
|
||||
// 获取详细信息
|
||||
_this.getDetail();
|
||||
},
|
||||
|
||||
// 跳转-完成页面
|
||||
jumpComplete() {
|
||||
// 获取详细信息
|
||||
getDetail() {
|
||||
let _this = this;
|
||||
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,
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-count-down": "@vant/weapp/count-down/index"
|
||||
"van-count-down": "@vant/weapp/count-down/index",
|
||||
"van-notify": "@vant/weapp/notify/index"
|
||||
},
|
||||
"navigationBarTitleText": "支付订单"
|
||||
}
|
@ -2,12 +2,17 @@
|
||||
|
||||
<!-- 订单信息 -->
|
||||
<view class="msgView">
|
||||
<van-count-down class="time" time="{{ countdownTime }}" format="支付剩余时间: mm分ss秒" />
|
||||
<view class="price">¥200.00</view>
|
||||
<van-count-down class="time" time="{{ countdownTime }}" use-slot bind:change="changeTime">
|
||||
支付剩余时间: {{ timeData.minutes }}分{{ timeData.seconds }}秒
|
||||
</van-count-down>
|
||||
<view class="price">¥{{detail.orderMoney}}</view>
|
||||
<view class="title">支付金额</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>
|
@ -153,7 +153,7 @@ Page({
|
||||
jumpPay(e) {
|
||||
console.log('jumpPay', e);
|
||||
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"
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -238,7 +238,7 @@ Page({
|
||||
jumpPay(e) {
|
||||
console.log('jumpPay', e);
|
||||
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"
|
||||
})
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user