const $$ = require('../../utils/util');
|
const app = getApp();
|
|
function pageZzQueryApi(param) {
|
return $$.request({
|
url: 'company/pageQuery',
|
type: 'get',
|
submitData: param || {},
|
service: 'sys'
|
})
|
}
|
Page({
|
|
/**
|
* 页面的初始数据
|
*/
|
data: {
|
imgUrl: $$.url.img,
|
search: {
|
integratedQuery: '',
|
page: 1,
|
size: 10,
|
}, // 查询条件
|
data: [], // 数据
|
total: 0, // 总数
|
},
|
|
searchButton() {
|
this.pageZzQuery(this.data.search)
|
},
|
|
handleChange(e) {
|
let key = e.currentTarget.dataset.key
|
let value = e.detail;
|
this.setData({
|
search: {
|
page: 1,
|
size: 10,
|
integratedQuery: value
|
}
|
});
|
},
|
|
async pageZzQuery(params, type) {
|
$$.showLoading();
|
const res = await pageZzQueryApi(params);
|
$$.hideLoading();
|
if (this.data.loading) {
|
this.setData({
|
loading: false
|
});
|
}
|
if (res.type) {
|
if (params.page === 1) {
|
this.data.data = res.data.content || [];
|
} else {
|
this.data.data = this.data.data.concat(res.data.content || []);
|
}
|
this.setData({
|
search: params,
|
data: this.data.data,
|
total: res.data.totalElements || 0
|
});
|
if (type === 'onPullDownRefresh') {
|
$$.showToast({
|
title: '已是最新记录',
|
duration: 1000
|
});
|
wx.stopPullDownRefresh();
|
}
|
}
|
},
|
|
// 滚动到底部获取案件
|
handlescrolltolower() {
|
if (this.data.data.length >= this.data.total) {
|
return false;
|
}
|
if (!this.data.loading) {
|
this.data.loading = true;
|
this.setData({
|
loading: this.data.loading
|
});
|
let submitData = {
|
...this.data.search
|
};
|
submitData.page = submitData.page + 1;
|
this.pageZzQuery(submitData);
|
}
|
},
|
|
// 跳转详情
|
_handleGoPage(e) {
|
let item = e.currentTarget.dataset.item;
|
// 获取当前页面栈
|
var pages = getCurrentPages();
|
|
// 上一个页面
|
var prevPage = pages[pages.length - 2];
|
// 直接设置数据对象到上一页面的data中
|
if (this.data.type === 'person') {
|
prevPage.setData({
|
frData: {
|
...item,
|
companyId: item.id || '',
|
trueName: item.name || '',
|
mobile: item.legalPersonTelephone || '',
|
addr: item.businessRegAddress || '',
|
orgaCode: item.socialCreditCode || '',
|
deputy: item.legalRepresent || '',
|
orgaType: item.orgaType || '',
|
placeAddr: item.placeAddr || '',
|
},
|
});
|
}
|
if (this.data.type === 'units') {
|
prevPage.setData({
|
ffrData: {
|
...item,
|
companyId: item.id || '',
|
trueName: item.name || '',
|
mobile: item.legalPersonTelephone || '',
|
addr: item.businessRegAddress || '',
|
orgaCode: item.socialCreditCode || '',
|
deputy: item.legalRepresent || '',
|
orgaType: item.orgaType || '',
|
placeAddr: item.placeAddr || '',
|
},
|
});
|
}
|
wx.navigateBack({
|
delta: 1,
|
})
|
},
|
|
|
/**
|
* 生命周期函数--监听页面加载
|
*/
|
onLoad(options) {
|
// 页面加载时设置标题
|
wx.setNavigationBarTitle({
|
title: options.type === 'person' ? '选择企业' : options.type === 'units' ? '选择机构' : '选择'
|
});
|
this.setData({
|
type: options.type
|
})
|
this.pageZzQuery(this.data.search)
|
},
|
|
/**
|
* 生命周期函数--监听页面初次渲染完成
|
*/
|
onReady() {
|
|
},
|
|
/**
|
* 生命周期函数--监听页面显示
|
*/
|
onShow() {
|
|
},
|
|
/**
|
* 生命周期函数--监听页面隐藏
|
*/
|
onHide() {
|
|
},
|
|
/**
|
* 生命周期函数--监听页面卸载
|
*/
|
onUnload() {
|
|
},
|
|
/**
|
* 页面相关事件处理函数--监听用户下拉动作
|
*/
|
onPullDownRefresh() {
|
|
},
|
|
/**
|
* 页面上拉触底事件的处理函数
|
*/
|
onReachBottom() {
|
|
},
|
|
/**
|
* 用户点击右上角分享
|
*/
|
onShareAppMessage() {
|
|
}
|
})
|