You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
2.3 KiB
JavaScript
117 lines
2.3 KiB
JavaScript
// pages/order/order.js
|
|
const app=getApp();
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
TabCur: 0,
|
|
scrollLeft:0,
|
|
tabItem: ['全部','申请中','已完成'],
|
|
page: 1,
|
|
listData: [],
|
|
hasNext: true,
|
|
keyword: '',
|
|
textContent: ''
|
|
},
|
|
tabSelect(e) {
|
|
this.setData({
|
|
TabCur: e.currentTarget.dataset.id,
|
|
scrollLeft: (e.currentTarget.dataset.id-1)*60,
|
|
page: 1,
|
|
listData: [],
|
|
hasNext: true
|
|
})
|
|
this.loadData()
|
|
},
|
|
getKeyword(e){
|
|
this.setData({
|
|
keyword: e.detail.value
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
this.loadData()
|
|
},
|
|
searchData(){
|
|
this.setData({
|
|
page: 1,
|
|
listData: [],
|
|
hasNext: true
|
|
})
|
|
this.loadData()
|
|
},
|
|
loadNextData(){
|
|
let that=this;
|
|
if(!that.data.hasNext)
|
|
return
|
|
let nextPage=that.data.page+1;
|
|
that.setData({
|
|
page: nextPage
|
|
})
|
|
that.loadData()
|
|
},
|
|
loadData(){
|
|
let that=this;
|
|
let status = null;
|
|
if(that.data.TabCur===1){
|
|
status=0
|
|
}else if(that.data.TabCur===2){
|
|
status=1
|
|
}
|
|
app.utils.util.request({
|
|
url:'/orderList',
|
|
data:{
|
|
keyword: that.data.keyword,
|
|
status: status,
|
|
page: that.data.page
|
|
},
|
|
success: function(res){
|
|
if(res.data.length){
|
|
res.data.forEach(e => {
|
|
that.data.listData.push(e)
|
|
});
|
|
that.setData({
|
|
listData: that.data.listData
|
|
})
|
|
}else{
|
|
wx.showModal({
|
|
title: '提示',
|
|
content: '暂无更多数据',
|
|
showCancel: false
|
|
})
|
|
that.setData({
|
|
hasNext: false
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
hideModal(e) {
|
|
this.setData({
|
|
modalName: null
|
|
})
|
|
},
|
|
showDownUrl(e){
|
|
console.log(e.currentTarget.dataset.downurl)
|
|
this.setData({
|
|
textContent: e.currentTarget.dataset.downurl,
|
|
modalName: e.currentTarget.dataset.target
|
|
})
|
|
},
|
|
copyText(){
|
|
let that=this;
|
|
wx.setClipboardData({
|
|
//准备复制的数据内容
|
|
data: that.data.textContent,
|
|
success: function (res) {
|
|
wx.showToast({
|
|
title: '复制成功',
|
|
});
|
|
}
|
|
});
|
|
}
|
|
}) |