Commit 042c931f4695ca6734440cb0382b80d8d9c1ae87

Authored by vking
1 parent 757648c7

cancel reserve

... ... @@ -33,7 +33,8 @@
"pages/reserve/submit",
"pages/me/history",
"pages/reserve/remark",
"pages/reserve/findSeller"
"pages/reserve/findSeller",
"pages/customer/cancel"
],
"subpackages": [
{
... ...
// pages/customer/cancel.js
import util from '../../utils/util';
import App from '../../utils/api';
import PubSub from '../../utils/PubSub'
const reasons=[
'不想去了',
'预订信息有误,重新预订',
'已通过其他方式预订',
'商家处理太慢,等不及了',
'其他',
]
Page({
/**
* 页面的初始数据
*/
data: {
reasons:reasons,
radioIndex:-1,
inputFouce:false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.options=options
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
keyboardheight:0,
keyboardheightchange(e){
console.log(e);
if(e.detail.height==0 || e.detail.height>this.keyboardheight){
this.keyboardheight=e.detail.height
}
this.setData({
//paddingBottom:e.detail.height?(parseInt(e.detail.height)+100):0
paddingBottom:this.keyboardheight>0?(parseInt(this.keyboardheight)+20):0
})
setTimeout(()=>{
this.pageScrollToBottom()
},0)
},
pageScrollToBottom: function () {
wx.createSelectorQuery().select('.pages').boundingClientRect(function (rect) {
// 使页面滚动到底部
wx.pageScrollTo({
scrollTop: rect.bottom
})
}).exec()
},
hideKeyboard(){
this.setData({
paddingBottom:0
})
},
cancelSubmit(){
let desc=''
if(this.radioIndex==reasons.length-1){
desc=this.desc
}else{
desc=reasons[this.radioIndex]
}
if(!desc){
return util.toast('请选择取消原因','none')
}
App.Reserve.Detail({
openid: getApp().openid,
rid: this.options.id
},'clear')
App.Customer.SetReserveStatusByUser({
rid:this.options.id,
desc:desc,
}).then(res=>{
if(res.ret!=200){
return util.toast(res.msg,'none')
}
PubSub.emit('detailPub',{type:'cancel'})
wx.navigateBack()
})
},
radioIndex:-1,
radioChange(e){
this.radioIndex=e.detail.value
if(this.radioIndex==reasons.length-1){
if(!this.data.inputFouce){
this.setData({
inputFouce:true,
})
}
}else{
if(this.data.inputFouce){
this.setData({
inputFouce:false,
})
}
}
},
textareaFocus(e){
if(this.radioIndex!=reasons.length-1){
this.radioIndex=reasons.length-1
this.setData({
radioIndex:this.radioIndex,
})
}
},
desc:'',
textareaInput(e){
this.desc=e.detail.value
}
})
\ No newline at end of file
... ...
{
"usingComponents": {
"nav":"/components/nav/nav"
}
}
\ No newline at end of file
... ...
<!--pages/customer/cancel.wxml-->
<nav hasHome>取消订座</nav>
<view class="pages" style="padding-bottom: {{paddingBottom}}px;">
<view class="tips">
请告知取消原因以便为您提供更好的服务
</view>
<view class="reasons-title">取消原因(必选)</view>
<radio-group class="radio-group reasons-group" bindchange="radioChange">
<radio class="radio reasons-radio"
color="#C0A369"
wx:for="{{reasons}}" wx:key="reasons" value="{{index}}" checked="{{index==radioIndex}}">
<text class="reasons-radio-text">{{item}}</text>
</radio>
</radio-group>
<textarea class="cancel-input" placeholder="请输入其他原因(不超过30字)"
bindinput="cancelInput" focus="{{inputFouce}}"
data-key="name"
value="{{user.name}}"
bindconfirm="hideKeyboard"
bindblur="hideKeyboard"
bindkeyboardheightchange="keyboardheightchange"
adjust-position="{{false}}" bindfocus="textareaFocus"
bindinput="textareaInput"
placeholder-class="input-pl" maxlength="30"></textarea>
<view class="cancel-button"
bindtap="cancelSubmit"
style="{{paddingBottom>0?'margin-top: 40rpx;':''}}">申请取消</view>
</view>
... ...
/* pages/customer/cancel.wxss */
.pages{
width: calc(100% - 80rpx);
padding-left: 40rpx;
font-size:28rpx;
color:rgba(153,153,153,1);
}
.cancel-button{
height:80rpx;
background:rgba(36,35,32,1);
line-height: 80rpx;
width: 100%;
text-align: center;
font-size:34rpx;
font-weight:400;
color:rgba(254,254,254,1);
margin: 182rpx auto 0;
}
.cancel-input{
border: 2rpx solid #F5F5F5;
height: 120rpx;
width: calc(100% - 100rpx);
margin-left: 90rpx;
box-sizing: border-box;
padding: 8rpx 24rpx;
}
.tips{
height:50rpx;
font-size:36rpx;
font-weight:500;
color:rgba(53,53,53,1);
line-height:50rpx;
margin-top: 80rpx;
}
.reasons-title{
height:40rpx;
font-size:28rpx;
font-weight:500;
color:rgba(153,153,153,1);
line-height:40rpx;
margin-top: 80rpx;
}
.reasons-group{
margin-top: 28rpx;
font-size: 26rpx;
}
.reasons-radio{
height: 100rpx;
line-height: 100rpx;
font-size:30rpx;
font-weight:500;
color:rgba(53,53,53,1);
width: 100%;
border-top: 2rpx solid #F5F5F5;
box-sizing: border-box;
}
.reasons-radio-text{
padding-left: 20rpx;
}
... ...
... ... @@ -2,7 +2,7 @@
import util from '../../utils/util';
import App from '../../utils/api';
import RS from '../../utils/reserveStatus';
import PubSub from '../../utils/PubSub'
const {regeneratorRuntime} = global
import TP from '../../utils/tpls';
... ... @@ -16,6 +16,7 @@ Page({
hasOnlineReserve: false,
firstShowMsg:'',
rsl:[],//推荐商家
hasCancel:false, //取消预定效果
},
id: null,
tpls: TP.tpls(),
... ... @@ -31,6 +32,26 @@ Page({
this.setData({
firstShowMsg:options.firstShowMsg,
})
PubSub.on('detailPub',(res)=>{
console.log(res)
if(res.type=='cancel'){
this.setData({
hasCancel:true,
})
setTimeout(()=>{
wx.pageScrollTo({
scrollTop:0,
success:()=>{
setTimeout(()=>{
this.setData({
hasCancel:false,
})
},3000)
},
})
}, 800)
}
})
},
/**
... ... @@ -58,7 +79,7 @@ Page({
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
PubSub.off('detailPub')
},
/**
... ...
<!--pages/customer/detail_owner.wxml-->
<nav hasHome>订座详情</nav>
<view class="page">
<view class="flex-vc success">
<view class="flex-vc success" wx:if="{{hasCancel}}">
<view class="icon">
<icon type="waiting" size="47" color="#C8B16D"/>
</view>
<view class="title Medium">申请已提交,待商家处理</view>
<view class="info">
请留意周到安排公众号通知
</view>
</view>
<view class="flex-vc success" wx:else="">
<block wx:if="{{detail.hasRunning}}">
<view class="icon">
<icon type="success" size="47" color="#C8B16D"/>
... ... @@ -43,6 +52,13 @@
</block>
</block>
</view>
<navigator url="/pages/reserve/detail?id={{detail.sid}}&activeTab=reserve"
wx:if="{{detail.hasCancel}}"
hover-class="navigator-hover">
<view class="flex-lr share-view subscribe" style="margin-top: 60rpx;">
<view class="share-but">再次预订</view>
</view>
</navigator>
<block wx:if="{{detail.hasRunning}}">
<view class="flex-lr share-view" wx:if="{{detail.type==1}}">
<formids url="/pages/customer/detail_owner_invitation?id={{detail.id}}&hasInvitation=1&hasSellerShare=1&tplid=1"
... ... @@ -125,7 +141,11 @@
<view class="detail-info Medium tuiding">
<view class="flex-rr">
<view class="item" bindtap="callSeller">联系商家</view>
<view class="item" bindtap="callSeller" wx:if="{{detail.hasRunning || detail.status==0}}">取消预订</view>
<navigator url="./cancel?id={{detail.id}}"
wx:if="{{detail.hasRunning || detail.status==0}}"
hover-class="navigator-hover">
<view class="item" >取消预订</view>
</navigator>
</view>
</view>
<block wx:if="{{rsl.length>0}}">
... ...
... ... @@ -481,7 +481,7 @@
"id": 57,
"name": "pages/customer/detail_owner",
"pathName": "pages/customer/detail_owner",
"query": "id=56282&firstShowMsg=",
"query": "id=58241&firstShowMsg=",
"scene": null
},
{
... ... @@ -588,6 +588,13 @@
"pathName": "pages/reserve/detail",
"query": "id=1001&activeTab=reserve&date=2020-02-16&pnum=6",
"scene": null
},
{
"id": -1,
"name": "pages/customer/cancel",
"pathName": "pages/customer/cancel",
"query": "id=58241",
"scene": null
}
]
}
... ...
... ... @@ -424,4 +424,8 @@ export default {
'App.Reserve.GetSellerUserDetail':{
openid:'openid',
},
//C端用户取消预订操作
'App.Customer.SetReserveStatusByUser':{
openid:'openid',
},
}
\ No newline at end of file
... ...