You just need to join the 3 tables and use the MAX and SUM aggregate functions.
This example assumes that the purchase id’s are generated sequentially because there is no other field to identify which one is the “latest” (something like a transaction date or similar).
c.id AS cus_id,
c.name AS cus_name,
MAX(p.id) AS latest_purchase_id,
SUM(pi.quantity) AS all_items_purchased
JOIN purchase p
ON c.id = p.customer_id
JOIN purchase_item pi
ON p.id = pi.purchase_id
GROUP BY c.id, c.name;