t_index.js
3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
var util = require('../../utils/util.js')
var uri=require('../../utils/uri.js')
import App from '../../utils/api.js'
Page({
data:{
totalfunction:[
{
imgurl:'../image/manage-total.png',
title:'经营中心',
isActive:true,
},
{
imgurl:'../image/store-total.png',
title:'门店管理',
isActive:false
}
],
},
onLoad:function(opt){
let systeminfo=util.cache('system.info');
let ratio=750/systeminfo.windowWidth;
this.setData({
contentHeight:systeminfo.windowHeight-util.cache('headerHeight')-120/ratio,
sellerid:opt.sellerid ? opt.sellerid : util.cache('sellerid'),
sellername:opt.sellername ? opt.sellername : ''
})
if(util.cache('dur')){
wx.removeStorageSync('dur');
}
if(util.cache('select')){
wx.removeStorageSync('select');
}
this.hasmore=true;
this.page=0;
this.getlist();
},
onShow(){
if(util.cache('select')){
if(util.cache('dur')){
let dur=util.cache('dur');
console.log(dur)
let timestamp=Date.parse(new Date())/1000;
let date=util.unixtoTime(timestamp,'YYYY-MM-DD'),mark='';
if(dur.start.date==dur.end.date){
if(dur.start.date==date){
mark='今天'
}
if(dur.start.date==''){
mark='今天'
}
}else{
if(dur.start.date==date && dur.end.date==''){
mark='今天'
}
}
if(mark!=''){
dur.mark=mark
}
this.setData({
dur:dur
})
}
wx.removeStorageSync('select');
this.hasmore=true;
this.page=0;
this.getlist();
}
},
getlist(){
let parmdata={
sellerid:this.data.sellerid,
page:this.page,
size:10
}
if(this.data.dur){
if(!this.data.dur.mark){
if(this.data.dur.start.date=='' || this.data.dur.end.date==''){
if(this.data.dur.start.date==''){
parmdata.stime=util.timetouUnix('2020-01-25 00:00:00','-');
parmdata.etime=this.data.dur.end.timestamp;
}else{
parmdata.stime=this.data.dur.start.timestamp;
let timestamp=Date.parse(new Date())/1000;
let date=util.unixtoTime(timestamp,'YYYY-MM-DD');
parmdata.etime=util.timetouUnix(date+' 23:59:59','-');
}
}else{
parmdata.stime=this.data.dur.start.timestamp;
parmdata.etime=this.data.dur.end.timestamp;
}
}
}
App.Orders.GetSellerSummaryOrder(parmdata).then((json)=>{
console.log(json)
if(json.ret==200){
json.data.orderList.forEach((v,i)=>{
let date=util.unixtoTime(v.cdate,'YYYY-MM-DD HH:II:SS');
v.showdate=date.split(' ')[0];
v.showtime=date.split(' ')[1];
v.showdatetime=date;
})
let orderinfo=json.data;
if(json.data.orderList.length<10){
this.hasmore=false;
}
let orderlist=parmdata.page==0 ? [] : this.data.orderinfo.orderList;
orderlist=orderlist.concat(json.data.orderList);
orderinfo.orderList=orderlist;
this.setData({
orderinfo:json.data
})
}
})
},
getnext(){
this.page+=1;
if(this.hasmore){
this.getlist();
}
},
sellermanage(){
wx.redirectTo({
url:'s_index?sellerid='+this.data.sellerid
})
},
totime(){
if(this.data.dur){
wx.navigateTo({
url:'../report/r_time?sdate='+this.data.dur.start.date+'&edate='+this.data.dur.end.date
})
}else{
wx.navigateTo({
url:'../report/r_time'
})
}
},
//订单详情
lookdetail(e){
let orderidx=e.currentTarget.dataset.index;
let id=e.currentTarget.dataset.id;
wx.navigateTo({
url:'../order/o_detail?id='+id+'&orderidx='+orderidx
})
},
})