123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- // pages/couponHistory/couponHistory.js
- import {
- get,
- post
- } from '../../utils/http'
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- list: []
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- this.getCouponLog()
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- },
- getCouponLog() {
- get('/v2/api/user/coupon/log', {}, res => {
- res.data.list.map(item=>{
- console.log(typeof(item.start_time),11111);
- if(typeof(item.start_time)=='string'){
- console.log(1);
- return
- }
- var date = new Date(item.start_time * 1000);
- let year = date.getFullYear()
- let month = date.getMonth()+1<10?'0'+date.getMonth():date.getMonth()
- let data = date.getDate()<10?'0'+date.getDate():date.getDate()
- let hours= date.getHours()<10?'0'+date.getHours():date.getHours()
- let minutes = date.getMinutes()<10?'0'+date.getMinutes():date.getMinutes()
- item.start_time = `${year}.${month}.${data} ${hours}:${minutes}`
- })
- this.setData({
- list: res.data.list
- })
- })
- },
- again(e){
- console.log(e);
- let item = e.currentTarget.dataset.item
- let storeId = wx.getStorageSync('store_id')
- wx.navigateTo({
- url: `/pages/projectDetail/projectDetail?source=project&id=${item.project_id}&store_id=${storeId}`,
- })
- }
- })
|