var util = require('../../utils/util.js') const app = getApp(); Page({ data: { calcDate: util.getToday(), isShow: true, noData:'../../images/noData.png', dataListTips: "暂无数据", inputvalue:"", //表格请求参数~~ table: { getdataListParm: { name: 'getCustomerApp', page: 1, offset: 1, pagecount: 10, returntype: 'Map', parammaps: { inputvalue: "", } }, tableKey: 0, list: [ // {"content":"想做计步器宣传,目前已让任老师帮忙做。","customerId":378,"customerName":"天津振杰","id":827,"receiverId":1497,"receiverName":"张振强","receiverTel":"","remark":"","vdate":"2020-10-16","visiterId":30,"visiterName":"高占永"}, // {"content":"兴安盟牧场已确定安装我司饲喂系统,目前正在走流程。","customerId":255,"customerName":"原阳富源牧业","id":826,"receiverId":1341,"receiverName":"贾又春","receiverTel":"","remark":"","vdate":"2020-09-27","visiterId":30,"visiterName":"高占永"}, // {"content":"沟通款项,已支付","customerId":643,"customerName":"木易牧场","id":825,"receiverId":1333,"receiverName":"李宝丽","receiverTel":"","remark":"","vdate":"2020-09-24","visiterId":30,"visiterName":"高占永"} ], total: 0, listLoading: true, }, }, onReachBottom: function () { console.log('下拉分页') var offset = this.data.table.getdataListParm.offset + 1 this.setData({['table.getdataListParm.offset']: offset}) this.getList() }, onLoad: function (options) { util.getDataByName(this.data.table.getdataListParm, this.getListSuccess1) }, //清空按钮 on_error_tap(e) { console.log("搜索清空") this.setData({ inputvalue:"", ['table.getdataListParm.parammaps.inputvalue']:"" }) this.setData({ ['table.getdataListParm.offset']:1 }) console.log("表格请求数据:", this.data.table.getdataListParm) util.getDataByName(this.data.table.getdataListParm, this.getListSuccess1) }, //加载表格 getList() { console.log("表格请求数据:", this.data.table.getdataListParm) util.getDataByName(this.data.table.getdataListParm, this.getListSuccess2) }, getListSuccess2: function (res) { console.log('table数据======>', res.data) var tempList = res.data.list; if (res.data.list !== null) { this.setData({ isShow: true, ['table.list']: this.data.table.list.concat(tempList), ['table.getdataListParm.offset']: res.data.pageNum, ['table.total']: res.data.total }) } else { this.setData({ ['table.getdataListParm.offset']: res.data.pageNum }) } }, getListSuccess1: function (res) { console.log('table数据======>', res.data) var tempList = res.data.list; if (res.data.list !== null) { this.setData({ isShow: true, ['table.list']: tempList, ['table.getdataListParm.offset']: res.data.pageNum, ['table.total']: res.data.total }) } else { this.setData({ ['table.list']: [], ['table.getdataListParm.offset']: res.data.pageNum, isShow: false, dataListTips: "暂无数据" }) } }, //搜索内容 change_inputvalue:function(e){ var value = e.detail.value this.setData({ ['table.getdataListParm.parammaps.inputvalue']: value }) }, //搜索按钮 on_search_tap(e) { this.setData({ ['table.getdataListParm.offset']:1 }) console.log("表格请求数据:", this.data.table.getdataListParm) util.getDataByName(this.data.table.getdataListParm, this.getListSuccess1) }, //查看 on_see_tap: function (e) { var id = e.currentTarget.dataset.id; wx.navigateTo({ url:"../customerInformationSee/customerInformationSee?id=" + id}) }, //编辑 on_edit_tap: function (e) { var id = e.currentTarget.dataset.id; wx.navigateTo({ url:"../customerInformationEdit/customerInformationEdit?id=" + id}) }, //新增 on_add_tap: function (e) { wx.navigateTo({ url:"../customerInformationAdd/customerInformationAdd"}) }, //删除 on_del_tap: function (e) { var id = e.currentTarget.dataset.id; var send_data = { "name": 'delCustomer', "parammaps":{"id":id } } util.postDataByName(send_data, this.getDelSuccess) }, getDelSuccess: function (res) { console.log('删除======>', res) var that = this if (res.msg !== 'fail') { wx.showToast({ title: '删除成功', icon: 'success', duration: 2000, success: function(){ that.getList() } }) } else { wx.showToast({ title: '删除失败'+res.data, icon: 'error', duration: 2000, }) } }, //联系人管理 on_cont_tap: function (e) { var id = e.currentTarget.dataset.id; wx.navigateTo({ url:"../contact/contact?id=" + id}) }, //服务记录 on_service_tap: function (e) { var id = e.currentTarget.dataset.id; wx.navigateTo({ url:"../servicepg/servicepg?id=" + id}) }, })