orderClassDetail.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. // pages/orderClassDetail/orderClassDetail.js
  2. const app = getApp()
  3. const util = require("../../utils/util")
  4. const urlDef = require("../../utils/urls")
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. id: null,
  11. cid: null,
  12. order: {},
  13. items: [],
  14. images: [],
  15. item: null
  16. },
  17. showImg: function () {
  18. let list = this.data.images;
  19. if (list.length == 0) {
  20. wx.showToast({
  21. title: '未上传合同',
  22. icon: 'none',
  23. })
  24. return
  25. }
  26. wx.previewImage({
  27. current: list[0],
  28. urls: list,
  29. })
  30. },
  31. /**
  32. * 生命周期函数--监听页面加载
  33. */
  34. onLoad: function (options) {
  35. let id = options.id
  36. let cid = options.cid
  37. this.setData({ id: id, cid: cid })
  38. const urls = urlDef.urls;
  39. let params = {
  40. 'q.orderId': id
  41. }
  42. util.apiPost(urls.get_order, params).then(rs => {
  43. if (rs != null) {
  44. // rs[0].payDate = this.renderTime(rs[0].payDate)
  45. // this.setData({ items: rs, order: rs[0] })
  46. // this.queryContract()
  47. }
  48. })
  49. },
  50. renderTime:function(date) {
  51. var dateee = new Date(date).toJSON();
  52. return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
  53. },
  54. /**
  55. * 生命周期函数--监听页面初次渲染完成
  56. */
  57. onReady: function () {
  58. },
  59. /**
  60. * 生命周期函数--监听页面显示
  61. */
  62. onShow: function () {
  63. },
  64. /**
  65. * 生命周期函数--监听页面隐藏
  66. */
  67. onHide: function () {
  68. },
  69. /**
  70. * 生命周期函数--监听页面卸载
  71. */
  72. onUnload: function () {
  73. },
  74. /**
  75. * 页面相关事件处理函数--监听用户下拉动作
  76. */
  77. onPullDownRefresh: function () {
  78. },
  79. /**
  80. * 页面上拉触底事件的处理函数
  81. */
  82. onReachBottom: function () {
  83. },
  84. /**
  85. * 用户点击右上角分享
  86. */
  87. onShareAppMessage: function () {
  88. },
  89. queryContract: function () {
  90. const urls = urlDef.urls;
  91. let params = {
  92. 'q.orderId': this.data.cid
  93. }
  94. util.apiPost(urls.get_contract_images, params).then(rs => {
  95. if (rs != null) {
  96. let images = [];
  97. if (rs && rs.length > 0) {
  98. rs.forEach(r => {
  99. images.push(r.imgUrl);
  100. });
  101. this.setData({ images: images })
  102. }
  103. }
  104. })
  105. }
  106. })