const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'; const util = require("../../../utils/util.js"); const config = require("../../../config/config.js"); const Http = require("../../../utils/HttpBasics"); let app = getApp(); const imgurl = require("../../../utils/imgurl"); Page({ /** * 页面的初始数据 */ data: { navigationBarHeight, data: {} }, cardDetail(couponOrderId) { let that = this; Http.get({ url: config.api.cardDetail, data: { couponOrderId: couponOrderId } }) .then(res => { console.log(res) if (res.code == 200) { res.data.expiredTime = util.formatTime(res.data.expiredTime, "yyyy-MM-dd hh:mm:ss") that.setData({ showPage: true, data: res.data, supportTransfer: res.data.supportTransfer }) /** * 若可转赠获取用户头像信息 */ if (res.data.supportTransfer) { that.getUserInfo() } if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length <= 4) { that.setData({ height: that.data.cardDetail.merchantVoList.length * 140 + 'rpx', showMore: false }) } else if (that.data.cardDetail.merchantVoList && that.data.cardDetail.merchantVoList.length > 4) { that.setData({ height: 4 * 140 + 'rpx' }) } } }) .catch(err => { console.log(err) }) }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { console.log(options); if (options.cardId) { this.cardDetail(options.cardId); } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })