// pages/faceDetectionDetails/faceDetectionDetails.js
import {
  get,
} from '../../utils/http';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    man: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20220527/invite/man.png',
    female: 'https://we-spa.oss-cn-shenzhen.aliyuncs.com/wxapp/20220527/invite/wuman.png',
    scheme_list: [],
    userInfo: {},
    nowTimesIndex: 0,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getInfo()
  },

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

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  getInfo() {
    get('/v2/api/user/scheme', {}, (res) => {
      this.setData({
        userInfo: res.data
      })
    })
  },
  changeWeek(e) {
    this.setData({
      nowTimesIndex: e.currentTarget.dataset.index
    })
  },
  beginOrder() {

  },

  ruleClick: function () {
    wx.navigateTo({
      url: '/pages/recommendRule/recommendRule?notTrueBtn=true',
    })
  },

  // 去预约
  toMake(e) {
    let orderDetails = e.currentTarget.dataset.item
    let moneyShow = 0
    for (let i = 0; i < orderDetails.length; i++) {
      moneyShow = (moneyShow * 1) + (orderDetails[i].price * 1)
      if (orderDetails[i].product_name) {
        orderDetails[i].selectMaterial = {}
        orderDetails[i].selectMaterial.name = orderDetails[i].product_name
        orderDetails[i].selectMaterial.id = orderDetails[i].product_id
      }
    }
    console.log(orderDetails)
    wx.navigateTo({
      url: '../reserveCar/reserveCar?data=' + JSON.stringify(orderDetails) + '&&money=' + moneyShow + '&&type=project',
    })
  }
})