index.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import {
  2. ApiModel
  3. } from '../../utils/api';
  4. const _Http = new ApiModel();
  5. import queryLogin from '../../utils/isLogin';
  6. Component({
  7. options: {
  8. addGlobalClass: true,
  9. },
  10. /**
  11. * 组件的属性列表
  12. */
  13. properties: {
  14. list: Array
  15. },
  16. /**
  17. * 组件的初始数据
  18. */
  19. data: {
  20. isLogin: false,
  21. },
  22. pageLifetimes: {
  23. show: function () {
  24. this.setData({
  25. isLogin: wx.getStorageSync('userData') ? true : false
  26. })
  27. },
  28. },
  29. /**
  30. * 组件的方法列表
  31. */
  32. methods: {
  33. /* 跳转详情页 */
  34. toDetailPage(e) {
  35. const {
  36. item
  37. } = e.currentTarget.dataset;
  38. wx.navigateTo({
  39. url: '/pages/tabbar-pages/home/sdDetalis?item=' + JSON.stringify(item),
  40. });
  41. },
  42. /* 马上拨打 */
  43. callUp(e) {
  44. if (!queryLogin()) return;
  45. const {
  46. phone,
  47. id
  48. } = e.currentTarget.dataset;
  49. wx.makePhoneCall({
  50. phoneNumber: phone
  51. })
  52. this.record(2, id)
  53. },
  54. shareCall(e) {
  55. if (!queryLogin()) return;
  56. let {
  57. item
  58. } = e.currentTarget.dataset
  59. console.log(item)
  60. this.triggerEvent('shareCallBack', item);
  61. this.record(3, item.tsupplyanddemandid)
  62. },
  63. /* 处理记录 */
  64. record(type, id) {
  65. _Http.basic({
  66. "accesstoken": wx.getStorageSync('userData').token,
  67. "classname": "customer.supplyanddemand.supplyanddemand",
  68. "method": "addsupplyanddemandLog",
  69. "content": {
  70. "ftype": type,
  71. "tsupplyanddemandid": id,
  72. "tenterprise_userid": wx.getStorageSync('userData').userid ? wx.getStorageSync('userData').userid : 0
  73. }
  74. }).then(res => {
  75. console.log(res)
  76. })
  77. }
  78. },
  79. })