数组的方法reduce
selectTotalPrice() { let totalPrice = this.goods.reduce((prev, cur) => { const curPrice = cur.goods.sku?.price || cur.goods.price; return parseFloat(prev) + parseFloat((cur.is_select && curPrice) || 0) * cur.num; }, 0); return totalPrice; }