This commit is contained in:
SelfRidicule 2024-03-07 14:15:50 +08:00
parent f185882195
commit b67269f5fc
5 changed files with 70 additions and 9 deletions

View File

@ -1,5 +1,8 @@
const app = getApp() const app = getApp()
import Dialog from '@vant/weapp/dialog/dialog';
import Notify from '@vant/weapp/notify/notify';
import { import {
selfFormatTimeYMD, selfFormatTimeYMD,
selfFormatTimeHM, selfFormatTimeHM,
@ -7,7 +10,8 @@ import {
} from "../../../../../utils/util.js" } from "../../../../../utils/util.js"
import { import {
selectReservationByIdRq selectReservationByIdRq,
cancelOrderRq
} from "../../../../../api/meeting/meetingRoom.js" } from "../../../../../api/meeting/meetingRoom.js"
Page({ Page({
@ -100,6 +104,53 @@ Page({
}) })
}, },
// 取消订单
cancelOrder(e) {
console.log('cancelOrder', e);
let _this = this;
let id = e.currentTarget.dataset.id
const beforeClose = (action) => {
console.log('action', action);
return new Promise((resolve) => {
if (action === 'confirm') {
cancelOrderRq({
id,
cancelResaon: ""
}).then(res => {
console.log('cancelOrderRq', res);
if (res.code == 0) {
// 刷新数据
_this.getDetail();
} else {
// 危险通知
Notify({
type: 'danger',
message: res.msg
});
}
resolve(true);
})
} else {
// 拦截取消操作
resolve(true);
}
});
}
Dialog.confirm({
title: '提示',
message: '是否要取消订单!',
beforeClose,
});
},
// 跳转-支付
jumpPay(e) {
console.log('jumpPay', e);
wx.navigateTo({
url: "/pages/meeting/pay/waitPay/waitPay?id=" + e.currentTarget.dataset.id
})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

View File

@ -1,4 +1,7 @@
{ {
"usingComponents": {}, "usingComponents": {
"navigationBarTitleText": "会议预约详情" "van-dialog": "@vant/weapp/dialog/index",
"van-notify": "@vant/weapp/notify/index"
},
"navigationBarTitleText": "会议预约详情"
} }

View File

@ -67,10 +67,16 @@
<!-- 底部区域 --> <!-- 底部区域 -->
<view class="bottomFix" wx:if="{{detail.showPay || detail.showInvite || detail.showCancel}}"> <view class="bottomFix" wx:if="{{detail.showPay || detail.showInvite || detail.showCancel}}">
<view class="btn" wx:if="{{detail.showPay}}">去支付</view> <view class="btn" wx:if="{{detail.showPay}}" bind:tap="jumpPay" data-id="{{detail.id}}">去支付</view>
<view class="btn" wx:if="{{detail.showInvite}}">去邀请 <view class="btn" wx:if="{{detail.showInvite}}">去邀请
<button class="shareBtn" open-type="share" data-id="{{detail.id}}">转发</button> <button class="shareBtn" open-type="share" data-id="{{detail.id}}">转发</button>
</view> </view>
<view class="btn" wx:if="{{detail.showCancel}}">取消订单</view> <view class="btn" wx:if="{{detail.showCancel}}" bind:tap="cancelOrder" data-id="{{detail.id}}">取消订单</view>
</view> </view>
<!-- 提示框 -->
<van-dialog id="van-dialog" />
<!-- 提示框 -->
<van-notify id="van-notify" />
</view> </view>

View File

@ -234,9 +234,10 @@ Page({
}, },
// 跳转-支付 // 跳转-支付
jumpPay() { jumpPay(e) {
console.log('jumpPay' , e);
wx.navigateTo({ wx.navigateTo({
url: "/pages/meeting/pay/waitPay/waitPay" url: "/pages/meeting/pay/waitPay/waitPay?id=" + e.currentTarget.dataset.id
}) })
}, },
@ -282,7 +283,7 @@ Page({
}).then(res => { }).then(res => {
console.log('cancelOrderRq', res); console.log('cancelOrderRq', res);
if (res.code == 0) { if (res.code == 0) {
// 清空预约数据 // 刷新预约数据
_this.setData({ _this.setData({
reservationPageNum: 1, reservationPageNum: 1,
reservationDataList: [], reservationDataList: [],

View File

@ -19,7 +19,7 @@
<view class="price">¥{{item.orderMoney}}</view> <view class="price">¥{{item.orderMoney}}</view>
</view> </view>
<view class="btnView"> <view class="btnView">
<view class="btn" wx:if="{{item.showPay}}" bind:tap="jumpPay">去支付</view> <view class="btn" wx:if="{{item.showPay}}" bind:tap="jumpPay" data-id="{{item.id}}">去支付</view>
<view class="btn" wx:if="{{item.showInvite}}">去邀请 <view class="btn" wx:if="{{item.showInvite}}">去邀请
<button class="shareBtn" open-type="share" data-id="{{item.id}}">转发</button> <button class="shareBtn" open-type="share" data-id="{{item.id}}">转发</button>
</view> </view>