Quark mean field model for nuclear matter and finite nuclei