hist_service.js 3.13 KB
var e = getApp(),
  a = e.globalData.setting,
  os = a,
  t = e.request,
  d = e.globalData;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    iurl: a.imghost,
    isPickerShow: false,
    isPickerRender: false,
    startTime: 0,
    endTime: 0,
    pickerConfig: {
      endDate: true,
      column: "",
      dateLimit: true,
      initStartTime: "2019-01-01 12:32:44",
      initEndTime: "2019-12-01 12:32:44",
      limitStartTime: "1917-05-06 12:32:44",
      limitEndTime: "2055-05-06 12:32:44"
    },
    hist_List: [], //服务项目列表
    is_service_read: 0,
    curpage: 1, //当前分页数
    pageSize: 10, //页大小
    total: 0,
    ismore: 0, //是否加载完毕
  },
  pickerShow: function() {
    this.setData({
      isPickerShow: true,
      isPickerRender: true,
      chartHide: true
    });
  },
  pickerHide: function() {
    var th = this;
    th.setData({
      isPickerShow: false,
      chartHide: false
    });
  },
  //--选择时间--
  setPickerTime: function(val) {
    let data = val.detail,
      gl_data = getApp().globalData,
      th = this;
    th.setData({
      startTime: data.startTime,
      endTime: data.endTime,
      val: 0,
      distance: 0,
    });
    console.log("开始" + data.startTime + "结束" + data.endTime, );
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {
    var th = this;
    th.query_hist();
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {
    var th = this;
    if (th.data.total <= th.data.pageSize) return;
    if (th.data.ismore) return;

    wx.showLoading({
      title: '加载中...',
    })
    th.query_service();
  },
  query_hist: function() {
    var th = this;
    var url = "http://localhost:8022/api/weshop/yy_fuwu_lishi";
    wx.request({
      url: url,
      success: function(res) {
        if (res.data.code == 0) {
          th.setData({
            hist_List: res.data.data.pageData,
            total: res.data.data.total
          })
        }
      }
    })

    // var th = this;
    // var url = "/api/weshop/marketing/reservation/sm/page";
    // getApp().request.promiseGet(url, {
    //   data: {
    //     storeId: a.stoid,
    //     userId: d.user_id,
    //     page: th.data.curpage,
    //     pageSize: th.data.pageSize
    //   }
    // }).then(res => {
    //   if (res.data.code == 0) {
    //     wx.hideLoading();
    //     th.data.curpage++;
    //     var arr1 = th.data.service_List;
    //     var arr2 = res.data.data.pageData;
    //     var arr3 = [...arr1, ...arr2];
    //     var ismore = 0;
    //     if (arr3.length == res.data.data.total) ismore = 1
    //     th.setData({
    //       service_List: arr3,
    //       total: res.data.data.total,
    //       ismore: ismore,
    //       is_service_read: 1,
    //     }), wx.stopPullDownRefresh(); //停止下拉刷新
    //   }
    // })
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})