Hanoi or Shanghai for 5 days?

Trying to pick between the two. I'm going to be in Phuket then Bangkok and trying to pick my last stop before I head back to Seattle. Flying costs are similar, while Hanoi seems to have the cheaper high end hotels. Shanghai would be an easier, direct flight, so that's nice.

But has anyone been to both and has a recommendation?