displayData.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. const _Http = getApp().globalData.http;
  2. Component({
  3. properties: {
  4. ptype: {
  5. type: String,
  6. value: "浏览"
  7. },
  8. dataId: {
  9. type: String,
  10. value: ''
  11. },
  12. dataAuth: {
  13. type: String,
  14. value: '' //all 内部 经销商
  15. }
  16. },
  17. data: {
  18. actions: [{
  19. name: '',
  20. color: '#3874F6'
  21. }],
  22. actionShow: false,
  23. active: "经销商"
  24. },
  25. lifetimes: {
  26. attached() {
  27. getApp().globalData.Language.getLanguagePackage(this)
  28. },
  29. ready() {
  30. let params = {
  31. "classname": "saletool.notice.data", //默认通告
  32. "method": "getSaleareaInfo", //默认经销商
  33. "content": {
  34. sat_noticeid: this.data.dataId,
  35. "sat_coursewareid": this.data.dataId
  36. }
  37. };
  38. if (this.data.ptype == '学习') params.classname = "saletool.courseware.data";
  39. if (this.data.dataAuth != 'all') {
  40. params.method = this.data.dataAuth == '内部' ? 'getInternalInfo' : 'getSaleareaInfo'
  41. this.setData({
  42. active: this.data.dataAuth
  43. })
  44. };
  45. this.setData({
  46. params
  47. })
  48. this.getData();
  49. },
  50. },
  51. options: {
  52. addGlobalClass: true
  53. },
  54. methods: {
  55. onChange(e) {
  56. let {
  57. name
  58. } = e.detail;
  59. this.setData({
  60. active: name,
  61. "params.method": name == '内部' ? 'getInternalInfo' : 'getSaleareaInfo'
  62. });
  63. this.getData();
  64. },
  65. getData() {
  66. _Http.basic(this.data.params).then(res => {
  67. this.setData({
  68. list: res.data,
  69. tips: res.tips
  70. });
  71. })
  72. },
  73. callOut(e) {
  74. const {
  75. item
  76. } = e.currentTarget.dataset;
  77. this.setData({
  78. 'actions[0].name': '呼叫 ' + item.phonenumber,
  79. actionShow: true
  80. })
  81. },
  82. handleCallOut(e) {
  83. let phone = e.detail.name.split(' ')[1];
  84. wx.makePhoneCall({
  85. phoneNumber: phone,
  86. success() {},
  87. fail() {}
  88. })
  89. },
  90. onClose() {
  91. this.setData({
  92. 'actions[0].name': '',
  93. actionShow: false
  94. })
  95. },
  96. }
  97. })