<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Title</title> <style> body { background: oldlace; } img { width: 150px; margin-left: 20px; } h1 { text-align: center; color: brown; } #div { display: flex; flex-direction: column; justify-content: center; margin: 0 auto; align-items: center; } #img-block { display: flex; align-items: center; } #textBlock { display: flex; } p { padding-right: 20px; color: brown; font-size: 20px; } button { margin: 0 auto; width: 200px; height: 40px; background-color: bisque; box-shadow: 6px 6px 20px rgba(0, 0, 0, 0.3); } button:hover { box-shadow: 0px; } .buttomP { color: red; margin: 0; text-align: center; font-size: 20px; padding-left: 15px; } #list, #amount, #sum { margin-bottom: 20px; width: 300px; height: 20px; background-color: bisque; } #amount, #sum { width: 294px; } #text { padding-left: 60px; } </style> </head> <body> <h1>ГОПОТА МАРКЕТ</h1> <div id="div"> <div id="img-block"> <div> <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoGCBUVExcVFRMXGBcZGhkaGhoZGhojHBkXHRwdHRkbHBwhICsjHSEpHxkcJDYlKCwuMjIyGSE3PDcxOysxMi4BCwsLDw4PHRERHS4pISgxMzEyMS4xOzExMTE7NjsxMTIzMTE5MTExMTEuMTExMTExMzExOTExMTExMTExMTExMf/AABEIATYAowMBIgACEQEDEQH/xAAcAAABBAMBAAAAAAAAAAAAAAAABAUGBwECAwj/xABLEAABAgMEBwQECwYEBQUAAAABAhEAAyEEEjFBBQYiUWFxgQcTMpGhsbLBFCM0NUJScnPR4fAkJWKCs/F0kqLSFVNjwuIWM0OT8v/EABkBAQADAQEAAAAAAAAAAAAAAAACAwQBBf/EADERAAIBAgQEBQMDBQEAAAAAAAABAgMRBBIhMTJBUXEFExQzYYGRoSIj8EJSYrHhFf/aAAwDAQACEQMRAD8AuaCCCACCCCACCIhp/XqRZ5ypAlzJkxJAUzBIJYh1E7iMAYTaW13XLu3JCVv9WY4TzN2AJvBFfI15mKIDyEc7xb/UIcZesxIraJPRLetRjl11O2ZMIIhK9bJaTt26Unon8Iy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esRS8HDk2WLEy5olejLQhm7xJ/mG7nDmmYKVGJq/KKjtui5gNZZ8oRjR8z6rdREfRrqd9T8Fzz1Bsa1fCGy2rAbbFWOODxVwsK96f8AMPxjcWNQxu+Yh6P/ACO+q+CertKQPGgAuC5B4vwyhv8AhcsKBKknr+uER+xaNWvwjyCj6hD1o7VactQHdzG392oD/UBHVg482ceKfQk2hdYJCMVE8EpJ9JaHDSOtyLrIlKJLAOcSaAMINEaoolgPLc71n3B4drLq7LEwTF7RSXQlmSg5FvpHifKLoYeEVYonUlJ3GnR2qaps0TrZdLF0yU1QD/GfpcsOcTKCCLYxUVZEW29WZgggiRwIIIIAIIIIAIIIIAIIIIAIIIIAwRGhkp+qnyEEEAa/BkfUT5CBElAwQkdBBBAHWMwQQAQQQQAQQQQAQQQQAQQQQB//2Q==" alt="" /> <p id="text">20 денег</p> </div> <div> <img src="https://euro-opt.shop/4119-large_default/chipsy-pringles-original-pringls-original-165g.jpg" alt="" width="" /> <p id="text">10 денег</p> </div> <div> <img src="https://img3.zakaz.ua/1.1620828397.ad72436478c_2021-05-12_Tatiana/1.1620828397.SNCPSG10.obj.0.1.jpg.oe.jpg.pf.jpg.1350nowm.jpg.1350x.jpg" alt="" /> <p id="text">30 денег</p> </div> </div> <div id="textBlock"> <p>В наличии:</p> <br /> </div> <p>Чё надо?</p> <select name="store" id="list" class="s-10"> <option value="пиво">Пиво</option> <option value="чипсы">Чипсы</option> <option value="сиги">Сиги</option> </select> <p>Скок надо?</p> <input type="number" id="sum" class="i-3" /> <p>Давай бабки! Сдачи нету!</p> <input type="number" id="amount" class="i-2" /> <button id="button" class="b-2"> <p class="buttomP">КУПИТЬ</p> </button> <p class="out-2" id="kassa">КАССА: 0 денег</p> </div> <script> setTimeout(function () { let parent = document.querySelector("#textBlock"); parent.lastElementChild.remove(); store.dispatch({ type: "КУПИТЬ", ШО: "пиво", СКОКА: 0 }); }, 1); function reducer(state, { type, ШО, СКОКА, БАБЛО }) { //объект action деструктуризируется на три переменных if (!state) { //начальная уборка в ларьке: return { пиво: { price: 20, amount: 100 }, чипсы: { price: 10, amount: 100 }, сиги: { price: 30, amount: 100 }, касса: { cash: 0 }, }; } let stateSHO = state[ШО].amount; let statePrice = state[ШО].price; if ( type === "КУПИТЬ" && stateSHO != 0 && stateSHO >= 0 && sum.value <= 100 ) { if((stateSHO - sum.value) >= 0) { if (statePrice * sum.value <= amount.value) { return { ...state, [ШО]: { price: state[ШО].price, amount: stateSHO - СКОКА, }, касса: { cash: +state.касса.cash + +amount.value, }, }; } else { alert("Мало денеге, пойди в мамы попроси!") } } else { alert("У нас нету столько товара") } } else { alert("Либо у нас нету столько товара, либо говорить научись!") } return state; //если мы не поняли, что от нас просят в `action` - оставляем все как есть } function createStore(reducer) { let state = reducer(undefined, {}); //стартовая инициализация состояния, запуск редьюсера со state === undefined let cbs = []; //массив подписчиков const getState = () => state; //функция, возвращающая переменную из замыкания const subscribe = (cb) => ( cbs.push(cb), //запоминаем подписчиков в массиве () => (cbs = cbs.filter((c) => c !== cb)) ); //возвращаем функцию unsubscribe, которая удаляет подписчика из списка const dispatch = (action) => { const newState = reducer(state, action); //пробуем запустить редьюсер if (newState !== state) { //проверяем, смог ли редьюсер обработать action state = newState; //если смог, то обновляем state for (let cb of cbs) cb(); //и запускаем подписчиков } }; return { getState, //добавление функции getState в результирующий объект dispatch, subscribe, //добавление subscribe в объект }; } const store = createStore(reducer); //запомнит функцию во внутреннем массиве cbs. //она будет запущена при любом успешном dispatch const unsubscribe = store.subscribe(() => console.log(store.getState()) ); setTimeout(unsubscribe, 10000); //отпишемся через 10 секунд, например //происходит запуск редьюсера, который создает новый state. //dispatch запускает всех подписчиков из массива cbs console.log(store.getState()); store.subscribe(() => console.log(store.getState())); for (let [good, amount] of Object.entries(store.getState())) { console.log(good, amount); let p = document.createElement("p"); p.innerHTML = `${good} (${amount})`; textBlock.append(p); button.onclick = () => { store.dispatch({ type: "КУПИТЬ", ШО: list.value, СКОКА: sum.value, }); kassa.innerHTML = "КАССА: " + store.getState().касса.cash + " денег"; }; store.subscribe( () => (p.innerText = `${good} (${ store.getState()[good].amount })`) ); } </script> </body> </html>