const {
  globalData: {
    util: {
      regeneratorRuntime,
      api: {
        reservationDetail,
        reservationCancel
      },
      navigateBack,
      showTip,
      request: {
        get
      },

    }
  }
} = getApp()
Page({

  async onLoad({
    id
  }) {
    this.setData({
      item: await get(reservationDetail, { id }, { loading: true, loadingMsg: '信息加载中' }),
      id
    })

  },
  async cancelReservation({ currentTarget: { dataset: { id } } }) {
    let { _err } = await get(reservationCancel, { id })
    if (_err) return _err.status && showTip('取消失败')
    navigateBack()
    showTip('取消成功')

  },
  navigateBack
})