detail.js 6.9 KB

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