index.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. const _Http = getApp().globalData.http,
  2. MFT = require("../../../../../utils/matchingFeilType");
  3. Page({
  4. data: {
  5. ownertable: null,
  6. ownerid: null,
  7. sys_datafollowupid: null,
  8. detail: {},
  9. files: {
  10. images: [],
  11. viewImages: [],
  12. videos: [],
  13. viewVideos: [],
  14. files: []
  15. },
  16. tabbarList: [{
  17. icon: "icon-bianji",
  18. label: "编辑"
  19. }, {
  20. icon: "icon-shanchu",
  21. label: "作废"
  22. }]
  23. },
  24. onLoad(options) {
  25. if (options.data) {
  26. this.setData({
  27. ...JSON.parse(options.data)
  28. })
  29. this.getDetail();
  30. }
  31. },
  32. getDetail() {
  33. _Http.basic({
  34. "id": 20221026085601,
  35. "content": {
  36. "sys_datafollowupid": this.data.sys_datafollowupid
  37. }
  38. }).then(res => {
  39. console.log("跟进详情", res)
  40. if (res.msg != '成功') return wx.showToast({
  41. title: res.data,
  42. icon: "none"
  43. })
  44. this.handleFiles(MFT.fileList(res.data.attinfos));
  45. this.setData({
  46. detail: res.data,
  47. briefs: [{
  48. label: "跟进类型",
  49. value: res.data.type
  50. }, {
  51. label: "跟进内容",
  52. value: res.data.content
  53. }]
  54. })
  55. })
  56. },
  57. /* 处理附件 */
  58. handleFiles(list) {
  59. let files = this.data.files;
  60. list.forEach(v => {
  61. switch (v.fileType) {
  62. case "video":
  63. files.videos.push(v)
  64. files.viewVideos.push({
  65. url: v.url,
  66. type: "video",
  67. poster: v.subfiles[0].url
  68. })
  69. break;
  70. case "image":
  71. files.images.push(v)
  72. files.viewImages.push({
  73. url: v.url,
  74. type: "image"
  75. })
  76. break;
  77. default:
  78. files.files.push(v)
  79. break;
  80. }
  81. });
  82. this.setData({
  83. files
  84. })
  85. },
  86. /* tab 切换回调 */
  87. tabbarOnClick({
  88. detail
  89. }) {
  90. const item = this.data.detail;
  91. switch (detail.label) {
  92. case "编辑":
  93. wx.navigateTo({
  94. url: `/packageA/setclient/modules/trace/add/index?ownertable=${this.data.ownertable}&ownerid=${this.data.ownerid}&sys_datafollowupid=${item.sys_datafollowupid}`
  95. });
  96. break;
  97. case "作废":
  98. wx.navigateTo({
  99. url: `/packageA/setclient/modules/trace/list/delete?item=${JSON.stringify({
  100. "sys_datafollowupid": item.sys_datafollowupid,
  101. "ownertable": this.data.ownertable,
  102. "ownerid": this.data.ownerid
  103. })}`,
  104. })
  105. break;
  106. }
  107. },
  108. onShareAppMessage() {}
  109. })