The nation’s third-largest drugstore chain says it will pay about $1.8 billion in cash and $200 million in stock for EnvisionRx, a pharmacy benefit manager, or PBM, owned by the investment firm TPG. PBMs run prescription drug plans for customers like employers and insurers.