orderDetail.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. import {
  2. get,
  3. post
  4. } from '../../utils/http';
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. urls: [
  11. "https://img1.baidu.com/it/u=202543353,3627416815&fm=26&fmt=auto",
  12. "https://img0.baidu.com/it/u=745609344,230882238&fm=26&fmt=auto",
  13. "https://img0.baidu.com/it/u=286636366,3227707112&fm=26&fmt=auto",
  14. "https://img1.baidu.com/it/u=2450865760,444795162&fm=26&fmt=auto",
  15. "https://img0.baidu.com/it/u=4226275504,4103997964&fm=26&fmt=auto",
  16. "https://img0.baidu.com/it/u=2247422843,411257408&fm=26&fmt=auto",
  17. "https://img0.baidu.com/it/u=3098615520,360170704&fm=26&fmt=auto",
  18. "https://img1.baidu.com/it/u=510862345,2249984174&fm=26&fmt=auto",
  19. "https://img2.baidu.com/it/u=2222750380,2392750381&fm=26&fmt=auto",
  20. ],
  21. status: {
  22. 1: '待进行',
  23. 2: '进行中',
  24. 3: '已完成'
  25. },
  26. list: [],
  27. total: 0,
  28. page: 1,
  29. index: 0,
  30. visible: false,
  31. },
  32. /**
  33. * 生命周期函数--监听页面加载
  34. */
  35. onLoad: function (options) {
  36. console.log(options)
  37. this.setData({
  38. id: options.orderId
  39. },() => {
  40. this.getOrderInfo()
  41. this.getFeedbackList()
  42. })
  43. },
  44. /**
  45. * 生命周期函数--监听页面初次渲染完成
  46. */
  47. onReady: function () {
  48. },
  49. /**
  50. * 生命周期函数--监听页面显示
  51. */
  52. onShow: function () {
  53. },
  54. /**
  55. * 生命周期函数--监听页面隐藏
  56. */
  57. onHide: function () {
  58. },
  59. /**
  60. * 生命周期函数--监听页面卸载
  61. */
  62. onUnload: function () {
  63. },
  64. /**
  65. * 页面相关事件处理函数--监听用户下拉动作
  66. */
  67. onPullDownRefresh: function () {
  68. },
  69. /**
  70. * 页面上拉触底事件的处理函数
  71. */
  72. onReachBottom: function () {
  73. if(this.data.page * 10 < this.data.total) {
  74. this.getFeedbackList(++this.data.page)
  75. }
  76. },
  77. /**
  78. * 用户点击右上角分享
  79. */
  80. onShareAppMessage: function () {
  81. },
  82. /**
  83. * 复制订单号
  84. */
  85. onCopyOrderNum(e) {
  86. wx.setClipboardData({
  87. data: e.currentTarget.dataset.num || '',
  88. success(res) {
  89. console.log(res)
  90. }
  91. })
  92. },
  93. /**
  94. * 打开弹框
  95. */
  96. onEditItem() {
  97. this.setData({
  98. visible: true
  99. })
  100. },
  101. /**
  102. * 关闭弹框
  103. */
  104. onPopupState() {
  105. this.setData({
  106. visible: false
  107. })
  108. },
  109. /**
  110. * 图片预览
  111. */
  112. previewImage(e) {
  113. wx.previewImage({
  114. current: e.currentTarget.dataset.index,
  115. urls: this.data.urls
  116. })
  117. },
  118. /**
  119. * 获取订单详情
  120. */
  121. getOrderInfo(id) {
  122. get('api/order/info',{
  123. order_id: this.data.id
  124. },(res) => {
  125. this.setData({
  126. detailData: res.data
  127. // detailData: {}
  128. })
  129. })
  130. },
  131. /**
  132. * 获取反馈记录列表
  133. * api/feedback/list/order
  134. */
  135. getFeedbackList(_page) {
  136. let { list,page } = this.data;
  137. get('api/feedback/list/order',{
  138. order_id: this.data.id,
  139. page: _page || page,
  140. limit: 10
  141. },(res) => {
  142. list.push(...res.data.list)
  143. this.setData({ list,total: res.data.total, })
  144. console.log(res)
  145. })
  146. }
  147. })