The primary designation of the decimals
function is off-chain display (it doesn't mean that it should not be used on-chain, but you should consider it very carefully before being tempted to do so).
This function can be used in order to avoid the need for displaying very low significant digits.
For example, instead of displaying 1234567890000000000 wei, you can display 1.23456789 ether.
Regarding the rest of your question:
10 tokens = 1 ether -->
10 tokens = 1000000000000000000 (1e+18) wei -->
1 token = 100000000000000000 (1e+17) wei -->
1 wei = 0.00000000000000001 (1e-17) token
As you can see, your token decimals
have no impact on this; they only mean that 1 token will be represented in your contract via the numeric equivalence of 10 ** decimals
.