index.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. // nova-tourism/pages/my/my-order/order-detail-good/index.js
  2. let Parse = getApp().Parse;
  3. const company = getApp().globalData.company
  4. const uid = Parse.User.current()?.id
  5. const dateF = require("../../../../../utils/date")
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. statusBarHeight: 0,
  12. screenHeight: 0,
  13. customHeight: 0,
  14. bottomNavHeight: 0,
  15. contentHeight: 0,
  16. objectId: '',
  17. value: '',
  18. roomList: {},
  19. statusMap: {
  20. '200': '待发货',
  21. '500': '等待退款',
  22. '601': '退款中',
  23. '602': '待发货',
  24. '300': '已发货',
  25. '400': '已收货',
  26. '700': '已收货',
  27. '800': '已收货',
  28. },
  29. },
  30. /**
  31. * 生命周期函数--监听页面加载
  32. */
  33. onLoad(options) {
  34. const {
  35. objectId
  36. } = options;
  37. this.setData({
  38. objectId,
  39. })
  40. console.log(this.data.objectId);
  41. const systemInfo = wx.getSystemInfoSync();
  42. const statusBarHeight = systemInfo.statusBarHeight || 0;
  43. const screenHeight = systemInfo.screenHeight || 0;
  44. const custom = wx.getMenuButtonBoundingClientRect();
  45. const customHeight = custom.height + 10 + 2 || 0;
  46. const bottomNavHeight = systemInfo.screenHeight - systemInfo.safeArea.bottom || 0;
  47. const contentHeight = (screenHeight - bottomNavHeight - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
  48. this.setData({
  49. statusBarHeight,
  50. screenHeight,
  51. customHeight,
  52. bottomNavHeight,
  53. contentHeight
  54. });
  55. this.getOrder()
  56. },
  57. /**获取订单 */
  58. async getOrder() {
  59. let {
  60. objectId
  61. } = this.data
  62. let query = new Parse.Query('Order')
  63. query.include('targetObject', 'store','expressCompany')
  64. let d = await query.get(objectId)
  65. let order = d?.toJSON()
  66. order.payTime = dateF.formatTime('YYYY-mm-dd HH:MM:SS', order.payTime.iso)
  67. if (order.startTime) {
  68. order.startTime = dateF.formatTime('YYYY-mm-dd HH:MM:SS', order.startTime.iso)
  69. }
  70. console.log(order)
  71. this.setData({
  72. order
  73. })
  74. },
  75. /** 复制*/
  76. copyStr(e) {
  77. let {
  78. str
  79. } = e.currentTarget.dataset
  80. if (str) {
  81. wx.setClipboardData({
  82. data: str,
  83. success: () => {
  84. wx.showToast({
  85. title: '复制成功',
  86. icon: 'success',
  87. });
  88. },
  89. fail: (err) => {
  90. console.error('复制失败:', err);
  91. wx.showToast({
  92. title: '复制失败',
  93. icon: 'none',
  94. duration: 2000
  95. });
  96. }
  97. });
  98. } else {
  99. wx.showToast({
  100. title: '没有订单编号',
  101. icon: 'none',
  102. duration: 2000
  103. });
  104. }
  105. },
  106. /**查看物流 */
  107. toExpress() {
  108. let {
  109. order
  110. } = this.data
  111. if (!order?.trackingNumber||!order?.expressCompany?.objectId) {
  112. wx.showToast({
  113. title: '暂无物流单号或快递公司',
  114. icon:'none'
  115. })
  116. return
  117. }
  118. wx.navigateTo({
  119. url: `/common-page/pages/nova-express/index?num=${order?.trackingNumber}&com=${order?.expressCompany?.code}&phone=${order?.info?.mobile}`,
  120. })
  121. },
  122. tourl(e) {
  123. let url = e.currentTarget.dataset.url
  124. wx.navigateTo({
  125. url: `${url}`,
  126. });
  127. },
  128. /**
  129. * 生命周期函数--监听页面初次渲染完成
  130. */
  131. onReady() {
  132. },
  133. /**
  134. * 生命周期函数--监听页面显示
  135. */
  136. onShow() {
  137. },
  138. /**
  139. * 生命周期函数--监听页面隐藏
  140. */
  141. onHide() {
  142. },
  143. /**
  144. * 生命周期函数--监听页面卸载
  145. */
  146. onUnload() {
  147. },
  148. /**
  149. * 页面相关事件处理函数--监听用户下拉动作
  150. */
  151. onPullDownRefresh() {
  152. },
  153. /**
  154. * 页面上拉触底事件的处理函数
  155. */
  156. onReachBottom() {
  157. },
  158. /**
  159. * 用户点击右上角分享
  160. */
  161. onShareAppMessage() {
  162. }
  163. })