mirror of
https://github.com/yangjian102621/geekai.git
synced 2026-04-23 11:34:27 +08:00
67 lines
1.4 KiB
Vue
67 lines
1.4 KiB
Vue
<template>
|
|
<el-dialog
|
|
v-model="showDialog"
|
|
:close-on-click-modal="true"
|
|
:before-close="close"
|
|
:width="450"
|
|
:title="title"
|
|
>
|
|
<div class="form" id="bind-mobile-form">
|
|
<el-form :model="form">
|
|
<el-form-item>
|
|
<el-input v-model="form.code" />
|
|
</el-form-item>
|
|
</el-form>
|
|
</div>
|
|
|
|
<template #footer>
|
|
<span class="dialog-footer">
|
|
<el-button type="primary" @click="save"> 立即兑换 </el-button>
|
|
</span>
|
|
</template>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { showMessageError, showMessageOK } from '@/utils/dialog'
|
|
import { httpPost } from '@/utils/http'
|
|
import { ElMessage } from 'element-plus'
|
|
import { computed, ref } from 'vue'
|
|
|
|
const props = defineProps({
|
|
show: Boolean,
|
|
})
|
|
|
|
const showDialog = computed(() => {
|
|
return props.show
|
|
})
|
|
|
|
const title = ref('兑换码核销')
|
|
const form = ref({
|
|
code: '',
|
|
})
|
|
|
|
const emits = defineEmits(['hide'])
|
|
|
|
const save = () => {
|
|
if (form.value.code === '') {
|
|
return ElMessage.error({ message: '请输入兑换码' })
|
|
}
|
|
|
|
httpPost('/api/redeem/verify', form.value)
|
|
.then(() => {
|
|
showMessageOK('兑换成功!')
|
|
emits('hide', true)
|
|
})
|
|
.catch((e) => {
|
|
showMessageError('兑换失败:' + e.message)
|
|
})
|
|
}
|
|
|
|
const close = function () {
|
|
emits('hide', false)
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss"></style>
|