displayData.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. ready() {
  27. let params = {
  28. "classname": "saletool.notice.data", //默认通告
  29. "method": "getSaleareaInfo", //默认经销商
  30. "content": {
  31. sat_noticeid: this.data.dataId,
  32. "sat_coursewareid": this.data.dataId
  33. }
  34. };
  35. if (this.data.ptype == '学习') params.classname = "saletool.courseware.data";
  36. if (this.data.dataAuth != 'all') {
  37. params.method = this.data.dataAuth == '内部' ? 'getInternalInfo' : 'getSaleareaInfo'
  38. this.setData({
  39. active: this.data.dataAuth
  40. })
  41. };
  42. this.setData({
  43. params
  44. })
  45. this.getData();
  46. },
  47. },
  48. pageLifetimes: {
  49. show: function () {
  50. console.log(31321321)
  51. }
  52. },
  53. options: {
  54. addGlobalClass: true
  55. },
  56. methods: {
  57. onChange(e) {
  58. let {
  59. name
  60. } = e.detail;
  61. this.setData({
  62. active: name,
  63. "params.method": name == '内部' ? 'getInternalInfo' : 'getSaleareaInfo'
  64. });
  65. this.getData();
  66. },
  67. getData() {
  68. _Http.basic(this.data.params).then(res => {
  69. console.log("学习数据", res)
  70. this.setData({
  71. list: res.data,
  72. tips: res.tips
  73. });
  74. })
  75. },
  76. callOut(e) {
  77. const {
  78. item
  79. } = e.currentTarget.dataset;
  80. this.setData({
  81. 'actions[0].name': '呼叫 ' + item.phonenumber,
  82. actionShow: true
  83. })
  84. },
  85. handleCallOut(e) {
  86. let phone = e.detail.name.split(' ')[1];
  87. wx.makePhoneCall({
  88. phoneNumber: phone,
  89. success() {},
  90. fail() {}
  91. })
  92. },
  93. onClose() {
  94. this.setData({
  95. 'actions[0].name': '',
  96. actionShow: false
  97. })
  98. },
  99. }
  100. })