contacts.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. sys_phonebookid: 0,
  5. detail: {}, //联系人画像详情
  6. tabsList: [{
  7. label: "跟进记录",
  8. model: "#FollowUp"
  9. }, {
  10. label: "关联客户",
  11. model: "#Client"
  12. }, {
  13. label: "关联项目",
  14. model: "#Project"
  15. }, {
  16. label: "报价单",
  17. model: "#PriceSheet"
  18. }, {
  19. label: "订单",
  20. model: "#OrderForm"
  21. }],
  22. tabsActive: 0,
  23. },
  24. onLoad(options) {
  25. this.setData({
  26. sys_phonebookid: options.id,
  27. })
  28. getApp().globalData.Language.getLanguagePackage(this, '联系人画像');
  29. this.getDetail();
  30. },
  31. getDetail() {
  32. _Http.basic({
  33. "id": 20240605102804,
  34. "content": {
  35. "sys_phonebookid": this.data.sys_phonebookid
  36. }
  37. }).then(res => {
  38. console.log("联系人画像详情", res)
  39. if (res.code != 1) return wx.showToast({
  40. title: res.msg,
  41. icon: "none"
  42. });
  43. this.setData({
  44. detail: res.data[0]
  45. })
  46. this.partialRenewal();
  47. })
  48. },
  49. //tabs 切换
  50. tabsChange({
  51. detail
  52. }) {
  53. this.setData({
  54. tabsActive: detail
  55. });
  56. this.partialRenewal();
  57. },
  58. //局部数据更新 tabs
  59. partialRenewal(init = false) {
  60. const model = this.data.tabsList[this.data.tabsActive].model;
  61. if (model) {
  62. const Component = this.selectComponent(model),
  63. {
  64. total,
  65. pageNumber,
  66. pageTotal
  67. } = Component.data.content,
  68. id = this.data.sys_phonebookid;
  69. if (model == "#Files") init = true;
  70. if (total == null || init) {
  71. Component.getList(id, init);
  72. } else if (pageNumber <= pageTotal) {
  73. Component.getList(id, false);
  74. }
  75. }
  76. },
  77. onReachBottom() {
  78. this.partialRenewal();
  79. },
  80. showSubdateInfo() {
  81. getApp().globalData.Language.modeBoxPrompts('未跟进天数=当前查询时间-最近跟进时间-节假日')
  82. }
  83. })