Commit 7fc5068f by Jaxon

feat(商品导入): 添加导入进度弹窗组件

- 移除调试用的延时 Promise,改为返回空对象
- 引入 VenusDialog 组件展示导入进度弹窗
- 新增 ImportProgress 组件,支持开始、成功、失败三种状态
- 弹窗根据导入状态动态调整高度和按钮配置
1 parent 97062676
<template>
<div class="import-progress-wrapper">
<transition name="fade" mode="out-in">
<div v-if="status === 'starting'"
key="starting"
class="starting-wrapper">
<el-progress stroke-linecap="square"
type="circle"
width="80"
color="#2A58AD"
:percentage="percentage">
</el-progress>
<div class="progress-tips">
正在处理中
</div>
<div class="tips" style="width:317px">
说明:系统正在加急导入中,请耐心等待;导入过程中,请不要退出当前操作,否则将导致本次提交无效。
</div>
</div>
<div v-if="status === 'failed'"
key="failed"
class="failed-wrapper">
<div class="el-icon el-icon-warning"></div>
<span class="failed-tips">处理失败。可点击</span>
<el-button class="download-btn"
type="text"
size="small">
下载失败模板
</el-button>
<span>查看失败原因。</span>
</div>
<div v-if="status === 'success'"
key="success"
class="success-wrapper">
<div class="el-icon el-icon-success"></div>
<span class="tips">处理成功,可返回列表查看。</span>
</div>
</transition>
</div>
</template>
<script>
export default {
name: "",
props: {
percentage: {
type: Number,
default: 25,
},
status: {
type: String,
default: "unknown",
},
},
data() {
return {
};
},
computed: {
},
mounted() {
},
methods: {
},
};
</script>
<style scoped lang="scss">
.import-progress-wrapper {
.starting-wrapper {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.tips {
font-weight: 400;
font-size: 12px;
text-align: center;
color: #999;
}
.progress-tips {
font-weight: 400;
font-size: 14px;
text-align: center;
color: #333;
margin: 8px 0;
}
::v-deep .el-progress {
.el-progress__text {
font-weight: 400;
font-size: 14px !important;
color: #333;
top: 54%;
}
}
}
.el-icon {
font-size: 20px;
}
.failed-wrapper {
font-weight: 400;
font-size: 14px;
color: #333;
display: flex;
align-items: center;
.el-icon-warning {
color: #f59619;
font-size: 20px;
}
.failed-tips {
margin-left: 10px;
}
.download-btn {
margin: 0 4px;
font-weight: 400;
font-size: 14px;
padding: 0;
}
}
.success-wrapper {
font-weight: 400;
font-size: 14px;
color: #333;
display: flex;
align-items: center;
.el-icon-success {
color: #2cca74;
}
.tips {
margin-left: 10px;
}
}
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.2s ease;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
</style>
<template> <template>
<div v-loading="_getLoading()" class="shelf-product-import-wrapper"> <div v-loading="_getLoading()" class="shelf-product-import-wrapper">
<Modify ref="modifyRef" :form-data="formData" /> <Modify ref="modifyRef" :form-data="formData" />
<VenusDialog v-model="dialog.importProgress.show"
title="提示"
width="480"
draggable
:show-cancel="false"
:show-close="false"
:close-on-click-modal="false"
:confirm-loading="false"
v-bind="dialog.importProgress[dialog.importProgress.status]">
<ImportProgress :status="dialog.importProgress.status" />
<!-- <el-button @click="dialog.importProgress.status = 'starting'">
starting
</el-button>
<el-button @click="dialog.importProgress.status = 'failed'">
failed
</el-button>
<el-button @click="dialog.importProgress.status = 'success'">
success
</el-button> -->
</VenusDialog>
</div> </div>
</template> </template>
<script> <script>
import VenusDialog from "@/components/venusDialog/index.vue";
import { getShelfProductBaseInfoApi } from "@/views/goods/shelfProduct/api/index.js"; import { getShelfProductBaseInfoApi } from "@/views/goods/shelfProduct/api/index.js";
import { VIEW_MODE } from "@/views/goods/shelfProduct/constant/index.js"; import { VIEW_MODE } from "@/views/goods/shelfProduct/constant/index.js";
import FormProvideItemMixin from "../formProvider/formItemMixin.js"; import FormProvideItemMixin from "../formProvider/formItemMixin.js";
import ImportProgress from "./components/importProgress/index.vue";
import Modify from "./components/modify/index.vue"; import Modify from "./components/modify/index.vue";
export default { export default {
name: "ShelfProductImport", name: "ShelfProductImport",
components: { components: {
Modify, Modify,
VenusDialog,
ImportProgress,
}, },
mixins: [FormProvideItemMixin], mixins: [FormProvideItemMixin],
props: { props: {
...@@ -33,6 +57,25 @@ export default { ...@@ -33,6 +57,25 @@ export default {
merchantNames: undefined, merchantNames: undefined,
shelfType: 1, shelfType: 1,
}, },
dialog: {
importProgress: {
show: true,
status: "starting",
starting: {
height: "192px",
showFooter: false,
},
failed: {
height: "56px",
showFooter: true,
},
success: {
height: "56px",
showFooter: true,
confirmText: "继续下一步",
},
},
},
}; };
}, },
computed: { computed: {
......
...@@ -152,12 +152,7 @@ export default { ...@@ -152,12 +152,7 @@ export default {
// 第一步的提交 -> 第一步比较特殊, 内部没有自己的保存与取消.要放在next中做 // 第一步的提交 -> 第一步比较特殊, 内部没有自己的保存与取消.要放在next中做
handleSubmitProductImport(stepFormData, formData) { handleSubmitProductImport(stepFormData, formData) {
console.log("this.stepSubmitting", this.stepSubmitting); return {};
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(stepFormData);
}, 5000 * 10);
});
}, },
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!