Commit c2226262 by 高淑倩

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

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