1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- Page({
- data: {
- date: '',
- items: [],
- itemsId:[1,2],
- yuIndex:0,
- arr:[]
- },
- bindDateChange:function(e){
- console.log(e)
- this.setData({date:e.detail.value})
- this.methods(this.data.date,this.data.itemsId)
- },
- getNowFormatDate:function() {
- var date = new Date();
- var seperator1 = "-";
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var strDate = date.getDate();
- if (month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = "0" + strDate;
- }
- var currentdate = year + seperator1 + month + seperator1 + strDate;
- console.log(currentdate)
- this.setData({date:currentdate})
- return currentdate;
- },
- onLoad: function (options) {
- this.getNowFormatDate()
- var items = wx.getStorageSync('items');
- var arr = [{'id':"",name:'全部'}];
- for(var i=0;i<items.length;i++){
- var obj = {}
- obj.name = items[i].name;
- obj.id = items[i].id;
- console.log(obj)
- arr = arr.concat(obj)
- }
- this.setData({
- items:arr
- });
- this.methods(this.data.date,this.data.itemsId)
- },
- yutang:function(e){
- console.log(e)
- var index= e.currentTarget.dataset.index
- this.setData({yuIndex:index})
- if(index==0){
- this.setData({itemsId:[1,2]})
- }else if(index==1){
- this.setData({itemsId:[this.data.items[index].id]})
- }else if(index==2){
- this.setData({itemsId:[this.data.items[index].id]})
- }
- this.methods(this.data.date,this.data.itemsId)
- },
- methods:function(time,arr){
- var that = this;
- wx.request({
- url: 'https://yutang.web.ximengnaikang.com/api/admin/byDateGetNos?date='+time+'&sate='+arr,
- method: 'GET',
- header: {
- 'content-type': 'application/x-www-form-urlencoded',
- 'Authorization':wx.getStorageSync('token')
- },
- success: function (res) {
- console.log(res)
- if(res.data.code==200){
- that.setData({arr:res.data.data})
- }
- }
- })
- },
- onReady: function () {
- },
- onShow: function () {
- },
- onHide: function () {
- },
- onUnload: function () {
- },
- onPullDownRefresh: function () {
-
- },
- onReachBottom: function () {
- console.log('没有更多了~')
- },
- onShareAppMessage: function () {
- }
- })
|