orderClassDetail.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. },
  16. showImg: function () {
  17. let list = this.data.images;
  18. if (list.length == 0) {
  19. wx.showToast({
  20. title: '未上传合同',
  21. icon: 'none',
  22. })
  23. return
  24. }
  25. wx.previewImage({
  26. current: list[0],
  27. urls: list,
  28. })
  29. },
  30. /**
  31. * 生命周期函数--监听页面加载
  32. */
  33. onLoad: function (options) {
  34. let id = options.id
  35. let cid = options.cid
  36. this.setData({ id: id, cid: cid })
  37. const urls = urlDef.urls;
  38. let params = {
  39. 'q.orderId': id
  40. }
  41. util.apiPost(urls.get_order, params).then(rs => {
  42. if (rs != null) {
  43. this.setData({ items: rs, order: rs[0] })
  44. this.queryContract()
  45. }
  46. })
  47. },
  48. /**
  49. * 生命周期函数--监听页面初次渲染完成
  50. */
  51. onReady: function () {
  52. },
  53. /**
  54. * 生命周期函数--监听页面显示
  55. */
  56. onShow: function () {
  57. },
  58. /**
  59. * 生命周期函数--监听页面隐藏
  60. */
  61. onHide: function () {
  62. },
  63. /**
  64. * 生命周期函数--监听页面卸载
  65. */
  66. onUnload: function () {
  67. },
  68. /**
  69. * 页面相关事件处理函数--监听用户下拉动作
  70. */
  71. onPullDownRefresh: function () {
  72. },
  73. /**
  74. * 页面上拉触底事件的处理函数
  75. */
  76. onReachBottom: function () {
  77. },
  78. /**
  79. * 用户点击右上角分享
  80. */
  81. onShareAppMessage: function () {
  82. },
  83. queryContract: function () {
  84. const urls = urlDef.urls;
  85. let params = {
  86. 'q.orderId': this.data.cid
  87. }
  88. util.apiPost(urls.get_contract_images, params).then(rs => {
  89. if (rs != null) {
  90. let images = [];
  91. if (rs && rs.length > 0) {
  92. rs.forEach(r => {
  93. images.push(r.imgUrl);
  94. });
  95. this.setData({ images: images })
  96. }
  97. }
  98. })
  99. }
  100. })