fix(mall): normalise group quantity and drop abandoned intents
Opening or joining a group now sets the activity SKU to quantity 1 instead of accumulating, so a retry after a failed checkout - or a second click - can no longer push the line to quantity 2 and then fail the quantity-1 intent with an opaque error. The stashed group intent is cleared when the checkout page unmounts without submitting, and when its SKU is no longer in the cart, so an abandoned intent cannot silently reprice a later order or keep the coupon picker hidden.
This commit is contained in:
@@ -54,6 +54,9 @@ async function start(activity: GroupBuyingActivityView, open: boolean): Promise<
|
||||
workingId.value = activity.id;
|
||||
try {
|
||||
await $api.addCartItem(activity.sku_id, 1);
|
||||
// The intent is quantity-1 only, so normalise in case the SKU was already in
|
||||
// the cart or a previous attempt failed.
|
||||
await $api.updateCartItem(activity.sku_id, 1);
|
||||
await cart.refresh();
|
||||
useState<GroupBuyIntent | null>("checkout-group-intent", () => null).value = {
|
||||
activity_id: activity.id,
|
||||
|
||||
Reference in New Issue
Block a user