index.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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. if(order.payTime){
  67. order.payTime = dateF.formatTime('YYYY-mm-dd HH:MM:SS', order?.payTime?.iso)
  68. }
  69. if (order.startTime) {
  70. order.startTime = dateF.formatTime('YYYY-mm-dd HH:MM:SS', order?.startTime?.iso)
  71. }
  72. console.log(order)
  73. this.setData({
  74. order
  75. })
  76. },
  77. /** 复制*/
  78. copyStr(e) {
  79. let {
  80. str
  81. } = e.currentTarget.dataset
  82. if (str) {
  83. wx.setClipboardData({
  84. data: str,
  85. success: () => {
  86. wx.showToast({
  87. title: '复制成功',
  88. icon: 'success',
  89. });
  90. },
  91. fail: (err) => {
  92. console.error('复制失败:', err);
  93. wx.showToast({
  94. title: '复制失败',
  95. icon: 'none',
  96. duration: 2000
  97. });
  98. }
  99. });
  100. } else {
  101. wx.showToast({
  102. title: '没有订单编号',
  103. icon: 'none',
  104. duration: 2000
  105. });
  106. }
  107. },
  108. /**查看物流 */
  109. toExpress() {
  110. let {
  111. order
  112. } = this.data
  113. if (!order?.trackingNumber||!order?.expressCompany?.objectId) {
  114. wx.showToast({
  115. title: '暂无物流单号或快递公司',
  116. icon:'none'
  117. })
  118. return
  119. }
  120. wx.navigateTo({
  121. url: `/common-page/pages/nova-express/index?num=${order?.trackingNumber}&com=${order?.expressCompany?.code}&phone=${order?.info?.mobile}`,
  122. })
  123. },
  124. tourl(e) {
  125. let url = e.currentTarget.dataset.url
  126. wx.navigateTo({
  127. url: `${url}`,
  128. });
  129. },
  130. /**
  131. * 生命周期函数--监听页面初次渲染完成
  132. */
  133. onReady() {
  134. },
  135. /**
  136. * 生命周期函数--监听页面显示
  137. */
  138. onShow() {
  139. },
  140. /**
  141. * 生命周期函数--监听页面隐藏
  142. */
  143. onHide() {
  144. },
  145. /**
  146. * 生命周期函数--监听页面卸载
  147. */
  148. onUnload() {
  149. },
  150. /**
  151. * 页面相关事件处理函数--监听用户下拉动作
  152. */
  153. onPullDownRefresh() {
  154. },
  155. /**
  156. * 页面上拉触底事件的处理函数
  157. */
  158. onReachBottom() {
  159. },
  160. /**
  161. * 用户点击右上角分享
  162. */
  163. onShareAppMessage() {
  164. }
  165. })