feat(eventOrder): add WhatsApp quote request functionality
Replaces the 'copy to clipboard' action with a direct 'Request a Quote' via WhatsApp. This streamlines the process for users to submit their event order details. - The 'Request a Quote' button now opens a pre-filled WhatsApp message to a designated contact number. - A new `buildMessage` computed property is created in the `eventOrder` composable to generate a detailed quote request message. - Adds support for tracking referrers via a `?referer` URL query parameter, which is included in the final message.
This commit is contained in:
@@ -58,19 +58,15 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
const { priceBreakdown, estimatedTotal, money } = useEventOrder();
|
||||
const { priceBreakdown, estimatedTotal, buildMessage, money } = useEventOrder();
|
||||
|
||||
const items = computed(() => priceBreakdown.value);
|
||||
const total = computed(() => estimatedTotal.value);
|
||||
|
||||
function onRequestQuote() {
|
||||
// Placeholder interaction (no backend). Could open mailto or copy summary.
|
||||
const lines = items.value.map(
|
||||
(i) =>
|
||||
`${i.label}:${money.format(i.amount)}${i.note ? `(${i.note})` : ""}`
|
||||
);
|
||||
const text = `预算合计:${money.format(total.value)}\n\n` + lines.join("\n");
|
||||
if (navigator?.clipboard) navigator.clipboard.writeText(text).catch(() => {});
|
||||
const text = encodeURIComponent(buildMessage.value);
|
||||
const url = `http://api.whatsapp.com/send?phone=+601157753558&text=${text}`;
|
||||
window.open(url, "_blank");
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user