Commit c2226262 by 高淑倩

add: 订单列表_无数据展示

parent 92401a4a
......@@ -44,7 +44,8 @@ wxService.page({
orderList: null,
totalPages: 0,
subImgs: [],
trade: '' // 订单状态(C:取消;N:新建,P:已支付;D:已发货;R:已收货)
trade: '', // 订单状态(C:取消;N:新建,P:已支付;D:已发货;R:已收货)
no_data: true
},
/**
......@@ -62,7 +63,7 @@ wxService.page({
},
// 确认收货
handelConfirmReceipt(e) {
const {id} = e.currentTarget.dataset
const { id } = e.currentTarget.dataset
wx.showLoading({
title: '加载中',
mask: true
......@@ -84,12 +85,31 @@ wxService.page({
const { id } = e.currentTarget.dataset
wxService.router(`/pages/orderDetail/orderDetail?id=${id}`)
},
initOrderList(pageNo, pageSize,trade) {
//点击切换tab
switchTab(e) {
const { type, status } = e.currentTarget.dataset
const { currentIndex } = this.data
if (currentIndex == type) return false
this.setData({
currentIndex: type,
pageNo: 1,
orderList: [],
trade: '',
no_data: true
}, () => {
if (type == 5 && status == 'RF') {
this.getRefundList(this.data.pageNo, this.data.pageSize)
} else {
this.initOrderList(this.data.pageNo, this.data.pageSize, status)
}
})
},
initOrderList(pageNo, pageSize, trade) {
wx.showLoading({
title: '加载中',
mask: true
})
const params = {trade}
const params = { trade }
wxService.post(`/sale/trade/buyer/history?pageNum=${pageNo}&pageSize=${pageSize}`, params).then(res => {
if (res) {
const { result, data } = res.data
......@@ -97,34 +117,37 @@ wxService.page({
wx.hideLoading()
this.setData({
orderList: this.data.pageNo == 1 ? [...data] : [...this.data.orderList, ...data],
noMoreFlag: data.length < pageSize ? true : false
},()=> {
noMoreFlag: data.length < pageSize ? true : false,
no_data: data.length ? true : false
}, () => {
wx.setStorageSync('orderList', this.data.orderList)
})
}
}
})
},
//点击切换tab
switchTab(e) {
const { type, status } = e.currentTarget.dataset
const {currentIndex} = this.data
if(currentIndex == type) return false
// 退款列表 /refund/buyer/history 滚动查询
getRefundList(pageNo, pageSize) {
wx.showLoading({
title: '加载中',
mask: true
})
const params = {}
wxService.post(`/sale/refund/buyer/history?pageNum=${pageNo}&pageSize=${pageSize}`, params).then(res => {
if (res) {
const { result, data } = res.data
if (result == 0) {
wx.hideLoading()
this.setData({
currentIndex: type,
pageNo: 1,
orderList: [],
trade: ''
},()=>{
if(type == 5 && status == 'RF'){
console.log("退款/售后")
} else {
this.initOrderList(this.data.pageNo, this.data.pageSize, status)
orderList: this.data.pageNo == 1 ? [...data] : [...this.data.orderList, ...data],
noMoreFlag: data.length < pageSize ? true : false,
no_data: data.length ? true : false
})
}
}
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
......@@ -139,7 +162,7 @@ wxService.page({
this.setData({
pageNo: this.data.pageNo + 1,
}, () => {
this.initOrderList(this.data.pageNo, this.data.pageSize,this.data.trade)
this.initOrderList(this.data.pageNo, this.data.pageSize, this.data.trade)
})
},
......
......@@ -12,7 +12,7 @@
{{item.name}}
</view>
</view>
<view class="order-content">
<view class="order-content" wx:if="{{orderList.length}}">
<block
wx:for="{{orderList}}"
wx:for-item="item"
......@@ -74,14 +74,17 @@
<button class="btn btn-sm btn-default" data-id="{{item.id}}">查看物流</button>
<button class="btn btn-sm btn-default" data-id="{{item.id}}" bindtap="handelConfirmReceipt">确认收货</button>
</view>
<view class="order-status" wx-if="{{item.status == 'R'}}"/>
<view class="order-status" wx-if="{{item.status == 'R'}}" />
<!--<button class="btn btn-sm btn-primary btn-outline ">再来一单</button>-->
</view>
</view>
</block>
</view>
</view>
<view class="no-bottom">
<view class="no-bottom">
<no-more wx:if="{{noMoreFlag}}" />
</view>
</view>
<view hidden="{{no_data}}" class="no-list df border_box">
当前无数据
</view>
</view>
......@@ -115,3 +115,7 @@ scroll-view{
width: 140rpx;
height: 140rpx;
}
.no-list {
padding-top: 300rpx;
font-size: 26rpx;
}
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