Showing
11 changed files
with
115 additions
and
35 deletions
| 1 | // components/seller-card/seller-card.js | 1 | // components/seller-card/seller-card.js |
| 2 | import util from '../../utils/util'; | 2 | import util from '../../utils/util'; |
| 3 | Component({ | 3 | Component({ |
| 4 | + options: { | ||
| 5 | + multipleSlots: true // 在组件定义时的选项中启用多slot支持 | ||
| 6 | + }, | ||
| 4 | /** | 7 | /** |
| 5 | * 组件的属性列表 | 8 | * 组件的属性列表 |
| 6 | */ | 9 | */ |
| @@ -14,9 +17,13 @@ Component({ | @@ -14,9 +17,13 @@ Component({ | ||
| 14 | this.init(); | 17 | this.init(); |
| 15 | } | 18 | } |
| 16 | }, | 19 | }, |
| 17 | - hasMaster:{ | 20 | + hasMaster:{ //预订人+手机 |
| 18 | type:Boolean, | 21 | type:Boolean, |
| 19 | value:false | 22 | value:false |
| 23 | + }, | ||
| 24 | + hasListShare:{ //首页列表的预订人+分享 | ||
| 25 | + type:Boolean, | ||
| 26 | + value:false | ||
| 20 | } | 27 | } |
| 21 | }, | 28 | }, |
| 22 | 29 |
| @@ -38,7 +38,18 @@ | @@ -38,7 +38,18 @@ | ||
| 38 | {{masterMan}} | 38 | {{masterMan}} |
| 39 | </view> | 39 | </view> |
| 40 | </view> | 40 | </view> |
| 41 | + <view class="seller master flex-lr" wx:if="{{hasListShare}}"> | ||
| 42 | + <view class="flex-ll"> | ||
| 43 | + <view class="master-label"> | ||
| 44 | + 预订人 | ||
| 45 | + </view> | ||
| 46 | + <view class="master-man" style="margin-left: 20rpx;">{{detail.rname}}</view> | ||
| 47 | + </view> | ||
| 48 | + <view class="master-man"> | ||
| 49 | + <slot name="listshare"></slot> | ||
| 50 | + </view> | ||
| 51 | + </view> | ||
| 41 | <view> | 52 | <view> |
| 42 | - <slot></slot> | 53 | + <slot name="opt"></slot> |
| 43 | </view> | 54 | </view> |
| 44 | </view> | 55 | </view> |
| 1 | <!--components/userinfo/share.wxml--> | 1 | <!--components/userinfo/share.wxml--> |
| 2 | <block wx:if="{{!hasShare}}"> | 2 | <block wx:if="{{!hasShare}}"> |
| 3 | - <userinfo binduserinfo="userinfo" class="share-but-view"> | 3 | + <userinfo binduserinfo="userinfo" class="share-but-view" catchtap="catchtap"> |
| 4 | <slot></slot> | 4 | <slot></slot> |
| 5 | </userinfo> | 5 | </userinfo> |
| 6 | </block> | 6 | </block> |
| 7 | <block wx:else=""> | 7 | <block wx:else=""> |
| 8 | - <button class="button-none" open-type="share" data-id="{{share.id}}"> | 8 | + <button class="button-none" open-type="share" data-id="{{share.id}}" catchtap="catchtap"> |
| 9 | <slot></slot> | 9 | <slot></slot> |
| 10 | </button> | 10 | </button> |
| 11 | </block> | 11 | </block> |
| @@ -18,7 +18,6 @@ | @@ -18,7 +18,6 @@ | ||
| 18 | </formids> | 18 | </formids> |
| 19 | <userinfo-share | 19 | <userinfo-share |
| 20 | binduserinfo="userinfo" | 20 | binduserinfo="userinfo" |
| 21 | - bindshare="share" | ||
| 22 | share="{{detail}}"> | 21 | share="{{detail}}"> |
| 23 | <view class="opt-button">分享日程</view> | 22 | <view class="opt-button">分享日程</view> |
| 24 | </userinfo-share> | 23 | </userinfo-share> |
| @@ -12,6 +12,7 @@ Page({ | @@ -12,6 +12,7 @@ Page({ | ||
| 12 | padding:[], | 12 | padding:[], |
| 13 | total:0, | 13 | total:0, |
| 14 | }, | 14 | }, |
| 15 | + ids:[], | ||
| 15 | 16 | ||
| 16 | /** | 17 | /** |
| 17 | * 生命周期函数--监听页面加载 | 18 | * 生命周期函数--监听页面加载 |
| @@ -47,11 +48,17 @@ Page({ | @@ -47,11 +48,17 @@ Page({ | ||
| 47 | onUnload: function () { | 48 | onUnload: function () { |
| 48 | 49 | ||
| 49 | }, | 50 | }, |
| 50 | - getListData(){ | 51 | + /** |
| 52 | + * 用户点击右上角分享 | ||
| 53 | + */ | ||
| 54 | + onShareAppMessage: function () { | ||
| 55 | + return this.shareSetting(); | ||
| 56 | + }, | ||
| 57 | + getListData(fouce=false){ | ||
| 51 | App.Reserve.GetListFromScheAndRes({ | 58 | App.Reserve.GetListFromScheAndRes({ |
| 52 | flag:this.data.tabFlag, | 59 | flag:this.data.tabFlag, |
| 53 | openid:getApp().openid, | 60 | openid:getApp().openid, |
| 54 | - }).then(res => { | 61 | + },fouce).then(res => { |
| 55 | let data=this.formatList(res.data); | 62 | let data=this.formatList(res.data); |
| 56 | this.setData({ | 63 | this.setData({ |
| 57 | success:data.success, | 64 | success:data.success, |
| @@ -68,14 +75,17 @@ Page({ | @@ -68,14 +75,17 @@ Page({ | ||
| 68 | list.forEach(row=>{ | 75 | list.forEach(row=>{ |
| 69 | row.rdateStr=util.unixtoTime(row.rdate,'MM月DD日 WW HH:II'); | 76 | row.rdateStr=util.unixtoTime(row.rdate,'MM月DD日 WW HH:II'); |
| 70 | row.navigator=row.openid==openid?'detail_owner':'detail_customer'; | 77 | row.navigator=row.openid==openid?'detail_owner':'detail_customer'; |
| 78 | + row.hasOwner=getApp().openid==row.openid | ||
| 71 | let d=util.unixtoTime(row.rdate,'MM月DD日 DAY 星期WW'); | 79 | let d=util.unixtoTime(row.rdate,'MM月DD日 DAY 星期WW'); |
| 72 | typeof dlist[d]=='undefined'?dlist[d]=[]:''; | 80 | typeof dlist[d]=='undefined'?dlist[d]=[]:''; |
| 73 | dlist[d].push(row); | 81 | dlist[d].push(row); |
| 82 | + this.ids.push(row.id); | ||
| 74 | }) | 83 | }) |
| 75 | } | 84 | } |
| 76 | return dlist; | 85 | return dlist; |
| 77 | }, | 86 | }, |
| 78 | formatList(res){ | 87 | formatList(res){ |
| 88 | + this.ids=[]; | ||
| 79 | res.success=this._formatList(res.success); | 89 | res.success=this._formatList(res.success); |
| 80 | res.padding=this._formatList(res.padding); | 90 | res.padding=this._formatList(res.padding); |
| 81 | return res; | 91 | return res; |
| @@ -87,20 +97,39 @@ Page({ | @@ -87,20 +97,39 @@ Page({ | ||
| 87 | this.getListData(); | 97 | this.getListData(); |
| 88 | }, | 98 | }, |
| 89 | userinfo(e){ | 99 | userinfo(e){ |
| 90 | - let id=e.target.dataset.id; | ||
| 91 | - let type=e.target.dataset.type; | ||
| 92 | - if(type=='padding'){ | ||
| 93 | - App.Reserve.SetRelaSuccess({ | ||
| 94 | - rid:id, | ||
| 95 | - openid:getApp().openid | ||
| 96 | - }).then(res=>{ | ||
| 97 | - this.getListData(); | ||
| 98 | - }) | ||
| 99 | - }else{ | ||
| 100 | - wx.navigateTo({ | ||
| 101 | - url:'invite?id='+id, | ||
| 102 | - }); | ||
| 103 | - } | ||
| 104 | - | 100 | + console.log('userinfo-share',e) |
| 101 | + this.ids.forEach(id=>{ | ||
| 102 | + let us=this.selectComponent("#userinfo-share-"+id); | ||
| 103 | + //console.log('userinfo-share',us) | ||
| 104 | + us.init(); | ||
| 105 | + }) | ||
| 106 | + }, | ||
| 107 | + shareSetting(){ | ||
| 108 | + console.log('this.topicVal',this.topicVal) | ||
| 109 | + if(this.topicVal && this.data.detail.openid==getApp().openid){ | ||
| 110 | + App.Reserve.SetTopicFromShare({ | ||
| 111 | + rid:this.id, | ||
| 112 | + topic:this.topicVal | ||
| 113 | + }) | ||
| 114 | + } | ||
| 115 | + let nickname=""; | ||
| 116 | + try{ | ||
| 117 | + nickname=util.cache('userInfo').nickName; | ||
| 118 | + }catch(e){} | ||
| 119 | + return { | ||
| 120 | + title: nickname+'给你发了一个邀请,点击查看', | ||
| 121 | + path: '/pages/customer/index?id='+this.id+'&fromid='+getApp().openid+'&invite_name='+nickname, | ||
| 122 | + } | ||
| 123 | + }, | ||
| 124 | + accept(e){//同意 | ||
| 125 | + console.log('accept',e) | ||
| 126 | + let id=e.target.dataset.id; | ||
| 127 | + App.Reserve.SetRelaSuccess({ | ||
| 128 | + rid:id, | ||
| 129 | + openid:getApp().openid, | ||
| 130 | + is_agree:1, | ||
| 131 | + }).then(res=>{ | ||
| 132 | + this.getListData(true); | ||
| 133 | + }) | ||
| 105 | } | 134 | } |
| 106 | }) | 135 | }) |
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | "navigationBarTitleText":"订个座儿", | 4 | "navigationBarTitleText":"订个座儿", |
| 5 | "usingComponents": { | 5 | "usingComponents": { |
| 6 | "userinfo": "/components/userinfo/userinfo", | 6 | "userinfo": "/components/userinfo/userinfo", |
| 7 | + "userinfo-share": "/components/userinfo/share", | ||
| 7 | "formids":"/components/formids/formids", | 8 | "formids":"/components/formids/formids", |
| 8 | "nav":"/components/nav/nav", | 9 | "nav":"/components/nav/nav", |
| 9 | "card":"/components/seller-card/seller-card" | 10 | "card":"/components/seller-card/seller-card" |
| @@ -23,8 +23,17 @@ | @@ -23,8 +23,17 @@ | ||
| 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}}"> | 24 | <navigator url="/pages/customer/{{detail.navigator}}?id={{detail.id}}"> |
| 25 | <view class="card"> | 25 | <view class="card"> |
| 26 | - <card hasMaster | ||
| 27 | - seller="{{detail.seller}}" detail="{{detail}}"></card> | 26 | + <card hasListShare |
| 27 | + seller="{{detail.seller}}" detail="{{detail}}"> | ||
| 28 | + <view slot="listshare"> | ||
| 29 | + <userinfo-share | ||
| 30 | + id="userinfo-share-{{detail.id}}" | ||
| 31 | + binduserinfo="userinfo" | ||
| 32 | + share="{{detail}}"> | ||
| 33 | + <view class="opt-button">{{detail.hasOwner?'邀请':'分享日程'}}</view> | ||
| 34 | + </userinfo-share> | ||
| 35 | + </view> | ||
| 36 | + </card> | ||
| 28 | </view> | 37 | </view> |
| 29 | </navigator> | 38 | </navigator> |
| 30 | </block> | 39 | </block> |
| @@ -37,8 +46,17 @@ | @@ -37,8 +46,17 @@ | ||
| 37 | <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"> |
| 38 | <navigator url="/pages/customer/{{detail.navigator}}?id={{detail.id}}"> | 47 | <navigator url="/pages/customer/{{detail.navigator}}?id={{detail.id}}"> |
| 39 | <view class="card"> | 48 | <view class="card"> |
| 40 | - <card hasMaster | ||
| 41 | - seller="{{detail.seller}}" detail="{{detail}}"></card> | 49 | + <card hasListShare |
| 50 | + seller="{{detail.seller}}" detail="{{detail}}"> | ||
| 51 | + <view slot="listshare"> | ||
| 52 | + <userinfo | ||
| 53 | + id="userinfo-share-{{detail.id}}" | ||
| 54 | + data-id="{{detail.id}}" | ||
| 55 | + binduserinfo="accept"> | ||
| 56 | + <view class="opt-button">赴约</view> | ||
| 57 | + </userinfo> | ||
| 58 | + </view> | ||
| 59 | + </card> | ||
| 42 | </view> | 60 | </view> |
| 43 | </navigator> | 61 | </navigator> |
| 44 | </block> | 62 | </block> |
| @@ -93,4 +93,15 @@ | @@ -93,4 +93,15 @@ | ||
| 93 | } | 93 | } |
| 94 | .customers view{ | 94 | .customers view{ |
| 95 | margin-left: 14rpx; | 95 | margin-left: 14rpx; |
| 96 | +} | ||
| 97 | +.opt-button{ | ||
| 98 | + width: 120rpx; | ||
| 99 | + height: 40rpx; | ||
| 100 | + line-height: 40rpx; | ||
| 101 | + font-size: 26rpx; | ||
| 102 | + color:#262628; | ||
| 103 | + border: 2rpx solid #262628; | ||
| 104 | + text-align: center; | ||
| 105 | + margin-left: 18rpx; | ||
| 106 | + | ||
| 96 | } | 107 | } |
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | "newFeature": true | 8 | "newFeature": true |
| 9 | }, | 9 | }, |
| 10 | "compileType": "miniprogram", | 10 | "compileType": "miniprogram", |
| 11 | - "libVersion": "2.2.3", | 11 | + "libVersion": "2.3.0", |
| 12 | "appid": "wxd3dc4206c76f14fc", | 12 | "appid": "wxd3dc4206c76f14fc", |
| 13 | "projectname": "xcx-book", | 13 | "projectname": "xcx-book", |
| 14 | "isGameTourist": false, | 14 | "isGameTourist": false, |
| @@ -31,7 +31,7 @@ function unixtoTime(ns,format) { | @@ -31,7 +31,7 @@ function unixtoTime(ns,format) { | ||
| 31 | var time = new Date(ns*1000); | 31 | var time = new Date(ns*1000); |
| 32 | //result=format || 'YYYY年MM月DD日 HH时II分SS秒 WW'; | 32 | //result=format || 'YYYY年MM月DD日 HH时II分SS秒 WW'; |
| 33 | result=format || 'YYYY年MM月DD日'; | 33 | result=format || 'YYYY年MM月DD日'; |
| 34 | - console.log(format); | 34 | + //console.log(format); |
| 35 | result=result.toUpperCase(); | 35 | result=result.toUpperCase(); |
| 36 | result=result.replace('YYYY',time.getFullYear()); | 36 | result=result.replace('YYYY',time.getFullYear()); |
| 37 | var m=time.getMonth()+1; | 37 | var m=time.getMonth()+1; |
| @@ -56,14 +56,18 @@ function unixtoTime(ns,format) { | @@ -56,14 +56,18 @@ function unixtoTime(ns,format) { | ||
| 56 | } | 56 | } |
| 57 | result=result.replace('WW',week); | 57 | result=result.replace('WW',week); |
| 58 | if(format.indexOf('DAY')>0){ | 58 | if(format.indexOf('DAY')>0){ |
| 59 | - var day = new Date(); | ||
| 60 | - //day.setDate(day.getDate());//今天 | ||
| 61 | - console.log('ns<day.getTime()',ns,day.getTime(),ns<day.getTime()) | ||
| 62 | - if(ns<day.getTime()){ | 59 | + // 获取当天 0 点的时间戳 |
| 60 | + var timeStamp = new Date(new Date().setHours(0, 0, 0, 0)) / 1000; | ||
| 61 | + | ||
| 62 | + var day1 = timeStamp+86400//今天结束 | ||
| 63 | + var day2 = day1+86400//明天结束 | ||
| 64 | + | ||
| 65 | + //console.log('ns<day.getTime()',ns,day1,day2) | ||
| 66 | + | ||
| 67 | + if(ns<day1){ | ||
| 63 | result=result.replace('DAY','今天'); | 68 | result=result.replace('DAY','今天'); |
| 64 | }else{ | 69 | }else{ |
| 65 | - day.setDate(day.getDate() +1);//明天 | ||
| 66 | - if(ns<day.getTime()){ | 70 | + if(ns<day2){ |
| 67 | result=result.replace('DAY','明天'); | 71 | result=result.replace('DAY','明天'); |
| 68 | }else{ | 72 | }else{ |
| 69 | result=result.replace('DAY',''); | 73 | result=result.replace('DAY',''); |
-
Please register or login to post a comment