mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 14:19:38 +08:00
1
This commit is contained in:
parent
a1f0a7ebf0
commit
c94f6d0d73
@ -71,9 +71,14 @@ Page({
|
||||
// 点击-选择优惠卷
|
||||
couponSelect(e) {
|
||||
console.log('couponSelect', e);
|
||||
let _this = this;
|
||||
if (!e.currentTarget.dataset.isdisable) {
|
||||
this.setData({
|
||||
couponId: e.currentTarget.dataset.id,
|
||||
let couponId = e.currentTarget.dataset.id;
|
||||
if(_this.data.couponId == couponId){
|
||||
couponId = ''
|
||||
}
|
||||
_this.setData({
|
||||
couponId
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -1,7 +1,8 @@
|
||||
const app = getApp()
|
||||
|
||||
import {
|
||||
meetingRoomDetailRq
|
||||
meetingRoomDetailRq,
|
||||
getCustomerTicketRq
|
||||
} from "../../../../api/meeting/meetingRoom.js"
|
||||
|
||||
import {
|
||||
@ -28,7 +29,11 @@ Page({
|
||||
bannerList: [],
|
||||
room: {},
|
||||
userData: {},
|
||||
couponId : '',
|
||||
couponId: '',
|
||||
couponData : {},
|
||||
couponList: [],
|
||||
couponUseList: [],
|
||||
couponNotUseList: [],
|
||||
},
|
||||
|
||||
/**
|
||||
@ -36,7 +41,7 @@ Page({
|
||||
*/
|
||||
onLoad(options) {
|
||||
console.log('onLoad', options);
|
||||
let selectCountTime = selfFormatTimeHM(options.startTime) + "-" + selfFormatTimeHM(options.endTime) + ' 共计' + twoTimeInterval(options.startTime , options.endTime)
|
||||
let selectCountTime = selfFormatTimeHM(options.startTime) + "-" + selfFormatTimeHM(options.endTime) + ' 共计' + twoTimeInterval(options.startTime, options.endTime)
|
||||
this.setData({
|
||||
...options,
|
||||
userData: wx.getStorageSync('user'),
|
||||
@ -45,6 +50,8 @@ Page({
|
||||
})
|
||||
// 详细信息
|
||||
this.getDetail();
|
||||
// 获取优惠卷
|
||||
this.getCustomerTicket();
|
||||
},
|
||||
|
||||
// 详细信息
|
||||
@ -58,6 +65,39 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
// 获取优惠卷
|
||||
getCustomerTicket() {
|
||||
let _this = this;
|
||||
getCustomerTicketRq({
|
||||
"userId": _this.data.userData.id,
|
||||
"customerId": _this.data.userData.icsCustomerId,
|
||||
"type": '1'
|
||||
}).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)
|
||||
_this.setData({
|
||||
couponList: dataList,
|
||||
couponUseList: useList,
|
||||
couponNotUseList: notUseList,
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 跳转-空间设施
|
||||
jumpMeetingFacilities() {
|
||||
let meetingRoomId = this.data.meetingRoomId;
|
||||
@ -107,8 +147,16 @@ Page({
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow(options) {
|
||||
console.log('onShow' , options);
|
||||
onShow() {
|
||||
console.log('onShow');
|
||||
let _this = this
|
||||
_this.data.couponData
|
||||
if(_this.data.couponId){
|
||||
let couponData = _this.data.couponList.find(item=> item.id == _this.data.couponId)
|
||||
_this.setData({
|
||||
couponData
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -56,7 +56,7 @@
|
||||
<view class="itemView" bind:tap="jumpMeetingCoupon">
|
||||
<view class="label">优惠券</view>
|
||||
<view class="content">
|
||||
<view class="coupon">5张可用</view>
|
||||
<view class="coupon">{{couponId? couponData.ticketName : couponUseList.length + '张可用' + '(共计'+ couponList.length +'张)'}}</view>
|
||||
<van-icon name="arrow" size="44rpx"/>
|
||||
</view>
|
||||
</view>
|
||||
|
Loading…
x
Reference in New Issue
Block a user