Commit e1b08c24b2c5a9b8efa0eacdd652b3b01d54fb83

Authored by wangfan
1 parent 96fca973

customer

@@ -29,14 +29,7 @@ Page({ @@ -29,14 +29,7 @@ Page({
29 * 生命周期函数--监听页面显示 29 * 生命周期函数--监听页面显示
30 */ 30 */
31 onShow: function () { 31 onShow: function () {
32 - App.Reserve.Detail({  
33 - openid: getApp().openid,  
34 - rid: this.id  
35 - }).then(res => {  
36 - this.setData({  
37 - detail:this.formatDatail(res.data)  
38 - })  
39 - }) 32 + this.getDetail();
40 }, 33 },
41 34
42 /** 35 /**
@@ -59,7 +52,16 @@ Page({ @@ -59,7 +52,16 @@ Page({
59 onPullDownRefresh: function () { 52 onPullDownRefresh: function () {
60 53
61 }, 54 },
62 - 55 + getDetail(){
  56 + App.Reserve.Detail({
  57 + openid: getApp().openid,
  58 + rid: this.id
  59 + }).then(res => {
  60 + this.setData({
  61 + detail:this.formatDatail(res.data)
  62 + })
  63 + })
  64 + },
63 formatDatail(detail){ 65 formatDatail(detail){
64 detail.rdateStr=util.unixtoTime(detail.rdate,'MM月DD日 WW HH:II'); 66 detail.rdateStr=util.unixtoTime(detail.rdate,'MM月DD日 WW HH:II');
65 detail.tableFirst=detail.tables[0].name; 67 detail.tableFirst=detail.tables[0].name;
@@ -72,6 +74,16 @@ Page({ @@ -72,6 +74,16 @@ Page({
72 detail.cusman_phone='15877556369'; 74 detail.cusman_phone='15877556369';
73 detail.cusman_account='wx:vking'; 75 detail.cusman_account='wx:vking';
74 } 76 }
  77 + detail.hasCanSuccess=false;
  78 + if(detail.customers.length>0){
  79 + let openid=getApp().openid;
  80 + detail.customers.forEach(item=>{
  81 + if(openid==item.openid){
  82 + detail.hasCanSuccess=true;
  83 + return true;
  84 + }
  85 + })
  86 + }
75 return detail; 87 return detail;
76 }, 88 },
77 showManager(){ 89 showManager(){
@@ -88,5 +100,19 @@ Page({ @@ -88,5 +100,19 @@ Page({
88 } 100 }
89 }) 101 })
90 }, 102 },
  103 + userinfo(){
  104 + if(!this.data.detail.hasCanSuccess){
  105 + App.Reserve.SetRelaSuccess({
  106 + rid:this.id,
  107 + openid:getApp().openid
  108 + }).then(res=>{
  109 + this.getDetail();
  110 + })
  111 + }else{
  112 + wx.navigateTo({
  113 + url:'invite?id='+this.id,
  114 + });
  115 + }
  116 + },
91 117
92 }) 118 })
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 </view> 24 </view>
25 </view> 25 </view>
26 <userinfo binduserinfo="userinfo" class="share-but-view"> 26 <userinfo binduserinfo="userinfo" class="share-but-view">
27 - <view class="share-but Regular">我愿意</view> 27 + <view class="share-but Regular">{{!detail.hasCanSuccess?'我愿意':'去邀请'}}</view>
28 </userinfo> 28 </userinfo>
29 <block wx:if="{{detail.customers.length>0}}"> 29 <block wx:if="{{detail.customers.length>0}}">
30 <view class="line-text"> 30 <view class="line-text">
@@ -68,9 +68,10 @@ Page({ @@ -68,9 +68,10 @@ Page({
68 _formatList(list){ 68 _formatList(list){
69 if(!list) return []; 69 if(!list) return [];
70 if(list.length>0){ 70 if(list.length>0){
  71 + let openid=getApp().openid;
71 list.forEach(row=>{ 72 list.forEach(row=>{
72 row.rdateStr=util.unixtoTime(row.rdate,'MM月DD日 WW HH:II'); 73 row.rdateStr=util.unixtoTime(row.rdate,'MM月DD日 WW HH:II');
73 - row.navigator=row.inviting==getApp().openid?'detail_owner':'detail_customer' 74 + row.navigator=row.openid==openid?'detail_owner':'detail_customer'
74 }) 75 })
75 } 76 }
76 return list; 77 return list;