Commit 5572271345447fdfd91138719d83975c77623919

Authored by vking
1 parent fe92130c

online

<!--components/seller-card/seller-card.wxml-->
<view class="card {{hasOnlineReserve?'online':''}}">
<formids url="/pages/reserve/detail?id={{seller.id}}" catchtap="">
<formids url="{{hasOnlineReserve?'':('/pages/reserve/detail?id='+seller.id)}}" catchtap="">
<view class="seller flex-lr">
<view class="flex-ll" style="max-width: {{hasShowStatus?'80%':'94%'}};">
<view class="avatar" wx:if="{{seller.seller_image}}">
... ... @@ -16,21 +16,23 @@
</view>
</view>
</formids>
<view class="context flex-lr" bindtap="tapEvent">
<view class="left info Medium">
<view class="label">时间</view>
<view class="value">{{rdateStr}}</view>
</view>
<view class="line"></view>
<view class="right info Medium" wx:if="{{hasOnlineReserve || (detail.type==1 && (detail.status==0 || detail.status==6))}}">
<view class="label">人数</view>
<view class="value">{{detail.pnum}}人包间</view>
</view>
<view class="right info Medium" wx:else="">
<view class="label">包间{{detail.tables.length>1?(" ("+detail.tables.length+"个)"):""}}</view>
<view class="value">{{tableFirst}}</view>
<formids bindclick="tapEvent">
<view class="context flex-lr">
<view class="left info Medium">
<view class="label">时间</view>
<view class="value">{{rdateStr}}</view>
</view>
<view class="line"></view>
<view class="right info Medium" wx:if="{{hasOnlineReserve || (detail.type==1 && (detail.status==0 || detail.status==6))}}">
<view class="label">人数</view>
<view class="value">{{detail.pnum}}人包间</view>
</view>
<view class="right info Medium" wx:else="">
<view class="label">包间{{detail.tables.length>1?(" ("+detail.tables.length+"个)"):""}}</view>
<view class="value">{{tableFirst}}</view>
</view>
</view>
</view>
</formids>
<view class="seller address flex-ll" catchtap="lookLocation" wx:if="{{hasAddress}}">
<view class="gps-icon">
<image src="http://qn.colorcun.com/custom/lite-yd/image/gps-icon.png"></image>
... ...
// pages/customer/list.js
import util from '../../utils/util';
import App from '../../utils/api';
const {regeneratorRuntime} = global
import TP from '../../utils/tpls';
Page({
/**
* 页面的初始数据
*/
data: {
success:[],
padding:[],
total:0,
success: [],
padding: [],
total: 0,
},
ids:[],
id:0,
tpls:TP.tpls(),
ids: [],
id: 0,
tpls: TP.tpls(),
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getListData();
this.getListData();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function (e) {
return this.shareSetting(e);
},
getListData(fouce=false){
App.Reserve.GetListFromScheAndRes({
flag:0,
openid:getApp().openid,
},fouce).then(res => {
let total=res.data.success.length + res.data.padding.length;
let data=this.formatList(res.data);
this.setData({
success:data.success,
padding:data.padding,
total:total
})
})
},
_formatList(list){
if(!list) return {};
let dlist={};
if(list.length>0){
let openid=getApp().openid;
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;
},
switchTab(e){
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function (e) {
return this.shareSetting(e);
},
getListData(fouce = false) {
App.Reserve.GetListFromScheAndRes({
flag: 0,
openid: getApp().openid,
}, fouce).then(res => {
let total = res.data.success.length + res.data.padding.length;
let data = this.formatList(res.data);
this.setData({
tabFlag:util.attr(e,'index')
success: data.success,
padding: data.padding,
total: total
})
})
},
_formatList(list) {
if (!list) return {};
let dlist = {};
if (list.length > 0) {
let openid = getApp().openid;
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);
})
this.getListData();
},
userinfo(e){
console.log('userinfo-share',e)
this.ids.forEach(id=>{
let us=this.selectComponent("#userinfo-share-"+id);
//console.log('userinfo-share',us)
us.init();
})
},
share(e){
this.id=e.target.id.replace('userinfo-share-','');
console.log('userinfo-share.share.id',this.id)
},
shareSetting(e){
console.log('shareSetting',e)
let id=e.target.dataset.id
//this.data.detail.openid==getApp().openid
let nickname="";
try{
nickname=util.cache('userInfo').nickName;
}catch(e){}
return {
//title: (nickname||'')+'给你发了一个邀请,点击查看',
title: this.tpls[0].shareTitle,
path: '/pages/customer/index?id='+id+'&fromid='+getApp().openid+'&invite_name='+nickname+'&hasInvitation=1&tplid=1',
imageUrl:this.tpls[0].shareImage,
}
},
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=>{
App.Reserve.Detail({
openid: getApp().openid,
rid: id
},'clear')
this.getListData(true);
})
}
return dlist;
},
formatList(res) {
this.ids = [];
res.success = this._formatList(res.success);
res.padding = this._formatList(res.padding);
return res;
},
switchTab(e) {
this.setData({
tabFlag: util.attr(e, 'index')
})
this.getListData();
},
userinfo(e) {
console.log('userinfo-share', e)
this.ids.forEach(id => {
let us = this.selectComponent("#userinfo-share-" + id);
//console.log('userinfo-share',us)
us.init();
})
},
share(e) {
this.id = e.target.id.replace('userinfo-share-', '');
console.log('userinfo-share.share.id', this.id)
},
shareSetting(e) {
console.log('shareSetting', e)
let id = e.target.dataset.id
//this.data.detail.openid==getApp().openid
let nickname = "";
try {
nickname = util.cache('userInfo').nickName;
} catch (e) {
}
return {
//title: (nickname||'')+'给你发了一个邀请,点击查看',
title: this.tpls[0].shareTitle,
path: '/pages/customer/index?id=' + id + '&fromid=' + getApp().openid + '&invite_name=' + nickname + '&hasInvitation=1&tplid=1',
imageUrl: this.tpls[0].shareImage,
}
},
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 => {
App.Reserve.Detail({
openid: getApp().openid,
rid: id
}, 'clear')
this.getListData(true);
})
},
gotoDetail(e){
let url='/pages/customer/'+e.detail.detail.navigator+'?id='+e.detail.detail.id
wx.navigateTo({
url:url,
})
},
})
\ No newline at end of file
... ...
... ... @@ -21,23 +21,21 @@
<view class="list-content" wx:if="{{part.length>0}}">
<view class="cate-class" style="margin-bottom: 40rpx;margin-left: 44rpx;">{{dateIndex}}</view>
<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 hasListShare
seller="{{detail.seller}}" detail="{{detail}}">
<view slot="listshare" style="height:52rpx;line-height:52rpx;margin-top:4rpx;">
<userinfo-share
id="userinfo-share-{{detail.id}}"
binduserinfo="userinfo"
bindshare="share"
share="{{detail}}">
<!--<view class="opt-button">{{detail.hasOwner?'邀请':'分享日程'}}</view>-->
<view class="opt-button">发邀请函</view>
</userinfo-share>
</view>
</card>
</view>
</navigator>
<view class="card">
<card hasListShare bindevent="gotoDetail"
seller="{{detail.seller}}" detail="{{detail}}">
<view slot="listshare" style="height:52rpx;line-height:52rpx;margin-top:4rpx;">
<userinfo-share
id="userinfo-share-{{detail.id}}"
binduserinfo="userinfo"
bindshare="share"
share="{{detail}}">
<!--<view class="opt-button">{{detail.hasOwner?'邀请':'分享日程'}}</view>-->
<view class="opt-button">发邀请函</view>
</userinfo-share>
</view>
</card>
</view>
</block>
</view>
</block>
... ... @@ -46,21 +44,19 @@
<view class="cate-class" style="margin-bottom: 26rpx;">待处理<text>({{part.length}}条)</text></view>
<view class="cate-class" style="margin-bottom: 40rpx;margin-top: 0;margin-left: 44rpx;">{{dateIndex}}</view>
<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 hasListShare
seller="{{detail.seller}}" detail="{{detail}}">
<view slot="listshare">
<userinfo wx:if="{{detail.status}}"
id="userinfo-share-{{detail.id}}"
data-id="{{detail.id}}"
binduserinfo="accept">
<view class="opt-button">赴约</view>
</userinfo>
</view>
</card>
</view>
</navigator>
<view class="card">
<card hasListShare bindevent="gotoDetail"
seller="{{detail.seller}}" detail="{{detail}}">
<view slot="listshare">
<userinfo wx:if="{{detail.status}}"
id="userinfo-share-{{detail.id}}"
data-id="{{detail.id}}"
binduserinfo="accept">
<view class="opt-button">赴约</view>
</userinfo>
</view>
</card>
</view>
</block>
</view>
</block>
... ...
// pages/customer/list.js
import util from '../../utils/util';
import App from '../../utils/api';
const {regeneratorRuntime} = global
Page({
... ... @@ -8,100 +9,105 @@ Page({
* 页面的初始数据
*/
data: {
success:[],
padding:[],
total:0,
success: [],
padding: [],
total: 0,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getListData();
this.getListData();
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
getListData(){
App.Reserve.GetListFromScheAndRes({
flag:1,
openid:getApp().openid,
}).then(res => {
let total=res.data.success.length+res.data.padding.length
let data=this.formatList(res.data);
this.setData({
success:data.success,
padding:data.padding,
total:total
})
})
},
_formatList(list){
if(!list) return {};
let dlist={};
if(list.length>0){
let openid=getApp().openid;
list.forEach(row=>{
row.rdateStr=util.unixtoTime(row.ddate,'MM月DD日 WW HH:II');
row.navigator=row.openid==openid?'detail_owner':'detail_customer';
let d=util.unixtoTime(row.rdate,'MM月DD日 DAY 星期WW');
typeof dlist[d]=='undefined'?dlist[d]=[]:'';
dlist[d].push(row);
})
}
return dlist;
},
formatList(res){
res.success=this._formatList(res.success);
res.padding=this._formatList(res.padding);
return res;
},
switchTab(e){
getListData() {
App.Reserve.GetListFromScheAndRes({
flag: 1,
openid: getApp().openid,
}).then(res => {
let total = res.data.success.length + res.data.padding.length
let data = this.formatList(res.data);
this.setData({
tabFlag:util.attr(e,'index')
success: data.success,
padding: data.padding,
total: total
})
})
},
_formatList(list) {
if (!list) return {};
let dlist = {};
if (list.length > 0) {
let openid = getApp().openid;
list.forEach(row => {
row.rdateStr = util.unixtoTime(row.ddate, 'MM月DD日 WW HH:II');
row.navigator = row.openid == openid ? 'detail_owner' : 'detail_customer';
let d = util.unixtoTime(row.rdate, 'MM月DD日 DAY 星期WW');
typeof dlist[d] == 'undefined' ? dlist[d] = [] : '';
dlist[d].push(row);
})
}
return dlist;
},
formatList(res) {
res.success = this._formatList(res.success);
res.padding = this._formatList(res.padding);
return res;
},
switchTab(e) {
this.setData({
tabFlag: util.attr(e, 'index')
})
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();
},
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,
});
}
})
} else {
wx.navigateTo({
url: 'invite?id=' + id,
});
}
},
gotoDetail(e){
let url='/pages/customer/'+e.detail.detail.navigator+'?id='+e.detail.detail.id
wx.navigateTo({
url:url,
})
},
})
\ No newline at end of file
... ...
... ... @@ -11,13 +11,11 @@
<block wx:for="{{success}}" 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">
<navigator url="/pages/customer/{{detail.navigator}}?id={{detail.id}}">
<view class="card">
<card
hasShowStatus
seller="{{detail.seller}}" detail="{{detail}}"></card>
</view>
</navigator>
<view class="card">
<card
hasShowStatus bindevent="gotoDetail"
seller="{{detail.seller}}" detail="{{detail}}"></card>
</view>
</block>
</view>
</block>
... ...