Commit d1b65078 by 高淑倩

add: 订单列表

parent 747bbc4c
......@@ -79,7 +79,7 @@ wxService.page({
noMore: true
})
this.initIntegralCouponList(this.data.pageNo, this.data.pageSize)
}else {
} else {
this.setData({
noMore: true
})
......
......@@ -9,79 +9,74 @@ wxService.page({
* 页面的初始数据
*/
data: {
params:{
pageNo:'1',
pageSize:'10'
},
totalPages:''
pageNo:1,
pageSize:10,
totalPages:'',
orderList: [],
noMore: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
onLoad: function (options) {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.initOrderList()
// const { orderNo } = this.options
const orderNo = '700000000013498'
if(orderNo){
this.initOrderList(this.data.pageNo,this.data.pageSize,orderNo)
}
},
//获取消费列表
initOrderList(type){
initOrderList(pageNo,pageSize,orderNo){
wx.showLoading({
title: '加载中'
})
wxService.post(`/sale/order/list?pageNo=${this.data.params.pageNo}&pageSize=${this.data.params.pageSize}`,{
memberId:546456
}).then(res => {
let orderList = [];
orderList = this.data.params.pageNo == 1 ? res.data.data.content : this.data.orderList.concat(res.data.data.content);
this.setData({
orderList,
totalPages: res.data.data.totalPages,
})
wx.hideLoading();
if (type && type.pullDown) wx.stopPullDownRefresh();
const params = {
memberId: orderNo
}
wxService.post(`/sale/order/list?pageNo=${pageNo}&pageSize=${pageSize}`,params).then(res => {
const {result,data} = res.data
if(result == 0){
wx.hideLoading()
// 数量
this.setData({
orderList: this.data.pageNo == 1? [...data.content]: [...this.data.orderList,...data.content],
totalPages: data.totalPages
})
}
}).finally(() => {
wx.hideLoading();
this.setData({
orderList: ''
})
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.setData({
params: {
pageNo: 1,
pageSize: 10,
},
})
this.initOrderList({
pullDown: true
});
},
onPullDownRefresh: function () {},
/**
* 页面上拉触底事件的处理函数
*/
bindDownLoad: function () {
if (this.data.params.pageNo < this.data.totalPages) {
onReachBottom: function () {
if (this.data.pageNo < this.data.totalPages) {
this.setData({
pageNo: this.data.pageNo + 1,
pageSize: 10,
noMore: true
})
this.initOrderList(this.data.pageNo, this.data.pageSize)
}else {
this.setData({
params: {
pageNo: this.data.params.pageNo + 1,
pageSize: 10
},
loadDataDone: true
noMore: true
})
this.initOrderList()
}
},
})
\ No newline at end of file
{
"navigationBarTitleText": "我的消费",
"usingComponents": {},
"usingComponents": {
"no-more": "/component/noMore/noMore"
},
"enablePullDownRefresh": true,
"onPullDownRefresh": true,
"onReachBottom": true
......
<!--pages/userCenter.wxml-->
<view class='page-mySpend'>
<scroll-view scroll-y bindscrolltolower="bindDownLoad">
<!-- <view class='spend-wrap' wx:for='{{orderList}}' wx:key='{{index}}'> -->
<!-- <view class='spend-wrap' wx:for='{{orderList}}' wx:for-item="item" wx:for-index="k" wx:key="{{k}}"> -->
<navigator url='/pages/consumptionDetails/consumptionDetails' hover-class='none'>
<view class='spend-list'>
<view class='spend-id fs-22'>订单编号:{{item.orderId}}</view>
......@@ -12,4 +12,6 @@
</navigator>
<!-- </view> -->
</scroll-view>
<no-more wx:if="{{noMore}}"/>
</view>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment