To accommodate the advent of microgrids (MG) managing distributed energy resources (DER) in distribution systems, an interactive two-stage joint retail electricity market mechanism is proposed to provide an effective platform for these prosumers to proactively join in retail transactions. Day-ahead stochastic energy trading between the distribution system operator (DSO) and MGs is conducted in the first stage of a centralized retail market, where a chance-constrained uncertainty distribution locational marginal price (CC-UDLMP) containing the cost of uncertainty precautions is used to settle transactions. In the second stage, a novel intra-day peer-to-peer-based (P2P) flexibility transaction pattern is implemented between MGs in local flexibility markets under the regulation of DSO to eliminate power imbalances caused by rolling-based estimates whilst considering systematic operations. A fully distributed iterative algorithm is presented to find the equilibrium solution of this two-stage sequential game framework. Moreover, in order to enhance the versatility of this algorithm, an improved Lp-box alternating direction methods of multipliers (ADMM) algorithm is used to efficiently resolve the first-stage stochastic economic dispatch problem with a mixed-integer second-order cone structure. It is verified that the proposed market mechanism can effectively improve the overall market efficiency under uncertainties.