250 lines
6.3 KiB
JavaScript
250 lines
6.3 KiB
JavaScript
//获取应用实例
|
||
var app = getApp();
|
||
Page({
|
||
/**
|
||
* 页面的初始数据
|
||
*/
|
||
data: {
|
||
order_list: [],
|
||
nav_type: 1,
|
||
all: true,
|
||
height: '',
|
||
url: app.globalData.url,
|
||
|
||
statusType: ["全部", "待付款", "未使用", "退款"],
|
||
status: ["", "1", "2", "3"],
|
||
currentType: 0,
|
||
tabClass: ["", "", "", "", "", ""],
|
||
pageNum: 1
|
||
},
|
||
statusTap: function (e) {
|
||
var curType = e.currentTarget.dataset.index;
|
||
this.setData({
|
||
currentType: curType,
|
||
pageNum: 1
|
||
});
|
||
|
||
this.getOrderList();
|
||
},
|
||
onClickLeft() {
|
||
wx.navigateBack()
|
||
},
|
||
/**
|
||
* 生命周期函数--监听页面加载
|
||
*/
|
||
onLoad: function (options) {
|
||
var statusBarHeight = wx.getSystemInfoSync().statusBarHeight;
|
||
this.setData({
|
||
statusBarHeight: statusBarHeight,
|
||
height: 46 + statusBarHeight,
|
||
});
|
||
},
|
||
//条目点击---订单状态:-2:已取消 -1:拒绝接单 0:待付款 1:已付款 2:已接单(待服务)3:服务中 4:已完成 5申请退款 6退款中 7已退款 8:已结算
|
||
itemclick(e) {
|
||
console.log("index==" + e.currentTarget.dataset.index)
|
||
console.log("status==" + e.currentTarget.dataset.status)
|
||
//去待付款详情
|
||
if (e.currentTarget.dataset.status == 0) {
|
||
if (e.currentTarget.dataset.item != 0) {
|
||
let item = JSON.stringify(e.currentTarget.dataset.item);
|
||
console.log("传递的item" + item);
|
||
wx.navigateTo({
|
||
url: "/pages/orderdetail/orderdetail?item=" + item,
|
||
});
|
||
}
|
||
}
|
||
//去取消订单详情
|
||
if (e.currentTarget.dataset.status == -2) {
|
||
if (e.currentTarget.dataset.item != 0) {
|
||
let item = JSON.stringify(e.currentTarget.dataset.item);
|
||
console.log("传递的item" + item);
|
||
wx.navigateTo({
|
||
url: "/pages/orderdetail/orderdetail?item=" + item,
|
||
});
|
||
}
|
||
}
|
||
|
||
|
||
|
||
if (this.data.order_list[e.currentTarget.dataset.index].status == '已取消订单') {
|
||
wx.navigateTo({
|
||
url: '/pages/orderdetail/orderdetail?' + "type=" + '1' + '&id=' + this.data.order_list[e.currentTarget.dataset.index].order_id,
|
||
})
|
||
}
|
||
|
||
if (this.data.order_list[e.currentTarget.dataset.index].status == '待退款') {
|
||
wx.navigateTo({
|
||
url: '/pages/reforderdetail/reforderdetail?' + "type=" + '4' + '&id=' + e.currentTarget.dataset.id,
|
||
})
|
||
}
|
||
|
||
if (this.data.order_list[e.currentTarget.dataset.index].status == '退款驳回') {
|
||
wx.navigateTo({
|
||
url: '/pages/reforderdetail/reforderdetail?' + "type=" + '1' + '&id=' + e.currentTarget.dataset.id,
|
||
})
|
||
}
|
||
|
||
if (this.data.order_list[e.currentTarget.dataset.index].status == '已退款') {
|
||
wx.navigateTo({
|
||
url: '/pages/reforderdetail/reforderdetail?' + "type=" + '2' + '&id=' + e.currentTarget.dataset.id,
|
||
})
|
||
}
|
||
// wx.navigateTo({
|
||
// url: '/pages/orderdetail/orderdetail?'+"type="+'1'+ '&id=' +e.currentTarget.dataset.id,
|
||
// })
|
||
},
|
||
//跳转订单详情(去付款)
|
||
go_pay(e) {
|
||
console.log(e.currentTarget.dataset.id)
|
||
// wx.navigateTo({
|
||
// url: '/pages/orderdetail/orderdetail?' + "type=" + '2' + '&id=' + e.currentTarget.dataset.id,
|
||
// })
|
||
|
||
if (e.currentTarget.dataset.item != 0) {
|
||
let item = JSON.stringify(e.currentTarget.dataset.item);
|
||
console.log("传递的item" + item);
|
||
wx.navigateTo({
|
||
url: "/pages/orderdetail/orderdetail?item=" + item,
|
||
});
|
||
}
|
||
},
|
||
go_Qcode(e) {
|
||
wx.navigateTo({
|
||
url: '/pages/orderdetail/orderdetail?' + "type=" + '3' + '&id=' + e.currentTarget.dataset.id,
|
||
})
|
||
},
|
||
// 导航栏
|
||
all_order() {
|
||
this.setData({
|
||
nav_type: 1,
|
||
all: true
|
||
|
||
})
|
||
},
|
||
payment_order() {
|
||
this.setData({
|
||
nav_type: 2,
|
||
all: false
|
||
})
|
||
},
|
||
use_order() {
|
||
this.setData({
|
||
nav_type: 3,
|
||
all: false
|
||
})
|
||
},
|
||
refund_order() {
|
||
this.setData({
|
||
nav_type: 4,
|
||
all: false
|
||
})
|
||
},
|
||
/**
|
||
* 生命周期函数--监听页面初次渲染完成
|
||
*/
|
||
onReady: function () {},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面显示
|
||
*/
|
||
onShow: function () {
|
||
this.setData({
|
||
order_list: [],
|
||
pageNum: 1
|
||
})
|
||
this.getOrderList();
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面隐藏
|
||
*/
|
||
onHide: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面卸载
|
||
*/
|
||
onUnload: function () {
|
||
|
||
},
|
||
|
||
/**
|
||
* 页面相关事件处理函数--监听用户下拉动作
|
||
*/
|
||
onPullDownRefresh: function () {
|
||
//this.getOrderList();
|
||
var that = this;
|
||
wx.request({
|
||
url: app.globalData.url + '/system/view/list',
|
||
header: app.getRequestHeader(),
|
||
method: 'GET',
|
||
data: {
|
||
pageNum: 1,
|
||
pageSize: 30,
|
||
status: that.data.status[that.data.currentType],
|
||
usercId: wx.getStorageSync('uid')
|
||
},
|
||
success: (res) => {
|
||
var resp = res.data;
|
||
if (res.data.code == 200) {
|
||
that.setData({
|
||
pageNum: 1,
|
||
order_list: resp.data,
|
||
});
|
||
wx.stopPullDownRefresh({
|
||
success: (res) => {},
|
||
})
|
||
}
|
||
}
|
||
});
|
||
},
|
||
|
||
/**
|
||
* 页面上拉触底事件的处理函数
|
||
*/
|
||
onReachBottom: function () {
|
||
console.log("==页面上拉触底事件的处理函数==")
|
||
this.getOrderList();
|
||
},
|
||
|
||
/**
|
||
* 用户点击右上角分享
|
||
*/
|
||
onShareAppMessage: function () {
|
||
|
||
},
|
||
//订单状态:-2:已取消 -1:拒绝接单 0:待付款 1:已付款 2:已接单(待服务)3:服务中 4:已完成 5申请退款 6退款中 7已退款 8:已结算
|
||
getOrderList: function () {
|
||
var that = this;
|
||
wx.request({
|
||
url: app.globalData.url + '/system/view/list',
|
||
header: app.getRequestHeader(),
|
||
method: 'GET',
|
||
data: {
|
||
pageNum: 1,
|
||
pageSize: 30,
|
||
status: that.data.status[that.data.currentType],
|
||
usercId: wx.getStorageSync('uid')
|
||
},
|
||
success: (res) => {
|
||
var resp = res.data;
|
||
console.log(resp + "===========订单")
|
||
if (res.data.code == 200) {
|
||
if (this.data.pageNum == 1) {
|
||
that.setData({
|
||
order_list: resp.data,
|
||
pageNum: this.data.pageNum + 1
|
||
});
|
||
|
||
} else {
|
||
that.setData({
|
||
order_list: this.data.order_list.concat(resp.data),
|
||
pageNum: this.data.pageNum + 1
|
||
});
|
||
}
|
||
}
|
||
}
|
||
});
|
||
},
|
||
}) |