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.
88 lines
2.0 KiB
88 lines
2.0 KiB
// pages/activity_list/activity_list.js
|
|
const util = require('../../utils/util.js')
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
repos: [],
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.loadData();
|
|
},
|
|
|
|
loadData: function () {//定义函数名称
|
|
wx.showLoading();
|
|
var that = this;
|
|
wx.request({
|
|
url: getApp().gw.hostUrl + '/mall/wxa/activity/group/list',
|
|
method: 'get',
|
|
data: {
|
|
pageNum: 1,
|
|
pageSize: 2
|
|
},
|
|
header: {
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
'sessionId': wx.getStorageSync('sessionId')
|
|
},
|
|
success: function (res) {
|
|
console.log(res);
|
|
wx.hideLoading();
|
|
if (res.data.code == 0) {
|
|
that.setData({
|
|
repos: res.data.response.map((n) => Object.assign({}, n, {
|
|
createdAt: util.formatTime(new Date(n.createdAt)).substr(0, 16),
|
|
img: that.switchImg(n.status),
|
|
activityTypeStr: that.switchType(n.activityType),
|
|
})),
|
|
})
|
|
} else {
|
|
wx.showToast({
|
|
title: res.data.msg,
|
|
icon: 'none',
|
|
duration: 1000
|
|
});
|
|
}
|
|
},
|
|
|
|
fail: function (e) {
|
|
wx.hideLoading();
|
|
wx.showToast({
|
|
title: '网络异常!',
|
|
icon: 'none',
|
|
duration: 1000
|
|
});
|
|
},
|
|
|
|
})
|
|
},
|
|
|
|
itemClick: function (event) {
|
|
var groupNo = event.currentTarget.dataset.testid;
|
|
wx.navigateTo({
|
|
url: '../pay_result/pay_result?groupNo=' + groupNo
|
|
})
|
|
},
|
|
|
|
switchType: function (activityType) {
|
|
switch (activityType) {
|
|
case 10: return '拼团'
|
|
case 20: return '砍价'
|
|
case 30: return '抽奖'
|
|
}
|
|
},
|
|
|
|
switchImg: function (status) {
|
|
switch (status) {
|
|
case 0: return '../../images/icon_task_finish.png'
|
|
case 20: return '../../images/icon_task_finish.png'
|
|
case 90: return '../../images/icon_task_finish.png'
|
|
}
|
|
}
|
|
|
|
})
|