C端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
2.3 KiB

  1. const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px';
  2. const util = require("../../../utils/util.js");
  3. const config = require("../../../config/config.js");
  4. const Http = require("../../../utils/HttpBasics");
  5. let app = getApp();
  6. const imgurl = require("../../../utils/imgurl");
  7. Page({
  8. /**
  9. * 页面的初始数据
  10. */
  11. data: {
  12. navigationBarHeight,
  13. data: {}
  14. },
  15. cardDetail(couponOrderId) {
  16. let that = this;
  17. Http.get({
  18. url: config.api.cardDetail,
  19. data: {
  20. couponOrderId: couponOrderId
  21. }
  22. })
  23. .then(res => {
  24. console.log(res)
  25. if (res.code == 200) {
  26. res.data.expiredTime = util.formatTime(res.data.expiredTime, "yyyy-MM-dd hh:mm:ss")
  27. that.setData({
  28. showPage: true,
  29. data: res.data,
  30. supportTransfer: res.data.supportTransfer
  31. })
  32. /**
  33. * 若可转赠获取用户头像信息
  34. */
  35. if (res.data.supportTransfer) {
  36. that.getUserInfo()
  37. }
  38. if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length <= 4) {
  39. that.setData({
  40. height: that.data.cardDetail.merchantVoList.length * 140 + 'rpx',
  41. showMore: false
  42. })
  43. } else if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length > 4) {
  44. that.setData({
  45. height: 4 * 140 + 'rpx'
  46. })
  47. }
  48. }
  49. })
  50. .catch(err => {
  51. console.log(err)
  52. })
  53. },
  54. /**
  55. * 生命周期函数--监听页面加载
  56. */
  57. onLoad(options) {
  58. console.log(options);
  59. if (options.cardId) {
  60. this.cardDetail(options.cardId);
  61. }
  62. },
  63. /**
  64. * 生命周期函数--监听页面初次渲染完成
  65. */
  66. onReady() {
  67. },
  68. /**
  69. * 生命周期函数--监听页面显示
  70. */
  71. onShow() {
  72. },
  73. /**
  74. * 生命周期函数--监听页面隐藏
  75. */
  76. onHide() {
  77. },
  78. /**
  79. * 生命周期函数--监听页面卸载
  80. */
  81. onUnload() {
  82. },
  83. /**
  84. * 页面相关事件处理函数--监听用户下拉动作
  85. */
  86. onPullDownRefresh() {
  87. },
  88. /**
  89. * 页面上拉触底事件的处理函数
  90. */
  91. onReachBottom() {
  92. },
  93. /**
  94. * 用户点击右上角分享
  95. */
  96. onShareAppMessage() {
  97. }
  98. })