detail.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. const _Http = getApp().globalData.http;
  2. Page({
  3. data: {
  4. ownertable: null,
  5. ownerid: null,
  6. sys_datafollowupid: null,
  7. detail: {},
  8. tabbarList: [{
  9. icon: "icon-bianji",
  10. label: "编辑"
  11. }, {
  12. icon: "icon-shanchu",
  13. label: "删除"
  14. }]
  15. },
  16. onLoad(options) {
  17. if (options.data) {
  18. this.setData({
  19. ...JSON.parse(options.data),
  20. userid: wx.getStorageSync('userMsg').userid,
  21. })
  22. this.getDetail();
  23. }
  24. getApp().globalData.Language.getLanguagePackage(this, '跟进动态详情');
  25. },
  26. getDetail() {
  27. _Http.basic({
  28. "id": 20221026085601,
  29. "content": {
  30. "sys_datafollowupid": this.data.sys_datafollowupid
  31. }
  32. }).then(res => {
  33. console.log("跟进详情", res)
  34. if (res.code != '1') return wx.showToast({
  35. title: res.data,
  36. icon: "none"
  37. })
  38. res.data.names = res.data.contacts.map(n => n.name)
  39. this.selectComponent("#Yl_files").initData()
  40. this.selectComponent("#Yl_files").handleFiles(res.data.attinfos)
  41. this.setData({
  42. detail: res.data,
  43. briefs: [{
  44. label: "跟进对象",
  45. value: res.data.names
  46. }, {
  47. label: "跟进类型",
  48. value: res.data.type
  49. }, {
  50. label: "跟进内容",
  51. value: res.data.content
  52. }]
  53. })
  54. })
  55. },
  56. /* tab 切换回调 */
  57. tabbarOnClick({
  58. detail
  59. }) {
  60. const item = this.data.detail;
  61. switch (detail.label) {
  62. case "编辑":
  63. _Http.editItem(item);
  64. break;
  65. case "删除":
  66. _Http.handleDelete(item).then(code => {
  67. if (code) setTimeout(() => {
  68. wx.navigateBack()
  69. }, 300)
  70. });
  71. break;
  72. }
  73. },
  74. onUnload() {
  75. delete _Http.changeItem
  76. delete _Http.editItem
  77. delete _Http.handleDelete
  78. },
  79. onShareAppMessage() {}
  80. })