Commit a932e1ce17c36162b8134b776114aa63f84df3a5

Authored by wangfan
2 parents 5ec18909 7057ca9a

v2 merge vking

... ... @@ -2,14 +2,14 @@ var uri_dc = require('utils/uri.js')
global.regeneratorRuntime = require('lib/regenerator/runtime-module')
const { regeneratorRuntime } = global
Array.prototype.indexOf = function(val) {
Array.prototype._indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) return i;
}
return -1;
};
Array.prototype.remove = function(val) {
var index = this.indexOf(val);
var index = this._indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
... ...
... ... @@ -55,5 +55,11 @@
}
]
},
"plugins": {
"calendar": {
"version": "1.1.3",
"provider": "wx92c68dae5a8bb046"
}
},
"debug": true
}
\ No newline at end of file
... ...
... ... @@ -39,23 +39,37 @@ Page({
}
],
buttonhide:true,
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' }
],
},
tablesAll:[],
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let d=new Date()/1000;
let dateStr=[
util.unixtoTime(d,'MM-DD'),
util.unixtoTime(d+86400,'MM-DD'),
];
this.setData({
dateStr:dateStr,
})
this.setDateStr();
this.sellerid=util.cache('sellerid');
this.getTables()
},
/**
*
* @param d
*
*/
setDateStr(d=new Date()/1000){
let dateStr=[
util.unixtoTime(d,'MM-DD `DAY/周WW`'),
util.unixtoTime(parseInt(d)+86400,'MM-DD `DAY/周WW`'),
];
this.setData({
dateStr:dateStr,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
... ... @@ -68,6 +82,11 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
setTimeout(()=>{
this.setData({
calendarMaskLoad:true,
})
},1000);
},
... ... @@ -166,7 +185,7 @@ Page({
let form=this.data.form;
try{
let rdate=await comm.getTimeSpace(this.data.dateStr[this.data.form.date],this.data.form.time);
console.log('rdate',rdate);
console.log('rdate',this.data.dateStr[this.data.form.date],rdate);
App.Reserve.GetTableList({
sid:this.sellerid,
pnum_str:form.pnum_str,
... ... @@ -224,5 +243,27 @@ Page({
form:this.data.form,
searchlist:null
})
}
},
calendarShow(){
this.setData({
calendarMask:true
})
},
dateChange(event){
console.log(event);
let clickDay = event.detail.day;
let changeDay = `dayStyle[1].day`;
let changeBg = `dayStyle[1].background`;
this.setData({
[changeDay]: clickDay,
[changeBg]: "#84e7d0"
})
this.setDateStr(util.timetouUnix(event.detail.year+'/'+event.detail.month+'/'+event.detail.day))
this.getTables()
},
calendarClose(){
this.setData({
calendarMask:false
})
},
})
\ No newline at end of file
... ...
... ... @@ -7,6 +7,7 @@
"bookList":"/components/book/list/list",
"nav":"/components/nav/nav",
"tabBar":"/components/book/tabBar/tabBar",
"searchList":"/components/searchlist/searchlist"
"searchList":"/components/searchlist/searchlist",
"calendar": "plugin://calendar/calendar"
}
}
\ No newline at end of file
... ...
... ... @@ -6,14 +6,14 @@
<view class="flex-rr" style="width:100%;">
<item class="date-item {{form.date==0?'checked':''}}"
bindtap="selectedValue" data-key="date" data-value="0">
<view class="date-item-text">{{dateStr[0]}} 今天</view>
<view class="date-item-text">{{dateStr[0]}}</view>
</item>
<item class="date-item {{form.date==1?'checked':''}}"
bindtap="selectedValue" data-key="date" data-value="1">
<view class="date-item-text">{{dateStr[1]}} 明天</view>
<view class="date-item-text">{{dateStr[1]}}</view>
</item>
</view>
<view class="more flex-ll">
<view class="more flex-ll" bindtap="calendarShow">
<view></view>
<view></view>
<view></view>
... ... @@ -146,3 +146,18 @@
</view>
</view>
<tabBar></tabBar>
<view class="calendar-mask"
bindtap="calendarClose"
style="left:{{calendarMask?0:-5000}}px;" wx:if="{{calendarMaskLoad}}">
<calendar weeks-type="cn"
year="2018"
month="9"
day="27"
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>
\ No newline at end of file
... ...
... ... @@ -40,6 +40,7 @@
.date .more{
width: 65rpx;
min-width: 65rpx;
height: 60rpx;
}
.date .more view{
width: 12rpx;
... ... @@ -187,4 +188,31 @@
}
.confirm-button-active{
opacity:1;
}
/**
*/
.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: fixed;
bottom: 0;
width: 100%;
}
.calendar-header{
font-size: large; /*修改了标题文字和按钮的大小*/
color: #605eac; /*修改了标题文字和按钮的颜色*/
}
.calendar-board {
background-color: #dddcff;
color: white;
}
\ No newline at end of file
... ...
... ... @@ -50,6 +50,8 @@ module.exports ={
let d=new Date()/1000;
if(!mmdd){
mmdd=util.unixtoTime(d,'MM-DD');
}else{
mmdd=mmdd.replace(/[^\d-\/]/ig,'')
}
if(!sc){
let res = await App.Reserve.SellerInfo(util.cache('enter_params'));
... ...
... ... @@ -74,6 +74,11 @@ function unixtoTime(ns,format) {
}
}
}
if(format.indexOf('`')>0){
result=result.replace(/`(.*)\/(.*)`/ig,function($0,$1,$2){
return $1||$2;
});
}
return result;
}
... ...