|
|
|
@ -62,13 +62,16 @@ Page({ |
|
|
|
return |
|
|
|
} |
|
|
|
this.data.tabIndex = Number(detail.index) |
|
|
|
if (!app.globalData.userInfo && this.data.tabIndex == 3) { |
|
|
|
wx.navigateTo({ url: '/pages/login/index' }) |
|
|
|
if(util.isEmpty(this.data.form.searchKey)){ |
|
|
|
return |
|
|
|
} |
|
|
|
this.onSearchList({ detail:{value: this.data.form.searchKey} }) |
|
|
|
}, |
|
|
|
onSearchList: function({detail}){ |
|
|
|
if (!app.globalData.userInfo && this.data.tabIndex == 3) { |
|
|
|
wx.navigateTo({ url: '/pages/login/index' }) |
|
|
|
return |
|
|
|
} |
|
|
|
this.data.form.searchKey = detail.value |
|
|
|
if(util.isEmpty(this.data.form.searchKey)){ |
|
|
|
util.showToast('请输入要搜索的关键字') |
|
|
|
@ -94,57 +97,57 @@ Page({ |
|
|
|
if(this.data.tabIndex == 0){ |
|
|
|
getFactoryPrice(this.data.form).then(result => { |
|
|
|
if (result.data.records.length) { |
|
|
|
this.handRespList(result.data.records) |
|
|
|
this.handRespList(result.data) |
|
|
|
} else { |
|
|
|
this.setData({ finished: true, requesting: false, loading: false }) |
|
|
|
this.setData({ finished: true, requesting: false, loading: false, tabIndex: this.data.tabIndex }) |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
this.setData({ requesting: false, loading: false }) |
|
|
|
this.setData({ requesting: false, loading: false, tabIndex: this.data.tabIndex}) |
|
|
|
util.showToast(err) |
|
|
|
}) |
|
|
|
} else if(this.data.tabIndex == 1){ |
|
|
|
getInformationList(this.data.form).then(result => { |
|
|
|
if (result.data.records.length) { |
|
|
|
this.handRespList(result.data.records) |
|
|
|
this.handRespList(result.data) |
|
|
|
} else { |
|
|
|
this.setData({ finished: true, requesting: false, loading: false }) |
|
|
|
this.setData({ finished: true, requesting: false, loading: false, tabIndex: this.data.tabIndex }) |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
this.setData({ requesting: false, loading: false }) |
|
|
|
this.setData({ requesting: false, loading: false, tabIndex: this.data.tabIndex }) |
|
|
|
util.showToast(err) |
|
|
|
}) |
|
|
|
} else if(this.data.tabIndex == 2){ |
|
|
|
getProxyOrderList(this.data.form).then(result => { |
|
|
|
if (result.data.records.length) { |
|
|
|
this.handRespList(result.data.records) |
|
|
|
this.handRespList(result.data) |
|
|
|
} else { |
|
|
|
this.setData({ finished: true, requesting: false, loading: false }) |
|
|
|
this.setData({ finished: true, requesting: false, loading: false, tabIndex: this.data.tabIndex }) |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
this.setData({ requesting: false, loading: false }) |
|
|
|
this.setData({ requesting: false, loading: false, tabIndex: this.data.tabIndex }) |
|
|
|
util.showToast(err) |
|
|
|
}) |
|
|
|
} else if(this.data.tabIndex == 3){ |
|
|
|
getPreferList(this.data.form).then(result => { |
|
|
|
if (result.data.records.length) { |
|
|
|
this.handRespList(result.data.records) |
|
|
|
this.handRespList(result.data) |
|
|
|
} else { |
|
|
|
this.setData({ finished: true, requesting: false, loading: false }) |
|
|
|
this.setData({ finished: true, requesting: false, loading: false, tabIndex: this.data.tabIndex }) |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
this.setData({ requesting: false, loading: false }) |
|
|
|
this.setData({ requesting: false, loading: false, tabIndex: this.data.tabIndex }) |
|
|
|
util.showToast(err) |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
handRespList: function(respList){ |
|
|
|
handRespList: function(data){ |
|
|
|
let nowList = `taskList[${this.data.taskList.length}]` |
|
|
|
var num = this.data.form.pageNum |
|
|
|
var finished = this.data.form.pageNum >= result.data.pages |
|
|
|
var finished = this.data.form.pageNum >= data.pages |
|
|
|
if (this.data.form.pageNum == 1) { |
|
|
|
this.setData({ [nowList]: respList, total: result.data.total, ['form.pageNum']: (num + 1), top: 0, finished, requesting: false, loading: false }) |
|
|
|
this.setData({ [nowList]: data.records, total: data.total, ['form.pageNum']: (num + 1), top: 0, finished, requesting: false, loading: false, tabIndex: this.data.tabIndex }) |
|
|
|
} else { |
|
|
|
this.setData({ [nowList]: respList, total: result.data.total, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false }) |
|
|
|
this.setData({ [nowList]: data.records, total: data.total, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false, tabIndex: this.data.tabIndex }) |
|
|
|
} |
|
|
|
}, |
|
|
|
tagClick: function(e){ |
|
|
|
@ -157,13 +160,14 @@ Page({ |
|
|
|
onHide: function(){ |
|
|
|
tdsdk.Page.onHide() |
|
|
|
}, |
|
|
|
onUnload() { |
|
|
|
onUnload: function() { |
|
|
|
console.log('onUnload>>>') |
|
|
|
tdsdk.Page.onUnload() |
|
|
|
if(this.data.rearchStringList.length){ |
|
|
|
try { |
|
|
|
wx.setStorageSync('mall-search', this.data.rearchStringList.toString()) |
|
|
|
} catch (e) { |
|
|
|
|
|
|
|
console.log(e) |
|
|
|
} |
|
|
|
} |
|
|
|
} |