The problem of locating distribution centers for delivering fresh food as a part of electronic commerce is a strategic decision problem for enterprises. This paper establishes a model for locating distribution centers that considers the uncertainty of customer demands for fresh goods in terms of time-sensitiveness and freshness. Based on the methodology of robust optimization in dealing with uncertain problems, this paper optimizes the location model in discrete demand probabilistic scenarios. In this paper, an improved fruit fly optimization algorithm is proposed to solve the distribution center location problem. An example is given to show that the proposed model and algorithm are robust and can effectively handle the complications caused by uncertain demand. The model proposed in this paper proves valuable both theoretically and practically in the selection of locations of distribution centers.