Does pruning node keep old wallet's transactions? For example I need to use the
gettransaction API to retrieve a wallet's transaction in a deleted block, should I use the pruning mode? I cannot find any document about it,
Yes, it does.
Pruning only affects the blockchain/validation logic. The wallet always maintains a copy of all transactions relevant to it (including e.g. unconfirmed transactions that the validation logic does not know about).