Commit eed853ab40eafea82f8264e997cf3859050cfd46

Authored by wangfan
1 parent 36f51672

v2 customer view

// components/seller-card/seller-card.js
import util from '../../utils/util';
Component({
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
/**
* 组件的属性列表
*/
... ... @@ -14,9 +17,13 @@ Component({
this.init();
}
},
hasMaster:{
hasMaster:{ //预订人+手机
type:Boolean,
value:false
},
hasListShare:{ //首页列表的预订人+分享
type:Boolean,
value:false
}
},
... ...
... ... @@ -38,7 +38,18 @@
{{masterMan}}
</view>
</view>
<view class="seller master flex-lr" wx:if="{{hasListShare}}">
<view class="flex-ll">
<view class="master-label">
预订人
</view>
<view class="master-man" style="margin-left: 20rpx;">{{detail.rname}}</view>
</view>
<view class="master-man">
<slot name="listshare"></slot>
</view>
</view>
<view>
<slot></slot>
<slot name="opt"></slot>
</view>
</view>
... ...
<!--components/userinfo/share.wxml-->
<block wx:if="{{!hasShare}}">
<userinfo binduserinfo="userinfo" class="share-but-view">
<userinfo binduserinfo="userinfo" class="share-but-view" catchtap="catchtap">
<slot></slot>
</userinfo>
</block>
<block wx:else="">
<button class="button-none" open-type="share" data-id="{{share.id}}">
<button class="button-none" open-type="share" data-id="{{share.id}}" catchtap="catchtap">
<slot></slot>
</button>
</block>
\ No newline at end of file
... ...
<button bindgetuserinfo="getUserInfoSuccess" open-type="getUserInfo" class="button-none">
<button bindgetuserinfo="getUserInfoSuccess" open-type="getUserInfo" class="button-none" catchtap="catchtap">
<slot></slot>
</button>
\ No newline at end of file
... ...
... ... @@ -18,7 +18,6 @@
</formids>
<userinfo-share
binduserinfo="userinfo"
bindshare="share"
share="{{detail}}">
<view class="opt-button">分享日程</view>
</userinfo-share>
... ...
... ... @@ -12,6 +12,7 @@ Page({
padding:[],
total:0,
},
ids:[],
/**
* 生命周期函数--监听页面加载
... ... @@ -47,11 +48,17 @@ Page({
onUnload: function () {
},
getListData(){
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return this.shareSetting();
},
getListData(fouce=false){
App.Reserve.GetListFromScheAndRes({
flag:this.data.tabFlag,
openid:getApp().openid,
}).then(res => {
},fouce).then(res => {
let data=this.formatList(res.data);
this.setData({
success:data.success,
... ... @@ -68,14 +75,17 @@ Page({
list.forEach(row=>{
row.rdateStr=util.unixtoTime(row.rdate,'MM月DD日 WW HH:II');
row.navigator=row.openid==openid?'detail_owner':'detail_customer';
row.hasOwner=getApp().openid==row.openid
let d=util.unixtoTime(row.rdate,'MM月DD日 DAY 星期WW');
typeof dlist[d]=='undefined'?dlist[d]=[]:'';
dlist[d].push(row);
this.ids.push(row.id);
})
}
return dlist;
},
formatList(res){
this.ids=[];
res.success=this._formatList(res.success);
res.padding=this._formatList(res.padding);
return res;
... ... @@ -87,20 +97,39 @@ Page({
this.getListData();
},
userinfo(e){
let id=e.target.dataset.id;
let type=e.target.dataset.type;
if(type=='padding'){
App.Reserve.SetRelaSuccess({
rid:id,
openid:getApp().openid
}).then(res=>{
this.getListData();
})
}else{
wx.navigateTo({
url:'invite?id='+id,
});
}
console.log('userinfo-share',e)
this.ids.forEach(id=>{
let us=this.selectComponent("#userinfo-share-"+id);
//console.log('userinfo-share',us)
us.init();
})
},
shareSetting(){
console.log('this.topicVal',this.topicVal)
if(this.topicVal && this.data.detail.openid==getApp().openid){
App.Reserve.SetTopicFromShare({
rid:this.id,
topic:this.topicVal
})
}
let nickname="";
try{
nickname=util.cache('userInfo').nickName;
}catch(e){}
return {
title: nickname+'给你发了一个邀请,点击查看',
path: '/pages/customer/index?id='+this.id+'&fromid='+getApp().openid+'&invite_name='+nickname,
}
},
accept(e){//同意
console.log('accept',e)
let id=e.target.dataset.id;
App.Reserve.SetRelaSuccess({
rid:id,
openid:getApp().openid,
is_agree:1,
}).then(res=>{
this.getListData(true);
})
}
})
\ No newline at end of file
... ...
... ... @@ -4,6 +4,7 @@
"navigationBarTitleText":"订个座儿",
"usingComponents": {
"userinfo": "/components/userinfo/userinfo",
"userinfo-share": "/components/userinfo/share",
"formids":"/components/formids/formids",
"nav":"/components/nav/nav",
"card":"/components/seller-card/seller-card"
... ...
... ... @@ -23,8 +23,17 @@
<block wx:for="{{part}}" wx:key="part.key" wx:for-item="detail">
<navigator url="/pages/customer/{{detail.navigator}}?id={{detail.id}}">
<view class="card">
<card hasMaster
seller="{{detail.seller}}" detail="{{detail}}"></card>
<card hasListShare
seller="{{detail.seller}}" detail="{{detail}}">
<view slot="listshare">
<userinfo-share
id="userinfo-share-{{detail.id}}"
binduserinfo="userinfo"
share="{{detail}}">
<view class="opt-button">{{detail.hasOwner?'邀请':'分享日程'}}</view>
</userinfo-share>
</view>
</card>
</view>
</navigator>
</block>
... ... @@ -37,8 +46,17 @@
<block wx:for="{{part}}" wx:key="part.key" wx:for-item="detail">
<navigator url="/pages/customer/{{detail.navigator}}?id={{detail.id}}">
<view class="card">
<card hasMaster
seller="{{detail.seller}}" detail="{{detail}}"></card>
<card hasListShare
seller="{{detail.seller}}" detail="{{detail}}">
<view slot="listshare">
<userinfo
id="userinfo-share-{{detail.id}}"
data-id="{{detail.id}}"
binduserinfo="accept">
<view class="opt-button">赴约</view>
</userinfo>
</view>
</card>
</view>
</navigator>
</block>
... ...
... ... @@ -93,4 +93,15 @@
}
.customers view{
margin-left: 14rpx;
}
.opt-button{
width: 120rpx;
height: 40rpx;
line-height: 40rpx;
font-size: 26rpx;
color:#262628;
border: 2rpx solid #262628;
text-align: center;
margin-left: 18rpx;
}
\ No newline at end of file
... ...
... ... @@ -8,7 +8,7 @@
"newFeature": true
},
"compileType": "miniprogram",
"libVersion": "2.2.3",
"libVersion": "2.3.0",
"appid": "wxd3dc4206c76f14fc",
"projectname": "xcx-book",
"isGameTourist": false,
... ...
... ... @@ -31,7 +31,7 @@ function unixtoTime(ns,format) {
var time = new Date(ns*1000);
//result=format || 'YYYY年MM月DD日 HH时II分SS秒 WW';
result=format || 'YYYY年MM月DD日';
console.log(format);
//console.log(format);
result=result.toUpperCase();
result=result.replace('YYYY',time.getFullYear());
var m=time.getMonth()+1;
... ... @@ -56,14 +56,18 @@ function unixtoTime(ns,format) {
}
result=result.replace('WW',week);
if(format.indexOf('DAY')>0){
var day = new Date();
//day.setDate(day.getDate());//今天
console.log('ns<day.getTime()',ns,day.getTime(),ns<day.getTime())
if(ns<day.getTime()){
// 获取当天 0 点的时间戳
var timeStamp = new Date(new Date().setHours(0, 0, 0, 0)) / 1000;
var day1 = timeStamp+86400//今天结束
var day2 = day1+86400//明天结束
//console.log('ns<day.getTime()',ns,day1,day2)
if(ns<day1){
result=result.replace('DAY','今天');
}else{
day.setDate(day.getDate() +1);//明天
if(ns<day.getTime()){
if(ns<day2){
result=result.replace('DAY','明天');
}else{
result=result.replace('DAY','');
... ...