detail.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. tabsActive: 3, //tabs 选中项
  5. sa_projectid: "",
  6. tabsList: [{
  7. label: "详细信息",
  8. num: 132
  9. }, {
  10. label: "阶段任务",
  11. num: 132
  12. }, {
  13. label: "跟进动态",
  14. num: 132
  15. }, {
  16. label: "关联客户",
  17. num: 132
  18. }],
  19. },
  20. onLoad(options) {
  21. this.setData({
  22. sa_projectid: options.sa_projectid
  23. });
  24. this.getDetail()
  25. },
  26. getDetail() {
  27. _Http.basic({
  28. "id": 20221021103902,
  29. "content": {
  30. "sa_projectid": this.data.sa_projectid
  31. },
  32. }).then(res => {
  33. console.log("项目商机详情", res)
  34. if (res.msg != '成功') return wx.showToast({
  35. title: res.data,
  36. icon: "none"
  37. });
  38. this.setData({
  39. detail: res.data,
  40. briefs: [{
  41. label: "项目编号",
  42. value: res.data.projectnum
  43. }, {
  44. label: "项目地址",
  45. value: res.data.province + res.data.city + res.data.county + res.data.address
  46. }, {
  47. label: "项目类型",
  48. value: res.data.projecttype
  49. }, {
  50. label: "负责人",
  51. value: res.data.name
  52. }, {
  53. label: "当前项目阶段",
  54. value: res.data.stagename
  55. }, {
  56. label: "赢率",
  57. value: res.data.winrate
  58. }, {
  59. label: "最近跟进时间",
  60. value: res.data.followdate
  61. }],
  62. list1: [{
  63. label: "项目名称",
  64. value: res.data.projectname
  65. }, {
  66. label: "项目编号",
  67. value: res.data.projectnum
  68. }, {
  69. label: "项目类型",
  70. value: res.data.projecttype
  71. }, {
  72. label: "省市县",
  73. value: res.data.province ? res.data.province + res.data.city + res.data.county : ''
  74. }, {
  75. label: "详细地址",
  76. value: res.data.address
  77. }, {
  78. label: "项目等级",
  79. value: res.data.grade
  80. }, {
  81. label: "当前阶段",
  82. value: res.data.stagename
  83. }, {
  84. label: "项目报备时间",
  85. value: res.data.createdate
  86. }, {
  87. label: "项目规模",
  88. value: res.data.scale
  89. }, {
  90. label: "项目状态",
  91. value: res.data.status
  92. }, {
  93. label: "项目预算",
  94. value: res.data.budgetary
  95. }, {
  96. label: "预计签约金额",
  97. value: res.data.signamount_due
  98. }, {
  99. label: "预计签约月份",
  100. value: res.data.signdate_due
  101. }, {
  102. label: "赢率",
  103. value: res.data.winrate
  104. }, {
  105. label: "负责人",
  106. value: res.data.name
  107. }],
  108. list2: [{
  109. label: "创建人",
  110. value: res.data.createby
  111. }, {
  112. label: "创建时间",
  113. value: res.data.createdate
  114. }, {
  115. label: "最近编辑人",
  116. value: res.data.changeby
  117. }, {
  118. label: "最近编辑时间",
  119. value: res.data.changedate
  120. }, {
  121. label: "最近跟进人",
  122. value: res.data.followby
  123. }, {
  124. label: "最近跟进时间",
  125. value: res.data.followdate
  126. }, {
  127. label: "转手次数",
  128. value: res.data.changecount
  129. }, {
  130. label: "报备人",
  131. value: res.data.reportby
  132. }, {
  133. label: "报备时间",
  134. value: res.data.reportdate
  135. }, {
  136. label: "报备审核通过时间",
  137. value: res.data.reportcheckdate
  138. }]
  139. })
  140. //更新列表赢率
  141. getCurrentPages().forEach(v => {
  142. if (v.getList) {
  143. let i = v.data.list.findIndex(e => e.sa_projectid == this.data.sa_projectid);
  144. if (i != -1) v.setData({
  145. [`list[${i}].winrate`]: parseFloat(res.data.winrate.substring(0, res.data.winrate.length - 1))
  146. })
  147. }
  148. })
  149. this.getTags();
  150. this.getGroup();
  151. this.partialRenewal();
  152. })
  153. },
  154. //tabs 切换
  155. tabsChange({
  156. detail
  157. }) {
  158. this.setData({
  159. tabsActive: detail
  160. });
  161. this.partialRenewal();
  162. },
  163. //更新标签
  164. getTags() {
  165. this.selectComponent("#Tags").getTags();
  166. },
  167. //更新团队成员
  168. getGroup() {
  169. this.selectComponent("#Group").getList();
  170. },
  171. //局部数据更新 tabs
  172. partialRenewal(init = false) {
  173. const id = this.data.detail.sa_projectid;
  174. let model = '';
  175. let name = this.data.tabsList[this.data.tabsActive].label;
  176. switch (name) {
  177. case "跟进动态":
  178. model = "#Trace"
  179. break;
  180. case "阶段任务":
  181. model = '#Task'
  182. break;
  183. case "关联客户":
  184. model = "#Treaty"
  185. break;
  186. };
  187. if (model) {
  188. // 确定好模块ID total = null 是第一次加载 加载数据
  189. // init是新增或修改需要清数据
  190. let Component = this.selectComponent(model);
  191. const {
  192. total,
  193. pageNumber,
  194. pageTotal
  195. } = Component.data.content;
  196. if (total == null || init) {
  197. Component.getList(id, init);
  198. } else if (pageNumber <= pageTotal) {
  199. Component.getList(id, false);
  200. } else {
  201. //用来判断 在搜索页面修改,与tabs选项不一致 但是切换到该选项 重置数据
  202. }
  203. }
  204. },
  205. onReachBottom() {
  206. this.partialRenewal();
  207. },
  208. onShareAppMessage() {
  209. }
  210. })