leadsdetail.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. const {
  2. api_leads_info
  3. } = require('../../utils/api.js');
  4. const {
  5. net
  6. } = require('../../utils/net.js');
  7. const util = require('../../utils/util.js');
  8. Page({
  9. data: {
  10. loadingFlag: true,
  11. current: 1,
  12. tabs: ['跟进', '详情', '订单'],
  13. id: '',
  14. detailData: {}
  15. },
  16. onLoad: function (options) {
  17. this.setData({
  18. current: util.getStorageSync('leadsdetailCheck') || 0,
  19. id: options.id
  20. }, () => {
  21. this.getData();
  22. })
  23. },
  24. goOrderDetail(e) {
  25. const orderId = e.currentTarget.dataset.orderId;
  26. wx.navigateTo({
  27. url: `/pages/orderdetail/orderdetail?id=${orderId}`
  28. })
  29. },
  30. onReady: function () {
  31. wx.setNavigationBarTitle({
  32. title: '客户详情'
  33. })
  34. },
  35. // 滑动切换
  36. swiperChange(options) {
  37. this.setData({
  38. current: options.detail.current
  39. })
  40. },
  41. // 点击切换
  42. slideTab(options) {
  43. this.setData({
  44. current: options.currentTarget.dataset.index
  45. })
  46. wx.setStorageSync('leadsdetailCheck', options.currentTarget.dataset.index);
  47. },
  48. // 获取数据
  49. getData() {
  50. let _this = this
  51. _this.setData({
  52. loadingFlag: true
  53. })
  54. let params = {
  55. url: api_leads_info,
  56. data: {
  57. id: this.data.id
  58. }
  59. }
  60. net.req(params).then((res) => {
  61. _this.setData({
  62. detailData: res.data,
  63. loadingFlag: false
  64. })
  65. })
  66. },
  67. copyWXAction(e) {
  68. const { currentWx } = e.currentTarget.dataset;
  69. if (currentWx && currentWx.length) {
  70. wx.setClipboardData({
  71. data: currentWx,
  72. success(res) {
  73. }
  74. })
  75. }
  76. },
  77. tapTelAction(e) {
  78. const { tel } = e.currentTarget.dataset;
  79. let _this = this;
  80. let systemInfo = util.getStorageSync('systemInfo');
  81. if (!systemInfo) {
  82. systemInfo = wx.getSystemInfoSync();
  83. if (systemInfo) {
  84. wx.setStorageSync('systemInfo', systemInfo);
  85. }
  86. }
  87. let { system } = systemInfo;
  88. if (system.toLowerCase().indexOf('ios') !== -1) {
  89. wx.makePhoneCall({
  90. phoneNumber: tel,
  91. success() { },
  92. fail() { },
  93. complete() { }
  94. });
  95. } else {
  96. wx.showActionSheet({
  97. itemList: [tel],
  98. success(res) {
  99. if (res.tapIndex === 0) {
  100. wx.makePhoneCall({
  101. phoneNumber: _this.data.phone,
  102. success() { },
  103. fail() { },
  104. complete() { }
  105. });
  106. }
  107. }
  108. })
  109. }
  110. },
  111. copyNumAction(e) {
  112. const { currentNum } = e.currentTarget.dataset;
  113. if (currentNum && currentNum.length) {
  114. wx.setClipboardData({
  115. data: currentNum,
  116. success(res) {
  117. }
  118. })
  119. }
  120. }
  121. })