business.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. export default {
  2. namespaced: true,
  3. state: () => ({
  4. checkinInfo: JSON.parse(uni.getStorageSync('checkinInfo') || '{}'),
  5. reservationInfo: uni.getStorageSync('reservationInfo') || {},
  6. hotelParams: JSON.parse(uni.getStorageSync('hotelParams') || '{}'),
  7. currentHotelId: uni.getStorageSync('currentHotelId') || '',
  8. currentHotelName: uni.getStorageSync('currentHotelName') || '',
  9. }),
  10. mutations: {
  11. updateCheckinInfo(state, checkinInfo) {
  12. state.checkinInfo = checkinInfo
  13. this.commit('m_business/saveCheckinInfoToStorage')
  14. },
  15. saveCheckinInfoToStorage(state) {
  16. uni.setStorageSync('checkinInfo', JSON.stringify(state.checkinInfo))
  17. },
  18. updateReservationInfo(state, reservationInfo) {
  19. state.reservationInfo = reservationInfo
  20. this.commit('m_business/saveReservationInfoToStorage')
  21. },
  22. saveReservationInfoToStorage(state) {
  23. uni.setStorageSync('reservationInfo', state.reservationInfo)
  24. },
  25. updateHotelParams(state, hotelParams) {
  26. state.hotelParams = hotelParams
  27. this.commit('m_business/saveHotelParamsToStorage')
  28. },
  29. saveHotelParamsToStorage(state) {
  30. uni.setStorageSync('hotelParams', state.hotelParams)
  31. },
  32. updateCurrentHotelId(state, currentHotelId) {
  33. state.currentHotelId = currentHotelId
  34. this.commit('m_business/saveCurrentHotelIdToStorage')
  35. },
  36. saveCurrentHotelIdToStorage(state) {
  37. uni.setStorageSync('currentHotelId', state.currentHotelId)
  38. },
  39. updateCurrentHotelName(state, currentHotelName) {
  40. state.currentHotelName = currentHotelName
  41. this.commit('m_business/saveCurrentHotelNameToStorage')
  42. },
  43. saveCurrentHotelNameToStorage(state) {
  44. uni.setStorageSync('currentHotelName', state.currentHotelName)
  45. },
  46. },
  47. getters: {},
  48. }