"Have you eaten?" is simply a common greeting in China, not an invitation to dinner.
Don's expect this is an invitation to have a meal together if your Chinese friend asks you this question. This expression is used simply as a common greeting in China. Since it is only a greeting instead of a genuine question, you can usually give a positive answer like "Yes, I've eaten. Have you?"
This special greeting can be interpreted in two ways: the Chinese care about eating or it indicates that there was not enough food to eat in the past. Just as Americans like to greet people "How are you doing ?" or British "Nice day, isn't it?" to show their first concern, this Chinese greeting also reflects the priority of the Chinese people.
Nowadays, as China has adapted to a market economy and eating is no longer the top concern, the popular greeting has changed to "Are you busy? ". The change indicates the shifted priority from food to occupation. The positive answer to this question conveys that you are still working, while the negative answer suggests probably you will be laid off or have been laid off. Another common greeting in China is "Where are you going?" Since it is not a request for information, a vague answer like "Just have a walk" will do.
The most misleading greeting is that your neighbor or the guard downstairs will greet you as "You're back?" or "You're going out?" when he/she sees you coming in or going out of the building. Don't think he/she is spying on you. Rather it is just a simple way of making contact. The response to that is also a smile and a "yes".
On most occasions, the above-mentioned are the common greeting methods among Chinese themselves. The most frequently used word for them to greet a foreign friend is still "Ni Hao" (Hello).