clientInfo.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. import { get } from "../../utils/http"
  2. // pages/clientInfo/clientInfo.js
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. urls: [
  9. "https://img1.baidu.com/it/u=202543353,3627416815&fm=26&fmt=auto",
  10. "https://img0.baidu.com/it/u=745609344,230882238&fm=26&fmt=auto",
  11. "https://img0.baidu.com/it/u=286636366,3227707112&fm=26&fmt=auto",
  12. "https://img1.baidu.com/it/u=2450865760,444795162&fm=26&fmt=auto",
  13. "https://img0.baidu.com/it/u=4226275504,4103997964&fm=26&fmt=auto",
  14. "https://img0.baidu.com/it/u=2247422843,411257408&fm=26&fmt=auto",
  15. "https://img0.baidu.com/it/u=3098615520,360170704&fm=26&fmt=auto",
  16. "https://img1.baidu.com/it/u=510862345,2249984174&fm=26&fmt=auto",
  17. "https://img2.baidu.com/it/u=2222750380,2392750381&fm=26&fmt=auto",
  18. ],
  19. sex: {
  20. 0: '保密',
  21. 1: '男',
  22. 2: '女'
  23. },
  24. list: [],
  25. total: 0,
  26. page: 1,
  27. tags: ['美丽貌美','短短胳膊粗粗的腿','闭月羞花','人美声甜白富美']
  28. },
  29. /**
  30. * 生命周期函数--监听页面加载
  31. */
  32. onLoad: function (options) {
  33. console.log(options)
  34. if(options.userId) {
  35. this.setData({
  36. userId: options.userId
  37. },() => {
  38. this.getUserInfo()
  39. this.getfeedbackList()
  40. })
  41. }
  42. },
  43. /**
  44. * 生命周期函数--监听页面初次渲染完成
  45. */
  46. onReady: function () {
  47. },
  48. /**
  49. * 生命周期函数--监听页面显示
  50. */
  51. onShow: function () {
  52. },
  53. /**
  54. * 生命周期函数--监听页面隐藏
  55. */
  56. onHide: function () {
  57. },
  58. /**
  59. * 生命周期函数--监听页面卸载
  60. */
  61. onUnload: function () {
  62. },
  63. /**
  64. * 页面相关事件处理函数--监听用户下拉动作
  65. */
  66. onPullDownRefresh: function () {
  67. },
  68. /**
  69. * 页面上拉触底事件的处理函数
  70. */
  71. onReachBottom: function () {
  72. if(this.data.page * 10 < this.data.total) {
  73. this.getfeedbackList(++this.data.page)
  74. }
  75. },
  76. /**
  77. * 用户点击右上角分享
  78. */
  79. onShareAppMessage: function () {
  80. },
  81. afterCalendarRender(e) {
  82. const calendar = this.selectComponent('#calendar').calendar
  83. console.log('afterCalendarRender -> calendar', calendar)
  84. const toSet = [
  85. {
  86. year: 2021,
  87. month: 11,
  88. date: 15
  89. },
  90. {
  91. year: 2019,
  92. month: 3,
  93. date: 18
  94. }
  95. ]
  96. calendar.setSelectedDates(toSet)
  97. },
  98. /**
  99. * 图片预览
  100. */
  101. previewMedia(e) {
  102. let { idx,index } = e.currentTarget.dataset;
  103. let arr = this.data.list[idx].media_list
  104. let current = index
  105. wx.previewMedia({
  106. sources: arr,
  107. current
  108. })
  109. },
  110. /**
  111. * 获取客户信息
  112. * api/user/info
  113. */
  114. getUserInfo(user_id) {
  115. let { userId } = this.data;
  116. get('api/user/info',{
  117. user_id: userId
  118. },(res) => {
  119. this.setData({
  120. userInfo: res.data
  121. })
  122. console.log(res)
  123. })
  124. },
  125. /**
  126. * 获取订单反馈记录
  127. * api/feedback/list/user
  128. */
  129. getfeedbackList(_page) {
  130. let { page,list,userId } = this.data;
  131. get('api/feedback/list/user',{
  132. user_id: userId,
  133. page: _page || page,
  134. limit: 10
  135. },(res) => {
  136. console.log(res)
  137. res.data.list.forEach((item,index) => {
  138. item.media_list = JSON.parse(item.media_list)
  139. })
  140. list.push(...res.data.list)
  141. this.setData({ list,total: res.data.total, })
  142. })
  143. }
  144. })