This commit is contained in:
kron
2025-09-30 10:53:06 +08:00
parent ca399ffc19
commit c0aa6e8058
2 changed files with 70 additions and 31 deletions

View File

@@ -2,6 +2,10 @@
import { ref, reactive, watch } from "vue";
import { donateAPI } from "@/apis";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
const { config } = storeToRefs(store);
const props = defineProps({
show: {
@@ -13,7 +17,7 @@ const props = defineProps({
default: null,
},
});
const amounts = [5, 20, 50, 80, 100, 200];
const amounts = ref([]);
const selected = ref(null);
const checked = ref(false);
@@ -27,7 +31,7 @@ const formData = reactive({
const onPay = async (index) => {
selected.value = index;
const result = await donateAPI(
0.01,
amounts.value[index],
formData.name,
formData.account,
formData.organization,
@@ -60,6 +64,14 @@ const onPay = async (index) => {
}
};
watch(
() => config.value.donateAmount,
(value) => {
amounts.value = value || [];
},
{ immediate: true }
);
watch(
() => props.show,
() => {