Commit 7c4ccaf9 by zqm

MM - 活动预约。取消预约

parent 05f095e5
// pages/hotelAccommodation/hotelAccommodation.js const App = getApp()
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
...@@ -12,6 +11,9 @@ Page({ ...@@ -12,6 +11,9 @@ Page({
mobile: '', mobile: '',
num: '', num: '',
time: '', time: '',
tickerInfo: {},
isDoing: false,
isShowCancel: false
}, },
showHotline() { showHotline() {
...@@ -19,6 +21,65 @@ Page({ ...@@ -19,6 +21,65 @@ Page({
hotline: true hotline: true
}) })
}, },
//取消预约
onCancel: function (event) {
let that = this
if (this.data.isDoing) return
wx.lin.showDialog({
type: "confirm",
title: "",
content: "是否确认取消预约",
success: (res) => {
if (res.confirm) {
console.log('用户点击确定')
wx.showLoading({
title: '处理中',
mask: true
})
this.setData({
isDoing: true
})
App.wxRequest({
url: '/api/v1/subscribe/cancelSubscribe',
data: {
'id': that.data.tickerInfo.id
},
success: (response) => {
wx.hideLoading()
that.setData({
isDoing: false
})
wx.lin.showToast({
image: '/image/success.png',
title: '取消成功',
})
setTimeout(() => {
let type = that.data.type
let tabType = 2
if (type == 0) {
//返回夜间入园预约列表
tabType = 1
} else {
// 返回看房预约
tabType = 2
}
wx.redirectTo({
url: '/pages/mine/appointment/appointment?tab=' + tabType,
})
}, 2000);
}
})
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
//客服热线拨打 //客服热线拨打
call() { call() {
wx.makePhoneCall({ wx.makePhoneCall({
...@@ -39,12 +100,23 @@ Page({ ...@@ -39,12 +100,23 @@ Page({
console.log('.............', options.detail) console.log('.............', options.detail)
let detail = JSON.parse(options.detail); let detail = JSON.parse(options.detail);
console.log(detail); console.log(detail);
let yyDate = detail.subscribeDate ? Date.parse(detail.subscribeDate.replace(/-/, '/')) : 0
let nowStr=new Date().toLocaleString().substr(0,10)+" 00:00:00"
let now = Date.parse(nowStr)
console.log(yyDate, 'yyDateyyDateyyDateyyDateyyDate');
console.log(nowStr, 'nowStr');
console.log(now, 'now');
let isShowCancel = now <= yyDate
this.setData({ this.setData({
tickerInfo: detail,
type: detail.type, type: detail.type,
name: detail.name, name: detail.name,
mobile: detail.mobile, mobile: detail.mobile,
num: detail.num, num: detail.num,
time: detail.time, time: detail.time,
isShowCancel
}) })
}, },
}) })
\ No newline at end of file
...@@ -35,12 +35,16 @@ ...@@ -35,12 +35,16 @@
</view> </view>
<image src="http://sm-web.meiqicloud.com/userfiles/appResources/appointment/night/ornament-1.png" class="thanks"></image> <image src="http://sm-web.meiqicloud.com/userfiles/appResources/appointment/night/ornament-1.png" class="thanks"></image>
</view> </view>
<view class="bottom-btns"> <view class="bottom-btns" wx:if="{{isShowCancel}}">
<view class="custom" bindtap="showHotline">客服咨询</view> <view class="custom margin-right-20" bindtap="onCancel">取消预约</view>
<view class="custom" bindtap="showHotline">客服咨询</view> <view class="custom" bindtap="showHotline">客服咨询</view>
</view> </view>
<view wx:else class="custom" bindtap="showHotline">客服咨询</view>
</view> </view>
</view> </view>
<l-dialog />
<l-toast l-image-class="toast-image"></l-toast>
<!-- 客服热线 --> <!-- 客服热线 -->
<l-arc-popup show="{{hotline}}" arc-radius="30"> <l-arc-popup show="{{hotline}}" arc-radius="30">
......
...@@ -126,4 +126,7 @@ ...@@ -126,4 +126,7 @@
.bottom-btns { .bottom-btns {
display: flex; display: flex;
}
.margin-right-20{
margin-right: 20rpx;
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment