detailData.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // pages/detailInfo/detailData.js
  2. import http from '../../utils/http'
  3. import util from '../../utils/util'
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. dates: '',
  10. date: "",
  11. project_id: "",
  12. datainfo: {},
  13. order_sn: "",
  14. th: ["租赁设备", "提交人", "金额"],
  15. td: [],
  16. is_manager:""
  17. },
  18. /**
  19. * 生命周期函数--监听页面加载
  20. */
  21. onLoad: function (options) {
  22. this.setData({
  23. date: options.date,
  24. project_id: options.id - 0,
  25. dates: options.dates,
  26. order_sn: options.order_sn
  27. })
  28. this.getOrderDetails()
  29. },
  30. /**
  31. * 生命周期函数--监听页面初次渲染完成
  32. */
  33. onReady: function () {
  34. },
  35. getOrderDetails() {
  36. http({
  37. url: 'orders/getOrderDetails',
  38. data: {
  39. date: this.data.date,
  40. project_id: this.data.project_id,
  41. dates: this.data.dates,
  42. order_sn: this.data.order_sn,
  43. user_id:wx.getStorageSync('sg-userinfo').id
  44. },
  45. success: (res) => {
  46. console.log(res)
  47. if (res.code == 0) {
  48. this.setData({
  49. datainfo: res.order_view,
  50. td: res.data,
  51. is_manager:res.is_manager
  52. })
  53. }
  54. }
  55. })
  56. },
  57. confirmOrder() {
  58. let time = util.formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss')
  59. wx.showModal({
  60. title: "提示",
  61. content: "是否确认账单",
  62. success: (res) => {
  63. if (res.confirm) {
  64. http({
  65. url: 'orders/updateOrderviewStatus',
  66. data: {
  67. order_sn: this.data.order_sn,
  68. time: time
  69. },
  70. success: (re) => {
  71. if (re.code == 0) {
  72. wx.showToast({
  73. title: re.msg,
  74. icon: "none",
  75. duration:1000
  76. })
  77. setTimeout(()=>{
  78. wx.navigateBack({
  79. delta: 1,
  80. })
  81. },1000)
  82. }
  83. }
  84. })
  85. }
  86. }
  87. })
  88. },
  89. /**
  90. * 生命周期函数--监听页面显示
  91. */
  92. onShow: function () {
  93. },
  94. /**
  95. * 生命周期函数--监听页面隐藏
  96. */
  97. onHide: function () {
  98. },
  99. /**
  100. * 生命周期函数--监听页面卸载
  101. */
  102. onUnload: function () {
  103. },
  104. /**
  105. * 页面相关事件处理函数--监听用户下拉动作
  106. */
  107. onPullDownRefresh: function () {
  108. },
  109. /**
  110. * 页面上拉触底事件的处理函数
  111. */
  112. onReachBottom: function () {
  113. },
  114. /**
  115. * 用户点击右上角分享
  116. */
  117. onShareAppMessage: function () {
  118. }
  119. })