Commit eb7c4679 by Jaxon

feat(商品上架): 新增商品上架导入和分步表单功能

1 parent 6f874a8a
<template>
<div class="">
</div>
</template>
<script>
export default {
name: "",
props: {
},
data() {
return {
};
},
computed: {
},
mounted() {
},
methods: {
},
};
</script>
<style scoped lang="scss">
</style>
<template>
<div class="shelf-product-import-modify-wrapper">
<glsx-combi-form ref="formRef"
:form-data="form.schema"
:form-obj="form.data"
:form-rules="form.rules"
is-block
default-width="100%"
size="mini"
label-width="150px">
<template #upload>
<el-upload :http-request="handleUpload"
:limit="1"
accept=".xls,.xlsx"
:on-change="handleChange"
:file-list="fileList">
<template #trigger>
<el-button size="small">
+ 添加附件
</el-button>
</template>
<el-button size="small" @click="handleDownloadTemplate">
下载模板
</el-button>
<template #tip>
<div class="el-upload__tip">
注:用于商品上架信息获取,请务必按照模版准确填写并上传。
</div>
</template>
</el-upload>
</template>
</glsx-combi-form>
</div>
</template>
<script>
import { mapActions } from "vuex";
import { shelfProductImportModifyFormSchema } from "../../shelfProductImport.data.js";
export default {
name: "ShelfProductImportModify",
props: {
},
data() {
return {
form: {
schema: shelfProductImportModifyFormSchema,
rules: {},
data: {},
},
};
},
computed: {
},
mounted() {
},
methods: {
...mapActions("d2admin/user", ["actionSetDownloadList"]),
handleUpload() {},
handleDownloadTemplate() {
const params = {
sceneType: this.infoForm.sceneType,
shelfType: this.infoForm.shelfType,
method: "dj.api.create.business.approve.template.export",
};
const list = [
...this.dowloadList,
{
name: "产品上架表模板",
exportParam: JSON.stringify(params),
status: "waiting",
timeid: new Date().getTime(),
},
];
this.actionSetDownloadList({ list, type: "dowloadList" });
},
},
};
</script>
<style scoped lang="scss">
</style>
<template>
<div class="shelf-product-import-wrapper">
<Modify />
</div>
</template>
<script>
import Modify from "./components/modify/index.vue";
export default {
name: "ShelfProductImport",
components: {
Modify,
},
props: {
},
data() {
return {
};
},
computed: {
},
mounted() {
},
methods: {
},
};
</script>
<style scoped lang="scss">
.shelf-product-import-wrapper {
padding: 20px;
}
</style>
import { sceneTypeOptions } from "@/views/goods/shelfProduct/constant/index";
export const shelfProductImportModifyFormSchema = [
{
label: "业务场景",
name: "sceneType",
type: "select",
optionList: sceneTypeOptions,
optionId: "confId",
optionLabel: "confValue",
optionsName: "sceneCodeList",
},
{
label: "上架类型",
name: "sceneType",
type: "select",
optionList: sceneTypeOptions,
optionId: "confId",
optionLabel: "confValue",
optionsName: "sceneCodeList",
},
{
label: "流量方信息",
name: "merchantId",
type: "select",
placeholder: "请选择流量方信息",
optionList: [],
optionSync: {
useSync: true,
syncField: "merchantName",
},
optionsName: "merchantList",
},
{
label: "商品上架表",
name: "uploadId",
addHtml: "upload",
},
];
export const statusOptions = [
{
value: 1,
label: "草稿",
},
{
value: 2,
label: "待审核",
},
{
value: 3,
label: "已审核",
},
{
value: 10,
label: "驳回",
},
];
// 商品上架 业务场景
export const sceneTypeOptions = [
{ confId: 1, confValue: "精品升级" },
{ confId: 0, confValue: "会员权益升级" },
];
<template>
<div class="">
<d2-container v-if="step.confirmStep > -1"
v-loading="loading.page"
class="modify-wrapper">
<div class="step-wrapper">
<el-steps :active="step.confirmStep" finish-status="success">
<el-step title="1、商品上架表导入"></el-step>
<el-step title="2、上架商品及测算"></el-step>
<el-step title="3、分账配置"></el-step>
<el-step title="4、对账配置"></el-step>
<el-step title="5、利润率测算"></el-step>
</el-steps>
</div>
<div class="wrapper">
<template v-if="step.confirmStep === 0">
<ShelfProductImport />
</template>
</div>
<div class="footer-wrapper">
<el-button v-if="step.confirmStep !== 0"
plain
size="small"
:loading="loading.step"
@click="handlePreviousSteps">
上一步
</el-button>
<el-button v-if="step.confirmStep < 4"
:loading="loading.step"
size="small"
type="primary"
@click="handleNextSteps">
下一步
</el-button>
</div>
<el-button v-else
:loading="polling.load"
type="primary"
size="small"
@click="handleSubmit">
提交
</el-button>
<el-button :loading="loading.step"
class="cancel-btn"
size="small"
@click="handleCancel">
取消
</el-button>
</div>
</d2-container>
</template>
<script>
import ShelfProductImport from "../../components/shelfProductImport/index.vue";
export default {
name: "",
name: "ShelfProductModify",
components: {
ShelfProductImport,
},
props: {
},
data() {
return {
step: {
confirmStep: 0,
},
loading: {
page: false,
step: false,
},
polling: {
status: "未启动",
startTime: 0, // 记录开始时间
id: 0,
pollRecordId: undefined,
retryCount: 0,
pollTimer: null,
load: false,
MAX_DURATION: 5 * 60 * 1000, // 5分钟超时
MAX_RETRIES: 8, // 最大重试次数
},
};
},
......@@ -28,5 +99,122 @@ export default {
</script>
<style scoped lang="scss">
.modify-wrapper {
::v-deep .d2-container-full__body {
flex: 1;
overflow: hidden;
display: flex;
flex-direction: column;
border-radius: 0 !important;
.wrapper {
flex: 1;
display: flex;
flex-direction: column;
margin-top: 20px;
overflow-y: auto;
background-color: white;
}
.footer-wrapper {
margin-top: 16px;
text-align: center;
.cancel-btn {
width: 60px;
}
}
}
.step-wrapper {
padding: 20px 105px;
background-color: white;
::v-deep .el-step {
.el-step__head {
.el-step__line {
top: 7px;
left: 36px;
width: calc(100% - 58px);
height: 1px;
border-color: #2a58ad;
background-color: #2a58ad;
color: #2a58ad;
border: 0;
.el-step__line-inner {
display: none;
}
}
.el-step__icon {
position: relative;
width: 16px;
height: 16px;
border-color: #2a58ad;
}
&.is-process {
.el-step__icon {
&::after {
position: absolute;
content: "";
width: 8px;
height: 8px;
background-color: #2a58ad;
border-radius: 100%;
animation: elasticScale 0.6s ease-in forwards;
transform: scale(0);
}
.el-step__icon-inner {
display: none;
}
}
}
&.is-wait {
.el-step__icon {
.el-step__icon-inner {
display: none;
}
}
}
&.is-success {
.el-step__icon {
}
.el-step__icon-inner {
display: none;
}
}
}
.el-step__main {
.el-step__title {
font-size: 16px;
&.is-process {
color: #2a58ad;
}
&.is-wait {
color: #333333;
}
&.is-success {
color: #333333;
}
}
}
}
}
}
@keyframes elasticScale {
0% {
/* 起始:0px */
transform: scale(0);
}
70% {
/* 过度缩放:8px * 1.25 = 10px(超出目标尺寸) */
transform: scale(1.25);
}
90% {
/* 过度缩放:8px * 1.25 = 10px(超出目标尺寸) */
transform: scale(0.75);
}
100% {
/* 回弹:回到8px(原始尺寸) */
transform: scale(1);
}
}
</style>
......@@ -22,7 +22,7 @@
</template>
<div class="d2-container-content">
<d2-table-header>
<!-- 新增商品上架 -->
<!-- 新增商品上架 handleModify -->
<span style=" display: inline-block; margin-right: 10px">
<auth-button category="Button"
:data="{ operate: 'create' }"
......@@ -32,11 +32,11 @@
<d2-table ref="tableRef" v-bind="table">
<template #auth-button="scope">
<div>
<!-- 查看 -->
<!-- 查看 handleDetail -->
<span style="margin-right: 10px">
<auth-button :data="scope.scope" :show-btn-ids="['9031803']" />
</span>
<!-- 编辑 - 编辑合同 -->
<!-- 编辑 handleModify -->
<span style="margin-right: 10px">
<auth-button :data="{
operate: 'edit',
......@@ -44,11 +44,11 @@
}"
:show-btn-ids="['9031806']" />
</span>
<!-- 驳回 -->
<!-- 驳回 handleReject -->
<span style="margin-right: 10px">
<auth-button :data="scope.scope" :show-btn-ids="['9031808']" />
</span>
<!-- 重新发起 -->
<!-- 审核 handleApprove -->
<span style="margin-right: 10px">
<auth-button :show-btn-ids="['9031809']" />
</span>
......@@ -64,7 +64,8 @@ import { getDPlusPage as getPage } from "@api/shelfManage.js";
import { cloneDeep } from "lodash-es";
import { nanoid } from "nanoid";
import { mapActions } from "vuex";
import { shelfProductTableFormSchema } from "./table.data";
import { setAllOptions } from "@/libs/select.js";
import { shelfProductTableColumn, shelfProductTableFormSchema } from "@/views/goods/shelfProduct/view/table/table.data";
export default {
name: "ShelfManage",
......@@ -78,15 +79,14 @@ export default {
return {
// cloneDeep(shelManageTableForm)
table: {
formSchema: shelfProductTableFormSchema,
formSchema: cloneDeep(shelfProductTableFormSchema),
getListApi: getPage,
searchForm: {
},
searchForm: { },
// 表格参数
tableParams: {
btnId: nanoid(),
// shelManageTableColumn
tableColumns: [],
tableColumns: shelfProductTableColumn,
},
},
......@@ -100,20 +100,7 @@ export default {
close: "d2admin/page/close",
}),
async getBaseData() {
this.setOptionsList();
},
setOptionsList() {
this.table.formSchema.forEach((item, index) => {
// 添加全部选项
if (item.type === "select") {
if (item.optionList[0][item.optionLabel] !== "全部") {
item.optionList.unshift({
[item.optionId]: "",
[item.optionLabel]: "全部",
});
}
}
});
setAllOptions(this.table.formSchema);
},
handleReset() {
this.table.searchForm = {
......@@ -137,8 +124,18 @@ export default {
// 查看
handleDetail() {},
// 新增 或 修改
handleModify(data) {
handleModify({ operate, record }) {
if (operate === "create") {
this.$router.push({
name: "goodsShelfCreate",
});
}
if (operate === "edit") {
this.$router.push({
name: "goodsShelfModify",
});
}
},
},
};
......
import { cloneDeep } from "lodash-es";
import { shelfTypeOpt, systemStatusOpt } from "@/common/constants";
import { Util } from "@/common/util";
import { sceneTypeOptions } from "@/views/goods/shelfManage/constant/baseData";
import { statusOptions } from "../../constant/index";
export const shelfProductTableFormSchema = [
{
label: "单据编号",
......@@ -10,64 +16,89 @@ export const shelfProductTableFormSchema = [
label: "流量方信息",
name: "merchantName",
type: "input",
maxlength: "20",
maxlength: "50",
isClear: true,
},
{
label: "审批编号",
name: "workWechatApproveCode",
type: "input",
maxlength: "20",
isClear: true,
},
{
label: "审批类型",
name: "approveType",
label: "业务场景",
name: "sceneType",
type: "select",
isClear: true,
optionList: [],
optionList: cloneDeep(sceneTypeOptions),
optionId: "confId",
optionLabel: "confValue",
optionsName: "approveTypeOpt",
optionsName: "sceneTypeOptions",
},
{
label: "上架类型",
name: "shelfType",
type: "select",
isClear: true,
optionList: [],
optionList: cloneDeep(shelfTypeOpt),
optionId: "confId",
optionLabel: "confValue",
optionsName: "shelfTypeOpt",
},
{
label: "系统状态",
name: "systemStatus",
label: "状态",
name: "status",
type: "select",
isClear: true,
optionList: [],
optionId: "confId",
optionLabel: "confValue",
optionsName: "systemStatusOpt",
optionList: statusOptions,
optionId: "id",
optionLabel: "value",
optionsName: "statusOptions",
},
];
export const shelfProductTableColumn = [
{
label: "审批状态",
name: "approveStatus",
type: "select",
isClear: true,
optionList: [],
optionId: "confId",
optionLabel: "confValue",
optionsName: "approveStatusOpt",
label: "单据编号",
prop: "businessCode",
width: "150px",
},
{
label: "上架类型",
prop: "approveType",
width: "150px",
formatter: (cellValue) => {
return cloneDeep(shelfTypeOpt.find(item => item.confId === cellValue.shelfType)?.confValue);
},
},
{
label: "业务场景",
name: "sceneType",
type: "select",
isClear: true,
optionList: [],
optionId: "confId",
optionLabel: "confValue",
optionsName: "sceneTypeOptions",
prop: "sceneType",
width: "150px",
formatter: (cellValue) => {
return sceneTypeOptions.find(item => item.confId === cellValue.sceneType)?.confValue;
},
},
{
label: "流量方信息",
prop: "merchantName",
addHtml: "merchantName",
minWidth: "188px",
},
{
label: "提交时间",
prop: "createdDate",
width: "160px",
formatter: (cellValue) => {
return cellValue.createdDate ? Util.dateFormate(cellValue.createdDate, "YYYY-MM-DD HH:mm:ss") : "-";
},
},
{
label: "提交人",
width: "120px",
prop: "committer",
},
{
label: "状态",
prop: "systemStatus",
width: "150px",
formatter: (cellValue) => {
return cloneDeep(statusOptions.find(item => item.status === cellValue.status)?.label);
},
},
];
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!