|
|
@ -1,5 +1,5 @@ |
|
|
// pages/message/index.js
|
|
|
// pages/message/index.js
|
|
|
import { getFactoryPrice, getBannerList } from "../../../api/ztb" |
|
|
|
|
|
|
|
|
import { getMessageNumber, getBannerList } from "../../../api/ztb" |
|
|
import { getCategoryType, getPreferList, getMomentList } from "../../../api/moment" |
|
|
import { getCategoryType, getPreferList, getMomentList } from "../../../api/moment" |
|
|
const event = require('../../../utils/event') |
|
|
const event = require('../../../utils/event') |
|
|
const storage = require('../../../utils/storage') |
|
|
const storage = require('../../../utils/storage') |
|
|
@ -40,6 +40,7 @@ Component({ |
|
|
{sort: 5, text: '排队降序'} |
|
|
{sort: 5, text: '排队降序'} |
|
|
], |
|
|
], |
|
|
sortIndex: 0, |
|
|
sortIndex: 0, |
|
|
|
|
|
messageNumber: 0 |
|
|
}, |
|
|
}, |
|
|
lifetimes: { |
|
|
lifetimes: { |
|
|
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
|
|
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
|
|
@ -70,10 +71,10 @@ Component({ |
|
|
tabList.push(typeList[index].categoryName) |
|
|
tabList.push(typeList[index].categoryName) |
|
|
} |
|
|
} |
|
|
form.categoryId = typeList[0].categoryId |
|
|
form.categoryId = typeList[0].categoryId |
|
|
console.log(form) |
|
|
|
|
|
this.setData({ tabList }) |
|
|
this.setData({ tabList }) |
|
|
this.fetchAgentList() |
|
|
this.fetchAgentList() |
|
|
}) |
|
|
}) |
|
|
|
|
|
this.initLogin() |
|
|
} |
|
|
} |
|
|
this.data.firstShow = true |
|
|
this.data.firstShow = true |
|
|
var bannerstring = storage.get('ztb-banner-list') |
|
|
var bannerstring = storage.get('ztb-banner-list') |
|
|
@ -90,12 +91,19 @@ Component({ |
|
|
onEvent: function (message) { |
|
|
onEvent: function (message) { |
|
|
console.log('mall>>fragment>>onEvent', message) |
|
|
console.log('mall>>fragment>>onEvent', message) |
|
|
if(message.what == 888){ |
|
|
if(message.what == 888){ |
|
|
this.fetchAgentList() |
|
|
|
|
|
|
|
|
this.initLogin() |
|
|
} else if(message.what == 444){ |
|
|
} else if(message.what == 444){ |
|
|
this.setData({ cityName: app.nowCity.cityName }) |
|
|
this.setData({ cityName: app.nowCity.cityName }) |
|
|
this.fetchAgentList() |
|
|
this.fetchAgentList() |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
initLogin: function(){ |
|
|
|
|
|
if(app.globalData.userInfo){ |
|
|
|
|
|
getMessageNumber().then(result => { |
|
|
|
|
|
this.setData({ messageNumber: result.data.messageNumber + result.data.notificationNumber }) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
searchList: function(){ |
|
|
searchList: function(){ |
|
|
wx.navigateTo({url: `/pages/mall/search-list/index` }) |
|
|
wx.navigateTo({url: `/pages/mall/search-list/index` }) |
|
|
}, |
|
|
}, |
|
|
@ -116,6 +124,8 @@ Component({ |
|
|
util.navigateTo('/pages/article/index/index') |
|
|
util.navigateTo('/pages/article/index/index') |
|
|
} else if(e.currentTarget.id == 'city'){ |
|
|
} else if(e.currentTarget.id == 'city'){ |
|
|
wx.navigateTo({url: `/pages/home/city-select/index?type=1` }) |
|
|
wx.navigateTo({url: `/pages/home/city-select/index?type=1` }) |
|
|
|
|
|
} else if(e.currentTarget.id == 'message'){ |
|
|
|
|
|
util.navigateTo('/pages/message/index/index') |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
tapBanner: function(e){ |
|
|
tapBanner: function(e){ |
|
|
@ -154,7 +164,6 @@ Component({ |
|
|
} |
|
|
} |
|
|
this.setData({ requesting: true, orderList: [] }) |
|
|
this.setData({ requesting: true, orderList: [] }) |
|
|
getMomentList(form).then(result => { |
|
|
getMomentList(form).then(result => { |
|
|
console.log(result) |
|
|
|
|
|
if (result.data.records.length) { |
|
|
if (result.data.records.length) { |
|
|
this.setData({ orderList: result.data.records, requesting: false }) |
|
|
this.setData({ orderList: result.data.records, requesting: false }) |
|
|
} else { |
|
|
} else { |
|
|
|