Don't hand in your ID card just because you don't have a job. Think about it. At present, many of these companies pay less after their ID cards are seized. Seriously, you can't leave. Without an ID card, it is impossible to change jobs.
Moreover, China's labor law clearly stipulates that no company may detain employees' ID cards for any reason. The company you mentioned is obviously illegal. Think about it yourself and give you a piece of advice: don't make the mistake of losing the watermelon and picking up the sesame seeds.