133 lines
2.1 KiB
JavaScript
133 lines
2.1 KiB
JavaScript
|
const App = getApp();
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
count:1,
|
||
|
goodsInfo:[]
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad: function (options) {
|
||
|
var aid = options.aid;
|
||
|
this.getSignRecord(aid);
|
||
|
this.getBuSignAuth(aid);
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
*/
|
||
|
onReady: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面显示
|
||
|
*/
|
||
|
onShow: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面隐藏
|
||
|
*/
|
||
|
onHide: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面卸载
|
||
|
*/
|
||
|
onUnload: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
*/
|
||
|
onPullDownRefresh: function () {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面上拉触底事件的处理函数
|
||
|
*/
|
||
|
onReachBottom: function () {
|
||
|
|
||
|
},
|
||
|
/**
|
||
|
* 获取签到记录
|
||
|
*/
|
||
|
getSignRecord: function (aid) {
|
||
|
let _this = this;
|
||
|
App._post_form('goods/getSignRecord', {
|
||
|
user_id:wx.getStorageSync('user_id'),
|
||
|
aid: aid,
|
||
|
}, function(result) {
|
||
|
_this.setData({
|
||
|
selectedDays: result.data.data
|
||
|
})
|
||
|
});
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 获取是否有补签权限
|
||
|
*/
|
||
|
getBuSignAuth: function (aid) {
|
||
|
let _this = this;
|
||
|
App._post_form('goods/getBuSignAuth', {
|
||
|
user_id:wx.getStorageSync('user_id'),
|
||
|
aid: aid,
|
||
|
}, function(result) {
|
||
|
|
||
|
let goodsInfo = result.data.goodsInfo;
|
||
|
let date = Date.parse( new Date() ).toString();
|
||
|
date = date.substr(0,10);//精确到秒
|
||
|
if( date > goodsInfo.starttime && date < goodsInfo.endtime ){
|
||
|
_this.setData({
|
||
|
count: result.data.count,
|
||
|
})
|
||
|
}
|
||
|
|
||
|
|
||
|
});
|
||
|
},
|
||
|
/**
|
||
|
* 用户点击右上角分享
|
||
|
*/
|
||
|
onShareAppMessage: function () {
|
||
|
|
||
|
},
|
||
|
/**
|
||
|
* 点击日期时候触发的事件
|
||
|
* bind:getdate
|
||
|
*/
|
||
|
getdate(e) {
|
||
|
console.log(e.detail);
|
||
|
},
|
||
|
/**
|
||
|
* 点击全选触发的事件
|
||
|
* bind:checkall
|
||
|
*/
|
||
|
checkall(e) {
|
||
|
console.log(e.detail.days);
|
||
|
},
|
||
|
/**
|
||
|
* 点击确定按钮触发的事件
|
||
|
* bind:select
|
||
|
*/
|
||
|
cmfclick(e){
|
||
|
console.log(e.detail.selectDays);
|
||
|
},
|
||
|
/**
|
||
|
* 点击清空事件
|
||
|
* bind:clear
|
||
|
*/
|
||
|
clear(e) {
|
||
|
console.log("要清空选中日期")
|
||
|
}
|
||
|
})
|