// pages/debitNoteList/debitNoteQuery/debitNoteQuery.js

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

Page({
  data: {
    Sdate: timechage.formatTimeTwo(Date.parse(new Date()), 'Y-M-D'),
    Edate: timechage.formatTimeTwo(Date.parse(new Date()), 'Y-M-D'),
  },

  submitForm: function (e) {
    let sDate = timechage.formatymdERTDate(this.data.Sdate);
    let eDate = timechage.formatymdERTDate(this.data.Edate);

    var pages = getCurrentPages();
    var currPage = pages[pages.length - 1];  //当前页面
    var prevPage = pages[pages.length - 2];  //上一个页面
    //直接调用上一个页面对象的setData()方法，把数据存到上一个页面中去
    prevPage.setData({
      startDate: sDate,
      endDate: eDate,
    });
    wx.navigateBack({
      delta: 1
    })
  },

  bindSDateChange: function (e) {
    this.setData({
      Sdate: e.detail.value,
    })
  },
  bindEDateChange: function (e) {
    this.setData({
      Edate: e.detail.value,
    })
  },

})