Commit d1b65078 by 高淑倩

add: 订单列表

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