Commit be17e6fabc2e635b914bfba6af03fa072b162731

Authored by zhangyan
1 parent 3e85babb

更多桌位

@@ -4,7 +4,6 @@ import comm from '../../utils/bookCommon'; @@ -4,7 +4,6 @@ import comm from '../../utils/bookCommon';
4 import App from '../../utils/api'; 4 import App from '../../utils/api';
5 const {regeneratorRuntime} = global 5 const {regeneratorRuntime} = global
6 Page({ 6 Page({
7 -  
8 /** 7 /**
9 * 页面的初始数据 8 * 页面的初始数据
10 */ 9 */
@@ -39,22 +38,36 @@ Page({ @@ -39,22 +38,36 @@ Page({
39 } 38 }
40 ], 39 ],
41 buttonhide:true, 40 buttonhide:true,
  41 +
  42 + calendarMaskLoad:false,
  43 + calendarMask:false,
  44 + dayStyle:[
  45 + { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' },
  46 + { month: 'current', day: new Date().getDate(), color: 'white', background: '#AAD4F5' }
  47 + ],
42 }, 48 },
43 tablesAll:[], 49 tablesAll:[],
44 /** 50 /**
45 * 生命周期函数--监听页面加载 51 * 生命周期函数--监听页面加载
46 */ 52 */
47 onLoad: function (options) { 53 onLoad: function (options) {
48 - let d=new Date()/1000; 54 + this.setDateStr();
  55 + this.sellerid=util.cache('sellerid');
  56 + this.getTables()
  57 + },
  58 + /**
  59 + *
  60 + * @param d
  61 + *
  62 + */
  63 + setDateStr(d=new Date()/1000){
49 let dateStr=[ 64 let dateStr=[
50 - util.unixtoTime(d,'MM-DD'),  
51 - util.unixtoTime(d+86400,'MM-DD'), 65 + util.unixtoTime(d,'MM-DD `DAY/周WW`'),
  66 + util.unixtoTime(parseInt(d)+86400,'MM-DD `DAY/周WW`'),
52 ]; 67 ];
53 this.setData({ 68 this.setData({
54 dateStr:dateStr, 69 dateStr:dateStr,
55 }) 70 })
56 - this.sellerid=util.cache('sellerid');  
57 - this.getTables()  
58 }, 71 },
59 72
60 /** 73 /**
@@ -68,6 +81,11 @@ Page({ @@ -68,6 +81,11 @@ Page({
68 * 生命周期函数--监听页面显示 81 * 生命周期函数--监听页面显示
69 */ 82 */
70 onShow: function () { 83 onShow: function () {
  84 + setTimeout(()=>{
  85 + this.setData({
  86 + calendarMaskLoad:true,
  87 + })
  88 + },1000);
71 89
72 }, 90 },
73 91
@@ -166,7 +184,7 @@ Page({ @@ -166,7 +184,7 @@ Page({
166 let form=this.data.form; 184 let form=this.data.form;
167 try{ 185 try{
168 let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time); 186 let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
169 - console.log('rdate',rdate); 187 + console.log('rdate',this.data.dateStr[this.data.form.date],rdate);
170 App.Reserve.GetTableList({ 188 App.Reserve.GetTableList({
171 sid:this.sellerid, 189 sid:this.sellerid,
172 pnum_str:form.pnum_str, 190 pnum_str:form.pnum_str,
@@ -225,11 +243,33 @@ selectphone:function(e){ @@ -225,11 +243,33 @@ selectphone:function(e){
225 searchlist:null 243 searchlist:null
226 }) 244 })
227 }, 245 },
  246 +calendarShow(){
  247 + this.setData({
  248 + calendarMask:true
  249 + })
  250 +},
  251 +dateChange(event){
  252 + console.log(event);
  253 + let clickDay = event.detail.day;
  254 + let changeDay = `dayStyle[1].day`;
  255 + let changeBg = `dayStyle[1].background`;
  256 + this.setData({
  257 + [changeDay]: clickDay,
  258 + [changeBg]: "#84e7d0"
  259 + })
  260 + this.setDateStr(util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day))
  261 + this.getTables()
  262 +},
  263 +calendarClose(){
  264 + this.setData({
  265 + calendarMask:false
  266 + })
  267 +},
228 async selectdesk(){ 268 async selectdesk(){
229 let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time); 269 let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
230 console.log(this.data.form) 270 console.log(this.data.form)
231 wx.navigateTo({ 271 wx.navigateTo({
232 url:'b_desk?rdate='+rdate+'&tid='+this.data.form.tabid+'&pnum_str='+this.data.form.pnum_str 272 url:'b_desk?rdate='+rdate+'&tid='+this.data.form.tabid+'&pnum_str='+this.data.form.pnum_str
233 }) 273 })
234 -}  
235 -})  
  274 +},
  275 +})
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 "compileType": "miniprogram", 10 "compileType": "miniprogram",
11 "libVersion": "2.3.0", 11 "libVersion": "2.3.0",
12 "appid": "wxd3dc4206c76f14fc", 12 "appid": "wxd3dc4206c76f14fc",
13 - "projectname": "xcx-book", 13 + "projectname": "book",
14 "isGameTourist": false, 14 "isGameTourist": false,
15 "condition": { 15 "condition": {
16 "search": { 16 "search": {
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 "list": [] 30 "list": []
31 }, 31 },
32 "miniprogram": { 32 "miniprogram": {
33 - "current": 16, 33 + "current": 14,
34 "list": [ 34 "list": [
35 { 35 {
36 "id": 0, 36 "id": 0,
@@ -145,7 +145,7 @@ @@ -145,7 +145,7 @@
145 } 145 }
146 }, 146 },
147 { 147 {
148 - "id": -1, 148 + "id": 14,
149 "name": "预定本-添加预定", 149 "name": "预定本-添加预定",
150 "pathName": "pages/book/b_addnew", 150 "pathName": "pages/book/b_addnew",
151 "query": "seller_id=1&seller_openid=o9pcQ0cbjRKnRWczcOJaaSRGP1lE&manager_id=500", 151 "query": "seller_id=1&seller_openid=o9pcQ0cbjRKnRWczcOJaaSRGP1lE&manager_id=500",
@@ -74,6 +74,11 @@ function unixtoTime(ns,format) { @@ -74,6 +74,11 @@ function unixtoTime(ns,format) {
74 } 74 }
75 } 75 }
76 } 76 }
  77 + if(format.indexOf('`')>0){
  78 + result=result.replace(/`(.*)\/(.*)`/ig,function($0,$1,$2){
  79 + return $1||$2;
  80 + });
  81 + }
77 return result; 82 return result;
78 } 83 }
79 84