123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- let app = getApp();
- let host = app.globalData.servsers; // 请求的url
- Page({
- data: {
- host: host,
- isSelect: "", //默认全部
- dataStateArray: [{
- state: '',
- label: "全部",
- },
- {
- state: '1',
- label: "待付款",
- },
- {
- state: '3',
- label: "待发货",
- },
- {
- state: '4',
- label: "待收货",
- },
- {
- state: '5',
- label: "待评价",
- }
- ],
- goodsList: [],
- dividerState: false, //判断数据是否请求结束了,默认是false
- page: 1, //默认第一页
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- let that = this;
- if ('state' in options) {
- that.setData({
- isSelect: options.state
- })
- }
- that.getOrderList(that, that.data.isSelect)
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
- tab(e) { // tab切换
- this.setData({
- isSelect: e.currentTarget.dataset.state
- })
- this.getOrderList(this, e.currentTarget.dataset.state)
- },
- getOrderList(that, status) {
- wx.request({
- url: host + '/orderapi/orderlist',
- method: 'get',
- data: {
- user_id: app.globalData.user_id,
- status: status
- },
- success(res) {
- console.log(res, "orderItem")
- that.setData({
- goodsList: [...res.data]
- })
- }
- })
- }
- })
|