Effects of dark energy on P–V criticality of charged AdS black holes