Commit 042c931f4695ca6734440cb0382b80d8d9c1ae87

Authored by vking
1 parent 757648c7

cancel reserve

@@ -33,7 +33,8 @@ @@ -33,7 +33,8 @@
33 "pages/reserve/submit", 33 "pages/reserve/submit",
34 "pages/me/history", 34 "pages/me/history",
35 "pages/reserve/remark", 35 "pages/reserve/remark",
36 - "pages/reserve/findSeller" 36 + "pages/reserve/findSeller",
  37 + "pages/customer/cancel"
37 ], 38 ],
38 "subpackages": [ 39 "subpackages": [
39 { 40 {
  1 +// pages/customer/cancel.js
  2 +import util from '../../utils/util';
  3 +import App from '../../utils/api';
  4 +import PubSub from '../../utils/PubSub'
  5 +const reasons=[
  6 + '不想去了',
  7 + '预订信息有误,重新预订',
  8 + '已通过其他方式预订',
  9 + '商家处理太慢,等不及了',
  10 + '其他',
  11 +]
  12 +Page({
  13 +
  14 + /**
  15 + * 页面的初始数据
  16 + */
  17 + data: {
  18 + reasons:reasons,
  19 + radioIndex:-1,
  20 + inputFouce:false,
  21 + },
  22 +
  23 + /**
  24 + * 生命周期函数--监听页面加载
  25 + */
  26 + onLoad: function (options) {
  27 + this.options=options
  28 + },
  29 +
  30 + /**
  31 + * 生命周期函数--监听页面初次渲染完成
  32 + */
  33 + onReady: function () {
  34 +
  35 + },
  36 +
  37 + /**
  38 + * 生命周期函数--监听页面显示
  39 + */
  40 + onShow: function () {
  41 +
  42 + },
  43 +
  44 + /**
  45 + * 生命周期函数--监听页面隐藏
  46 + */
  47 + onHide: function () {
  48 +
  49 + },
  50 +
  51 + /**
  52 + * 生命周期函数--监听页面卸载
  53 + */
  54 + onUnload: function () {
  55 +
  56 + },
  57 +
  58 + /**
  59 + * 页面相关事件处理函数--监听用户下拉动作
  60 + */
  61 + onPullDownRefresh: function () {
  62 +
  63 + },
  64 +
  65 + /**
  66 + * 页面上拉触底事件的处理函数
  67 + */
  68 + onReachBottom: function () {
  69 +
  70 + },
  71 + keyboardheight:0,
  72 + keyboardheightchange(e){
  73 + console.log(e);
  74 + if(e.detail.height==0 || e.detail.height>this.keyboardheight){
  75 + this.keyboardheight=e.detail.height
  76 + }
  77 + this.setData({
  78 + //paddingBottom:e.detail.height?(parseInt(e.detail.height)+100):0
  79 + paddingBottom:this.keyboardheight>0?(parseInt(this.keyboardheight)+20):0
  80 + })
  81 + setTimeout(()=>{
  82 + this.pageScrollToBottom()
  83 + },0)
  84 + },
  85 + pageScrollToBottom: function () {
  86 + wx.createSelectorQuery().select('.pages').boundingClientRect(function (rect) {
  87 + // 使页面滚动到底部
  88 + wx.pageScrollTo({
  89 + scrollTop: rect.bottom
  90 + })
  91 + }).exec()
  92 + },
  93 + hideKeyboard(){
  94 + this.setData({
  95 + paddingBottom:0
  96 + })
  97 + },
  98 + cancelSubmit(){
  99 + let desc=''
  100 + if(this.radioIndex==reasons.length-1){
  101 + desc=this.desc
  102 + }else{
  103 + desc=reasons[this.radioIndex]
  104 + }
  105 + if(!desc){
  106 + return util.toast('请选择取消原因','none')
  107 + }
  108 + App.Reserve.Detail({
  109 + openid: getApp().openid,
  110 + rid: this.options.id
  111 + },'clear')
  112 + App.Customer.SetReserveStatusByUser({
  113 + rid:this.options.id,
  114 + desc:desc,
  115 + }).then(res=>{
  116 + if(res.ret!=200){
  117 + return util.toast(res.msg,'none')
  118 + }
  119 + PubSub.emit('detailPub',{type:'cancel'})
  120 + wx.navigateBack()
  121 + })
  122 + },
  123 + radioIndex:-1,
  124 + radioChange(e){
  125 + this.radioIndex=e.detail.value
  126 + if(this.radioIndex==reasons.length-1){
  127 + if(!this.data.inputFouce){
  128 + this.setData({
  129 + inputFouce:true,
  130 + })
  131 + }
  132 + }else{
  133 + if(this.data.inputFouce){
  134 + this.setData({
  135 + inputFouce:false,
  136 + })
  137 + }
  138 + }
  139 + },
  140 + textareaFocus(e){
  141 + if(this.radioIndex!=reasons.length-1){
  142 + this.radioIndex=reasons.length-1
  143 + this.setData({
  144 + radioIndex:this.radioIndex,
  145 + })
  146 + }
  147 + },
  148 + desc:'',
  149 + textareaInput(e){
  150 + this.desc=e.detail.value
  151 + }
  152 +})
  1 +{
  2 + "usingComponents": {
  3 + "nav":"/components/nav/nav"
  4 + }
  5 +}
  1 +<!--pages/customer/cancel.wxml-->
  2 +<nav hasHome>取消订座</nav>
  3 +<view class="pages" style="padding-bottom: {{paddingBottom}}px;">
  4 + <view class="tips">
  5 + 请告知取消原因以便为您提供更好的服务
  6 + </view>
  7 + <view class="reasons-title">取消原因(必选)</view>
  8 + <radio-group class="radio-group reasons-group" bindchange="radioChange">
  9 + <radio class="radio reasons-radio"
  10 + color="#C0A369"
  11 + wx:for="{{reasons}}" wx:key="reasons" value="{{index}}" checked="{{index==radioIndex}}">
  12 + <text class="reasons-radio-text">{{item}}</text>
  13 + </radio>
  14 + </radio-group>
  15 + <textarea class="cancel-input" placeholder="请输入其他原因(不超过30字)"
  16 + bindinput="cancelInput" focus="{{inputFouce}}"
  17 + data-key="name"
  18 + value="{{user.name}}"
  19 + bindconfirm="hideKeyboard"
  20 + bindblur="hideKeyboard"
  21 + bindkeyboardheightchange="keyboardheightchange"
  22 + adjust-position="{{false}}" bindfocus="textareaFocus"
  23 + bindinput="textareaInput"
  24 + placeholder-class="input-pl" maxlength="30"></textarea>
  25 + <view class="cancel-button"
  26 + bindtap="cancelSubmit"
  27 + style="{{paddingBottom>0?'margin-top: 40rpx;':''}}">申请取消</view>
  28 +</view>
  1 +/* pages/customer/cancel.wxss */
  2 +.pages{
  3 + width: calc(100% - 80rpx);
  4 + padding-left: 40rpx;
  5 + font-size:28rpx;
  6 + color:rgba(153,153,153,1);
  7 +}
  8 +.cancel-button{
  9 + height:80rpx;
  10 + background:rgba(36,35,32,1);
  11 + line-height: 80rpx;
  12 + width: 100%;
  13 + text-align: center;
  14 + font-size:34rpx;
  15 + font-weight:400;
  16 + color:rgba(254,254,254,1);
  17 + margin: 182rpx auto 0;
  18 +}
  19 +.cancel-input{
  20 + border: 2rpx solid #F5F5F5;
  21 + height: 120rpx;
  22 + width: calc(100% - 100rpx);
  23 + margin-left: 90rpx;
  24 + box-sizing: border-box;
  25 + padding: 8rpx 24rpx;
  26 +}
  27 +.tips{
  28 + height:50rpx;
  29 + font-size:36rpx;
  30 + font-weight:500;
  31 + color:rgba(53,53,53,1);
  32 + line-height:50rpx;
  33 + margin-top: 80rpx;
  34 +}
  35 +.reasons-title{
  36 + height:40rpx;
  37 + font-size:28rpx;
  38 + font-weight:500;
  39 + color:rgba(153,153,153,1);
  40 + line-height:40rpx;
  41 + margin-top: 80rpx;
  42 +}
  43 +.reasons-group{
  44 + margin-top: 28rpx;
  45 + font-size: 26rpx;
  46 +}
  47 +.reasons-radio{
  48 + height: 100rpx;
  49 + line-height: 100rpx;
  50 + font-size:30rpx;
  51 + font-weight:500;
  52 + color:rgba(53,53,53,1);
  53 + width: 100%;
  54 + border-top: 2rpx solid #F5F5F5;
  55 + box-sizing: border-box;
  56 +}
  57 +.reasons-radio-text{
  58 + padding-left: 20rpx;
  59 +}
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 import util from '../../utils/util'; 2 import util from '../../utils/util';
3 import App from '../../utils/api'; 3 import App from '../../utils/api';
4 import RS from '../../utils/reserveStatus'; 4 import RS from '../../utils/reserveStatus';
5 - 5 +import PubSub from '../../utils/PubSub'
6 const {regeneratorRuntime} = global 6 const {regeneratorRuntime} = global
7 import TP from '../../utils/tpls'; 7 import TP from '../../utils/tpls';
8 8
@@ -16,6 +16,7 @@ Page({ @@ -16,6 +16,7 @@ Page({
16 hasOnlineReserve: false, 16 hasOnlineReserve: false,
17 firstShowMsg:'', 17 firstShowMsg:'',
18 rsl:[],//推荐商家 18 rsl:[],//推荐商家
  19 + hasCancel:false, //取消预定效果
19 }, 20 },
20 id: null, 21 id: null,
21 tpls: TP.tpls(), 22 tpls: TP.tpls(),
@@ -31,6 +32,26 @@ Page({ @@ -31,6 +32,26 @@ Page({
31 this.setData({ 32 this.setData({
32 firstShowMsg:options.firstShowMsg, 33 firstShowMsg:options.firstShowMsg,
33 }) 34 })
  35 + PubSub.on('detailPub',(res)=>{
  36 + console.log(res)
  37 + if(res.type=='cancel'){
  38 + this.setData({
  39 + hasCancel:true,
  40 + })
  41 + setTimeout(()=>{
  42 + wx.pageScrollTo({
  43 + scrollTop:0,
  44 + success:()=>{
  45 + setTimeout(()=>{
  46 + this.setData({
  47 + hasCancel:false,
  48 + })
  49 + },3000)
  50 + },
  51 + })
  52 + }, 800)
  53 + }
  54 + })
34 }, 55 },
35 56
36 /** 57 /**
@@ -58,7 +79,7 @@ Page({ @@ -58,7 +79,7 @@ Page({
58 * 生命周期函数--监听页面卸载 79 * 生命周期函数--监听页面卸载
59 */ 80 */
60 onUnload: function () { 81 onUnload: function () {
61 - 82 + PubSub.off('detailPub')
62 }, 83 },
63 84
64 /** 85 /**
1 <!--pages/customer/detail_owner.wxml--> 1 <!--pages/customer/detail_owner.wxml-->
2 <nav hasHome>订座详情</nav> 2 <nav hasHome>订座详情</nav>
3 <view class="page"> 3 <view class="page">
4 - <view class="flex-vc success"> 4 + <view class="flex-vc success" wx:if="{{hasCancel}}">
  5 + <view class="icon">
  6 + <icon type="waiting" size="47" color="#C8B16D"/>
  7 + </view>
  8 + <view class="title Medium">申请已提交,待商家处理</view>
  9 + <view class="info">
  10 + 请留意周到安排公众号通知
  11 + </view>
  12 + </view>
  13 + <view class="flex-vc success" wx:else="">
5 <block wx:if="{{detail.hasRunning}}"> 14 <block wx:if="{{detail.hasRunning}}">
6 <view class="icon"> 15 <view class="icon">
7 <icon type="success" size="47" color="#C8B16D"/> 16 <icon type="success" size="47" color="#C8B16D"/>
@@ -43,6 +52,13 @@ @@ -43,6 +52,13 @@
43 </block> 52 </block>
44 </block> 53 </block>
45 </view> 54 </view>
  55 + <navigator url="/pages/reserve/detail?id={{detail.sid}}&activeTab=reserve"
  56 + wx:if="{{detail.hasCancel}}"
  57 + hover-class="navigator-hover">
  58 + <view class="flex-lr share-view subscribe" style="margin-top: 60rpx;">
  59 + <view class="share-but">再次预订</view>
  60 + </view>
  61 + </navigator>
46 <block wx:if="{{detail.hasRunning}}"> 62 <block wx:if="{{detail.hasRunning}}">
47 <view class="flex-lr share-view" wx:if="{{detail.type==1}}"> 63 <view class="flex-lr share-view" wx:if="{{detail.type==1}}">
48 <formids url="/pages/customer/detail_owner_invitation?id={{detail.id}}&hasInvitation=1&hasSellerShare=1&tplid=1" 64 <formids url="/pages/customer/detail_owner_invitation?id={{detail.id}}&hasInvitation=1&hasSellerShare=1&tplid=1"
@@ -125,7 +141,11 @@ @@ -125,7 +141,11 @@
125 <view class="detail-info Medium tuiding"> 141 <view class="detail-info Medium tuiding">
126 <view class="flex-rr"> 142 <view class="flex-rr">
127 <view class="item" bindtap="callSeller">联系商家</view> 143 <view class="item" bindtap="callSeller">联系商家</view>
128 - <view class="item" bindtap="callSeller" wx:if="{{detail.hasRunning || detail.status==0}}">取消预订</view> 144 + <navigator url="./cancel?id={{detail.id}}"
  145 + wx:if="{{detail.hasRunning || detail.status==0}}"
  146 + hover-class="navigator-hover">
  147 + <view class="item" >取消预订</view>
  148 + </navigator>
129 </view> 149 </view>
130 </view> 150 </view>
131 <block wx:if="{{rsl.length>0}}"> 151 <block wx:if="{{rsl.length>0}}">
@@ -481,7 +481,7 @@ @@ -481,7 +481,7 @@
481 "id": 57, 481 "id": 57,
482 "name": "pages/customer/detail_owner", 482 "name": "pages/customer/detail_owner",
483 "pathName": "pages/customer/detail_owner", 483 "pathName": "pages/customer/detail_owner",
484 - "query": "id=56282&firstShowMsg=", 484 + "query": "id=58241&firstShowMsg=",
485 "scene": null 485 "scene": null
486 }, 486 },
487 { 487 {
@@ -588,6 +588,13 @@ @@ -588,6 +588,13 @@
588 "pathName": "pages/reserve/detail", 588 "pathName": "pages/reserve/detail",
589 "query": "id=1001&activeTab=reserve&date=2020-02-16&pnum=6", 589 "query": "id=1001&activeTab=reserve&date=2020-02-16&pnum=6",
590 "scene": null 590 "scene": null
  591 + },
  592 + {
  593 + "id": -1,
  594 + "name": "pages/customer/cancel",
  595 + "pathName": "pages/customer/cancel",
  596 + "query": "id=58241",
  597 + "scene": null
591 } 598 }
592 ] 599 ]
593 } 600 }
@@ -424,4 +424,8 @@ export default { @@ -424,4 +424,8 @@ export default {
424 'App.Reserve.GetSellerUserDetail':{ 424 'App.Reserve.GetSellerUserDetail':{
425 openid:'openid', 425 openid:'openid',
426 }, 426 },
  427 + //C端用户取消预订操作
  428 + 'App.Customer.SetReserveStatusByUser':{
  429 + openid:'openid',
  430 + },
427 } 431 }