Commit f5e1fc596b5ff84103e8f726b27940e48f93c9f6

Authored by wangfan
1 parent 54d93d34

录入调整

... ... @@ -17,7 +17,8 @@
"pages/me/setting",
"pages/me/list",
"pages/book/b_addnew",
"pages/book/b_sms"
"pages/book/b_sms",
"pages/book/b_setting"
],
"window": {
"navigationStyle": "custom",
... ...
// components/book/board/board.js
Component({
/**
* 组件的属性列表
*/
properties: {
width:{
type:String,
value:160
},
height:{
type:String,
value:160
},
board:{
type:Object,
value:{}
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--components/book/board/board.wxml-->
<view class="board flex-cc {{board.status_classname}}" style="width: {{width}}rpx;height: {{height}}rpx;">
<view class="info">
<view class="name">{{board.name}}</view>
<view class="pnum">{{board.table_pnum}}人</view>
</view>
<view class="tid" wx:if="{{board.tid==2}}">包间</view>
<view class="status" wx:if="{{board.status_str}}" style="width: {{width}}rpx;">{{board.status_str}}</view>
</view>
... ...
/* components/book/board/board.wxss */
@import "../../../app.wxss";
.board{
background-color: #A9E3E6;
border-radius: 10rpx;
position: relative;
overflow: hidden;
}
.board .tid{
width: 72rpx;
height: 30rpx;
line-height: 30rpx;
font-size: 26rpx;
border-radius: 10rpx 16rpx 16rpx 0;
background-color: #61A5D1;
position: absolute;
top:0;
left: 0;
text-align: center;
color: #FEFEFE;
}
.board .status{
position: absolute;
bottom:0;
left: 0;
height: 36rpx;
text-align: center;
line-height: 36rpx;
font-size: 26rpx;
font-weight: bold;
background-color: #777777;
color: #FEFEFE;
border-radius: 0 0 10rpx 10rpx;
}
.board .info{
text-align: center;
width: 80%;
margin: 0 10%;
color: #353535;
}
.board .name{
font-size: 28rpx;
max-height: 60rpx;
overflow: hidden;
line-height: 28rpx;
}
.board .pnum{
font-size: 26rpx;
}
.board.highlight .status{
background-color: #E95750;
}
.board.disabled {
background-color: #E0E0E0;
}
.board.disabled .tid{
background-color: #94BCD6;
}
\ No newline at end of file
... ...
... ... @@ -11,6 +11,6 @@
</view>
<view class="item flex-vc {{pi==2?'checked':''}}" bindtap="redirectTo" data-url="/pages/book/b_setting">
<view class="icon setting"></view>
<view class="text">设置</view>
<view class="text">桌位</view>
</view>
</view>
... ...
// pages/book/b_setting.js
var util = require('../../utils/util.js')
var bookOrder=require('../../utils/bookCommon.js')
import App from '../../utils/api';
const {regeneratorRuntime} = global
Page({
/**
* 页面的初始数据
*/
data: {
dateStr:'',
calendarMaskLoad:false,
calendarMask:false,
dayStyle:[
{ month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' },
{ month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' }
],
regions:[],
regions_active:'',
time:-1,
},
regions:[],
sellerid:0,
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let d=new Date()/1000;
let dateStr=util.unixtoTime(d,'MM-DD DAY');
this.setData({
dateStr:dateStr
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: async function () {
this.setData({
height:getApp().system.windowHeight-170,
})
setTimeout(()=>{
this.setData({
calendarMaskLoad:true,
})
},1000);
this.selectComponent('#nav').init();
this.sellerid=util.cache('sellerid');
App.Tables.GetTableListsBySellerId({
sellerid:this.sellerid
}).then((res)=>{
this.regions=res.data[0];
this.getbooklist();
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
calendarShow(){
console.log('xxxxx')
this.setData({
calendarMask:true
})
console.log(this.data.calendarMask)
},
dateChange(event){
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);
var currentime=bookOrder.gettimestamp(currentdate+' 00:00:00');
var myDate = new Date(parseInt(currentime)*1000);
var week=bookOrder.getweek(myDate.getDay());
var dateStr=(event.detail.month<10 ? '0'+event.detail.month : event.detail.month)+'-'+(event.detail.day<10 ? '0'+event.detail.day : event.detail.day);
if(currentime-new Date()/1000<=86400 && currentime-new Date()/1000>0){
dateStr+=' 明天'
}else{
dateStr+=' '+week
}
let clickDay = event.detail.day;
let changeDay = `dayStyle[1].day`;
let changeBg = `dayStyle[1].background`;
console.log(changeBg)
this.setData({
showyear:event.detail.year,
showmonth:event.detail.month,
showday:event.detail.day,
dateStr:dateStr,
[changeDay]: clickDay,
[changeBg]: "#84e7d0"
})
this.getbooklist();
this.calendarClose();
},
calendarClose(){
this.setData({
calendarMask:false
})
},
async getbooklist(){
let obj={};
let formdata={};
formdata.sid=this.sellerid;
formdata.x=1;
formdata.y=200;
let time=0;
if(this.data.time<0){
time=await bookOrder.getTimeSpaceIndex();
obj.time=time;
}else{
time=this.data.time;
}
let rdate=await bookOrder.getTimeSpace(this.data.dateStr,time);
formdata.rdate=rdate;
let tids={};
let reserves=await App.Reserve.GetReserveList(formdata);
if(reserves.data.length>0){
reserves.data.forEach(r=>{
let ts=r.tid.split(',');
ts.forEach(tid=>{
tids[tid]={
rdate:r.rdate,
id:r.id
}
})
})
}
console.log('tids',tids);
let regions=[];
let now=new Date()/1000;
this.regions.forEach(region=>{
if(region.list.length>0){
region.list.forEach(tb=>{
tb.status_str='';
tb.status_classname='enabled'
if(tids[tb.id]){
console.log('tids',region.name,tb.name);
tb.status_str=now>tids[tb.id].rdate?'用餐中':'已预订';
tb.status_classname='highlight';
tb.reserve_id=tids[tb.id].id;
}else if(tb.enable!=1){
tb.status_str='已停用';
tb.status_classname='disabled';
}
})
regions.push(region);
}
})
obj.regions=regions
if(!this.data.regions_active){
obj.regions_active=this.regions[0].name
}
this.setData(obj)
},
chooseRegion(e){
this.setData({
regions_active:util.attr(e,'name')
})
}
})
\ No newline at end of file
... ...
{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle":"black",
"usingComponents": {
"nav":"/components/nav/nav",
"tabBar":"/components/book/tabBar/tabBar",
"calendar": "plugin://calendar/calendar",
"board":"/components/book/board/board"
}
}
\ No newline at end of file
... ...
<!--pages/book/b_setting.wxml-->
<nav id="nav">桌位</nav>
<view class="page">
<view class="search-easy flex-lr">
<view class="block flex-vc" bindtap="calendarShow">
<view class="green-font font34r font-bold flex-cc">{{dateStr}}</view>
</view>
<view class="block section flex-vc">
<view class="tab flex-cc">
<item class="item {{time==0?'checked':''}} flex-cc"
bindtap="selectedValue" data-key="time" data-value="0">
早市
</item>
<item class="item {{time==1?'checked':''}} flex-cc"
bindtap="selectedValue" data-key="time" data-value="1">
午市
</item>
<item class="item {{time==2?'checked':''}} flex-cc"
bindtap="selectedValue" data-key="time" data-value="2">
晚市
</item>
</view>
</view>
</view>
<view class="flex-lr disks">
<view class="menus Medium" style="height: {{height}}px;">
<view class="menu flex-cc {{regions_active==item.name?'active':''}}"
wx:for="{{regions}}" wx:key="regions.key"
bindtap="chooseRegion" data-name="{{item.name}}">
<view class="menu-text">{{item.name}}</view>
</view>
</view>
<view class="items" style="height: {{height}}px;">
<block wx:for="{{regions}}" wx:key="regions.key">
<view class="items-disks flex-ll" style="flex-wrap: wrap"
wx:if="{{regions_active==item.name}}">
<board width="160" height="160" board="{{item}}"
style="margin: 20rpx 0 0 20rpx"
wx:for="{{item.list}}" wx:key="item.key" ></board>
</view>
</block>
</view>
</view>
</view>
<tabBar></tabBar>
<view class="calendar-mask" bindtap="calendarClose"
style="height:{{calendarMask?'100%':0}};" wx:if="{{calendarMaskLoad}}">
<view style="width: 100%; height:{{calendarMask?'100%':0}};overflow: hidden;position: relative;">
<calendar weeks-type="cn" catchtap="catchtap"
start-date="2018-09"
days-color="{{dayStyle}}"
binddayClick="dateChange"
active-type="rounded"
calendar-style="calendar"
header-style="calendar-header"
board-style="calendar-board"></calendar>
</view>
</view>
... ...
/* pages/book/b_setting.wxss */
.page{
width: 100%;
margin: 20rpx 0 0;
}
.search-easy{
height:80rpx;
}
.search-easy .block{
width: 50%;
min-width: 50%;
height: 100%;
}
.search-easy .block:first-child{
border-right: 1px solid #E0E0E0;
}
.section .tab{
font-size: 34rpx;
color: #199095;
height: 50rpx;
}
.section .tab .item{
height: 50rpx;
line-height: 50rpx;
width: 94rpx !important;
min-width: 94rpx !important;
border-radius: 10rpx;
border: 2rpx solid #199095;
margin-right: 16rpx;
text-align: center;
display: block;
}
.section .tab .checked{
background-color:#199095;
color: #FEFEFE;
}
.calendar-mask{
position: fixed;
z-index: 99;
width: 100%;
height: 100%;
left:0;
top:0;
background-color: rgba(0,0,0,.5);
}
.calendar {
background-color: #eeedff;
padding-top: 10px;
position: absolute;
bottom: 0;
width: 100%;
z-index: 999;
}
.calendar-header{
font-size: large; /*修改了标题文字和按钮的大小*/
color: #605eac; /*修改了标题文字和按钮的颜色*/
}
.calendar-board {
background-color: #dddcff;
color: white;
}
.disks{
width: 100%;
border-top: 1rpx solid #E0E0E0;
margin-top: 14rpx;
background-color: #F5F5F5;
}
.disks .menus,.disks .items{
overflow-y: auto;
}
.disks .menus{
background-color: #fefefe;
width: 168rpx;
min-width: 168rpx;
color: #999999;
}
.disks .menu{
height: 160rpx;
overflow: hidden;
border-left: 4rpx solid #fefefe;
}
.disks .menu.active{
background-color: #F5F5F5;
border-left: 4rpx solid #199095;
color: #199095;
}
.disks .menu-text{
font-size: 30rpx;
width: 120rpx;
margin: 0 auto;
max-height: 84rpx;
line-height: 42rpx;
overflow: hidden;
}
.disks .items{
width: 100%;
}
.disks .items-disks{
margin: 0 auto 40rpx;
width: 560rpx;
}
... ...
... ... @@ -30,7 +30,7 @@
"list": []
},
"miniprogram": {
"current": 19,
"current": 20,
"list": [
{
"id": 0,
... ... @@ -188,6 +188,11 @@
"pathName": "pages/book/b_desk",
"query": "rdate=1540339200-1540346400&tid=0&pnum=6&checked_tids=&rid=",
"scene": "1001"
},
{
"id": -1,
"name": "桌位",
"pathName": "pages/book/b_setting"
}
]
}
... ...
... ... @@ -54,4 +54,9 @@ export default {
//商家列表
'App.Reserve.SellerList':null,
//桌位列表
'App.Tables.GetTableListsBySellerId':{
cachetime:300,
}
}
\ No newline at end of file
... ...
... ... @@ -59,7 +59,7 @@ module.exports ={
}
if (sc.daily){
let ti=['morning','noon','night'];
console.log('getTimeSpace',sc.daily[ti[timeIndex]],timeIndex);
console.log('getTimeSpace',sc.daily,sc.daily[ti[timeIndex]],timeIndex);
let ts=sc.daily[ti[timeIndex]].split('-');
let stime
... ...