detail.js 6.7 KB

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