client.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. sa_customersid: 0,
  5. businessInfo: {}, //工商信息
  6. showBusInfo: false, //是否显示工商信息
  7. detail: {}, //客户画像详情
  8. tabsList: [{
  9. label: "跟进记录",
  10. model: "#FollowUp"
  11. }, {
  12. label: "项目",
  13. model: "#Project"
  14. }, {
  15. label: "报价单",
  16. model: "#PriceSheet"
  17. }, {
  18. label: "合同",
  19. model: "#Contract"
  20. }, {
  21. label: "订单",
  22. model: "#OrderForm"
  23. }, {
  24. label: "服务",
  25. model: "#Serve"
  26. }, {
  27. label: "联系人"
  28. }],
  29. tabsActive: 0,
  30. },
  31. onLoad(options) {
  32. this.setData({
  33. sa_customersid: options.id,
  34. })
  35. getApp().globalData.Language.getLanguagePackage(this, '客户画像');
  36. this.getDetail();
  37. this.getGroup();
  38. },
  39. getDetail() {
  40. _Http.basic({
  41. "id": 20230713103804,
  42. "content": {
  43. "sa_customersid": this.data.sa_customersid
  44. }
  45. }).then(res => {
  46. console.log("客户画像详情", res)
  47. if (res.code != 1) return wx.showToast({
  48. title: res.msg,
  49. icon: "none"
  50. });
  51. this.setData({
  52. detail: res.data
  53. })
  54. this.partialRenewal();
  55. })
  56. },
  57. //tabs 切换
  58. tabsChange({
  59. detail
  60. }) {
  61. this.setData({
  62. tabsActive: detail
  63. });
  64. this.partialRenewal();
  65. },
  66. //局部数据更新 tabs
  67. partialRenewal(init = false) {
  68. const model = this.data.tabsList[this.data.tabsActive].model;
  69. if (model) {
  70. const Component = this.selectComponent(model),
  71. {
  72. total,
  73. pageNumber,
  74. pageTotal
  75. } = Component.data.content,
  76. id = this.data.sa_customersid;
  77. if (model == "#Files") init = true;
  78. if (total == null || init) {
  79. Component.getList(id, init);
  80. } else if (pageNumber <= pageTotal) {
  81. Component.getList(id, false);
  82. }
  83. }
  84. },
  85. onReachBottom() {
  86. this.partialRenewal();
  87. },
  88. getBusinessInfo() {
  89. if (this.data.businessInfo.enterprisename) return this.setData({
  90. showBusInfo: true
  91. })
  92. _Http.basic({
  93. "id": 2024060715002601,
  94. "content": {
  95. "companyName": this.data.detail.enterprisename
  96. }
  97. }).then(res => {
  98. console.log("工商信息", res)
  99. if (res.code != 1) return wx.showToast({
  100. title: res.msg,
  101. icon: "none"
  102. });
  103. if (!res.data.companyName) return getApp().globalData.Language.showToast('暂无工商信息')
  104. this.setData({
  105. businessInfo: res.data,
  106. showBusInfo: true
  107. })
  108. })
  109. },
  110. closeBusInfo() {
  111. this.setData({
  112. showBusInfo: false
  113. })
  114. },
  115. //更新团队成员
  116. getGroup() {
  117. this.selectComponent("#Group").getList()
  118. },
  119. })