graveDetail.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. var util = require('../../utils/util.js');
  2. var api = require('../../config/api.js');
  3. let referCode = 0
  4. // pages/graveDetail/graveDetail.js
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. index: 0,
  11. currentSize: 0,
  12. phoneTypes: ['853', '852', '86'],
  13. name: '',
  14. email: '',
  15. phone: '',
  16. desc: '',
  17. statusMap: ['現貨', '已預定', '已售', '現貨', '預售', '轉售', '已下架'],
  18. detail: {}
  19. },
  20. bindIndexChange(val) {
  21. this.setData({
  22. index: val.detail.value
  23. })
  24. },
  25. bindDescChange(val) {
  26. this.setData({
  27. currentSize: val.detail.value.length,
  28. desc: val.detail.value
  29. })
  30. },
  31. bindNameChange(val) {
  32. this.setData({
  33. currentSize: val.detail.value.length,
  34. name: val.detail.value
  35. })
  36. },
  37. bindPhoneChange(val) {
  38. this.setData({
  39. currentSize: val.detail.value.length,
  40. phone: val.detail.value
  41. })
  42. },
  43. bindEmailChange(val) {
  44. this.setData({
  45. currentSize: val.detail.value.length,
  46. email: val.detail.value
  47. })
  48. },
  49. gotoImg(ev) {
  50. if (this.data.detail.boxPositionPic) {
  51. wx.navigateTo({
  52. url: '/pages/graveImage/graveImage?img=' + this.data.detail.boxPositionPic,
  53. })
  54. }
  55. },
  56. /**
  57. * 生命周期函数--监听页面加载
  58. */
  59. onLoad: async function (options) {
  60. let res = await util.request(api.BoxOrderDetail, {
  61. id: options.orderId
  62. }, 'GET')
  63. // let res = await util.request(api.BoxDetail, {
  64. // id: options.orderId
  65. // }, 'GET')
  66. this.setData({
  67. detail: res.data
  68. })
  69. },
  70. /**
  71. * 生命周期函数--监听页面初次渲染完成
  72. */
  73. onReady: function () {
  74. },
  75. /**
  76. * 生命周期函数--监听页面显示
  77. */
  78. onShow: function () {
  79. },
  80. /**
  81. * 生命周期函数--监听页面隐藏
  82. */
  83. onHide: function () {
  84. },
  85. /**
  86. * 生命周期函数--监听页面卸载
  87. */
  88. onUnload: function () {
  89. },
  90. /**
  91. * 页面相关事件处理函数--监听用户下拉动作
  92. */
  93. onPullDownRefresh: function () {
  94. },
  95. /**
  96. * 页面上拉触底事件的处理函数
  97. */
  98. onReachBottom: function () {
  99. },
  100. bindCanceHandle() {
  101. if (this.data.detail.isHandle) {
  102. return
  103. }
  104. wx.showActionSheet({
  105. alertText: '是否取消預訂',
  106. itemColor: '#FA5151',
  107. itemList: ['确定'],
  108. success: async _ => {
  109. let res = await util.request(api.BoxCancelOrder + '?orderId=' + this.options.orderId, {}, 'POST', 'application/json')
  110. if (res.code === 0) {
  111. wx.showToast({
  112. title: '取消預訂成功',
  113. icon: 'success'
  114. })
  115. getApp().callOrderBuyCbs({referCode: referCode++})
  116. wx.navigateBack()
  117. } else {
  118. wx.showToast({
  119. title: res.msg,
  120. icon: 'none'
  121. })
  122. }
  123. },
  124. fail(res) {
  125. console.log(res.errMsg)
  126. }
  127. })
  128. },
  129. /**
  130. * 用户点击右上角分享
  131. */
  132. onShareAppMessage: function () {
  133. }
  134. })