<template>
|
<NutForm
|
:model-value="form"
|
ref="formRef"
|
:rules="rules"
|
label-position="top"
|
class="order-bill-recharge phone"
|
>
|
<NutFormItem class="bole-form-item" prop="refundApplyRemark" required>
|
<NutTextarea
|
placeholder="请输入退款原因"
|
placeholderClass="bole-input-text-placeholder"
|
autoSize
|
class="bole-input-textarea"
|
v-model="form.refundApplyRemark"
|
:max-length="200"
|
limit-show
|
>
|
</NutTextarea>
|
</NutFormItem>
|
<div class="common-content">
|
<nut-button class="recharge-button" type="primary" @click="handleSubmit">
|
<div class="recharge-button-inner">
|
<div class="recharge-button-text">提交</div>
|
</div>
|
</nut-button>
|
</div>
|
</NutForm>
|
</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: 'OrderApplyRefundView',
|
});
|
|
type Props = {
|
id: string;
|
};
|
|
const props = withDefaults(defineProps<Props>(), {});
|
|
const emit = defineEmits<{
|
(e: 'submitApplyRefund'): 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: RefundUserLifePayOrderInput = {
|
id: props.id,
|
userId: blLifeRecharge.accountModel.userId,
|
refundApplyRemark: form.refundApplyRemark,
|
};
|
let res = await blLifeRecharge.services.refundUserLifePayOrder(params);
|
emit('submitApplyRefund');
|
queryClient.invalidateQueries({
|
queryKey: ['blLifeRecharge/getUserLifePayOrderPage'],
|
});
|
} catch (error) {}
|
}
|
</script>
|