business.js 1.9 KB

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