Commit f5e1fc596b5ff84103e8f726b27940e48f93c9f6

Authored by wangfan
1 parent 54d93d34

录入调整

@@ -17,7 +17,8 @@ @@ -17,7 +17,8 @@
17 "pages/me/setting", 17 "pages/me/setting",
18 "pages/me/list", 18 "pages/me/list",
19 "pages/book/b_addnew", 19 "pages/book/b_addnew",
20 - "pages/book/b_sms" 20 + "pages/book/b_sms",
  21 + "pages/book/b_setting"
21 ], 22 ],
22 "window": { 23 "window": {
23 "navigationStyle": "custom", 24 "navigationStyle": "custom",
  1 +// components/book/board/board.js
  2 +Component({
  3 + /**
  4 + * 组件的属性列表
  5 + */
  6 + properties: {
  7 + width:{
  8 + type:String,
  9 + value:160
  10 + },
  11 + height:{
  12 + type:String,
  13 + value:160
  14 + },
  15 + board:{
  16 + type:Object,
  17 + value:{}
  18 + }
  19 + },
  20 +
  21 + /**
  22 + * 组件的初始数据
  23 + */
  24 + data: {
  25 +
  26 + },
  27 +
  28 + /**
  29 + * 组件的方法列表
  30 + */
  31 + methods: {
  32 +
  33 + }
  34 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<!--components/book/board/board.wxml-->
  2 +<view class="board flex-cc {{board.status_classname}}" style="width: {{width}}rpx;height: {{height}}rpx;">
  3 + <view class="info">
  4 + <view class="name">{{board.name}}</view>
  5 + <view class="pnum">{{board.table_pnum}}人</view>
  6 + </view>
  7 + <view class="tid" wx:if="{{board.tid==2}}">包间</view>
  8 + <view class="status" wx:if="{{board.status_str}}" style="width: {{width}}rpx;">{{board.status_str}}</view>
  9 +</view>
  1 +/* components/book/board/board.wxss */
  2 +@import "../../../app.wxss";
  3 +.board{
  4 + background-color: #A9E3E6;
  5 + border-radius: 10rpx;
  6 + position: relative;
  7 + overflow: hidden;
  8 +}
  9 +.board .tid{
  10 + width: 72rpx;
  11 + height: 30rpx;
  12 + line-height: 30rpx;
  13 + font-size: 26rpx;
  14 + border-radius: 10rpx 16rpx 16rpx 0;
  15 + background-color: #61A5D1;
  16 + position: absolute;
  17 + top:0;
  18 + left: 0;
  19 + text-align: center;
  20 + color: #FEFEFE;
  21 +}
  22 +.board .status{
  23 + position: absolute;
  24 + bottom:0;
  25 + left: 0;
  26 + height: 36rpx;
  27 + text-align: center;
  28 + line-height: 36rpx;
  29 + font-size: 26rpx;
  30 + font-weight: bold;
  31 + background-color: #777777;
  32 + color: #FEFEFE;
  33 + border-radius: 0 0 10rpx 10rpx;
  34 +}
  35 +.board .info{
  36 + text-align: center;
  37 + width: 80%;
  38 + margin: 0 10%;
  39 + color: #353535;
  40 +}
  41 +.board .name{
  42 + font-size: 28rpx;
  43 + max-height: 60rpx;
  44 + overflow: hidden;
  45 + line-height: 28rpx;
  46 +}
  47 +.board .pnum{
  48 + font-size: 26rpx;
  49 +}
  50 +
  51 +.board.highlight .status{
  52 + background-color: #E95750;
  53 +}
  54 +
  55 +.board.disabled {
  56 + background-color: #E0E0E0;
  57 +}
  58 +.board.disabled .tid{
  59 + background-color: #94BCD6;
  60 +}
@@ -11,6 +11,6 @@ @@ -11,6 +11,6 @@
11 </view> 11 </view>
12 <view class="item flex-vc {{pi==2?'checked':''}}" bindtap="redirectTo" data-url="/pages/book/b_setting"> 12 <view class="item flex-vc {{pi==2?'checked':''}}" bindtap="redirectTo" data-url="/pages/book/b_setting">
13 <view class="icon setting"></view> 13 <view class="icon setting"></view>
14 - <view class="text">设置</view> 14 + <view class="text">桌位</view>
15 </view> 15 </view>
16 </view> 16 </view>
  1 +// pages/book/b_setting.js
  2 +var util = require('../../utils/util.js')
  3 +var bookOrder=require('../../utils/bookCommon.js')
  4 +import App from '../../utils/api';
  5 +const {regeneratorRuntime} = global
  6 +
  7 +Page({
  8 +
  9 + /**
  10 + * 页面的初始数据
  11 + */
  12 + data: {
  13 + dateStr:'',
  14 + calendarMaskLoad:false,
  15 + calendarMask:false,
  16 + dayStyle:[
  17 + { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' },
  18 + { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' }
  19 + ],
  20 + regions:[],
  21 + regions_active:'',
  22 + time:-1,
  23 + },
  24 + regions:[],
  25 + sellerid:0,
  26 + /**
  27 + * 生命周期函数--监听页面加载
  28 + */
  29 + onLoad: function (options) {
  30 + let d=new Date()/1000;
  31 + let dateStr=util.unixtoTime(d,'MM-DD DAY');
  32 +
  33 + this.setData({
  34 + dateStr:dateStr
  35 + })
  36 + },
  37 +
  38 + /**
  39 + * 生命周期函数--监听页面初次渲染完成
  40 + */
  41 + onReady: function () {
  42 +
  43 + },
  44 +
  45 + /**
  46 + * 生命周期函数--监听页面显示
  47 + */
  48 + onShow: async function () {
  49 + this.setData({
  50 + height:getApp().system.windowHeight-170,
  51 + })
  52 + setTimeout(()=>{
  53 + this.setData({
  54 + calendarMaskLoad:true,
  55 + })
  56 + },1000);
  57 + this.selectComponent('#nav').init();
  58 + this.sellerid=util.cache('sellerid');
  59 + App.Tables.GetTableListsBySellerId({
  60 + sellerid:this.sellerid
  61 + }).then((res)=>{
  62 + this.regions=res.data[0];
  63 + this.getbooklist();
  64 + })
  65 + },
  66 +
  67 + /**
  68 + * 生命周期函数--监听页面隐藏
  69 + */
  70 + onHide: function () {
  71 +
  72 + },
  73 +
  74 + /**
  75 + * 生命周期函数--监听页面卸载
  76 + */
  77 + onUnload: function () {
  78 +
  79 + },
  80 + calendarShow(){
  81 + console.log('xxxxx')
  82 + this.setData({
  83 + calendarMask:true
  84 + })
  85 + console.log(this.data.calendarMask)
  86 + },
  87 + dateChange(event){
  88 + var currentdate=event.detail.year+'-'+(event.detail.month<10 ? '0'+event.detail.month : event.detail.month)+'-'+(event.detail.day<10 ? '0'+event.detail.day : event.detail.day);
  89 + var currentime=bookOrder.gettimestamp(currentdate+' 00:00:00');
  90 + var myDate = new Date(parseInt(currentime)*1000);
  91 + var week=bookOrder.getweek(myDate.getDay());
  92 + var dateStr=(event.detail.month<10 ? '0'+event.detail.month : event.detail.month)+'-'+(event.detail.day<10 ? '0'+event.detail.day : event.detail.day);
  93 + if(currentime-new Date()/1000<=86400 && currentime-new Date()/1000>0){
  94 + dateStr+=' 明天'
  95 + }else{
  96 + dateStr+=' '+week
  97 + }
  98 + let clickDay = event.detail.day;
  99 + let changeDay = `dayStyle[1].day`;
  100 + let changeBg = `dayStyle[1].background`;
  101 + console.log(changeBg)
  102 + this.setData({
  103 + showyear:event.detail.year,
  104 + showmonth:event.detail.month,
  105 + showday:event.detail.day,
  106 + dateStr:dateStr,
  107 + [changeDay]: clickDay,
  108 + [changeBg]: "#84e7d0"
  109 + })
  110 + this.getbooklist();
  111 + this.calendarClose();
  112 + },
  113 + calendarClose(){
  114 + this.setData({
  115 + calendarMask:false
  116 + })
  117 + },
  118 + async getbooklist(){
  119 + let obj={};
  120 +
  121 + let formdata={};
  122 + formdata.sid=this.sellerid;
  123 + formdata.x=1;
  124 + formdata.y=200;
  125 + let time=0;
  126 + if(this.data.time<0){
  127 + time=await bookOrder.getTimeSpaceIndex();
  128 + obj.time=time;
  129 + }else{
  130 + time=this.data.time;
  131 + }
  132 + let rdate=await bookOrder.getTimeSpace(this.data.dateStr,time);
  133 + formdata.rdate=rdate;
  134 + let tids={};
  135 + let reserves=await App.Reserve.GetReserveList(formdata);
  136 + if(reserves.data.length>0){
  137 + reserves.data.forEach(r=>{
  138 + let ts=r.tid.split(',');
  139 + ts.forEach(tid=>{
  140 + tids[tid]={
  141 + rdate:r.rdate,
  142 + id:r.id
  143 + }
  144 + })
  145 + })
  146 + }
  147 + console.log('tids',tids);
  148 + let regions=[];
  149 + let now=new Date()/1000;
  150 + this.regions.forEach(region=>{
  151 + if(region.list.length>0){
  152 + region.list.forEach(tb=>{
  153 + tb.status_str='';
  154 + tb.status_classname='enabled'
  155 + if(tids[tb.id]){
  156 + console.log('tids',region.name,tb.name);
  157 + tb.status_str=now>tids[tb.id].rdate?'用餐中':'已预订';
  158 + tb.status_classname='highlight';
  159 + tb.reserve_id=tids[tb.id].id;
  160 + }else if(tb.enable!=1){
  161 + tb.status_str='已停用';
  162 + tb.status_classname='disabled';
  163 + }
  164 + })
  165 + regions.push(region);
  166 + }
  167 + })
  168 + obj.regions=regions
  169 + if(!this.data.regions_active){
  170 + obj.regions_active=this.regions[0].name
  171 + }
  172 + this.setData(obj)
  173 + },
  174 + chooseRegion(e){
  175 + this.setData({
  176 + regions_active:util.attr(e,'name')
  177 + })
  178 + }
  179 +})
  1 +{
  2 + "backgroundTextStyle":"light",
  3 + "navigationBarBackgroundColor": "#fff",
  4 + "navigationBarTextStyle":"black",
  5 + "usingComponents": {
  6 + "nav":"/components/nav/nav",
  7 + "tabBar":"/components/book/tabBar/tabBar",
  8 + "calendar": "plugin://calendar/calendar",
  9 + "board":"/components/book/board/board"
  10 + }
  11 +}
  1 +<!--pages/book/b_setting.wxml-->
  2 +<nav id="nav">桌位</nav>
  3 +<view class="page">
  4 + <view class="search-easy flex-lr">
  5 + <view class="block flex-vc" bindtap="calendarShow">
  6 + <view class="green-font font34r font-bold flex-cc">{{dateStr}}</view>
  7 + </view>
  8 + <view class="block section flex-vc">
  9 + <view class="tab flex-cc">
  10 + <item class="item {{time==0?'checked':''}} flex-cc"
  11 + bindtap="selectedValue" data-key="time" data-value="0">
  12 + 早市
  13 + </item>
  14 + <item class="item {{time==1?'checked':''}} flex-cc"
  15 + bindtap="selectedValue" data-key="time" data-value="1">
  16 + 午市
  17 + </item>
  18 + <item class="item {{time==2?'checked':''}} flex-cc"
  19 + bindtap="selectedValue" data-key="time" data-value="2">
  20 + 晚市
  21 + </item>
  22 + </view>
  23 + </view>
  24 + </view>
  25 + <view class="flex-lr disks">
  26 + <view class="menus Medium" style="height: {{height}}px;">
  27 + <view class="menu flex-cc {{regions_active==item.name?'active':''}}"
  28 + wx:for="{{regions}}" wx:key="regions.key"
  29 + bindtap="chooseRegion" data-name="{{item.name}}">
  30 + <view class="menu-text">{{item.name}}</view>
  31 + </view>
  32 + </view>
  33 + <view class="items" style="height: {{height}}px;">
  34 + <block wx:for="{{regions}}" wx:key="regions.key">
  35 + <view class="items-disks flex-ll" style="flex-wrap: wrap"
  36 + wx:if="{{regions_active==item.name}}">
  37 + <board width="160" height="160" board="{{item}}"
  38 + style="margin: 20rpx 0 0 20rpx"
  39 + wx:for="{{item.list}}" wx:key="item.key" ></board>
  40 + </view>
  41 + </block>
  42 + </view>
  43 + </view>
  44 +</view>
  45 +<tabBar></tabBar>
  46 +<view class="calendar-mask" bindtap="calendarClose"
  47 + style="height:{{calendarMask?'100%':0}};" wx:if="{{calendarMaskLoad}}">
  48 + <view style="width: 100%; height:{{calendarMask?'100%':0}};overflow: hidden;position: relative;">
  49 + <calendar weeks-type="cn" catchtap="catchtap"
  50 + start-date="2018-09"
  51 + days-color="{{dayStyle}}"
  52 + binddayClick="dateChange"
  53 + active-type="rounded"
  54 + calendar-style="calendar"
  55 + header-style="calendar-header"
  56 + board-style="calendar-board"></calendar>
  57 + </view>
  58 +</view>
  1 +/* pages/book/b_setting.wxss */
  2 +.page{
  3 + width: 100%;
  4 + margin: 20rpx 0 0;
  5 +}
  6 +.search-easy{
  7 + height:80rpx;
  8 +}
  9 +.search-easy .block{
  10 + width: 50%;
  11 + min-width: 50%;
  12 + height: 100%;
  13 +}
  14 +
  15 +.search-easy .block:first-child{
  16 + border-right: 1px solid #E0E0E0;
  17 +}
  18 +.section .tab{
  19 + font-size: 34rpx;
  20 + color: #199095;
  21 + height: 50rpx;
  22 +}
  23 +.section .tab .item{
  24 + height: 50rpx;
  25 + line-height: 50rpx;
  26 + width: 94rpx !important;
  27 + min-width: 94rpx !important;
  28 + border-radius: 10rpx;
  29 + border: 2rpx solid #199095;
  30 + margin-right: 16rpx;
  31 + text-align: center;
  32 + display: block;
  33 +}
  34 +.section .tab .checked{
  35 + background-color:#199095;
  36 + color: #FEFEFE;
  37 +}
  38 +
  39 +
  40 +.calendar-mask{
  41 + position: fixed;
  42 + z-index: 99;
  43 + width: 100%;
  44 + height: 100%;
  45 + left:0;
  46 + top:0;
  47 + background-color: rgba(0,0,0,.5);
  48 +}
  49 +.calendar {
  50 + background-color: #eeedff;
  51 + padding-top: 10px;
  52 + position: absolute;
  53 + bottom: 0;
  54 + width: 100%;
  55 + z-index: 999;
  56 +}
  57 +.calendar-header{
  58 + font-size: large; /*修改了标题文字和按钮的大小*/
  59 + color: #605eac; /*修改了标题文字和按钮的颜色*/
  60 +}
  61 +.calendar-board {
  62 + background-color: #dddcff;
  63 + color: white;
  64 +}
  65 +
  66 +.disks{
  67 + width: 100%;
  68 + border-top: 1rpx solid #E0E0E0;
  69 + margin-top: 14rpx;
  70 + background-color: #F5F5F5;
  71 +}
  72 +.disks .menus,.disks .items{
  73 + overflow-y: auto;
  74 +}
  75 +.disks .menus{
  76 + background-color: #fefefe;
  77 + width: 168rpx;
  78 + min-width: 168rpx;
  79 + color: #999999;
  80 +}
  81 +.disks .menu{
  82 + height: 160rpx;
  83 + overflow: hidden;
  84 + border-left: 4rpx solid #fefefe;
  85 +}
  86 +.disks .menu.active{
  87 + background-color: #F5F5F5;
  88 + border-left: 4rpx solid #199095;
  89 + color: #199095;
  90 +}
  91 +.disks .menu-text{
  92 + font-size: 30rpx;
  93 + width: 120rpx;
  94 + margin: 0 auto;
  95 + max-height: 84rpx;
  96 + line-height: 42rpx;
  97 + overflow: hidden;
  98 +}
  99 +
  100 +.disks .items{
  101 + width: 100%;
  102 +}
  103 +.disks .items-disks{
  104 + margin: 0 auto 40rpx;
  105 + width: 560rpx;
  106 +}
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 "list": [] 30 "list": []
31 }, 31 },
32 "miniprogram": { 32 "miniprogram": {
33 - "current": 19, 33 + "current": 20,
34 "list": [ 34 "list": [
35 { 35 {
36 "id": 0, 36 "id": 0,
@@ -188,6 +188,11 @@ @@ -188,6 +188,11 @@
188 "pathName": "pages/book/b_desk", 188 "pathName": "pages/book/b_desk",
189 "query": "rdate=1540339200-1540346400&tid=0&pnum=6&checked_tids=&rid=", 189 "query": "rdate=1540339200-1540346400&tid=0&pnum=6&checked_tids=&rid=",
190 "scene": "1001" 190 "scene": "1001"
  191 + },
  192 + {
  193 + "id": -1,
  194 + "name": "桌位",
  195 + "pathName": "pages/book/b_setting"
191 } 196 }
192 ] 197 ]
193 } 198 }
@@ -54,4 +54,9 @@ export default { @@ -54,4 +54,9 @@ export default {
54 //商家列表 54 //商家列表
55 'App.Reserve.SellerList':null, 55 'App.Reserve.SellerList':null,
56 56
  57 + //桌位列表
  58 + 'App.Tables.GetTableListsBySellerId':{
  59 + cachetime:300,
  60 + }
  61 +
57 } 62 }
@@ -59,7 +59,7 @@ module.exports ={ @@ -59,7 +59,7 @@ module.exports ={
59 } 59 }
60 if (sc.daily){ 60 if (sc.daily){
61 let ti=['morning','noon','night']; 61 let ti=['morning','noon','night'];
62 - console.log('getTimeSpace',sc.daily[ti[timeIndex]],timeIndex); 62 + console.log('getTimeSpace',sc.daily,sc.daily[ti[timeIndex]],timeIndex);
63 let ts=sc.daily[ti[timeIndex]].split('-'); 63 let ts=sc.daily[ti[timeIndex]].split('-');
64 64
65 let stime 65 let stime