业务交流通
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // components/listItem/listItem.js
  2. const app = getApp();
  3. const $request = require('../../utils/request.js');
  4. Component({
  5. /**
  6. * 组件的属性列表
  7. */
  8. properties: {
  9. // 数据
  10. item: {
  11. type: Object,
  12. },
  13. // index => 首页 detatil => 详情 homepage => 个人主页
  14. pageStatus: {
  15. type: String,
  16. value: 'index',
  17. },
  18. // 是否收藏
  19. isCollect: {
  20. type: Boolean,
  21. value: false,
  22. },
  23. // 是否显示收藏
  24. isShowCollect: {
  25. type: Boolean,
  26. value: false,
  27. },
  28. // 是否其他查看主页---用于是否显示聊一聊
  29. isOther: {
  30. type: Boolean,
  31. value: true,
  32. },
  33. // 类名
  34. listClass: {
  35. type: String,
  36. value: "",
  37. },
  38. customerId: {
  39. type: Number,
  40. value: null,
  41. },
  42. },
  43. /**
  44. * 组件的初始数据
  45. */
  46. data: {
  47. },
  48. /**
  49. * 组件的方法列表
  50. */
  51. methods: {
  52. getCustomerId() {
  53. return 123
  54. },
  55. // 进入详情
  56. goDetails(e) {
  57. if (this.data.listClass == 'disabled-model-view') {
  58. return
  59. }
  60. let value = e.currentTarget.dataset.value;
  61. this.triggerEvent('getItem', value);
  62. },
  63. // 进入个人主页
  64. goHomePage(e) {
  65. let customerid = e.currentTarget.dataset.customerid;
  66. wx.navigateTo({
  67. url: '/pages/index/components/homepage/homepage',
  68. success: function (res) {
  69. // 通过eventChannel向被打开页面传送数据
  70. res.eventChannel.emit('customerid', { customerid })
  71. }
  72. })
  73. },
  74. // 收藏
  75. productCollect(e) {
  76. this.triggerEvent('changeCollect');
  77. },
  78. // 聊一聊
  79. goToChat(e) {
  80. if (!app.globalData.customerId) {
  81. app.goLogin();
  82. return
  83. }
  84. let item = e.currentTarget.dataset.item;
  85. // console.log(e,'e')
  86. if(item.state != 0){
  87. return
  88. }
  89. let businessCommunicationDemandId = item.businessCommunicationDemandId;
  90. $request.post('/statisticsBusinessCommunicationDemand/saveDemandCollect.action',
  91. { businessCommunicationDemandId }
  92. ).then(res => { }).catch(err => { console.log(err) })
  93. $request.post('/statisticsBusinessCommunicationDemand/demandPageView.action',
  94. { businessCommunicationDemandId, customerId: app.globalData.customerId }
  95. ).then(res => { }).catch(err => { console.log(err) })
  96. wx.navigateTo({
  97. url: "/pages/msgModule/wechat2/wechat2",
  98. success: function (res) {
  99. // 通过eventChannel向被打开页面传送数据
  100. res.eventChannel.emit('customerid', {
  101. customerid: item.customerId,
  102. businessCommunicationDemandId,
  103. chatHeads: item.chatHeads,
  104. info: item.info
  105. })
  106. }
  107. })
  108. },
  109. }
  110. })