
const app = getApp();
var baseUrl = app.globalData.baseUrl;
var network = require("../../utils/net.js");
var timechage = require("../../utils/dateTimeUtil.js");


Page({

  /**
   * 页面的初始数据
   */
  data: {
    currentData: 0,
    dates: "请选择日期",
    index: 0,
    showView: false,

    list:[],
  },
  onLoad: function (options) {
    // 生命周期函数--监听页面加载
   
  }, 
  
  sendTheDetails: function (event) {
    let that = this
    var parm1 = event.currentTarget.dataset;
    wx.navigateTo({
      url: '/pages/sendTheDetails/sendTheDetails?ID=' + parm1.id
    })
    console.log(parm1.id)
  },

  onChangeShowState: function () {

  },
 
  onChangeShowState: function () {

    var that = this;
    that.setData({
      showView: (!that.data.showView)

    })
  },

  checkboxgroupBindchange: function (e) {
    var temp1 = e.detail.value
    var temp2 = ''
    console.log(temp1)
    if (temp1.length != 0) {
      for (var i = 0, len = temp1.length; i < len; i++) {
        temp2 = temp2 + temp1[i] + ','
      }

    }
  },

  bindDateChange: function (e) {
    this.setData({
      dates: e.detail.value
    })
    this.arr();
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    showView: (options.showView == "true" ? true : false)
    

  },
  onShow: function (e) {
    var that = this;
    var reslut = [];
    var method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/OrderRpc/GetNoDriverOrder';
    var params = [];

    network.requestLoading(method, params, function (res) {
      for (var i = 0; i < res.result.length; i++) {
        let dmo = {
          LoadTime: timechage.formatTimeTwo(res.result[i].LoadTime.substring(6, 19), "Y/M/D h:m"),
          ID: res.result[i].ID,
          Customer_Name: res.result[i].Customer_Name,
          Money: res.result[i].Money,
        }
        reslut.push(dmo)
        console.log(dmo)
      }
      //res就是我们请求接口返回的数据
      that.setData({
        list: reslut,
      })

    })
  },
  //获取当前滑块的index
  bindchange: function (e) {
    const that = this;
    that.setData({
      currentData: e.detail.current
    })
  },
  //点击切换，滑块index赋值
  checkCurrent: function (e) {
    const that = this;

    if (that.data.currentData === e.target.dataset.current) {
      return false;
    } else {

      that.setData({
        currentData: e.target.dataset.current
      })
    }
  }
})