Commit 5572271345447fdfd91138719d83975c77623919

Authored by vking
1 parent fe92130c

online

1 <!--components/seller-card/seller-card.wxml--> 1 <!--components/seller-card/seller-card.wxml-->
2 <view class="card {{hasOnlineReserve?'online':''}}"> 2 <view class="card {{hasOnlineReserve?'online':''}}">
3 - <formids url="/pages/reserve/detail?id={{seller.id}}" catchtap=""> 3 + <formids url="{{hasOnlineReserve?'':('/pages/reserve/detail?id='+seller.id)}}" catchtap="">
4 <view class="seller flex-lr"> 4 <view class="seller flex-lr">
5 <view class="flex-ll" style="max-width: {{hasShowStatus?'80%':'94%'}};"> 5 <view class="flex-ll" style="max-width: {{hasShowStatus?'80%':'94%'}};">
6 <view class="avatar" wx:if="{{seller.seller_image}}"> 6 <view class="avatar" wx:if="{{seller.seller_image}}">
@@ -16,21 +16,23 @@ @@ -16,21 +16,23 @@
16 </view> 16 </view>
17 </view> 17 </view>
18 </formids> 18 </formids>
19 - <view class="context flex-lr" bindtap="tapEvent">  
20 - <view class="left info Medium">  
21 - <view class="label">时间</view>  
22 - <view class="value">{{rdateStr}}</view>  
23 - </view>  
24 - <view class="line"></view>  
25 - <view class="right info Medium" wx:if="{{hasOnlineReserve || (detail.type==1 && (detail.status==0 || detail.status==6))}}">  
26 - <view class="label">人数</view>  
27 - <view class="value">{{detail.pnum}}人包间</view>  
28 - </view>  
29 - <view class="right info Medium" wx:else="">  
30 - <view class="label">包间{{detail.tables.length>1?(" ("+detail.tables.length+"个)"):""}}</view>  
31 - <view class="value">{{tableFirst}}</view> 19 + <formids bindclick="tapEvent">
  20 + <view class="context flex-lr">
  21 + <view class="left info Medium">
  22 + <view class="label">时间</view>
  23 + <view class="value">{{rdateStr}}</view>
  24 + </view>
  25 + <view class="line"></view>
  26 + <view class="right info Medium" wx:if="{{hasOnlineReserve || (detail.type==1 && (detail.status==0 || detail.status==6))}}">
  27 + <view class="label">人数</view>
  28 + <view class="value">{{detail.pnum}}人包间</view>
  29 + </view>
  30 + <view class="right info Medium" wx:else="">
  31 + <view class="label">包间{{detail.tables.length>1?(" ("+detail.tables.length+"个)"):""}}</view>
  32 + <view class="value">{{tableFirst}}</view>
  33 + </view>
32 </view> 34 </view>
33 - </view> 35 + </formids>
34 <view class="seller address flex-ll" catchtap="lookLocation" wx:if="{{hasAddress}}"> 36 <view class="seller address flex-ll" catchtap="lookLocation" wx:if="{{hasAddress}}">
35 <view class="gps-icon"> 37 <view class="gps-icon">
36 <image src="http://qn.colorcun.com/custom/lite-yd/image/gps-icon.png"></image> 38 <image src="http://qn.colorcun.com/custom/lite-yd/image/gps-icon.png"></image>
1 // pages/customer/list.js 1 // pages/customer/list.js
2 import util from '../../utils/util'; 2 import util from '../../utils/util';
3 import App from '../../utils/api'; 3 import App from '../../utils/api';
  4 +
4 const {regeneratorRuntime} = global 5 const {regeneratorRuntime} = global
5 import TP from '../../utils/tpls'; 6 import TP from '../../utils/tpls';
  7 +
6 Page({ 8 Page({
7 9
8 /** 10 /**
9 * 页面的初始数据 11 * 页面的初始数据
10 */ 12 */
11 data: { 13 data: {
12 - success:[],  
13 - padding:[],  
14 - total:0, 14 + success: [],
  15 + padding: [],
  16 + total: 0,
15 }, 17 },
16 - ids:[],  
17 - id:0,  
18 - tpls:TP.tpls(), 18 + ids: [],
  19 + id: 0,
  20 + tpls: TP.tpls(),
19 /** 21 /**
20 * 生命周期函数--监听页面加载 22 * 生命周期函数--监听页面加载
21 */ 23 */
22 onLoad: function (options) { 24 onLoad: function (options) {
23 - 25 +
24 }, 26 },
25 27
26 /** 28 /**
27 * 生命周期函数--监听页面初次渲染完成 29 * 生命周期函数--监听页面初次渲染完成
28 */ 30 */
29 onReady: function () { 31 onReady: function () {
30 - 32 +
31 }, 33 },
32 34
33 /** 35 /**
34 * 生命周期函数--监听页面显示 36 * 生命周期函数--监听页面显示
35 */ 37 */
36 onShow: function () { 38 onShow: function () {
37 - this.getListData(); 39 + this.getListData();
38 }, 40 },
39 41
40 /** 42 /**
41 * 生命周期函数--监听页面隐藏 43 * 生命周期函数--监听页面隐藏
42 */ 44 */
43 onHide: function () { 45 onHide: function () {
44 - 46 +
45 }, 47 },
46 48
47 /** 49 /**
48 * 生命周期函数--监听页面卸载 50 * 生命周期函数--监听页面卸载
49 */ 51 */
50 onUnload: function () { 52 onUnload: function () {
51 -  
52 - },  
53 - /**  
54 - * 用户点击右上角分享  
55 - */  
56 - onShareAppMessage: function (e) {  
57 - return this.shareSetting(e);  
58 - },  
59 - getListData(fouce=false){  
60 - App.Reserve.GetListFromScheAndRes({  
61 - flag:0,  
62 - openid:getApp().openid,  
63 - },fouce).then(res => {  
64 - let total=res.data.success.length + res.data.padding.length;  
65 - let data=this.formatList(res.data);  
66 - this.setData({  
67 - success:data.success,  
68 - padding:data.padding,  
69 - total:total  
70 - })  
71 - })  
72 - },  
73 - _formatList(list){  
74 - if(!list) return {};  
75 - let dlist={};  
76 - if(list.length>0){  
77 - let openid=getApp().openid;  
78 - list.forEach(row=>{  
79 - row.rdateStr=util.unixtoTime(row.rdate,'MM月DD日 WW HH:II');  
80 - row.navigator=row.openid==openid?'detail_owner':'detail_customer';  
81 - row.hasOwner=getApp().openid==row.openid  
82 - let d=util.unixtoTime(row.rdate,'MM月DD日 DAY 星期WW');  
83 - typeof dlist[d]=='undefined'?dlist[d]=[]:'';  
84 - dlist[d].push(row);  
85 - this.ids.push(row.id);  
86 - })  
87 - }  
88 - return dlist;  
89 - },  
90 - formatList(res){  
91 - this.ids=[];  
92 - res.success=this._formatList(res.success);  
93 - res.padding=this._formatList(res.padding);  
94 - return res;  
95 - },  
96 - switchTab(e){ 53 +
  54 + },
  55 + /**
  56 + * 用户点击右上角分享
  57 + */
  58 + onShareAppMessage: function (e) {
  59 + return this.shareSetting(e);
  60 + },
  61 + getListData(fouce = false) {
  62 + App.Reserve.GetListFromScheAndRes({
  63 + flag: 0,
  64 + openid: getApp().openid,
  65 + }, fouce).then(res => {
  66 + let total = res.data.success.length + res.data.padding.length;
  67 + let data = this.formatList(res.data);
97 this.setData({ 68 this.setData({
98 - tabFlag:util.attr(e,'index') 69 + success: data.success,
  70 + padding: data.padding,
  71 + total: total
  72 + })
  73 + })
  74 + },
  75 + _formatList(list) {
  76 + if (!list) return {};
  77 + let dlist = {};
  78 + if (list.length > 0) {
  79 + let openid = getApp().openid;
  80 + list.forEach(row => {
  81 + row.rdateStr = util.unixtoTime(row.rdate, 'MM月DD日 WW HH:II');
  82 + row.navigator = row.openid == openid ? 'detail_owner' : 'detail_customer';
  83 + row.hasOwner = getApp().openid == row.openid
  84 + let d = util.unixtoTime(row.rdate, 'MM月DD日 DAY 星期WW');
  85 + typeof dlist[d] == 'undefined' ? dlist[d] = [] : '';
  86 + dlist[d].push(row);
  87 + this.ids.push(row.id);
99 }) 88 })
100 - this.getListData();  
101 - },  
102 - userinfo(e){  
103 - console.log('userinfo-share',e)  
104 - this.ids.forEach(id=>{  
105 - let us=this.selectComponent("#userinfo-share-"+id);  
106 - //console.log('userinfo-share',us)  
107 - us.init();  
108 - })  
109 - },  
110 - share(e){  
111 - this.id=e.target.id.replace('userinfo-share-','');  
112 - console.log('userinfo-share.share.id',this.id)  
113 - },  
114 - shareSetting(e){  
115 - console.log('shareSetting',e)  
116 - let id=e.target.dataset.id  
117 - //this.data.detail.openid==getApp().openid  
118 - let nickname="";  
119 - try{  
120 - nickname=util.cache('userInfo').nickName;  
121 - }catch(e){}  
122 - return {  
123 - //title: (nickname||'')+'给你发了一个邀请,点击查看',  
124 - title: this.tpls[0].shareTitle,  
125 - path: '/pages/customer/index?id='+id+'&fromid='+getApp().openid+'&invite_name='+nickname+'&hasInvitation=1&tplid=1',  
126 - imageUrl:this.tpls[0].shareImage,  
127 - }  
128 - },  
129 - accept(e){//同意  
130 - console.log('accept',e)  
131 - let id=e.target.dataset.id;  
132 - App.Reserve.SetRelaSuccess({  
133 - rid:id,  
134 - openid:getApp().openid,  
135 - is_agree:1,  
136 - }).then(res=>{  
137 - App.Reserve.Detail({  
138 - openid: getApp().openid,  
139 - rid: id  
140 - },'clear')  
141 - this.getListData(true);  
142 - })  
143 } 89 }
  90 + return dlist;
  91 + },
  92 + formatList(res) {
  93 + this.ids = [];
  94 + res.success = this._formatList(res.success);
  95 + res.padding = this._formatList(res.padding);
  96 + return res;
  97 + },
  98 + switchTab(e) {
  99 + this.setData({
  100 + tabFlag: util.attr(e, 'index')
  101 + })
  102 + this.getListData();
  103 + },
  104 + userinfo(e) {
  105 + console.log('userinfo-share', e)
  106 + this.ids.forEach(id => {
  107 + let us = this.selectComponent("#userinfo-share-" + id);
  108 + //console.log('userinfo-share',us)
  109 + us.init();
  110 + })
  111 + },
  112 + share(e) {
  113 + this.id = e.target.id.replace('userinfo-share-', '');
  114 + console.log('userinfo-share.share.id', this.id)
  115 + },
  116 + shareSetting(e) {
  117 + console.log('shareSetting', e)
  118 + let id = e.target.dataset.id
  119 + //this.data.detail.openid==getApp().openid
  120 + let nickname = "";
  121 + try {
  122 + nickname = util.cache('userInfo').nickName;
  123 + } catch (e) {
  124 + }
  125 + return {
  126 + //title: (nickname||'')+'给你发了一个邀请,点击查看',
  127 + title: this.tpls[0].shareTitle,
  128 + path: '/pages/customer/index?id=' + id + '&fromid=' + getApp().openid + '&invite_name=' + nickname + '&hasInvitation=1&tplid=1',
  129 + imageUrl: this.tpls[0].shareImage,
  130 + }
  131 + },
  132 + accept(e) {//同意
  133 + console.log('accept', e)
  134 + let id = e.target.dataset.id;
  135 + App.Reserve.SetRelaSuccess({
  136 + rid: id,
  137 + openid: getApp().openid,
  138 + is_agree: 1,
  139 + }).then(res => {
  140 + App.Reserve.Detail({
  141 + openid: getApp().openid,
  142 + rid: id
  143 + }, 'clear')
  144 + this.getListData(true);
  145 + })
  146 + },
  147 + gotoDetail(e){
  148 + let url='/pages/customer/'+e.detail.detail.navigator+'?id='+e.detail.detail.id
  149 + wx.navigateTo({
  150 + url:url,
  151 + })
  152 + },
144 }) 153 })
@@ -21,23 +21,21 @@ @@ -21,23 +21,21 @@
21 <view class="list-content" wx:if="{{part.length>0}}"> 21 <view class="list-content" wx:if="{{part.length>0}}">
22 <view class="cate-class" style="margin-bottom: 40rpx;margin-left: 44rpx;">{{dateIndex}}</view> 22 <view class="cate-class" style="margin-bottom: 40rpx;margin-left: 44rpx;">{{dateIndex}}</view>
23 <block wx:for="{{part}}" wx:key="part.key" wx:for-item="detail"> 23 <block wx:for="{{part}}" wx:key="part.key" wx:for-item="detail">
24 - <navigator url="/pages/customer/{{detail.navigator}}?id={{detail.id}}">  
25 - <view class="card">  
26 - <card hasListShare  
27 - seller="{{detail.seller}}" detail="{{detail}}">  
28 - <view slot="listshare" style="height:52rpx;line-height:52rpx;margin-top:4rpx;">  
29 - <userinfo-share  
30 - id="userinfo-share-{{detail.id}}"  
31 - binduserinfo="userinfo"  
32 - bindshare="share"  
33 - share="{{detail}}">  
34 - <!--<view class="opt-button">{{detail.hasOwner?'邀请':'分享日程'}}</view>-->  
35 - <view class="opt-button">发邀请函</view>  
36 - </userinfo-share>  
37 - </view>  
38 - </card>  
39 - </view>  
40 - </navigator> 24 + <view class="card">
  25 + <card hasListShare bindevent="gotoDetail"
  26 + seller="{{detail.seller}}" detail="{{detail}}">
  27 + <view slot="listshare" style="height:52rpx;line-height:52rpx;margin-top:4rpx;">
  28 + <userinfo-share
  29 + id="userinfo-share-{{detail.id}}"
  30 + binduserinfo="userinfo"
  31 + bindshare="share"
  32 + share="{{detail}}">
  33 + <!--<view class="opt-button">{{detail.hasOwner?'邀请':'分享日程'}}</view>-->
  34 + <view class="opt-button">发邀请函</view>
  35 + </userinfo-share>
  36 + </view>
  37 + </card>
  38 + </view>
41 </block> 39 </block>
42 </view> 40 </view>
43 </block> 41 </block>
@@ -46,21 +44,19 @@ @@ -46,21 +44,19 @@
46 <view class="cate-class" style="margin-bottom: 26rpx;">待处理<text>({{part.length}}条)</text></view> 44 <view class="cate-class" style="margin-bottom: 26rpx;">待处理<text>({{part.length}}条)</text></view>
47 <view class="cate-class" style="margin-bottom: 40rpx;margin-top: 0;margin-left: 44rpx;">{{dateIndex}}</view> 45 <view class="cate-class" style="margin-bottom: 40rpx;margin-top: 0;margin-left: 44rpx;">{{dateIndex}}</view>
48 <block wx:for="{{part}}" wx:key="part.key" wx:for-item="detail"> 46 <block wx:for="{{part}}" wx:key="part.key" wx:for-item="detail">
49 - <navigator url="/pages/customer/{{detail.navigator}}?id={{detail.id}}">  
50 - <view class="card">  
51 - <card hasListShare  
52 - seller="{{detail.seller}}" detail="{{detail}}">  
53 - <view slot="listshare">  
54 - <userinfo wx:if="{{detail.status}}"  
55 - id="userinfo-share-{{detail.id}}"  
56 - data-id="{{detail.id}}"  
57 - binduserinfo="accept">  
58 - <view class="opt-button">赴约</view>  
59 - </userinfo>  
60 - </view>  
61 - </card>  
62 - </view>  
63 - </navigator> 47 + <view class="card">
  48 + <card hasListShare bindevent="gotoDetail"
  49 + seller="{{detail.seller}}" detail="{{detail}}">
  50 + <view slot="listshare">
  51 + <userinfo wx:if="{{detail.status}}"
  52 + id="userinfo-share-{{detail.id}}"
  53 + data-id="{{detail.id}}"
  54 + binduserinfo="accept">
  55 + <view class="opt-button">赴约</view>
  56 + </userinfo>
  57 + </view>
  58 + </card>
  59 + </view>
64 </block> 60 </block>
65 </view> 61 </view>
66 </block> 62 </block>
1 // pages/customer/list.js 1 // pages/customer/list.js
2 import util from '../../utils/util'; 2 import util from '../../utils/util';
3 import App from '../../utils/api'; 3 import App from '../../utils/api';
  4 +
4 const {regeneratorRuntime} = global 5 const {regeneratorRuntime} = global
5 Page({ 6 Page({
6 7
@@ -8,100 +9,105 @@ Page({ @@ -8,100 +9,105 @@ Page({
8 * 页面的初始数据 9 * 页面的初始数据
9 */ 10 */
10 data: { 11 data: {
11 - success:[],  
12 - padding:[],  
13 - total:0, 12 + success: [],
  13 + padding: [],
  14 + total: 0,
14 }, 15 },
15 16
16 /** 17 /**
17 * 生命周期函数--监听页面加载 18 * 生命周期函数--监听页面加载
18 */ 19 */
19 onLoad: function (options) { 20 onLoad: function (options) {
20 - 21 +
21 }, 22 },
22 23
23 /** 24 /**
24 * 生命周期函数--监听页面初次渲染完成 25 * 生命周期函数--监听页面初次渲染完成
25 */ 26 */
26 onReady: function () { 27 onReady: function () {
27 - 28 +
28 }, 29 },
29 30
30 /** 31 /**
31 * 生命周期函数--监听页面显示 32 * 生命周期函数--监听页面显示
32 */ 33 */
33 onShow: function () { 34 onShow: function () {
34 - this.getListData(); 35 + this.getListData();
35 }, 36 },
36 37
37 /** 38 /**
38 * 生命周期函数--监听页面隐藏 39 * 生命周期函数--监听页面隐藏
39 */ 40 */
40 onHide: function () { 41 onHide: function () {
41 - 42 +
42 }, 43 },
43 44
44 /** 45 /**
45 * 生命周期函数--监听页面卸载 46 * 生命周期函数--监听页面卸载
46 */ 47 */
47 onUnload: function () { 48 onUnload: function () {
48 - 49 +
49 }, 50 },
50 - getListData(){  
51 - App.Reserve.GetListFromScheAndRes({  
52 - flag:1,  
53 - openid:getApp().openid,  
54 - }).then(res => {  
55 - let total=res.data.success.length+res.data.padding.length  
56 - let data=this.formatList(res.data);  
57 - this.setData({  
58 - success:data.success,  
59 - padding:data.padding,  
60 - total:total  
61 - })  
62 - })  
63 - },  
64 - _formatList(list){  
65 - if(!list) return {};  
66 - let dlist={};  
67 - if(list.length>0){  
68 - let openid=getApp().openid;  
69 - list.forEach(row=>{  
70 - row.rdateStr=util.unixtoTime(row.ddate,'MM月DD日 WW HH:II');  
71 - row.navigator=row.openid==openid?'detail_owner':'detail_customer';  
72 - let d=util.unixtoTime(row.rdate,'MM月DD日 DAY 星期WW');  
73 - typeof dlist[d]=='undefined'?dlist[d]=[]:'';  
74 - dlist[d].push(row);  
75 - })  
76 - }  
77 - return dlist;  
78 - },  
79 - formatList(res){  
80 - res.success=this._formatList(res.success);  
81 - res.padding=this._formatList(res.padding);  
82 - return res;  
83 - },  
84 - switchTab(e){ 51 + getListData() {
  52 + App.Reserve.GetListFromScheAndRes({
  53 + flag: 1,
  54 + openid: getApp().openid,
  55 + }).then(res => {
  56 + let total = res.data.success.length + res.data.padding.length
  57 + let data = this.formatList(res.data);
85 this.setData({ 58 this.setData({
86 - tabFlag:util.attr(e,'index') 59 + success: data.success,
  60 + padding: data.padding,
  61 + total: total
  62 + })
  63 + })
  64 + },
  65 + _formatList(list) {
  66 + if (!list) return {};
  67 + let dlist = {};
  68 + if (list.length > 0) {
  69 + let openid = getApp().openid;
  70 + list.forEach(row => {
  71 + row.rdateStr = util.unixtoTime(row.ddate, 'MM月DD日 WW HH:II');
  72 + row.navigator = row.openid == openid ? 'detail_owner' : 'detail_customer';
  73 + let d = util.unixtoTime(row.rdate, 'MM月DD日 DAY 星期WW');
  74 + typeof dlist[d] == 'undefined' ? dlist[d] = [] : '';
  75 + dlist[d].push(row);
87 }) 76 })
  77 + }
  78 + return dlist;
  79 + },
  80 + formatList(res) {
  81 + res.success = this._formatList(res.success);
  82 + res.padding = this._formatList(res.padding);
  83 + return res;
  84 + },
  85 + switchTab(e) {
  86 + this.setData({
  87 + tabFlag: util.attr(e, 'index')
  88 + })
  89 + this.getListData();
  90 + },
  91 + userinfo(e) {
  92 + let id = e.target.dataset.id;
  93 + let type = e.target.dataset.type;
  94 + if (type == 'padding') {
  95 + App.Reserve.SetRelaSuccess({
  96 + rid: id,
  97 + openid: getApp().openid
  98 + }).then(res => {
88 this.getListData(); 99 this.getListData();
89 - },  
90 - userinfo(e){  
91 - let id=e.target.dataset.id;  
92 - let type=e.target.dataset.type;  
93 - if(type=='padding'){  
94 - App.Reserve.SetRelaSuccess({  
95 - rid:id,  
96 - openid:getApp().openid  
97 - }).then(res=>{  
98 - this.getListData();  
99 - })  
100 - }else{  
101 - wx.navigateTo({  
102 - url:'invite?id='+id,  
103 - });  
104 - }  
105 - 100 + })
  101 + } else {
  102 + wx.navigateTo({
  103 + url: 'invite?id=' + id,
  104 + });
106 } 105 }
  106 + },
  107 + gotoDetail(e){
  108 + let url='/pages/customer/'+e.detail.detail.navigator+'?id='+e.detail.detail.id
  109 + wx.navigateTo({
  110 + url:url,
  111 + })
  112 + },
107 }) 113 })
@@ -11,13 +11,11 @@ @@ -11,13 +11,11 @@
11 <block wx:for="{{success}}" wx:key="success.key" wx:for-item="part" wx:for-index="dateIndex"> 11 <block wx:for="{{success}}" wx:key="success.key" wx:for-item="part" wx:for-index="dateIndex">
12 <view class="list-content" wx:if="{{part.length>0}}"> 12 <view class="list-content" wx:if="{{part.length>0}}">
13 <block wx:for="{{part}}" wx:key="part.key" wx:for-item="detail"> 13 <block wx:for="{{part}}" wx:key="part.key" wx:for-item="detail">
14 - <navigator url="/pages/customer/{{detail.navigator}}?id={{detail.id}}">  
15 - <view class="card">  
16 - <card  
17 - hasShowStatus  
18 - seller="{{detail.seller}}" detail="{{detail}}"></card>  
19 - </view>  
20 - </navigator> 14 + <view class="card">
  15 + <card
  16 + hasShowStatus bindevent="gotoDetail"
  17 + seller="{{detail.seller}}" detail="{{detail}}"></card>
  18 + </view>
21 </block> 19 </block>
22 </view> 20 </view>
23 </block> 21 </block>