169 lines
3.4 KiB
JavaScript
169 lines
3.4 KiB
JavaScript
import _ from '../../../commons/js/commons'
|
|
const app = getApp()
|
|
Page({
|
|
data: {
|
|
list: [],//客户列表
|
|
pageNo: 1,
|
|
noData: false,
|
|
end: false,
|
|
load: true,
|
|
loading: false,
|
|
flag:1,
|
|
s_date:'',
|
|
e_date:'',
|
|
|
|
type:'',//调拨类型 1调拨发车2调拨收车
|
|
tabs_id:'',//分类 1进行中2已完成
|
|
tab:[],
|
|
channel:'',//是否来自渠道
|
|
city_id:'',//城市ID
|
|
},
|
|
onLoad: function (options) {
|
|
for (let key in options) {
|
|
this.setData({
|
|
[key]: options[key]
|
|
})
|
|
}
|
|
|
|
if(this.data.title){
|
|
wx.setNavigationBarTitle({
|
|
title:this.data.title,
|
|
})
|
|
}
|
|
|
|
this.getAppTransferTabs()
|
|
},
|
|
|
|
//客户-tab
|
|
getAppTransferTabs() {
|
|
_.apiQuery.getAppTransferTabs().then(res => {
|
|
this.setData({
|
|
tab:res.data,
|
|
tabs_id:this.data.tabs_id==''?res.data[0].id:this.data.tabs_id,
|
|
})
|
|
|
|
this.getAppTransferLists()
|
|
|
|
wx.stopPullDownRefresh()
|
|
});
|
|
},
|
|
|
|
//切换tab
|
|
changeTab(e){
|
|
this.setData({
|
|
tabs_id: this.data.tab[e.currentTarget.dataset.index].id,
|
|
})
|
|
this.searchSubmit()
|
|
},
|
|
|
|
//获取客户列表
|
|
getAppTransferLists() {
|
|
this.setData({
|
|
load: false,
|
|
loading: true,
|
|
})
|
|
let params = {};
|
|
params['page'] = this.data.pageNo;
|
|
params['size'] = 10;
|
|
if(this.data.channel != ''){
|
|
params['channel'] = this.data.channel;
|
|
}
|
|
if(this.data.city_id != ''){
|
|
params['city_id'] = this.data.city_id;
|
|
}
|
|
if(this.data.type != ''){
|
|
params['type'] = this.data.type;
|
|
}
|
|
if(this.data.tabs_id != ''){
|
|
params['tabs_id'] = this.data.tabs_id;
|
|
}
|
|
if(this.data.s_date != ''){
|
|
params['s_date'] = this.data.s_date;
|
|
}
|
|
if(this.data.e_date != ''){
|
|
params['e_date'] = this.data.e_date;
|
|
}
|
|
_.apiQuery.getAppTransferLists(params).then(res => {
|
|
this.setData({
|
|
flag: this.data.flag - 1
|
|
})
|
|
if (!this.data.flag) {
|
|
this.setData({
|
|
pageNo: this.data.pageNo + 1,
|
|
list: this.data.list.concat(res.data.list),
|
|
load: true,
|
|
loading: false,
|
|
})
|
|
if (res.data.total == 0) {
|
|
this.setData({
|
|
noData: true
|
|
})
|
|
} else if (this.data.list.length == res.data.total) {
|
|
this.setData({
|
|
end: true
|
|
})
|
|
}
|
|
}
|
|
wx.stopPullDownRefresh()
|
|
});
|
|
},
|
|
|
|
//提交搜索
|
|
searchSubmit(){
|
|
this.setData({
|
|
list: [],
|
|
pageNo: 1,
|
|
noData: false,
|
|
end: false,
|
|
load: true,
|
|
loading: false,
|
|
flag: this.data.flag + 1
|
|
})
|
|
this.getAppTransferLists()
|
|
},
|
|
|
|
//建卡时间
|
|
startDate(e){
|
|
this.setData({
|
|
s_date: e.detail.value,
|
|
})
|
|
},
|
|
|
|
//建卡时间
|
|
endDate(e){
|
|
this.setData({
|
|
e_date: e.detail.value,
|
|
})
|
|
},
|
|
|
|
//推送链接
|
|
pushLink(e){
|
|
if(e.currentTarget.dataset.url){
|
|
_.$router.openUrlScheme(e.currentTarget.dataset.url)
|
|
}
|
|
},
|
|
|
|
//页面相关事件处理函数--监听用户下拉动作
|
|
onPullDownRefresh(){
|
|
this.setData({
|
|
list: [],
|
|
pageNo: 1,
|
|
noData: false,
|
|
end: false,
|
|
load: true,
|
|
loading: false,
|
|
flag: this.data.flag + 1
|
|
})
|
|
this.getAppTransferLists()
|
|
},
|
|
|
|
//页面上拉触底事件的处理函数
|
|
onReachBottom(){
|
|
if (this.data.noData || this.data.end||!this.data.load) return;
|
|
this.setData({
|
|
flag: this.data.flag + 1
|
|
})
|
|
this.getAppTransferLists()
|
|
},
|
|
|
|
}) |