The Order Domain cleric's Voice of Authority feature (Guildmasters' Guide to Ravnica, p. 26) specifically says:
If you cast a spell with a spell slot of 1st level or higher and target an ally with the spell,
It doesn’t specify that the spell must have a positive effect, so any spell that targets a “creature” could be used to trigger the feature. It also doesn’t specify that the spell must target only an ally. On the subject of area of effect spells, the feature also says:
If the spell targets more than one ally, you choose the ally who can make the attack.
This means that spells that target multiple creatures are fine. So if a spell has multiple targets, the spell would trigger if one or more of them are allies, and if there are more than one, you choose which ally.
In the case of spiritual weapon, however, there's some ambiguity. According to Jeremy Crawford, lots of things can count as the "target" of a spell; this reddit post includes a good summary of his comments from this episode of the official D&D podcast, but in short, it's pretty broad. A spell like spiritual weapon initially targets a point, and creates the weapon there, but then the weapon - and by extension the spell - targets creatures for attacks.
That sort of usage is subject to interpretation by your Dungeon Master, who will probably be guided by the fairly clear intent of the spell - that it's an extra bonus for allies buffed by a spell cast by the cleric, rather than usable with a spell intended to attack enemies for many rounds, allowing the Order cleric to grant multiple additional attacks at the cost of a single spell slot. However, it is probably allowed by the rules as written, especially when Jeremy Crawford's comments are taken into account.
I suspect the language is a little loose to make sure it allows for all buffing spells, some of which might also have a delay between casting and targeting an ally - hence “if you cast a spell” rather than the perhaps clearer “when you cast a spell”.