main
parent
e247534320
commit
d0ff48e23f
@ -0,0 +1,111 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="title"
|
||||
v-model="visible"
|
||||
width="25%"
|
||||
class="x-dialog"
|
||||
:destroy-on-close="true"
|
||||
>
|
||||
<el-form
|
||||
class="dialog-data"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
ref="formRef"
|
||||
label-width="88px"
|
||||
>
|
||||
<el-form-item label="退单原因:" prop="reason">
|
||||
<el-select v-model="form.reason" placeholder="请选择" clearable>
|
||||
<el-option
|
||||
v-for="dict in dictReason"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="handlerClose()" icon="CloseBold">取消</el-button>
|
||||
<el-button type="primary" icon="Select" @click="confirm()"
|
||||
>确定</el-button
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
const { proxy } = getCurrentInstance();
|
||||
import { retreatyj } from "@/api/emergency-rescue";
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: String,
|
||||
default: "工单退单",
|
||||
},
|
||||
dictReason: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
},
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
const emit = defineEmits(["update:modelValue", "confirm"]);
|
||||
const data = reactive({
|
||||
form: {
|
||||
reason: undefined,
|
||||
},
|
||||
|
||||
rules: {
|
||||
reason: [{ required: true, message: "请选择退单原因", trigger: "blur" }],
|
||||
},
|
||||
});
|
||||
const { form, rules } = toRefs(data);
|
||||
|
||||
const visible = ref(props.modelValue);
|
||||
|
||||
const handlerClose = () => {
|
||||
visible.value = false;
|
||||
};
|
||||
|
||||
const confirm = () => {
|
||||
proxy.$refs["formRef"].validate(async (valid) => {
|
||||
if (valid) {
|
||||
await retreatyj({
|
||||
id: props.id,
|
||||
reason:form.value.reason,
|
||||
});
|
||||
proxy.$modal.msgSuccess("退单成功");
|
||||
emit("confirm");
|
||||
handlerClose();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 监听外部 modelValue 变化
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(val) => {
|
||||
visible.value = val;
|
||||
}
|
||||
);
|
||||
watch(visible, (val) => {
|
||||
emit("update:modelValue", val);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.dialog-data {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
& > div {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1 +1,2 @@
|
||||
export { default as operation } from './operation.vue'
|
||||
export { default as operation } from './components/operation.vue'
|
||||
export { default as chargeBack } from './components/chargeBack.vue'
|
Loading…
Reference in new issue