The invention discloses a preparation method of a nanofiltration composite membrane capable of being used for softening water. A trimesic acid crosslinking agent and polyethyleneimine are crosslinkedon the surface of an ultrafiltration membrane to obtain a composite layer, and the charge effect of the membrane surface is enhanced by quaternization, thereby enhancing the selectivity. The advantages of good hydrophilicity, strong charge property, stable film-forming property and the like of polyethyleneimine are fully exerted, and the desalination rate and the water flux are greatly improved. The membrane preparation process is simple, process parameters are easy to optimize, raw materials are cheap and easy to obtain, and expanded production of the nanofiltration composite membrane is facilitated; after amino quaternization, the charge effect is enhanced, and the membrane selectivity is further improved.