作者 lihongjuan
@@ -122,17 +122,17 @@ @@ -122,17 +122,17 @@
122 }, 1000) 122 }, 1000)
123 123
124 124
125 - } else if (token != '' && re_id == 0) {  
126 - uni.showToast({  
127 - title: '请绑定客户',  
128 - icon: "none"  
129 - })  
130 -  
131 - setTimeout(function() {  
132 - uni.navigateTo({  
133 - url: "/pages/binding/binding"  
134 - })  
135 - }, 1000) 125 +// } else if (token != '' && re_id == 0) {
  126 +// uni.showToast({
  127 +// title: '请绑定客户',
  128 +// icon: "none"
  129 +// })
  130 +//
  131 +// setTimeout(function() {
  132 +// uni.navigateTo({
  133 +// url: "/pages/binding/binding"
  134 +// })
  135 +// }, 1000)
136 } else { 136 } else {
137 uni.scanCode({ 137 uni.scanCode({
138 success: function(res) { 138 success: function(res) {
@@ -229,18 +229,18 @@ @@ -229,18 +229,18 @@
229 }, 1000) 229 }, 1000)
230 230
231 231
232 - } else if (token !=''&&re_id == 0) { 232 + // } else if (token !=''&&re_id == 0) {
233 233
234 - uni.showToast({  
235 - title: '请绑定客户',  
236 - icon: "none"  
237 - })  
238 -  
239 - setTimeout(function() {  
240 - uni.navigateTo({  
241 - url: "/pages/binding/binding"  
242 - })  
243 - }, 1000) 234 + // uni.showToast({
  235 + // title: '请绑定客户',
  236 + // icon: "none"
  237 + // })
  238 + //
  239 + // setTimeout(function() {
  240 + // uni.navigateTo({
  241 + // url: "/pages/binding/binding"
  242 + // })
  243 + // }, 1000)
244 }else{ 244 }else{
245 if (t.is_allow == 0) { 245 if (t.is_allow == 0) {
246 console.log(123) 246 console.log(123)
@@ -33,6 +33,23 @@ @@ -33,6 +33,23 @@
33 33
34 <view class="gerenitem"> 34 <view class="gerenitem">
35 <view class="gerenleft"> 35 <view class="gerenleft">
  36 + 公司名称
  37 + </view>
  38 + <view class="gerenright">
  39 + <view class="toutext" v-if="bangdingkehu==''" @click="bangding_kehu">
  40 + 绑定公司
  41 + </view>
  42 + <view class="toutext" v-else @click="bangding_kehu">
  43 + {{bangdingkehu}}
  44 + </view>
  45 + <view class="rowright">
  46 + <image src="/static/img/rowright.png"></image>
  47 + </view>
  48 + </view>
  49 + </view>
  50 +
  51 + <view class="gerenitem">
  52 + <view class="gerenleft">
36 推荐人 53 推荐人
37 </view> 54 </view>
38 <view class="gerenright"> 55 <view class="gerenright">
@@ -46,8 +63,6 @@ @@ -46,8 +63,6 @@
46 <image src="/static/img/rowright.png"></image> 63 <image src="/static/img/rowright.png"></image>
47 </view> 64 </view>
48 </view> 65 </view>
49 -  
50 -  
51 </view> 66 </view>
52 </view> 67 </view>
53 <view class="register" v-if="showbang"> 68 <view class="register" v-if="showbang">
@@ -68,6 +83,24 @@ @@ -68,6 +83,24 @@
68 </view> 83 </view>
69 </view> 84 </view>
70 </view> 85 </view>
  86 + <view class="register" v-if="showbang_kehu">
  87 + <view class="registerwrap">
  88 +
  89 + <view class="bangtitle">绑定客户</view>
  90 + <view class="tuiphone">
  91 + <input placeholder='请输入客户邀请码' placeholder-class='tuishouji' :value="number" @input="entrnnumber" type="text" />
  92 + </view>
  93 + <view class="tuiwarn" v-if="showfalse">
  94 + {{errmsg}}
  95 + <!-- 该客户不存在,请重新输入 -->
  96 + </view>
  97 + <!-- <view class="tuiwarn">{{content}}</view> -->
  98 + <view class="tuifoot">
  99 + <view class="tuifootleft" @click="hideshowbang_kehu">取消</view>
  100 + <view class="tuifootright" @click="quding_kehu">确定</view>
  101 + </view>
  102 + </view>
  103 + </view>
71 </view> 104 </view>
72 </template> 105 </template>
73 106
@@ -77,31 +110,55 @@ @@ -77,31 +110,55 @@
77 data() { 110 data() {
78 return { 111 return {
79 showbang: false, 112 showbang: false,
  113 + showbang_kehu: false,
80 name: '', 114 name: '',
81 peopleinfo: '', 115 peopleinfo: '',
82 phone: '', 116 phone: '',
  117 + number: '',
83 changename: '', 118 changename: '',
84 showfalse:false, 119 showfalse:false,
85 avatar:'', 120 avatar:'',
86 errmsg:'', 121 errmsg:'',
87 - bangdingpeople:'' 122 + bangdingpeople:'',
  123 + bangdingkehu:''
88 124
89 } 125 }
90 }, 126 },
91 methods: { 127 methods: {
92 bangding() { 128 bangding() {
93 - if(this.bangdingpeople != '') { 129 + let re_id = wx.getStorageSync('re_id');
  130 + if(re_id == 0) {
  131 + uni.showToast({
  132 + title: '请先绑定公司',
  133 + icon: 'none',
  134 + })
  135 + } else if(this.bangdingpeople != '') {
94 uni.showToast({ 136 uni.showToast({
95 title: '已绑定推荐人,无法修改', 137 title: '已绑定推荐人,无法修改',
96 icon: 'none', 138 icon: 'none',
97 }) 139 })
98 } else { 140 } else {
  141 + this.errmsg = '';
99 this.showbang = true 142 this.showbang = true
100 } 143 }
101 }, 144 },
102 hideshowbang() { 145 hideshowbang() {
103 this.showbang = false 146 this.showbang = false
104 }, 147 },
  148 + bangding_kehu() {
  149 + if(this.bangdingkehu != '') {
  150 + uni.showToast({
  151 + title: '已绑定客户,无法修改',
  152 + icon: 'none',
  153 + })
  154 + } else {
  155 + this.errmsg = '';
  156 + this.showbang_kehu = true
  157 + }
  158 + },
  159 + hideshowbang_kehu() {
  160 + this.showbang_kehu = false
  161 + },
105 // 输入姓名 162 // 输入姓名
106 entername(e) { 163 entername(e) {
107 this.changename = e.detail.value 164 this.changename = e.detail.value
@@ -135,7 +192,14 @@ @@ -135,7 +192,14 @@
135 } 192 }
136 console.log(e) 193 console.log(e)
137 }, 194 },
138 - 195 + entrnnumber(e) {
  196 + this.number = e.detail.value;
  197 + console.log(this.number)
  198 + if(this.number==''){
  199 + this.showfalse_kehu=false
  200 + }
  201 + console.log(e)
  202 + },
139 quding() { 203 quding() {
140 204
141 let phone = this.phone; 205 let phone = this.phone;
@@ -177,6 +241,48 @@ @@ -177,6 +241,48 @@
177 this.errmsg=err.msg 241 this.errmsg=err.msg
178 this.showfalse=true 242 this.showfalse=true
179 }); 243 });
  244 + },
  245 + quding_kehu() {
  246 +
  247 + let number = this.number;
  248 +
  249 + if (number.length == 0) {
  250 + uni.showToast({
  251 + title: "请输入邀请码",
  252 + icon: 'none',
  253 + })
  254 +
  255 + return false
  256 + }
  257 + let param = {
  258 + code: this.number
  259 + }
  260 + app.post("api/person/bindKehu", param, 'get')
  261 + .then(res => {
  262 + console.log(res);
  263 + uni.showToast({
  264 + title: '绑定成功',
  265 + icon: 'none',
  266 + })
  267 + wx.setStorageSync('re_id',1);
  268 + setTimeout(function(){
  269 + uni.navigateBack({
  270 + checked:true
  271 + })
  272 + // this.showfalse=false
  273 + },1500)
  274 +
  275 +
  276 + })
  277 + .catch(err => {
  278 + console.log(err)
  279 + // uni.showToast({
  280 + // title: err.msg,
  281 + // icon: 'none',
  282 + // })
  283 + this.errmsg=err.msg
  284 + this.showfalse=true
  285 + });
180 } 286 }
181 }, 287 },
182 onLoad(options) { 288 onLoad(options) {
@@ -185,7 +291,8 @@ @@ -185,7 +291,8 @@
185 this.peopleinfo = peopleinfo 291 this.peopleinfo = peopleinfo
186 this.name = peopleinfo.username; 292 this.name = peopleinfo.username;
187 this.avatar=peopleinfo.avatar; 293 this.avatar=peopleinfo.avatar;
188 - this.bangdingpeople=peopleinfo.company_name 294 + this.bangdingpeople=peopleinfo.recommender
  295 + this.bangdingkehu=peopleinfo.company_name
189 console.log(this.bangdingpeople) 296 console.log(this.bangdingpeople)
190 297
191 }, 298 },
@@ -13,12 +13,12 @@ @@ -13,12 +13,12 @@
13 13
14 <view class="infohead"> 14 <view class="infohead">
15 <view class="infoheadleft"> 15 <view class="infoheadleft">
16 - <view class="infotui">姓名</view>  
17 - <view class="infoji" v-if="token!=''">{{peopleinfo.username==''?'暂无':peopleinfo.username}}</view> 16 + <view class="infotui">推荐人</view>
  17 + <view class="infoji" v-if="token!=''">{{peopleinfo.recommender==''?'暂无':peopleinfo.recommender}}</view>
18 <view class="infoji" v-else>{{company}}</view> 18 <view class="infoji" v-else>{{company}}</view>
19 </view> 19 </view>
20 <view class="infoheadleft"> 20 <view class="infoheadleft">
21 - <view class="infotui">推荐人</view> 21 + <view class="infotui">公司名称</view>
22 <view class="infoji" v-if="token!=''">{{peopleinfo.company_name==''?'暂无':peopleinfo.company_name}}</view> 22 <view class="infoji" v-if="token!=''">{{peopleinfo.company_name==''?'暂无':peopleinfo.company_name}}</view>
23 <view class="infoji" v-else>{{tuijianren}}</view> 23 <view class="infoji" v-else>{{tuijianren}}</view>
24 </view> 24 </view>
@@ -113,18 +113,18 @@ @@ -113,18 +113,18 @@
113 }, 1000) 113 }, 1000)
114 114
115 115
116 - } else if (token !=''&&re_id == 0) {  
117 -  
118 - uni.showToast({  
119 - title: '请绑定客户',  
120 - icon: "none"  
121 - })  
122 -  
123 - setTimeout(function() {  
124 - uni.navigateTo({  
125 - url: "/pages/binding/binding"  
126 - })  
127 - }, 1000) 116 + // } else if (token !=''&&re_id == 0) {
  117 + //
  118 + // uni.showToast({
  119 + // title: '请绑定客户',
  120 + // icon: "none"
  121 + // })
  122 + //
  123 + // setTimeout(function() {
  124 + // uni.navigateTo({
  125 + // url: "/pages/binding/binding"
  126 + // })
  127 + // }, 1000)
128 }else { 128 }else {
129 let peopleinfo = this.peopleinfo; 129 let peopleinfo = this.peopleinfo;
130 peopleinfo = JSON.stringify(peopleinfo) 130 peopleinfo = JSON.stringify(peopleinfo)
@@ -154,18 +154,18 @@ @@ -154,18 +154,18 @@
154 }, 1000) 154 }, 1000)
155 155
156 156
157 - } else if (token !=''&&re_id == 0) {  
158 -  
159 - uni.showToast({  
160 - title: '请绑定客户',  
161 - icon: "none"  
162 - })  
163 -  
164 - setTimeout(function() {  
165 - uni.navigateTo({  
166 - url: "/pages/binding/binding"  
167 - })  
168 - }, 1000) 157 + // } else if (token !=''&&re_id == 0) {
  158 + //
  159 + // uni.showToast({
  160 + // title: '请绑定客户',
  161 + // icon: "none"
  162 + // })
  163 + //
  164 + // setTimeout(function() {
  165 + // uni.navigateTo({
  166 + // url: "/pages/binding/binding"
  167 + // })
  168 + // }, 1000)
169 }else { 169 }else {
170 uni.navigateTo({ 170 uni.navigateTo({
171 url: '/pages/myshuju/myshuju' 171 url: '/pages/myshuju/myshuju'
@@ -190,18 +190,18 @@ @@ -190,18 +190,18 @@
190 }, 1000) 190 }, 1000)
191 191
192 192
193 - } else if (token !=''&&re_id == 0) {  
194 -  
195 - uni.showToast({  
196 - title: '请绑定客户',  
197 - icon: "none"  
198 - })  
199 -  
200 - setTimeout(function() {  
201 - uni.navigateTo({  
202 - url: "/pages/binding/binding"  
203 - })  
204 - }, 1000) 193 + // } else if (token !=''&&re_id == 0) {
  194 + //
  195 + // uni.showToast({
  196 + // title: '请绑定客户',
  197 + // icon: "none"
  198 + // })
  199 + //
  200 + // setTimeout(function() {
  201 + // uni.navigateTo({
  202 + // url: "/pages/binding/binding"
  203 + // })
  204 + // }, 1000)
205 }else { 205 }else {
206 app.post("api/person/getUserInfo", '', 'get') 206 app.post("api/person/getUserInfo", '', 'get')
207 .then(res => { 207 .then(res => {
@@ -232,18 +232,18 @@ @@ -232,18 +232,18 @@
232 }, 1000) 232 }, 1000)
233 233
234 234
235 - } else if (token !=''&&re_id == 0) {  
236 -  
237 - uni.showToast({  
238 - title: '请绑定客户',  
239 - icon: "none"  
240 - })  
241 -  
242 - setTimeout(function() {  
243 - uni.navigateTo({  
244 - url: "/pages/binding/binding"  
245 - })  
246 - }, 1000) 235 + // } else if (token !=''&&re_id == 0) {
  236 + //
  237 + // uni.showToast({
  238 + // title: '请绑定客户',
  239 + // icon: "none"
  240 + // })
  241 + //
  242 + // setTimeout(function() {
  243 + // uni.navigateTo({
  244 + // url: "/pages/binding/binding"
  245 + // })
  246 + // }, 1000)
247 }else { 247 }else {
248 uni.navigateTo({ 248 uni.navigateTo({
249 url: '/pages/xiaofeijilu/xiaofeijilu', 249 url: '/pages/xiaofeijilu/xiaofeijilu',
@@ -65,7 +65,7 @@ @@ -65,7 +65,7 @@
65 console.log(res,"返回token"); 65 console.log(res,"返回token");
66 uni.setStorageSync('token', res.userInfo.token); 66 uni.setStorageSync('token', res.userInfo.token);
67 uni.setStorageSync("openid",res.openid); 67 uni.setStorageSync("openid",res.openid);
68 - uni.setStorageSync("re_id",1); 68 + uni.setStorageSync("re_id",res.userInfo.re_id);
69 // if(res.userInfo.re_id == 0){ 69 // if(res.userInfo.re_id == 0){
70 // uni.navigateTo({ 70 // uni.navigateTo({
71 // url: '/pages/binding/binding' 71 // url: '/pages/binding/binding'
@@ -92,12 +92,14 @@ @@ -92,12 +92,14 @@
92 now_data: "", 92 now_data: "",
93 number: '', 93 number: '',
94 is_share: 0, 94 is_share: 0,
  95 + interval_number: '',
95 page: 1 96 page: 1
96 } 97 }
97 }, 98 },
98 methods: { 99 methods: {
99 shubandetail(e) { 100 shubandetail(e) {
100 - 101 + let that = this;
  102 + clearInterval(that.interval_number);
101 uni.navigateTo({ 103 uni.navigateTo({
102 url: '/pages/shubandetail/shubandetail?id=' + e.id + '&number=' + this.number 104 url: '/pages/shubandetail/shubandetail?id=' + e.id + '&number=' + this.number
103 }) 105 })
@@ -112,7 +114,6 @@ @@ -112,7 +114,6 @@
112 // 获取最新的数板信息 114 // 获取最新的数板信息
113 get_newdata() { 115 get_newdata() {
114 let t = this; 116 let t = this;
115 - console.log('9999988888', t.number)  
116 let url = "api/equipment/getNewEquipment"; 117 let url = "api/equipment/getNewEquipment";
117 let param = { 118 let param = {
118 number: t.number, 119 number: t.number,
@@ -120,10 +121,8 @@ @@ -120,10 +121,8 @@
120 time: t.now_time 121 time: t.now_time
121 }; 122 };
122 app.post(url, param, 'post').then(r => { 123 app.post(url, param, 'post').then(r => {
123 - console.log(r, "最新的数板消息");  
124 124
125 t.now_data = r.equipment_log; 125 t.now_data = r.equipment_log;
126 - console.log('1234567', t.now_data)  
127 }).catch(err => { 126 }).catch(err => {
128 console.log(err) 127 console.log(err)
129 }) 128 })
@@ -139,7 +138,6 @@ @@ -139,7 +138,6 @@
139 // number:this.number 138 // number:this.number
140 }; 139 };
141 app.post(url, param, 'post').then(r => { 140 app.post(url, param, 'post').then(r => {
142 - console.log(r, "获取数板信息");  
143 t.is_over = r.is_over; 141 t.is_over = r.is_over;
144 t.equipment = r.equipment; 142 t.equipment = r.equipment;
145 t.shengyu_time = r.shengyu; 143 t.shengyu_time = r.shengyu;
@@ -150,7 +148,6 @@ @@ -150,7 +148,6 @@
150 }) 148 })
151 }, 149 },
152 get() { 150 get() {
153 - console.log('999999999')  
154 let number = this.shengyu_time; 151 let number = this.shengyu_time;
155 // // 时间戳处理 152 // // 时间戳处理
156 var totalSecond = number; 153 var totalSecond = number;
@@ -173,7 +170,6 @@ @@ -173,7 +170,6 @@
173 var secStr = sec.toString(); 170 var secStr = sec.toString();
174 if (secStr.length == 1) secStr = secStr; 171 if (secStr.length == 1) secStr = secStr;
175 this.shengyu_time = dayStr + '天' + hrStr + '小时' + minStr + "分钟" 172 this.shengyu_time = dayStr + '天' + hrStr + '小时' + minStr + "分钟"
176 - console.log('999999', this.shengyu_time)  
177 173
178 }, 174 },
179 175
@@ -190,7 +186,6 @@ @@ -190,7 +186,6 @@
190 186
191 }, 187 },
192 onLoad(options) { 188 onLoad(options) {
193 - console.log('9999900000', options)  
194 this.number = options.num; 189 this.number = options.num;
195 if (options.type == 1) { 190 if (options.type == 1) {
196 this.is_share = 1 191 this.is_share = 1
@@ -210,10 +205,17 @@ @@ -210,10 +205,17 @@
210 // 获取最新的数板消息 205 // 获取最新的数板消息
211 // this.get_newdata() 206 // this.get_newdata()
212 207
213 - setInterval(function() {  
214 - 208 + that.interval_number = setInterval(function() {
215 that.get_newdata() 209 that.get_newdata()
216 - }, 2000) 210 + }, 2000);
  211 + },
  212 + onUnload: function () {
  213 + let that = this;
  214 + clearInterval(that.interval_number);
  215 + },
  216 + onHide() {
  217 + let that = this;
  218 + clearInterval(that.interval_number);
217 }, 219 },
218 //上拉触底事件 220 //上拉触底事件
219 onReachBottom: function() { 221 onReachBottom: function() {
@@ -253,8 +253,24 @@ @@ -253,8 +253,24 @@
253 t.saoshuban_number = res.result; 253 t.saoshuban_number = res.result;
254 t.shuban_number = res.result; 254 t.shuban_number = res.result;
255 255
256 - t.shengyuqixian=t.time;  
257 - t.timechange() 256 + let url = "api/equipment/getEquipmentNumber";
  257 + let param = {
  258 + number: t.shuban_number
  259 + };
  260 + app.post(url, param, 'post').then(r => {
  261 + console.log(r)
  262 + t.shengyuqixian=r.time;
  263 + t.timechange()
  264 +
  265 +
  266 + }).catch(err => {
  267 +
  268 + this.shengyuqixian=0;
  269 + // this.timechange()
  270 +
  271 + })
  272 + // t.shengyuqixian=t.time;
  273 + // t.timechange()
258 // t.isquanxian() 274 // t.isquanxian()
259 }, 275 },
260 fail: function(res) { 276 fail: function(res) {
@@ -343,18 +359,18 @@ @@ -343,18 +359,18 @@
343 }, 1000) 359 }, 1000)
344 360
345 361
346 - } else if (token !=''&&re_id == 0) {  
347 -  
348 - uni.showToast({  
349 - title: '请绑定客户',  
350 - icon: "none"  
351 - })  
352 -  
353 - setTimeout(function() {  
354 - uni.navigateTo({  
355 - url: "/pages/binding/binding"  
356 - })  
357 - }, 1000) 362 + // } else if (token !=''&&re_id == 0) {
  363 + //
  364 + // uni.showToast({
  365 + // title: '请绑定客户',
  366 + // icon: "none"
  367 + // })
  368 + //
  369 + // setTimeout(function() {
  370 + // uni.navigateTo({
  371 + // url: "/pages/binding/binding"
  372 + // })
  373 + // }, 1000)
358 }else{ 374 }else{
359 console.log(t.kindtab); 375 console.log(t.kindtab);
360 console.log(t.shuban_number) 376 console.log(t.shuban_number)
@@ -424,18 +440,18 @@ @@ -424,18 +440,18 @@
424 }, 1000) 440 }, 1000)
425 441
426 442
427 - } else if (token !=''&&re_id == 0) {  
428 -  
429 - uni.showToast({  
430 - title: '请绑定客户',  
431 - icon: "none"  
432 - })  
433 -  
434 - setTimeout(function() {  
435 - uni.navigateTo({  
436 - url: "/pages/binding/binding"  
437 - })  
438 - }, 1000) 443 + // } else if (token !=''&&re_id == 0) {
  444 + //
  445 + // uni.showToast({
  446 + // title: '请绑定客户',
  447 + // icon: "none"
  448 + // })
  449 + //
  450 + // setTimeout(function() {
  451 + // uni.navigateTo({
  452 + // url: "/pages/binding/binding"
  453 + // })
  454 + // }, 1000)
439 }else{ 455 }else{
440 let is_allow = t.shenyu.is_allow; 456 let is_allow = t.shenyu.is_allow;
441 console.log(is_allow, "is_allow") 457 console.log(is_allow, "is_allow")
@@ -548,18 +564,18 @@ @@ -548,18 +564,18 @@
548 }, 1000) 564 }, 1000)
549 565
550 566
551 - } else if (token !=''&&re_id == 0) {  
552 -  
553 - uni.showToast({  
554 - title: '请绑定客户',  
555 - icon: "none"  
556 - })  
557 -  
558 - setTimeout(function() {  
559 - uni.navigateTo({  
560 - url: "/pages/binding/binding"  
561 - })  
562 - }, 1000) 567 + // } else if (token !=''&&re_id == 0) {
  568 + //
  569 + // uni.showToast({
  570 + // title: '请绑定客户',
  571 + // icon: "none"
  572 + // })
  573 + //
  574 + // setTimeout(function() {
  575 + // uni.navigateTo({
  576 + // url: "/pages/binding/binding"
  577 + // })
  578 + // }, 1000)
563 }else{ 579 }else{
564 let t = this; 580 let t = this;
565 let new_arr = t.array; 581 let new_arr = t.array;