zhengyiming
14 小时以前 23bfd958545ab5548d561ef6db1eafafe03e4e05
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<template>
  <div></div>
</template>
 
<script setup lang="ts">
import {
  Form as NutForm,
  FormItem as NutFormItem,
  Input as NutInput,
  Textarea as NutTextarea,
} from '@nutui/nutui-taro';
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
import { reactive, ref, computed } from 'vue';
import {
  useLifeRechargeContext,
  LifeRechargeConstants,
  RefundUserLifePayOrderInput,
} from '@life-payment/core-vue';
import { useQueryClient } from '@tanstack/vue-query';
 
defineOptions({
  name: 'ApplyAgentView',
});
 
const emit = defineEmits<{
  (e: 'submit'): void;
}>();
 
const form = reactive({
  refundApplyRemark: '',
});
 
const rules = reactive<FormRules>({
  refundApplyRemark: [{ required: true, message: '请输入退款原因' }],
});
 
const { blLifeRecharge } = useLifeRechargeContext();
 
const formRef = ref<any>(null);
 
function handleSubmit() {
  if (!formRef.value) return;
  formRef.value.validate().then(({ valid, errors }: any) => {
    if (valid) {
      refundUserLifePayOrder();
    }
  });
}
 
const queryClient = useQueryClient();
 
async function refundUserLifePayOrder() {
  try {
    let params = {
      userId: blLifeRecharge.accountModel.userId,
      refundApplyRemark: form.refundApplyRemark,
    };
    let res = await blLifeRecharge.services.refundUserLifePayOrder(params);
    emit('submit');
  } catch (error) {}
}
 
defineExpose({
  handleSubmit,
});
</script>