business.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. export default {
  2. namespaced: true,
  3. state: () => ({
  4. checkinInfo: JSON.parse(uni.getStorageSync('checkinInfo') || '{}'),
  5. order: JSON.parse(uni.getStorageSync('order') || '{}'),
  6. currentHotel: JSON.parse(uni.getStorageSync('currentHotel') || '{}'),
  7. queryOrderResult: JSON.parse(uni.getStorageSync('queryOrderResult') || '{}'),
  8. guestInfo: JSON.parse(uni.getStorageSync('checkinInfo') || '[]'),
  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. updateOrder(state, order) {
  19. state.order = order
  20. this.commit('m_business/saveOrderToStorage')
  21. },
  22. saveOrderToStorage(state) {
  23. uni.setStorageSync('order', JSON.stringify(state.order))
  24. },
  25. updateCurrentHotel(state, currentHotel) {
  26. state.currentHotel = currentHotel
  27. this.commit('m_business/saveCurrentHotelToStorage')
  28. },
  29. saveCurrentHotelToStorage(state) {
  30. uni.setStorageSync('currentHotel', JSON.stringify(state.currentHotel))
  31. },
  32. updateQueryOrderResult(state, queryOrderResult) {
  33. state.queryOrderResult = queryOrderResult
  34. this.commit('m_business/saveQueryOrderResultToStorage')
  35. },
  36. saveQueryOrderResultToStorage(state) {
  37. uni.setStorageSync('queryOrderResult', JSON.stringify(state.queryOrderResult))
  38. },
  39. updateGuestInfo(state, guestInfo) {
  40. state.guestInfo = guestInfo
  41. this.commit('m_business/saveGuestInfoToStorage')
  42. },
  43. saveGuestInfoToStorage(state) {
  44. uni.setStorageSync('guestInfo', JSON.stringify(state.guestInfo))
  45. },
  46. },
  47. getters: {},
  48. }