|
|
@@ -1,27 +1,9 @@
|
|
|
<template>
|
|
|
- <ele-modal
|
|
|
- v-model="visible"
|
|
|
- title="作废"
|
|
|
- width="500px"
|
|
|
- :destroy-on-close="true"
|
|
|
- @closed="handleClosed"
|
|
|
- >
|
|
|
+ <ele-modal v-model="visible" title="作废" width="500px" :destroy-on-close="true" @closed="handleClosed">
|
|
|
<div class="invalid-form">
|
|
|
<div class="form-item">
|
|
|
<label class="form-label">请选择作废原因</label>
|
|
|
- <el-select
|
|
|
- v-model="selectedReason"
|
|
|
- placeholder="请选择"
|
|
|
- style="width: 100%"
|
|
|
- clearable
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in reasonOptions"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- />
|
|
|
- </el-select>
|
|
|
+ <dict-data v-model="selectedReason" code="invalid_reason" placeholder="请选择" />
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -33,8 +15,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, reactive } from 'vue';
|
|
|
+import { ref } from 'vue';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
+import DictData from '@/components/DictData/index.vue';
|
|
|
+import request from '@/utils/request';
|
|
|
|
|
|
defineOptions({ name: 'InvalidModal' });
|
|
|
|
|
|
@@ -48,15 +32,6 @@ const currentRecord = ref(null);
|
|
|
// 选中的作废原因
|
|
|
const selectedReason = ref('');
|
|
|
|
|
|
-// 作废原因选项
|
|
|
-const reasonOptions = ref([
|
|
|
- { label: '系统错误', value: 'system_error' },
|
|
|
- { label: '用户取消', value: 'user_cancel' },
|
|
|
- { label: '库存不足', value: 'stock_shortage' },
|
|
|
- { label: '价格变动', value: 'price_change' },
|
|
|
- { label: '其他原因', value: 'other' }
|
|
|
-]);
|
|
|
-
|
|
|
// 打开弹窗
|
|
|
const handleOpen = (record) => {
|
|
|
currentRecord.value = record;
|
|
|
@@ -84,17 +59,17 @@ const handleConfirm = async () => {
|
|
|
}
|
|
|
|
|
|
loading.value = true;
|
|
|
-
|
|
|
+
|
|
|
try {
|
|
|
// 调用作废API(暂时使用假接口)
|
|
|
await mockInvalidApi({
|
|
|
id: currentRecord.value.id,
|
|
|
reason: selectedReason.value
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
ElMessage.success('作废成功');
|
|
|
visible.value = false;
|
|
|
-
|
|
|
+
|
|
|
// 触发父组件刷新
|
|
|
emit('success');
|
|
|
} catch (error) {
|
|
|
@@ -105,14 +80,12 @@ const handleConfirm = async () => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-// 模拟作废API
|
|
|
-const mockInvalidApi = (params) => {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- setTimeout(() => {
|
|
|
- console.log('作废参数:', params);
|
|
|
- // 模拟成功
|
|
|
- resolve({ code: 200, message: '作废成功' });
|
|
|
- }, 1000);
|
|
|
+// 作废API
|
|
|
+const mockInvalidApi = (data) => {
|
|
|
+ return request({
|
|
|
+ url: '/activation/bookActivationInfo/cancel',
|
|
|
+ method: 'post',
|
|
|
+ data
|
|
|
});
|
|
|
};
|
|
|
|