巴青农资商城

cartCheckout.js 588B

12345678910111213141516171819202122232425262728
  1. import { CART_CHECKOUT_STORAGE_KEY } from '@/constants/cart'
  2. /** 缓存去结算预校验结果,供后续确认订单页读取 */
  3. export function saveCheckoutPrepare(data) {
  4. if (!data) return
  5. try {
  6. uni.setStorageSync(CART_CHECKOUT_STORAGE_KEY, data)
  7. } catch (e) {
  8. // ignore
  9. }
  10. }
  11. export function readCheckoutPrepare() {
  12. try {
  13. return uni.getStorageSync(CART_CHECKOUT_STORAGE_KEY) || null
  14. } catch (e) {
  15. return null
  16. }
  17. }
  18. export function clearCheckoutPrepare() {
  19. try {
  20. uni.removeStorageSync(CART_CHECKOUT_STORAGE_KEY)
  21. } catch (e) {
  22. // ignore
  23. }
  24. }