Commit 56176c9dd6ed3a33e74e57fc393c58289ad97140

Authored by wangfan
1 parent 408d266c

取消预定

@@ -239,4 +239,13 @@ image{ @@ -239,4 +239,13 @@ image{
239 height: 22rpx; 239 height: 22rpx;
240 background-image: url("http://qn.colorcun.com/custom/lite-yd/image/click.png"); 240 background-image: url("http://qn.colorcun.com/custom/lite-yd/image/click.png");
241 background-size: 100%; 241 background-size: 100%;
  242 +}
  243 +.mask{
  244 + background-color: rgba(20,20,20,0.5);
  245 + position: fixed;
  246 + top:0;
  247 + right: 0;
  248 + bottom: 0;
  249 + left: 0;
  250 + z-index: 9999;
242 } 251 }
  1 +// components/book/reserveCancel/cancel.js
  2 +import util from '../../../utils/util';
  3 +import App from '../../../utils/api';
  4 +const {regeneratorRuntime} = global
  5 +const items=[{name:'顾客取消'},{name:'顾客行程有变'},{name:'信息填写有误'},{name:'操作失误'},{name:'其他原因'}];
  6 +
  7 +Component({
  8 + /**
  9 + * 组件的属性列表
  10 + */
  11 + properties: {
  12 + bookInfo:{
  13 + type:Object,
  14 + value:{},
  15 + }
  16 + },
  17 +
  18 + /**
  19 + * 组件的初始数据
  20 + */
  21 + data: {
  22 + hidden: true,
  23 + otherInputHidden:true,
  24 + items:JSON.parse(JSON.stringify(items)),
  25 + _cause:'',
  26 + cause:'',
  27 + },
  28 + /**
  29 + * 组件的方法列表
  30 + */
  31 + methods: {
  32 + show(){
  33 + this.setData({
  34 + hidden:false,
  35 + })
  36 + },
  37 + hide(){
  38 + this.setData({
  39 + hidden:true,
  40 + })
  41 + },
  42 + radioChange(e){
  43 + let val=util.val(e);
  44 + if(val=='其他原因'){
  45 + this.setData({
  46 + otherInputHidden:false,
  47 + _cause:val
  48 + })
  49 + }else{
  50 + this.setData({
  51 + otherInputHidden:true,
  52 + _cause:val
  53 + })
  54 + }
  55 + },
  56 + otherInput(e){
  57 + let val=util.val(e);
  58 + this.setData({
  59 + cause:val
  60 + })
  61 + },
  62 + async submit(e){
  63 + console.log(e,);
  64 + let cause=this.data._cause;
  65 + if(cause=='其他原因'){
  66 + cause=this.data.cause;
  67 + }
  68 + cause=cause.trim();
  69 + if(!cause){
  70 + return util.toast('请选择原因','none')
  71 + }
  72 +
  73 + let enter_params=util.cache('enter_params');
  74 + let sc=(await App.Reserve.SellerInfo(enter_params)).data
  75 + if(sc.seller_user){
  76 + cause=cause+'|'+(sc.seller_user.nick_name||sc.seller_user.nickname)
  77 + }
  78 + App.Reserve.SetReserveStatus({
  79 + rid:this.data.bookInfo.id,
  80 + status:4,
  81 + cause:cause,
  82 + }).then(()=>{
  83 + this.hide()
  84 + this.triggerEvent('reserveCancel',{hasCancel:true});
  85 + //this.getDetail(this.data.bookInfo.id,true);
  86 + })
  87 + }
  88 + }
  89 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {
  4 + "formids":"../../formids/formids"
  5 + }
  6 +}
  1 +<!--components/book/reserveCancel/cancel.wxml-->
  2 +<view class="mask flex-vc" hidden="{{hidden}}" bindtap="hide">
  3 + <view class="cancel" catchtap="catchtap">
  4 + <view class="flex-rr">
  5 + <view class="close" bindtap="hide">
  6 + <image src="http://qn.colorcun.com/custom/lite-yd/image/close.png"></image>
  7 + </view>
  8 + </view>
  9 + <view class="title Semibold flex-vc">请选择取消原因</view>
  10 + <radio-group class="radio-group flex-vl" bindchange="radioChange">
  11 + <label class="radio" wx:for="{{items}}" wx:key="items.key">
  12 + <radio value="{{item.name}}" checked="{{item.checked}}" />
  13 + {{item.name}}
  14 + </label>
  15 + </radio-group>
  16 + <view class="flex-rr other-view">
  17 + <input class="other" bindinput="otherInput" placeholder="请填写原因" hidden="{{otherInputHidden}}"/>
  18 + </view>
  19 + <formids class="flex-vc" bindclick="submit">
  20 + <view class="button">确认</view>
  21 + </formids>
  22 + </view>
  23 +</view>
  1 +/* components/book/reserveCancel/cancel.wxss */
  2 +@import "../../../app.wxss";
  3 +.cancel{
  4 + width: 90%;
  5 + background-color: #fefefe;
  6 + border-radius: 10rpx;
  7 + font-size: 32rpx;
  8 + padding-bottom: 52rpx;
  9 +}
  10 +.cancel image{
  11 + width: 100%;
  12 + height: 100%;
  13 +}
  14 +.close{
  15 + width: 32rpx;
  16 + height: 32rpx;
  17 + margin-top: 12rpx;
  18 + margin-right: 12rpx;
  19 +}
  20 +.title{
  21 + font-size: 34rpx;
  22 +}
  23 +.button{
  24 + width: 300rpx;
  25 + height: 80rpx;
  26 + line-height: 80rpx;
  27 + border-radius: 4rpx;
  28 + background-color: #199095;
  29 + font-size: 34rpx;
  30 + color: #fefefe;
  31 +}
  32 +.radio-group{
  33 + margin: 44rpx 5% 0rpx;
  34 +}
  35 +.radio{
  36 + margin-bottom: 40rpx;
  37 + height: 40rpx;
  38 + line-height: 40rpx;
  39 +}
  40 +.radio:last-child{
  41 + margin-bottom: 0;
  42 +}
  43 +.radio radio{
  44 + margin-right: 30rpx;
  45 +}
  46 +.other-view{
  47 + height: 110rpx;
  48 + line-height: 110rpx;
  49 +}
  50 +.other{
  51 + border-bottom: 2rpx solid #E0E0E0;
  52 + width: 75%;
  53 + margin-right: 40rpx;
  54 +}
@@ -148,30 +148,12 @@ Page({ @@ -148,30 +148,12 @@ Page({
148 url:'./b_addnew?id='+this.data.bookInfo.id 148 url:'./b_addnew?id='+this.data.bookInfo.id
149 }) 149 })
150 }, 150 },
151 - async cancelReserve(){  
152 - let enter_params=util.cache('enter_params');  
153 - let sc=(await App.Reserve.SellerInfo(enter_params)).data  
154 - let cause='';  
155 - if(sc.seller_user){  
156 - cause=(sc.seller_user.nick_name||sc.seller_user.nickname)+'手动取消'  
157 - }  
158 - wx.showModal({  
159 - title: '确认取消',  
160 - content: '你确认要取消预订吗',  
161 - success:(res)=>{  
162 - if (res.confirm) {  
163 - App.Reserve.SetReserveStatus({  
164 - rid:this.data.bookInfo.id,  
165 - status:4,  
166 - cause:cause,  
167 - }).then(()=>{  
168 - this.getDetail(this.data.bookInfo.id,true);  
169 - })  
170 - } else if (res.cancel) {  
171 - console.log('用户点击取消')  
172 - }  
173 - }  
174 - }) 151 + cancelReserve(){
  152 + this.selectComponent('#cancel').show();
  153 + },
  154 + reserveCancel(e){
  155 + console.log('reserveCancel',e.detail);
  156 + this.getDetail(this.data.bookInfo.id,true);
175 }, 157 },
176 actionSheetChange(e){ 158 actionSheetChange(e){
177 this.setData({ 159 this.setData({
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 "noticeCall":"/components/book/notice/notice", 6 "noticeCall":"/components/book/notice/notice",
7 "step":"/components/book/step/step", 7 "step":"/components/book/step/step",
8 "board":"/components/book/board/board", 8 "board":"/components/book/board/board",
  9 + "cancel":"/components/book/reserveCancel/cancel",
9 "nav":"/components/nav/nav" 10 "nav":"/components/nav/nav"
10 } 11 }
11 } 12 }
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 <view class="gray-deep-font font30r">用餐人数</view> 9 <view class="gray-deep-font font30r">用餐人数</view>
10 <view class="black-font font34r">{{bookInfo.pnum_str||bookInfo.pnum}}人</view> 10 <view class="black-font font34r">{{bookInfo.pnum_str||bookInfo.pnum}}人</view>
11 </view> 11 </view>
12 - <view class="reserve-status-tip"> 12 + <view class="reserve-status-tip" wx:if="{{bookInfo.status!=null}}">
13 <image src="http://qn.colorcun.com/custom/lite-yd/image/reserve-status-{{bookInfo.status}}.png"></image> 13 <image src="http://qn.colorcun.com/custom/lite-yd/image/reserve-status-{{bookInfo.status}}.png"></image>
14 </view> 14 </view>
15 <view class="flex-lr order-detail"> 15 <view class="flex-lr order-detail">
@@ -83,4 +83,5 @@ @@ -83,4 +83,5 @@
83 </action-sheet-item> 83 </action-sheet-item>
84 <action-sheet-cancel >取消</action-sheet-cancel> 84 <action-sheet-cancel >取消</action-sheet-cancel>
85 85
86 -</action-sheet>  
  86 +</action-sheet>
  87 +<cancel id="cancel" bindreserveCancel="reserveCancel" bookInfo="{{bookInfo}}"></cancel>
@@ -155,7 +155,8 @@ @@ -155,7 +155,8 @@
155 "id": 15, 155 "id": 15,
156 "name": "预定本详情", 156 "name": "预定本详情",
157 "pathName": "pages/book/b_detail", 157 "pathName": "pages/book/b_detail",
158 - "query": "id=1429" 158 + "query": "id=1464",
  159 + "scene": "1001"
159 }, 160 },
160 { 161 {
161 "id": -1, 162 "id": -1,