The generation of a specific laser beam profile on the work surface is key to various laser beam shaping tasks, relying heavily on diffractive optical elements (DOEs). Most beam-shaping DOEs are designed using iterative Fourier transform algorithms (IFTAs), which generally have slow convergence and prone to stagnate at local minima. Moreover, the microreliefs generated by IFTAs tend to be irregular, complicating manufacturing and causing uncontrolled scattering of light. We propose a differentiable DOE design method that applies a phase-smoothness constraint using multi-level B-splines. A multi-scale gradient-descent optimization strategy, naturally linked with the multi-level B-splines, is employed to robustly determine the optimized phase distribution that is fully continuous. This, in turn, can lead to more regular DOE microreliefs, which can simplify the fabrication process and be less sensitive to changes in wavelength and working distance. Furthermore, our method can also design a fully continuous freeform lens, distinguished from most freeform lens design approaches by its foundation in physical optics rather than geometrical optics. Simulation and experimental results of several design tasks demonstrate the effectiveness of the proposed method.