Commit df63463ef80ad0017df7712987ee5e25dc965d9a

Authored by vking
1 parent 1a190b6b

设置到店时间

// components/reserve/invitation/ddate.js
import util from '../../../utils/util'
import App from '../../../utils/api'
Component({
/**
* 组件的属性列表
*/
properties: {
order:{
type:Object,
value:{},
}
},
/**
* 组件的初始数据
*/
data: {
timePickerMask:false,
times:[],
},
attached(){
let times=[],defTime=''
let nt=parseInt(new Date()/1000)
let rdate=parseInt(this.data.order.rdate),edate=parseInt(this.data.order.edate)
for(let t=rdate;t<=edate;t+=1800){
times.push(t);
if(!defTime && nt+1800>t){
defTime=t
}
}
this.setData({
times:times,
defTime:defTime,
})
},
/**
* 组件的方法列表
*/
methods: {
show(){
this.setData({
timePickerMask:true,
})
},
calendarClose(){
this.setData({
timePickerMask:false,
})
},
bindTimePickerChange(e){
let ddate=util.attr(e,'val')
if(new Date()/1000>ddate){
return util.toast('请选择可用到店时间','none')
}
App.Customer.SetDdate({
rid:this.data.order.id,
ddate:ddate
}).then(res=>{
this.calendarClose()
this.triggerEvent('event',{ddate:ddate})
})
},
}
})
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<!--components/reserve/invitation/ddate.wxml-->
<wxs src="../../../utils/util.wxs" module="util" />
<view class="calendar-mask" bindtap="calendarClose"
style="height:100%;" wx:if="{{timePickerMask}}">
<view class="timePicker">
<view class="flex-lr title Semibold">
<view> </view>
<view bindtap="calendarClose">请选择您的到店时间</view>
<image class="close" bindtap="calendarClose"></image>
</view>
<view class="flex-ll" style="flex-wrap:wrap">
<view class="time-item {{item==defTime?'checked':''}}"
style="{{(index+1)%4==0?'margin-right:0;':''}}"
wx:for="{{times}}" wx:key=""
catchtap="bindTimePickerChange"
data-val="{{item}}"
>{{util.unixtoTime(item,'HH:II')}}</view>
</view>
</view>
</view>
... ...
/* components/reserve/invitation/ddate.wxss */
@import "../../../app.wxss";
.calendar-mask{
position: fixed;
z-index: 99;
width: 100%;
height: 100%;
left:0;
top:0;
background-color: rgba(0,0,0,.5);
}
.timePicker{
width: calc(100% - 60rpx);
overflow: hidden;
position: absolute;
bottom: 0;
background-color: #FEFEFE;
padding: 0rpx 30rpx 46rpx;
border-radius: 10px 10px 0px 0px ;
}
.timePicker .time-item{
width: 150rpx;
height: 80rpx;
line-height: 80rpx;
font-size: 36rpx;
color:#8B5318;
border: 2rpx solid #C0A369;
background-color: #FFF5EB;
border-radius: 4rpx;
text-align: center;
margin-right: 30rpx;
margin-bottom: 40rpx;
box-sizing: border-box;
}
.timePicker .time-item.checked{
}
.timePicker .close{
width: 32rpx;
height: 32rpx;
background-image: url("http://qn.colorcun.com/reserve/images/ddate-close.png");
background-size: 100% 100%;
}
.title{
margin-top: 40rpx;
margin-bottom: 40rpx;
font-size: 32rpx;
color: #353535;
line-height: 44rpx;
height: 44rpx;
}
\ No newline at end of file
... ...
... ... @@ -39,7 +39,13 @@
</view>
<block wx:if="{{detail.hasRunning}}">
<view class="flex-lr share-view" >
<view class="flex-lr share-view" wx:if="{{detail.type==1}}">
<formids url="/pages/customer/detail_owner_invitation?id={{detail.id}}&hasInvitation=1&hasSellerShare=1&tplid=1"
class="share-but-view">
<view class="share-but Regular">邀请同行的朋友</view>
</formids>
</view>
<view class="flex-lr share-view" wx:else="">
<userinfo-share
binduserinfo="userinfo"
bindshare="share"
... ... @@ -56,7 +62,7 @@
share="{{detail}}"
share-act="invitation"
class="share-but-view">
<view class="share-but Regular">自带酒水</view>
<view class="share-but Regular">订酒水</view>
</userinfo>
<userinfo wx:if="{{detail.seller.is_open_order==1}}"
binduserinfo="cookbook"
... ...
... ... @@ -118,6 +118,8 @@ Page({
addr:res.data.seller.real_address||res.data.seller.map_address,
image:res.data.image_url,
hasOwner:true,
type:res.data.type,
is_set_ddate:res.data.is_set_ddate
}
})
App.Reserve.SellerInfo({seller_id:res.data.seller.id}).then(async sc=>{
... ... @@ -274,4 +276,11 @@ Page({
data: this.msgTpl
})
},
upTime(){
this.selectComponent('#ddate').show();
},
ddateEvent(e){
console.log(e.detail.ddate)
this.getDetail(true)
},
})
... ...
... ... @@ -6,6 +6,7 @@
"userinfo": "/components/userinfo/userinfo",
"nav":"/components/nav/nav",
"formids":"/components/formids/formids",
"ddate":"/components/reserve/invitation/ddate",
"userinfo-share": "/components/userinfo/share"
}
}
\ No newline at end of file
... ...
... ... @@ -6,7 +6,7 @@
<view class="opt-view flex-vc">
<block wx:if="{{!detail.hasOvered && !detail.hasCancel}}">
<userinfo-share class="button-none flex-vc" binduserinfo="setUserInfoSuccess" catchtap="catchtap">
<view class="buts-share animation"></view>
<view class="buts-share"></view>
</userinfo-share>
</block>
<block wx:elif="{{detail.hasCancel}}">
... ... @@ -48,3 +48,4 @@
<template name="tpl-2">
<template is="tpl-wenxin" data="{{...seller,options}}"></template>
</template>
<ddate id="ddate" order="{{detail}}" wx:if="{{detail}}" bindevent="ddateEvent"></ddate>
... ...
... ... @@ -9,11 +9,15 @@ Page({
* 页面的初始数据
*/
data: {
success: [],
padding: [],
list: [],
total: 0,
tabType:1,
hasMore:true,
},
tabType:1,
offset:1,
limit:10,
hasMore:true,
/**
* 生命周期函数--监听页面加载
*/
... ... @@ -51,14 +55,21 @@ Page({
getListData() {
App.Reserve.GetListFromScheAndRes({
flag: 1,
type: this.tabType,
openid: getApp().openid,
offset:this.offset,
limit:this.limit,
}).then(res => {
let total = res.data.success.length + res.data.padding.length
let total = res.data.success.length
let data = this.formatList(res.data);
this.hasMore=data.success.length>=this.limit
if(this.hasMore){
this.offset+=this.limit
}
this.setData({
success: data.success,
padding: data.padding,
total: total
list: data.success,
hasMore:this.hasMore
})
})
},
... ... @@ -110,4 +121,20 @@ Page({
url:url,
})
},
switchType(e){
this.tabType=util.attr(e,'type')
this.setData({
tabType:this.tabType,
})
this.getListData()
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function (e) {
console.log(e)
if(this.hasMore){
this.getListData();
}
},
})
\ No newline at end of file
... ...
<!--pages/customer/list.wxml-->
<nav hasHome>我的订单</nav>
<view class="tabs flex-lr">
<view class="item {{tabType==1?'active':''}}" data-type="1" bindtap="switchType">等待确认</view>
<view class="item {{tabType==2?'active':''}}" data-type="2" bindtap="switchType">预订成功</view>
<view class="item {{tabType==3?'active':''}}" data-type="3" bindtap="switchType">历史订单</view>
<view class="item {{tabType==4?'active':''}}" data-type="4" bindtap="switchType">无效预订</view>
</view>
<view class="page">
<block wx:if="{{total==0}}">
<block wx:if="{{list.length==0}}">
<view class="flex-vc empry">
<image src="http://qn.colorcun.com/custom/lite/image/empty-order.png"></image>
<view class="Medium">暂无订座</view>
</view>
</block>
<block wx:else="">
<block wx:for="{{success}}" wx:key="success.key" wx:for-item="part" wx:for-index="dateIndex">
<block wx:for="{{list}}" wx:key="success.key" wx:for-item="part" wx:for-index="dateIndex">
<view class="list-content" wx:if="{{part.length>0}}">
<block wx:for="{{part}}" wx:key="part.key" wx:for-item="detail">
<view class="card">
... ...
/* pages/customer/list.wxss */
.page{
width: 90%;
margin: 30rpx 5% 0;
margin: 90rpx 5% 0;
color:#353535;
}
... ... @@ -56,16 +56,29 @@
}
.tabs{
margin: 56rpx 0 88rpx;
font-size: 38rpx;
color:#999999;
font-weight: bold;
font-size: 30rpx;
color:##353535;
position: fixed;
width: 90%;
padding: 0 5%;
background-color: #fff;
z-index: 9;
}
.tabs .item{
width: 25%;
border: 2rpx solid #E0E0E0;
height: 56rpx;
line-height: 56rpx;
text-align: center;
border-right-width: 0;
}
.tabs .item:last-child{
border-right-width: 2rpx;
}
.tabs .active{
color:#353535;
color:#FFFFFF;
background-color: #C8B16D;
border-color: #C8B16D;
}
.empry{
font-size: 34rpx;
... ...
... ... @@ -20,7 +20,10 @@
时间
<view class="title-right"></view>
</view>
<view class="content">{{date}}</view>
<view class="content flex-cc">
{{date}}
<view class="upTime" bindtap="upTime" wx:if="{{is_set_ddate==0 && type==1}}">修改时间</view>
</view>
<view class="title title-addr-view flex-cc" bindtap="lookLocation">
<view class="title-addr"></view>
地址导航
... ...
... ... @@ -51,7 +51,7 @@
font-size: 36rpx;
line-height: 50rpx;
text-align: center;
align-items:flex-start;
/*align-items:flex-start;*/
width: 90%;
}
.seller .content:last-child{
... ... @@ -254,4 +254,13 @@
.buts-text{
height: 40rpx;
line-height: 40rpx;
}
.upTime{
width: 92rpx;
height: 34rpx;
line-height: 34rpx;
font-size: 20rpx;
background-color: #ECD9B7;
color: #794F28;
margin-left: 20rpx;
}
\ No newline at end of file
... ...
... ... @@ -44,6 +44,10 @@
"currentL": -1,
"list": []
},
"gamePlugin": {
"current": -1,
"list": []
},
"miniprogram": {
"current": 54,
"list": [
... ... @@ -355,7 +359,7 @@
"id": 40,
"name": "邀请Ren pages/customer/index ",
"pathName": "pages/customer/detail_owner_invitation",
"query": "id=7611&fromid=test&hasInvitation=1&hasSellerShare=1&tplid=1",
"query": "id=25569&fromid=test&hasInvitation=1&hasSellerShare=1&tplid=1",
"scene": null
},
{
... ... @@ -476,6 +480,13 @@
"pathName": "pages/customer/detail_owner",
"query": "id=25569&hasFirstShow=1",
"scene": null
},
{
"id": -1,
"name": "pages/me/list 我的订单",
"pathName": "pages/me/list",
"query": "id=1017&act=quanzi",
"scene": null
}
]
}
... ...
... ... @@ -279,6 +279,12 @@ export default {
host: 'https://cli.im/mina/',
alias:'generate_qrcode'
},
// 设置到店时间 rid=??&ddate=??
'App.Customer.SetDdate':{
openid:'openid',
silence:false,
},
//获取营业时间段满房接口
'App.Customer.GetHouseFullDateTimes':null,
... ...
... ... @@ -14,7 +14,7 @@ export default {
//取消
detail.hasCancel=detail.status==4;
//结束
detail.hasOvered= ns > detail.ddate || (detail.status >= 2 && detail.status <= 3)
detail.hasOvered= ns > detail.edate || (detail.status >= 2 && detail.status <= 3)
//正常运行已接单
if(detail.type==0){//B端
detail.hasRunning = !detail.hasOvered && !detail.hasCancel
... ...
//时间戳转为时间
function unixtoTime(ns,format="YYYY-MM-DD HH:II:SS") {
var result;
var time = getDate(ns*1000);
//result=format || 'YYYY年MM月DD日 HH时II分SS秒 WW';
result=format || 'YYYY年MM月DD日';
//console.log(format);
result=result.toUpperCase();
result=result.replace('YYYY',time.getFullYear());
var m=time.getMonth()+1;
result=result.replace('MM',m>9?m:"0"+m);
var d=time.getDate();
result=result.replace('DD',d>9?d:'0'+d);
var hh=time.getHours();
result=result.replace('HH',hh>9?hh:'0'+hh);
var ii=time.getMinutes();
result=result.replace('II',ii>9?ii:'0'+ii);
var ss=time.getSeconds();
result=result.replace('SS',ss>9?ss:'0'+ss);
var week;
switch (time.getDay()) {
case 0:week="日";break
case 1:week="一";break
case 2:week="二";break
case 3:week="三";break
case 4:week="四";break
case 5:week="五";break
case 6:week="六";break
}
result=result.replace('WW',week);
if(format.indexOf('DAY')>0){
// 获取当天 0 点的时间戳
var timeStamp = getDate(getDate().setHours(0, 0, 0, 0)) / 1000;
var day1 = timeStamp+86400//今天结束
var day2 = day1+86400//明天结束
//console.log('ns<day.getTime()',timeStamp,ns,day1,day2)
if(ns>=timeStamp && ns<day1){
result=result.replace('DAY','今天');
}else{
if(ns>=day1 && ns<day2){
result=result.replace('DAY','明天');
}else{
result=result.replace('DAY','');
}
}
}
return result;
}
module.exports = {
unixtoTime: unixtoTime,
};
\ No newline at end of file
... ...