[水感应客户端最新]
This commit is contained in:
141
pages/order/index.js
Normal file
141
pages/order/index.js
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* 手太欠
|
||||
* 愿这世界都如故事里一样 美好而动人~
|
||||
*/
|
||||
|
||||
Page({
|
||||
data: {
|
||||
listType : '', // 订单状态
|
||||
listsArr : [], // 订单列表
|
||||
page : {}, // 分页信息
|
||||
lodingStats : false,// 加载状态
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
this.setData({
|
||||
listType: options.list_type
|
||||
})
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 获取订单列表
|
||||
this.listInfo()
|
||||
},
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
*/
|
||||
listInfo(page) {
|
||||
wx.$api.order.list({
|
||||
state: this.data.listType,
|
||||
page : page || 1
|
||||
}).then(res => {
|
||||
let listArr = this.data.listsArr,
|
||||
newData = []
|
||||
if(page == 1 || page == undefined) listArr = []
|
||||
newData = listArr.concat(res.data.data)
|
||||
this.setData({
|
||||
listsArr : newData,
|
||||
page : res.data.page,
|
||||
lodingStats : false
|
||||
})
|
||||
wx.stopPullDownRefresh()
|
||||
}).catch(err => {})
|
||||
},
|
||||
|
||||
/**
|
||||
* 状态筛选
|
||||
*/
|
||||
onTabs(val){
|
||||
if(this.data.listType === val) return
|
||||
this.setData({
|
||||
listType: val.currentTarget.dataset.type
|
||||
})
|
||||
|
||||
// 获取订单列表
|
||||
this.listInfo()
|
||||
},
|
||||
|
||||
/**
|
||||
* 支付订单
|
||||
*/
|
||||
payClick(e) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/pay/index?order_no=' + e.currentTarget.dataset.order_no + '&total=' + e.currentTarget.dataset.total
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 更多操作
|
||||
*/
|
||||
operateMore(e) {
|
||||
wx.showActionSheet({
|
||||
itemList: ['取消订单'],
|
||||
success: ()=> {
|
||||
wx.showModal({
|
||||
title : '提示',
|
||||
content : '是否取消订单',
|
||||
success : res=> {
|
||||
if (res.confirm) {
|
||||
wx.$api.order.goodsCancel(e.currentTarget.dataset.order_no).then(res => {
|
||||
wx.showToast({
|
||||
title:'取消成功',
|
||||
icon:'none'
|
||||
})
|
||||
// 获取订单列表
|
||||
this.listInfo()
|
||||
}).catch(err => {})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: err=> {}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 订单签收
|
||||
*/
|
||||
signClick(e) {
|
||||
wx.showModal({
|
||||
title : '提示',
|
||||
content : '是否签收',
|
||||
success : res=> {
|
||||
if (res.confirm) {
|
||||
wx.$api.order.goodsSign(e.currentTarget.dataset.order_no).then(res => {
|
||||
wx.showToast({
|
||||
title:'签收成功',
|
||||
icon:'none'
|
||||
})
|
||||
|
||||
// 获取订单列表
|
||||
this.listInfo()
|
||||
}).catch(err => {})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
// 获取订单列表
|
||||
this.listInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 上拉加载
|
||||
*/
|
||||
onReachBottom(){
|
||||
this.setData({
|
||||
lodingStats: true
|
||||
})
|
||||
let pageNumber = this.data.page.current
|
||||
if(this.data.page.has_more){
|
||||
pageNumber++
|
||||
// 获取订单列表
|
||||
this.listInfo(pageNumber);
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user