displayData.js 2.7 KB

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