Commit 68c8b1738577ec9be7301636c9580403f7775eda

Authored by vking
1 parent d2eb47d5

使用默认时间

@@ -85,7 +85,7 @@ @@ -85,7 +85,7 @@
85 "navigationBarTextStyle": "white" 85 "navigationBarTextStyle": "white"
86 }, 86 },
87 "networkTimeout": { 87 "networkTimeout": {
88 - "request": 5000, 88 + "request": 10000,
89 "downloadFile": 10000 89 "downloadFile": 10000
90 }, 90 },
91 "tabBar": { 91 "tabBar": {
@@ -95,21 +95,21 @@ Page({ @@ -95,21 +95,21 @@ Page({
95 let rev_time=parseInt(nt) 95 let rev_time=parseInt(nt)
96 if(options.hasQuick==1){ 96 if(options.hasQuick==1){
97 let rdate=options.ddate.split('-') 97 let rdate=options.ddate.split('-')
98 - if(rev_time<rdate[0] || rev_time>rdate[1]){ 98 + if(!(rev_time>=rdate[0] && rev_time<=rdate[1])){
99 rev_time=rdate[0] 99 rev_time=rdate[0]
100 } 100 }
  101 + await this.setDateStr(rev_time);
101 } 102 }
102 - await this.setDateStr(rev_time);  
103 - this.sellerid = util.cache('enter_params')['seller_id'];  
104 - let timePickerArray = await comm.getDayTimeSpace();  
105 //判断hasUseDefDtime 103 //判断hasUseDefDtime
106 let hasUseDefDtime = true; 104 let hasUseDefDtime = true;
107 let mmii = util.unixtoTime(rev_time, 'HH:II'); 105 let mmii = util.unixtoTime(rev_time, 'HH:II');
108 - console.log('initLoad',mmii,this.data.defDtime[this.data.form.time],this.data.defDtime)  
109 - console.log('initLoad',mmii > this.data.defDtime[this.data.form.time])  
110 if (mmii > this.data.defDtime[this.data.form.time]) { 106 if (mmii > this.data.defDtime[this.data.form.time]) {
111 hasUseDefDtime = false; 107 hasUseDefDtime = false;
112 } 108 }
  109 + //console.log('initLoad::setDateStr',util.unixtoTime(rev_time,'YYYY-MM-DD HH:II'),this.data.defDtime[this.data.form.time])
  110 + await this.setDateStr(rev_time,hasUseDefDtime);
  111 + this.sellerid = util.cache('enter_params')['seller_id'];
  112 + let timePickerArray = await comm.getDayTimeSpace();
113 this.setData({ 113 this.setData({
114 timePickerArray: timePickerArray, 114 timePickerArray: timePickerArray,
115 speciallist: speciallist, 115 speciallist: speciallist,
@@ -128,7 +128,12 @@ Page({ @@ -128,7 +128,12 @@ Page({
128 * @param d 128 * @param d
129 * 129 *
130 */ 130 */
131 - async setDateStr(d = new Date() / 1000){ 131 + async setDateStr(d = new Date() / 1000,hasUseDefDtime=false){
  132 + if(hasUseDefDtime){//
  133 + let timestr=util.unixtoTime(d,'YYYY-MM-DD '+this.data.defDtime[this.data.form.time])
  134 + d=util.timetouUnix(timestr)
  135 + }
  136 + console.log('setDateStr',util.unixtoTime(d,'YYYY-MM-DD HH:II'),hasUseDefDtime)
132 this.year=util.unixtoTime(d,'YYYY'); 137 this.year=util.unixtoTime(d,'YYYY');
133 let ns = new Date() / 1000; 138 let ns = new Date() / 1000;
134 let dateStr = [ 139 let dateStr = [
@@ -302,17 +307,6 @@ Page({ @@ -302,17 +307,6 @@ Page({
302 sobj.timePickerMask = true; 307 sobj.timePickerMask = true;
303 } 308 }
304 } 309 }
305 - if ('date,time,pnum,pnum_str,tabid'.indexOf(key) > -1) {  
306 - if (!displayTimes) {  
307 - //sobj.form.tid = []; //切换日期时间清空桌位  
308 - //sobj.buttonhide = true;  
309 - this.getTables();  
310 - }  
311 - if (key == 'date') {  
312 - let xtime = util.unixtoTime(new Date() / 1000, 'YYYY-' + (this.data.dateStr[val].substr(0, 5)) + ' HH:II:SS');  
313 - this.setDateStr(util.timetouUnix(xtime));  
314 - }  
315 - }  
316 //判断hasUseDefDtime 310 //判断hasUseDefDtime
317 if ((key == 'time' || key == 'date') && !sobj.timePickerMask) { 311 if ((key == 'time' || key == 'date') && !sobj.timePickerMask) {
318 sobj.hasUseDefDtime = true 312 sobj.hasUseDefDtime = true
@@ -323,6 +317,18 @@ Page({ @@ -323,6 +317,18 @@ Page({
323 sobj.hasUseDefDtime = false; 317 sobj.hasUseDefDtime = false;
324 } 318 }
325 } 319 }
  320 + if ('date,time,pnum,pnum_str,tabid'.indexOf(key) > -1) {
  321 + if (!displayTimes) {
  322 + //sobj.form.tid = []; //切换日期时间清空桌位
  323 + //sobj.buttonhide = true;
  324 + this.getTables();
  325 + }
  326 + if (key == 'date') {
  327 + let xtime = util.unixtoTime(new Date() / 1000, 'YYYY-' + (this.data.dateStr[val].substr(0, 5)) + ' HH:II:SS');
  328 + this.setDateStr(util.timetouUnix(xtime),sobj.hasUseDefDtime);
  329 + }
  330 + }
  331 +
326 this.setData(sobj) 332 this.setData(sobj)
327 }, 333 },
328 async getTables(){ 334 async getTables(){
@@ -695,6 +701,7 @@ Page({ @@ -695,6 +701,7 @@ Page({
695 this.year=util.unixtoTime(options.ddate.substr(0,10),'YYYY'); 701 this.year=util.unixtoTime(options.ddate.substr(0,10),'YYYY');
696 let form=this.data.form 702 let form=this.data.form
697 form.tid=[options.tid] 703 form.tid=[options.tid]
  704 +
698 this.setData({ 705 this.setData({
699 form: form, 706 form: form,
700 }) 707 })