Consumers, who endured a long recession, have turned to low-cost chains like T. J. Maxx and shifted their spending away from brick-and-mortar stores for the convenience of online shopping with the retail giant Amazon.