diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index 5d971a1..bc0b2d1 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -56,6 +56,12 @@ Page({ currentPage2: 1, currentDate: '', total: 0, //读取时段内记录数量 + is_no_data2: 0, + is_no_more2: 0, + + + // 搜索内容 + searchContent: '', }, onLoad: function(t) { // 设置日期选择器的结束时间为当前日期 @@ -1246,7 +1252,7 @@ Page({ }, request_list: function(data, callback){ - // console.log('触发上拉刷新'); + // console.log('进入request_list'); var th = this; if(this.data.is_load2) return false; //-- 正在加载 @@ -1282,7 +1288,7 @@ Page({ th.setData({is_no_more2:1}); } } - if(callback) callback(); + if(callback) callback(res); } else { wx.showToast({ title: res.data.msg, @@ -1307,6 +1313,10 @@ Page({ }); if(currentIndex == 0) { console.log('线上订单'); + this.setData({ + startDate: '选择开始时间', + endDate: '选择结束时间', + }); } else if(currentIndex == 1) { console.log('线下订单'); @@ -1331,40 +1341,67 @@ Page({ endDate: e.detail.value }) }, + + bindInput(e) { + this.data.searchContent = e.detail.value; + }, + + searchOnline() { + console.log('online',this.data.searchContent); + if(this.data.searchContent) { + console.log(this.data.searchContent); + } else { + wx.showToast({ + title: '您还没有输入搜索内容~', + icon: 'none', + }) + }; + }, - search() { + searchOffline() { + console.log('执行查询'); let th = this; let startDate = this.data.startDate; let endDate = this.data.endDate; - + + this.data.is_no_data2 = 0; + + if(startDate == '选择开始时间' || endDate == '选择结束时间') { wx.showToast({ title: '请选择完整的查询时间~', icon: 'none', }) - } + }; if(new Date(startDate) > new Date(endDate)) { wx.showToast({ - title: '敲黑板!开始时间不能晚于结束时间噢~', + title: '不对噢!开始时间不能晚于结束时间~', icon: 'none', }) - } + return false; + }; this.request_list({ store_id: os.stoid, user_id: oo.user_id, page: 1, - BeginDate:this.data.startDate, - EndDate: this.data.endDate, - }, function() { - th.setData({ - total: res.data.data.total - }); + BeginDate: this.data.startDate, + EndDate: this.data.endDate + }, function(res) { + if(res.data.data.total == 0) { + wx.showToast({ + title: '没有找到相关订单', + icon: 'none', + duration: 2000 + }) + } else { + th.setData({ + total: res.data.data.total + }); + } }); - - }, currentDate() { diff --git a/pages/user/order_list/order_list.wxml b/pages/user/order_list/order_list.wxml index 52a240c..3c45296 100644 --- a/pages/user/order_list/order_list.wxml +++ b/pages/user/order_list/order_list.wxml @@ -5,8 +5,8 @@ 线下订单 - - 搜索 + + 搜索 @@ -26,7 +26,7 @@ {{endDate}} - 查询 + 查询 注:读取时段内仅{{total}}笔记录 diff --git a/pages/user/order_list/order_list.wxss b/pages/user/order_list/order_list.wxss index eb7292c..c8b6e9f 100644 --- a/pages/user/order_list/order_list.wxss +++ b/pages/user/order_list/order_list.wxss @@ -584,5 +584,6 @@ page { } .search-btn2 { - border-radius-top-left: 8rpx; + border-top-left-radius: 8rpx; + border-bottom-left-radius: 8rpx; }