At first glance it seems very puzzling the Zohar's reference of אשת פוטיפר as שטן...-- What does a lustful woman seeking sexual pleasure have anything to do with the desire for קטרוג and meting out of justice? Further puzzling is the interpretation of ולא שמע אליה -- בגין דאיהו חייס על עלמא... where is that paralleled in the משל of יוסף?
לפע"ד, given the concept of ושפחה כי תירש גבירתה I'd suggest that by default the only possible way the שפחה can justify her promotion over גבירתה is by way of bringing to the Husband's attention the faults of his wife, thereby justifying his estrangement from her (and ergo the consequent bringing in of the שפחה as the new lady of the house).
But the Husband stays true to the one He knows is his fitting mate and refuses the "convenience" of a שפחה in his bed. The refusal to compromise the integrity of one's sense of Truth for the convenience of "buying cheap". And so the refusal of a Yosef because "I don't sleep with my friend's wife", regardless of how lonely the alternatives are. The choosing to stay home all alone while the only party in town is living it up because one knows "it's not what I belong to".... it comes from a deep love for that which one knows is his truly fitting partner/people/world .... בגין דאיהו חייס על עלמא
צדיק then is a function of staying true to the love of what one knows to be Truth and not allowing that love to be pragmatically "expendable"...