d96bfccf by simon

默认提交

1 parent d943f54c
...@@ -300,7 +300,7 @@ Page({ ...@@ -300,7 +300,7 @@ Page({
300 socketStatus: 'connected', 300 socketStatus: 'connected',
301 waitingResponse: false 301 waitingResponse: false
302 }) 302 })
303 this.refreshView(); 303 // this.refreshView();
304 }) 304 })
305 305
306 wx.onSocketClose(() => { 306 wx.onSocketClose(() => {
...@@ -321,10 +321,40 @@ Page({ ...@@ -321,10 +321,40 @@ Page({
321 // 监听服务器推送消息 321 // 监听服务器推送消息
322 wx.onSocketMessage(message => { 322 wx.onSocketMessage(message => {
323 console.log('socket message:', message); 323 console.log('socket message:', message);
324 this.setData({ 324 let socketData = message && message.data || "";
325 loading: false 325 let result = null;
326 if (socketData) {
327 let parseData = JSON.parse(socketData);
328 result = parseData && parseData.content || null;
329 }
330 console.log("result:", result);
331
332 if (!result) return;
333 let priceInfo = result.list || [];
334 priceInfo.forEach(element => {
335 element.recordTime = new Date(element.recordTime).toString("yyyy.MM.dd hh:mm:ss");
336 element.memberPhone = element.memberPhone.substr(0, 3) + '****' + element.memberPhone.substr(7);
326 }); 337 });
327 this.refreshView(); 338 this.setData({
339 priceInfo: priceInfo,
340 maxPrice: result.maxPrice || 0,
341 priceTotal: result.total || 0
342 })
343
344 // 重置倒计时
345 let productInfo = this.data.productInfo;
346 let endTime = result.endTime || 0;
347 productInfo.endTime = endTime
348 this.setData({
349 isTimeEnd: endTime <= 0,
350 productInfo
351 })
352 this.removeTimer();
353 this.startTimer();
354 // this.setData({
355 // loading: false
356 // });
357 // this.refreshView();
328 }) 358 })
329 359
330 // 打开信道 360 // 打开信道
......