112 lines
3.6 KiB
Vue
112 lines
3.6 KiB
Vue
<template>
|
||
<a-modal v-model:visible="okVisible" :modal-style="{width:'420px'}" body-class="okmodal" @ok="handleConfirm"
|
||
@cancel="handleClose" >
|
||
<template #title>
|
||
提示
|
||
</template>
|
||
<a-form :model="form" :rules="rules" ref="modalFormRef" size="medium" label-align="right" auto-label-width>
|
||
<a-form-item field="cancel_remarks" label="理由:" >
|
||
<a-textarea v-model.trim="form.cancel_remarks" allow-clear placeholder="请输入取消订单理由"></a-textarea>
|
||
</a-form-item>
|
||
<a-form-item field="refund_amount" label="退款金额(元):" >
|
||
<a-input-number v-model="form.refund_amount" placeholder="请输入退款金额" size="large" class="input-demo" :min="0" :max="payment_amount_total"/>
|
||
</a-form-item>
|
||
<a-form-item field="" label="温馨提示:" v-if="type=='service'">
|
||
温馨提示:退款金额不可大于实际付款金额,请谨慎填写;<br>
|
||
退款理由请认真填写,会显示给患者(本单实付金额:{{payment_amount_total}}元)。
|
||
</a-form-item>
|
||
<a-form-item field="" label="注:" v-if="type=='service'">
|
||
当前订单已超过3个月,无法在线上进行自动退款,请线下联系患者进行退款。沟通后,也要填写退款金额和理由。<br>
|
||
|
||
</a-form-item>
|
||
</a-form>
|
||
<template #footer>
|
||
<a-button @click="handleClose"><template #icon><icon-close /></template>取消</a-button>
|
||
<a-button type="primary" @click="handleConfirm"><template #icon><icon-check /></template>确认</a-button>
|
||
</template>
|
||
|
||
</a-modal>
|
||
</template>
|
||
<script setup>
|
||
import { reactive, toRefs, getCurrentInstance,watch } from 'vue';
|
||
import { Message } from '@arco-design/web-vue';
|
||
const { proxy } = getCurrentInstance();
|
||
const form = reactive({
|
||
cancel_remarks: '',
|
||
refund_amount:null
|
||
});
|
||
const props = defineProps({
|
||
// 是否显示
|
||
okVisible: {
|
||
type: Boolean,
|
||
default: false,
|
||
},
|
||
type:{
|
||
type: String,
|
||
default:'',
|
||
},
|
||
|
||
id:{
|
||
type: String,
|
||
default:'',
|
||
},
|
||
payment_amount_total:{
|
||
type:Number
|
||
},
|
||
dealType:{
|
||
type: String,
|
||
default:'',
|
||
},
|
||
title:{
|
||
type: String,
|
||
default:'',
|
||
},
|
||
api: {
|
||
type: Function,
|
||
},
|
||
});
|
||
const emits = defineEmits(['closeChange']);
|
||
const {okVisible,title,id,api,payment_amount_total,type} = toRefs(props);
|
||
|
||
// Akiraka 20230210 关闭弹窗
|
||
const handleClose = () => {
|
||
emits('closeChange',false);
|
||
// alert(flag)
|
||
}
|
||
watch(()=>props.payment_amount_total,(newVal,oldVal)=>{
|
||
if(!props.type){
|
||
form.refund_amount=Number(newVal);
|
||
}
|
||
//
|
||
},{immediate:true})
|
||
// Akiraka 20230210 删除数据校验
|
||
const rules = reactive({
|
||
cancel_remarks: [{ required: true, message: '请输入取消订单理由' }],
|
||
refund_amount:[{ required: true, message: '请输入退款金额' }]
|
||
});
|
||
// Akiraka 20230210 确认按钮 => 开始数据检查
|
||
const handleConfirm = () => {
|
||
proxy.$refs.modalFormRef.validate(async(valid) => {
|
||
if (!valid) {
|
||
const {code}= await api.value(id.value,form);
|
||
if(code==200){
|
||
Message.success("取消成功");
|
||
proxy.$refs.modalFormRef.resetFields();
|
||
}else{
|
||
proxy.$notification.error(response.message);
|
||
}
|
||
emits('closeChange',true);
|
||
// api.value(id.value,form).then(response => {
|
||
// // Akiraka 20230210 关闭弹窗
|
||
// if(response.code==200){
|
||
// Message.success("取消成功");
|
||
// proxy.$refs.modalFormRef.resetFields();
|
||
// }else{
|
||
// proxy.$notification.error(response.message);
|
||
// }
|
||
// emits('closeChange',true);
|
||
// })
|
||
}
|
||
})
|
||
}
|
||
</script> |