client-detail.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. import agentApi from '../../apis/agent'
  2. const app = getApp();
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. agent_user:{},
  9. clientInfo:[
  10. {
  11. key:'客户编号',
  12. id:'user_id',
  13. val:'50643540'
  14. },
  15. {
  16. key:'委托时间',
  17. id:'createTime',
  18. val:'2020.04.14'
  19. },
  20. {
  21. key:'维护进度',
  22. id:'',
  23. val:'暂无'
  24. }
  25. ],
  26. demand:[
  27. {
  28. key:'购房预算',
  29. id:'first_budget',
  30. val:'首付预算60-80万元'
  31. },
  32. {
  33. key:'购房位置',
  34. id:'buy_house_address',
  35. val:'香洲区-唐家湾镇'
  36. },
  37. {
  38. key:'面积',
  39. short:true,
  40. id:'ideal_area',
  41. val:'80-120m²'
  42. },
  43. {
  44. key:'居室',
  45. short:true,
  46. id:'rooms',
  47. val:'3居'
  48. },
  49. {
  50. key:'置业目的',
  51. short:true,
  52. id:'purpose',
  53. val:'刚需'
  54. },
  55. {
  56. key:'物业类型',
  57. short:true,
  58. id:'property_type',
  59. val:'待完善'
  60. }
  61. ]
  62. },
  63. /**
  64. * 生命周期函数--监听页面加载
  65. */
  66. onLoad: function (options) {
  67. app.wxshowloading('拼命加载中...');
  68. let {agency_user_id,user_id} = options
  69. this.user_id = user_id
  70. this.agency_user_id = agency_user_id
  71. },
  72. getClientDetail (agency_user_id,user_id) {
  73. agentApi.fetchCustomerDetail({agency_user_id,user_id}).then(res => {
  74. if (res.data) {
  75. this.setData({
  76. agent_user: res.data
  77. })
  78. }
  79. }).finally(data=>{
  80. wx.hideLoading()
  81. })
  82. },
  83. makePhoneCall(){
  84. app.makePhoneCall(this.data.agent_user.user_phone);
  85. },
  86. /**
  87. * 生命周期函数--监听页面初次渲染完成
  88. */
  89. onReady: function () {
  90. },
  91. /**
  92. * 生命周期函数--监听页面显示
  93. */
  94. onShow: function () {
  95. this.getClientDetail(this.agency_user_id, this.user_id)
  96. },
  97. /**
  98. * 生命周期函数--监听页面隐藏
  99. */
  100. onHide: function () {
  101. },
  102. /**
  103. * 生命周期函数--监听页面卸载
  104. */
  105. onUnload: function () {
  106. },
  107. /**
  108. * 页面相关事件处理函数--监听用户下拉动作
  109. */
  110. onPullDownRefresh: function () {
  111. },
  112. /**
  113. * 页面上拉触底事件的处理函数
  114. */
  115. onReachBottom: function () {
  116. },
  117. toChat () {
  118. wx.navigateTo({
  119. url: `/pages/chat/chat?toId=${this.data.agent_user.user_id}&toName=${this.data.agent_user.user_name}`,
  120. })
  121. },
  122. toEdit () {
  123. wx.navigateTo({
  124. url: `/pages/add-client/add-client?customer_id=${this.user_id}&agency_user_id=${this.agency_user_id}`,
  125. })
  126. }
  127. })