sales.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. hrid: 0,
  5. detail: {}, //业务员画像详情
  6. tabsList: [{
  7. label: "业绩",
  8. model: "#Performance"
  9. }, {
  10. label: "订单",
  11. model: "#OrderForm"
  12. }, {
  13. label: "销售线索",
  14. model: "#Clue"
  15. }, {
  16. label: "销售线索跟进明细",
  17. model: "#SalesFollow"
  18. }, {
  19. label: "客户",
  20. model: "#Client"
  21. }, {
  22. label: "客户跟进明细",
  23. model: "#ClientFollow"
  24. }, {
  25. label: "项目",
  26. model: "#Project"
  27. }, {
  28. label: "项目跟进明细",
  29. model: "#ProjectFollow"
  30. }, {
  31. label: "报价单",
  32. model: "#PriceSheet"
  33. }, {
  34. label: "合同",
  35. model: "#Contract"
  36. }],
  37. tabsActive: 0,
  38. },
  39. onLoad(options) {
  40. this.setData({
  41. hrid: options.id,
  42. })
  43. getApp().globalData.Language.getLanguagePackage(this, '业务员画像');
  44. this.getDetail();
  45. },
  46. getDetail() {
  47. _Http.basic({
  48. "id": 20230717100304,
  49. "content": {
  50. "hrid": this.data.hrid
  51. }
  52. }).then(res => {
  53. console.log("业务员画像详情", res)
  54. if (res.code != 1) return wx.showToast({
  55. title: res.msg,
  56. icon: "none"
  57. });
  58. this.setData({
  59. detail: res.data[0]
  60. })
  61. this.partialRenewal();
  62. })
  63. },
  64. //tabs 切换
  65. tabsChange({
  66. detail
  67. }) {
  68. this.setData({
  69. tabsActive: detail
  70. });
  71. this.partialRenewal();
  72. },
  73. //局部数据更新 tabs
  74. partialRenewal(init = false) {
  75. const model = this.data.tabsList[this.data.tabsActive].model;
  76. if (model) {
  77. const Component = this.selectComponent(model),
  78. {
  79. total,
  80. pageNumber,
  81. pageTotal
  82. } = Component.data.content,
  83. id = this.data.hrid;
  84. if (model == "#Files") init = true;
  85. if (total == null || init) {
  86. Component.getList(id, init);
  87. } else if (pageNumber <= pageTotal) {
  88. Component.getList(id, false);
  89. }
  90. }
  91. },
  92. onReachBottom() {
  93. this.partialRenewal();
  94. }
  95. })