contact.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. var util = require('../../utils/util.js')
  2. const app = getApp();
  3. Page({
  4. data: {
  5. calcDate: util.getToday(),
  6. isShow: true,
  7. noData:'../../images/noData.png',
  8. dataListTips: "暂无数据",
  9. customerId:"",
  10. //表格请求参数~~
  11. table: {
  12. getdataListParm: {
  13. name: 'getContactsByCid',
  14. page: 1,
  15. offset: 1,
  16. pagecount: 100,
  17. returntype: 'Map',
  18. parammaps: {
  19. cid: "",
  20. }
  21. },
  22. tableKey: 0,
  23. list: [
  24. // {"content":"想做计步器宣传,目前已让任老师帮忙做。","customerId":378,"customerName":"天津振杰","id":827,"receiverId":1497,"receiverName":"张振强","receiverTel":"","remark":"","vdate":"2020-10-16","visiterId":30,"visiterName":"高占永"},
  25. // {"content":"兴安盟牧场已确定安装我司饲喂系统,目前正在走流程。","customerId":255,"customerName":"原阳富源牧业","id":826,"receiverId":1341,"receiverName":"贾又春","receiverTel":"","remark":"","vdate":"2020-09-27","visiterId":30,"visiterName":"高占永"},
  26. // {"content":"沟通款项,已支付","customerId":643,"customerName":"木易牧场","id":825,"receiverId":1333,"receiverName":"李宝丽","receiverTel":"","remark":"","vdate":"2020-09-24","visiterId":30,"visiterName":"高占永"}
  27. ],
  28. total: 0,
  29. listLoading: true,
  30. },
  31. },
  32. onLoad: function (options) {
  33. var id = options.id;
  34. console.log(id)
  35. //获取编辑内容
  36. this.setData({
  37. ['table.getdataListParm.parammaps.cid']: id,
  38. "customerId": id,
  39. })
  40. this.getList()
  41. },
  42. //加载表格
  43. getList() {
  44. console.log("表格请求数据:", this.data.table.getdataListParm)
  45. util.getDataByName(this.data.table.getdataListParm, this.getListSuccess)
  46. },
  47. getListSuccess: function (res) {
  48. console.log('table数据======>', res.data.list)
  49. if (res.data.list !== null) {
  50. this.setData({
  51. isShow: true,
  52. ['table.list']: res.data.list,
  53. ['table.pageNum']: res.data.pageNum,
  54. ['table.pageSize']: res.data.pageSize,
  55. ['table.total']: res.data.total
  56. })
  57. } else {
  58. this.setData({
  59. ['table.list']: [],
  60. isShow: false,
  61. dataListTips: "暂无数据"
  62. })
  63. }
  64. },
  65. //查看
  66. on_see_tap: function (e) {
  67. var id = e.currentTarget.dataset.id;
  68. wx.navigateTo({ url:"../contactSee/contactSee?id=" + id})
  69. },
  70. //编辑
  71. on_edit_tap: function (e) {
  72. var id = e.currentTarget.dataset.id;
  73. wx.navigateTo({ url:"../contactEdit/contactEdit?id=" + id})
  74. },
  75. //新增
  76. on_add_tap: function (e) {
  77. var id = this.data.customerId;
  78. console.log(id)
  79. wx.navigateTo({ url:"../contactAdd/contactAdd?id=" + id})
  80. },
  81. })