In this paper, we study the problem of conflict detection and resolution for unmanned aerial vehicle (UAV) swarms. Specially, we propose a distributed conflict detection and resolution method for multi-UAVs in formation based on consensus algorithm and strategy coordination. When encountering threat swarms, the UAVs in one swarm act as one unit and are together treated as one control object. Each swarm in conflict selects three candidate collision avoidance maneuvers from the preset strategy pool, generates the corresponding planned trajectories with an uncertainty trajectory modeling, and then broadcasts and shares them. All of the swarms in conflict coordinate and determine an optimal combination of strategies. When a collision is imminent, the primary strategy is activated. Each swarm adopts a ''leader-follower'' strategy, where the leader UAV is regarded as the controller and flies independently, and the others follow the leader UAV. During motion, a decentralized consensus algorithm is adopted for agents to converge to their positions for the desired formation and to maintain a stable geometric configuration. A temporal and spatially integrated conflict-detection model is improved, especially for UAV swarms. A token-allocation strategy is especially improved for distributed coordination to resolve the partial knowledge of the airspace condition. Damping of the coordination is proposed to address data dropouts and transmission delays. Two typical scenarios are conducted to test the methodology proposed in this paper. The simulation result demonstrates the effectiveness and rationality of the proposed methodology.