parent
5067f42478
commit
734afe1ed9
@ -0,0 +1,90 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog v-model="state.visible" title="取消订单">
|
||||||
|
<el-form
|
||||||
|
ref="refsForm"
|
||||||
|
v-loading="state.submitting"
|
||||||
|
label-width="100px"
|
||||||
|
:model="state.form"
|
||||||
|
:rules="state.rules"
|
||||||
|
>
|
||||||
|
<el-form-item label="订单金额">
|
||||||
|
{{ state.form.totalAmount }}
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="运费">
|
||||||
|
{{ state.form.shippingAmount }}
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="退款金额">
|
||||||
|
{{ state.form.payAmount }}
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="取消原因" prop="cancelReason">
|
||||||
|
<el-input v-model="state.form.cancelReason" type="textarea" />
|
||||||
|
<p class="tips">会显示在客户的订单中</p>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="操作备注" prop="remark">
|
||||||
|
<el-input v-model="state.form.remark" type="textarea" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="close">取消</el-button>
|
||||||
|
<el-button :loading="state.submitting" type="primary" @click="handleSave">确定</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="jsx">
|
||||||
|
const store = useStore();
|
||||||
|
|
||||||
|
const refsForm = ref(null);
|
||||||
|
const state = reactive({
|
||||||
|
submitting: false,
|
||||||
|
visible: false,
|
||||||
|
form: {
|
||||||
|
orderId: null,
|
||||||
|
totalAmount: 0,
|
||||||
|
shippingAmount: 0,
|
||||||
|
payAmount: 0,
|
||||||
|
cancelReason: null,
|
||||||
|
remark: null,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
orderId: [{ required: true, message: '订单ID不能为空' }],
|
||||||
|
cancelReason: [{ required: true, message: '取消原因不能为空' }],
|
||||||
|
remark: [{ required: true, message: '操作备注不能为空' }],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const show = (form) => {
|
||||||
|
state.form.orderId = form.orderId;
|
||||||
|
state.form.totalAmount = form.totalAmount;
|
||||||
|
state.form.shippingAmount = form.shippingAmount;
|
||||||
|
state.form.payAmount = form.payAmount;
|
||||||
|
state.form.cancelReason = null;
|
||||||
|
state.form.remark = null;
|
||||||
|
state.visible = true;
|
||||||
|
};
|
||||||
|
const close = () => {
|
||||||
|
state.visible = false;
|
||||||
|
};
|
||||||
|
defineExpose({
|
||||||
|
show,
|
||||||
|
close,
|
||||||
|
});
|
||||||
|
const handleSave = async () => {
|
||||||
|
state.submitting = true;
|
||||||
|
try {
|
||||||
|
await unref(refsForm).validate();
|
||||||
|
let res = await store.dispatch('order/cancel', state.form);
|
||||||
|
if (res) {
|
||||||
|
state.visible = false;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.info('取消关闭', e);
|
||||||
|
}
|
||||||
|
state.submitting = false;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.tips {
|
||||||
|
color: @color-white2;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in new issue