// pages/homePage/homePage.js

var network = require("../../utils/net.js")
var timechage = require("../../utils/dateTimeUtil.js")

function GetUserProfile(successtion) {
  let method = '/MainSystem/B3MiniProgramRpc/XuRpcs/Customer/AccountBalanceRpc/GetCurrentBalanceMoney';
  let params = [];
  network.requestLoading(method, params, function (res) {
    successtion(res);
  })
}

Page({
  data: {
    currentDate: timechage.formatTimeTwo(Date.parse(new Date()), 'Y/M/D'),
    balance:"",
  },

  onLoad: function (options) {
    var that = this;
    // 添加接口请求当前余额
    GetUserProfile(function (res) {
      console.log(res);
       if (res != null) {
         that.setData({
           balance: res.result
         });
       }
     });
  },

  /**
   * 点击页面按钮进行跳转
   */
  transBtnClicked: function (event) {
    var btnID = event.currentTarget.dataset.itemid;
    var transferURL = '';
    switch (btnID) {
      // 找司机
      case "1":
        transferURL = '/pages/saleForecastList/saleForecastList';
        break;
      // 对账单
      case "2":
        transferURL = '/pages/statementOfAccount/statementOfAccount';
        break;
      // 客户找车
      case "3":
        transferURL = '/pages/sendCargo/sendCargo';
        break;
      // 销售出库
      case "4":
        transferURL = '/pages/saleOutStore/saleOutStore';
        break;
      // 担保单
      case "5":
        transferURL = '/pages/guarantee/guarantee';
        break;
      case "6":
        transferURL = '/pages/statementOfAccount/statementOfAccount';
        break; 
        case "7":
        transferURL = '/pages/homePage/homePage';
        break;
    }

    wx.navigateTo({
      url: transferURL,
    })
  },

  
})