mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 09:39:38 +08:00
描述:选择优惠卷
This commit is contained in:
parent
c19367dd88
commit
1fefce9a97
@ -43,4 +43,16 @@ export function selectFreeMeetingRoomRq(data) {
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
// 获取优惠卷
|
||||
// "userId":10000,
|
||||
// "customerId":33,
|
||||
// "type":1 类型 1.会议室,2.展厅
|
||||
export function getCustomerTicketRq(data) {
|
||||
return request({
|
||||
url: '/api/roomContent/getCustomerTicket',
|
||||
method: "post",
|
||||
data
|
||||
});
|
||||
}
|
@ -55,9 +55,20 @@ Page({
|
||||
confirmTime() {
|
||||
let _this = this;
|
||||
let meetingRoomId = _this.data.meetingRoomId;
|
||||
let startTime = selfFormatTimeYMDHMS(_this.data.startTime);
|
||||
let endTime = selfFormatTimeYMDHMS(_this.data.endTime);
|
||||
let paramUrl = "?meetingRoomId=" + meetingRoomId + "&startTime=" + startTime + "&endTime=" + endTime;
|
||||
let startTime = _this.data.startTime;
|
||||
let endTime = _this.data.endTime;
|
||||
let paramUrl = "?meetingRoomId=" + meetingRoomId + "&startTime=" + selfFormatTimeYMDHMS(startTime) + "&endTime=" + selfFormatTimeYMDHMS(endTime);
|
||||
|
||||
// 预约时间必须大于15分钟
|
||||
if ((1000 * 60 * 15) > (endTime - startTime)) {
|
||||
Notify({
|
||||
type: 'danger',
|
||||
message: '预约时间必须大于15分钟',
|
||||
duration: 1000,
|
||||
selector: '#notify',
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
// 当前会议室是否可以预约
|
||||
selectFreeMeetingRoomRq({
|
||||
|
@ -1,5 +1,13 @@
|
||||
const app = getApp()
|
||||
|
||||
import {
|
||||
getCustomerTicketRq
|
||||
} from "../../../../api/meeting/meetingRoom.js"
|
||||
|
||||
import {
|
||||
selfFormatTimeYMD
|
||||
} from "../../../../utils/util.js"
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
@ -8,28 +16,75 @@ Page({
|
||||
data: {
|
||||
IMG_NAME: app.IMG_NAME,
|
||||
couponId: '',
|
||||
dataList: [],
|
||||
userDetail: {}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
let _this = this;
|
||||
_this.setData({
|
||||
...options,
|
||||
userDetail: wx.getStorageSync('user')
|
||||
})
|
||||
// 获取优惠卷
|
||||
_this.getDataList()
|
||||
},
|
||||
|
||||
// 选择优惠卷
|
||||
couponChange(event) {
|
||||
this.setData({
|
||||
couponId: event.detail,
|
||||
});
|
||||
// 获取优惠卷
|
||||
getDataList() {
|
||||
let _this = this;
|
||||
getCustomerTicketRq({
|
||||
"userId": _this.data.userDetail.id,
|
||||
"customerId": _this.data.userDetail.icsCustomerId,
|
||||
"type": _this.data.type
|
||||
}).then(res => {
|
||||
let nowTime = new Date().getTime();
|
||||
let dataList = res.data.map(item => {
|
||||
item.startTime = selfFormatTimeYMD(item.startTime)
|
||||
item.endDate = selfFormatTimeYMD(item.endDate)
|
||||
let kaishiTime = new Date(item.startTime + " 00:00:00")
|
||||
let jieshuTime = new Date(item.endDate + " 23:59:59")
|
||||
if (nowTime >= kaishiTime && nowTime <= jieshuTime) {
|
||||
item.isDisable = false
|
||||
} else {
|
||||
item.isDisable = true
|
||||
}
|
||||
return item;
|
||||
})
|
||||
|
||||
// 可用
|
||||
let useList = res.data.filter(item => !item.isDisable)
|
||||
// 不可用
|
||||
let notUseList = res.data.filter(item => item.isDisable)
|
||||
dataList = useList.concat(notUseList)
|
||||
_this.setData({
|
||||
dataList
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 点击-选择优惠卷
|
||||
couponSelect(e) {
|
||||
console.log('couponSelect', e);
|
||||
this.setData({
|
||||
couponId: e.currentTarget.dataset.id,
|
||||
});
|
||||
if (!e.currentTarget.dataset.isdisable) {
|
||||
this.setData({
|
||||
couponId: e.currentTarget.dataset.id,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 确定
|
||||
submit() {
|
||||
let _this = this;
|
||||
let pages = getCurrentPages(); //获取page
|
||||
let prevPage = pages[pages.length - 2]; //上一个页面(父页面)
|
||||
prevPage.setData({
|
||||
couponId: _this.couponId
|
||||
})
|
||||
wx.navigateBack();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -3,26 +3,24 @@
|
||||
<!-- 优惠卷列表 -->
|
||||
<view class="couponView">
|
||||
<van-radio-group value="{{ couponId }}">
|
||||
<view class="item" wx:for="{{3}}" wx:for-index="idx" data-id="{{idx}}" bind:tap="couponSelect">
|
||||
<view class="item" wx:for="{{dataList}}" wx:key="*this" data-id="{{item.id}}" data-isDisable="{{item.isDisable}}" bind:tap="couponSelect">
|
||||
<view class="imgView">
|
||||
<view class="img"></view>
|
||||
<image class="img" src="{{IMG_NAME + '/profile/static/meeting/coupon/couponBg.png'}}" mode="aspectFill"></image>
|
||||
<view class="timeView">
|
||||
<view class="title">4小时</view>
|
||||
<view class="title">{{item.duration}}小时</view>
|
||||
<view class="type">抵用券</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="contentView">
|
||||
<view class="title">会议室预约抵用券</view>
|
||||
<view class="platform">适用平台: xxx楼</view>
|
||||
<view class="validityTime">有效期至: 2024-01-01</view>
|
||||
<view class="title">{{item.ticketName}}</view>
|
||||
<view class="platform">适用平台: {{item.content}}</view>
|
||||
<view class="validityTime">{{item.startTime}}~{{item.endDate}}</view>
|
||||
</view>
|
||||
|
||||
<van-radio name="{{idx}}"></van-radio>
|
||||
<van-radio name="{{item.id}}" disabled="{{item.isDisable}}"></van-radio>
|
||||
</view>
|
||||
</van-radio-group>
|
||||
</view>
|
||||
|
||||
<view class="submitBtn">确认</view>
|
||||
<view class="submitBtn" bind:tap="submit">确认</view>
|
||||
|
||||
</view>
|
@ -6,7 +6,7 @@
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
padding: 20rpx 0;
|
||||
padding: 20rpx 0;
|
||||
border-top: 1px solid rgb(126, 126, 126, 0.2);
|
||||
}
|
||||
|
||||
@ -16,14 +16,13 @@
|
||||
|
||||
.couponView .item .imgView {
|
||||
position: relative;
|
||||
width: 260rpx;
|
||||
height: 260rpx;
|
||||
width: 257rpx;
|
||||
height: 222rpx;
|
||||
}
|
||||
|
||||
.couponView .item .imgView .img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: red;
|
||||
}
|
||||
|
||||
.couponView .item .imgView .timeView {
|
||||
@ -52,6 +51,7 @@
|
||||
flex: 1;
|
||||
margin: 0 20rpx;
|
||||
color: gray;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.couponView .item .contentView .title {
|
||||
@ -59,14 +59,26 @@
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.couponView .item .contentView .platform,
|
||||
.couponView .item .contentView .validityTime {
|
||||
.couponView .item .contentView .platform {
|
||||
margin-top: 20rpx;
|
||||
font-size: 24rpx;
|
||||
opacity: 0.6;
|
||||
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
.submitBtn{
|
||||
.couponView .item .contentView .validityTime {
|
||||
margin-top: 20rpx;
|
||||
font-size: 22rpx;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
|
||||
.submitBtn {
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
width: 600rpx;
|
||||
|
@ -68,7 +68,7 @@ Page({
|
||||
// 跳转-优惠卷
|
||||
jumpMeetingCoupon() {
|
||||
wx.navigateTo({
|
||||
url: "/pages/meeting/meetingRoom/meetingCoupon/meetingCoupon",
|
||||
url: "/pages/meeting/meetingRoom/meetingCoupon/meetingCoupon?type=1",
|
||||
})
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user