так пойдет?
const books = {
'small:green': 10,
'small:red': 15,
'medium:green': 20,
'medium:red': 25,
'large:green': 30,
'large:red': 35
}
function count() {
const
size = document.querySelector('#size').value,
color1 = document.querySelector('#color').value,
amount = document.querySelector('#amount').value;
document.querySelector('#total').textContent = `${books[`${size}:${color}`] * amount} р.`;
}
count();
document.querySelector('form').addEventListener('change', count);
function change(objName, min, max, step) {
var obj = document.getElementById(objName);
var tmp = +obj.value + step;
if (tmp < min) tmp = min;
if (tmp > max) tmp = max;
obj.value = tmp;
count();
}