This commit is contained in:
Viet An
2026-06-19 15:55:16 +07:00
parent f491f82f43
commit cb5d63b064
3 changed files with 38 additions and 30 deletions

View File

@@ -1,6 +1,8 @@
export default function useOrderInfo({ activeCartId, activeCart, activeCartItems, addresses, getAddresses }) {
const orderInfo = ref({
address: null,
receiver_name: null,
receiver_phone: null,
deliveryMethod: null,
paymentMethod: null,
});
@@ -18,10 +20,14 @@ export default function useOrderInfo({ activeCartId, activeCart, activeCartItems
if (!oldVal || !oldVal.customer || oldVal.customer !== newVal.customer) {
const defaultAddress = addresses.value.find((add) => add.is_default);
orderInfo.value.address = defaultAddress;
orderInfo.value.receiver_name = newVal.customer__fullname;
orderInfo.value.receiver_phone = newVal.customer__phone;
}
} else {
addresses.value = null;
orderInfo.value.address = null;
orderInfo.value.receiver_name = null;
orderInfo.value.receiver_phone = null;
}
});