The weighted (edge-)Szeged index and the weighted (vertex-)PI index are modifications of the (edge-)Szeged index and the (vertex-)PI index, respectively, because they take into account also the vertex degrees. As the main result of this article, we prove that if G is a connected graph, then all these indices can be computed in terms of the corresponding indices of weighted quotient graphs with respect to a partition of the edge set that is coarser than the Theta*-partition. If G is a benzenoid system or a phenylene, then it is possible to choose a partition of the edge set in such a way that the quotient graphs are trees. As a consequence, it is shown that for a benzenoid system, the mentioned indices can be computed in sublinear time with respect to the number of vertices. Moreover, closed formulas for linear phenylenes are also deduced.