超市商品管理的修改
This commit is contained in:
1 parent
3a38bd19ee
commit
4e02c9bbea
6 files changed
+197
-159
No files matched your search
+56
-55
@@ -1,28 +1,28 @@
|
||||
import { RouteRecordRaw } from 'vue-router';
|
||||
import pinia from '/@/stores/index';
|
||||
import { useUserInfo } from '/@/stores/userInfo';
|
||||
import { useRequestOldRoutes } from '/@/stores/requestOldRoutes';
|
||||
import { Session } from '/@/utils/storage';
|
||||
import { NextLoading } from '/@/utils/loading';
|
||||
import { baseRoutes, notFoundAndNoPower, dynamicRoutes } from '/@/router/route';
|
||||
import { formatTwoStageRoutes, formatFlatteningRoutes, router } from '/@/router/index';
|
||||
import { useRoutesList } from '/@/stores/routesList';
|
||||
import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
|
||||
import { useMenuApi } from '/@/api/admin/menu';
|
||||
import { RouteRecordRaw } from "vue-router"
|
||||
import pinia from "/@/stores/index"
|
||||
import { useUserInfo } from "/@/stores/userInfo"
|
||||
import { useRequestOldRoutes } from "/@/stores/requestOldRoutes"
|
||||
import { Session } from "/@/utils/storage"
|
||||
import { NextLoading } from "/@/utils/loading"
|
||||
import { baseRoutes, notFoundAndNoPower, dynamicRoutes } from "/@/router/route"
|
||||
import { formatTwoStageRoutes, formatFlatteningRoutes, router } from "/@/router/index"
|
||||
import { useRoutesList } from "/@/stores/routesList"
|
||||
import { useTagsViewRoutes } from "/@/stores/tagsViewRoutes"
|
||||
import { useMenuApi } from "/@/api/admin/menu"
|
||||
|
||||
// 后端控制路由
|
||||
|
||||
// 引入 api 请求接口
|
||||
const menuApi = useMenuApi();
|
||||
const menuApi = useMenuApi()
|
||||
|
||||
/**
|
||||
* 获取目录下的 .vue、.tsx 全部文件
|
||||
* @method import.meta.glob
|
||||
* @link 参考:https://cn.vitejs.dev/guide/features.html#json
|
||||
*/
|
||||
const layouModules: any = import.meta.glob('../layout/routerView/*.{vue,tsx}');
|
||||
const viewsModules: any = import.meta.glob('../views/**/*.{vue,tsx}');
|
||||
const dynamicViewsModules: Record<string, Function> = Object.assign({}, { ...layouModules }, { ...viewsModules });
|
||||
const layouModules: any = import.meta.glob("../layout/routerView/*.{vue,tsx}")
|
||||
const viewsModules: any = import.meta.glob("../views/**/*.{vue,tsx}")
|
||||
const dynamicViewsModules: Record<string, Function> = Object.assign({}, { ...layouModules }, { ...viewsModules })
|
||||
|
||||
/**
|
||||
* 后端控制路由:初始化方法,防止刷新时路由丢失
|
||||
@@ -34,24 +34,24 @@ const dynamicViewsModules: Record<string, Function> = Object.assign({}, { ...lay
|
||||
*/
|
||||
export async function initBackEndControlRoutes() {
|
||||
// 界面 loading 动画开始执行
|
||||
if (window.nextLoading === undefined) NextLoading.start();
|
||||
if (window.nextLoading === undefined) NextLoading.start()
|
||||
// 无 token 停止执行下一步
|
||||
if (!Session.getToken()) return false;
|
||||
if (!Session.getToken()) return false
|
||||
// 触发初始化用户信息 pinia
|
||||
await useUserInfo().setUserInfos();
|
||||
await useUserInfo().setUserInfos()
|
||||
// 获取路由菜单数据
|
||||
const res = await getBackEndControlRoutes();
|
||||
const res = await getBackEndControlRoutes()
|
||||
// 无登录权限时,添加判断
|
||||
// https://gitee.com/lyt-top/vue-next-admin/issues/I64HVO
|
||||
if ((res.data || []).length <= 0) return Promise.resolve(true);
|
||||
if ((res.data || []).length <= 0) return Promise.resolve(true)
|
||||
// 存储接口原始路由(未处理component),根据需求选择使用
|
||||
useRequestOldRoutes().setRequestOldRoutes(JSON.parse(JSON.stringify(res.data)));
|
||||
useRequestOldRoutes().setRequestOldRoutes(JSON.parse(JSON.stringify(res.data)))
|
||||
// 处理路由(component),替换 baseRoutes(/@/router/route)第一个顶级 children 的路由
|
||||
baseRoutes[0].children = [...dynamicRoutes, ...(await backEndComponent(res.data))];
|
||||
baseRoutes[0].children = [...dynamicRoutes, ...(await backEndComponent(res.data))]
|
||||
// 添加动态路由
|
||||
await setAddRoute();
|
||||
await setAddRoute()
|
||||
// 设置路由到 pinia routesList 中(已处理成多级嵌套路由)及缓存多级嵌套数组处理后的一维数组
|
||||
await setFilterMenuAndCacheTagsViewRoutes();
|
||||
await setFilterMenuAndCacheTagsViewRoutes()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,9 +60,9 @@ export async function initBackEndControlRoutes() {
|
||||
* @description 用于 tagsView、菜单搜索中:未过滤隐藏的(isHide)
|
||||
*/
|
||||
export async function setFilterMenuAndCacheTagsViewRoutes() {
|
||||
const storesRoutesList = useRoutesList(pinia);
|
||||
storesRoutesList.setRoutesList(baseRoutes[0].children as any);
|
||||
setCacheTagsViewRoutes();
|
||||
const storesRoutesList = useRoutesList(pinia)
|
||||
storesRoutesList.setRoutesList(baseRoutes[0].children as any)
|
||||
setCacheTagsViewRoutes()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,8 +70,8 @@ export async function setFilterMenuAndCacheTagsViewRoutes() {
|
||||
* @description 用于 tagsView、菜单搜索中:未过滤隐藏的(isHide)
|
||||
*/
|
||||
export function setCacheTagsViewRoutes() {
|
||||
const storesTagsView = useTagsViewRoutes(pinia);
|
||||
storesTagsView.setTagsViewRoutes(formatTwoStageRoutes(formatFlatteningRoutes(baseRoutes))[0].children);
|
||||
const storesTagsView = useTagsViewRoutes(pinia)
|
||||
storesTagsView.setTagsViewRoutes(formatTwoStageRoutes(formatFlatteningRoutes(baseRoutes))[0].children)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,11 +80,11 @@ export function setCacheTagsViewRoutes() {
|
||||
* @returns 返回替换后的路由数组
|
||||
*/
|
||||
export function setFilterRouteEnd() {
|
||||
let filterRouteEnd: any = formatTwoStageRoutes(formatFlatteningRoutes(baseRoutes));
|
||||
let filterRouteEnd: any = formatTwoStageRoutes(formatFlatteningRoutes(baseRoutes))
|
||||
// notFoundAndNoPower 防止 404、401 不在 layout 布局中,不设置的话,404、401 界面将全屏显示
|
||||
// 关联问题 No match found for location with path 'xxx'
|
||||
filterRouteEnd[0].children = [...filterRouteEnd[0].children, ...notFoundAndNoPower];
|
||||
return filterRouteEnd;
|
||||
filterRouteEnd[0].children = [...filterRouteEnd[0].children, ...notFoundAndNoPower]
|
||||
return filterRouteEnd
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,8 +95,8 @@ export function setFilterRouteEnd() {
|
||||
*/
|
||||
export async function setAddRoute() {
|
||||
await setFilterRouteEnd().forEach((route: RouteRecordRaw) => {
|
||||
router.addRoute(route);
|
||||
});
|
||||
router.addRoute(route)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,7 +105,7 @@ export async function setAddRoute() {
|
||||
* @returns 返回后端路由菜单数据
|
||||
*/
|
||||
export function getBackEndControlRoutes() {
|
||||
return menuApi.getAdminMenu();
|
||||
return menuApi.getAdminMenu()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,7 +114,7 @@ export function getBackEndControlRoutes() {
|
||||
* @description 路径:/src/views/admin/menu/component/addMenu.vue
|
||||
*/
|
||||
export async function setBackEndControlRefreshRoutes() {
|
||||
await getBackEndControlRoutes();
|
||||
await getBackEndControlRoutes()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,26 +123,27 @@ export async function setBackEndControlRefreshRoutes() {
|
||||
* @returns 返回处理成函数后的 component
|
||||
*/
|
||||
export function backEndComponent(routes: any) {
|
||||
if (!routes) return;
|
||||
if (!routes) return
|
||||
return routes.map((item: any) => {
|
||||
if (item.path && item.path.startsWith('http')) {
|
||||
if (item.path && item.path.startsWith("http")) {
|
||||
if (item.meta.isIframe) {
|
||||
item.component = () => import('/@/layout/routerView/iframes.vue');
|
||||
item.component = () => import("/@/layout/routerView/iframes.vue")
|
||||
} else {
|
||||
item.component = () => import('/@/layout/routerView/link.vue');
|
||||
item.component = () => import("/@/layout/routerView/link.vue")
|
||||
}
|
||||
item.path = '/iframes/' + window.btoa(item.path);
|
||||
} else if (item.componentPath) { // 支持动态路径 /a/1 ==> /a ; /b/1 ==> /b
|
||||
item.component = dynamicImport(dynamicViewsModules, item.componentPath);
|
||||
item.path = "/iframes/" + window.btoa(item.path)
|
||||
} else if (item.componentPath) {
|
||||
// 支持动态路径 /a/1 ==> /a ; /b/1 ==> /b
|
||||
item.component = dynamicImport(dynamicViewsModules, item.componentPath)
|
||||
} else {
|
||||
item.component = dynamicImport(dynamicViewsModules, item.path);
|
||||
item.component = dynamicImport(dynamicViewsModules, item.path)
|
||||
}
|
||||
item.children && backEndComponent(item.children);
|
||||
item.children && backEndComponent(item.children)
|
||||
if (item.children) {
|
||||
item.redirect = item.children[0].path;
|
||||
item.redirect = item.children[0].path
|
||||
}
|
||||
return item;
|
||||
});
|
||||
return item
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,17 +153,17 @@ export function backEndComponent(routes: any) {
|
||||
* @returns 返回处理成函数后的 component
|
||||
*/
|
||||
export function dynamicImport(dynamicViewsModules: Record<string, Function>, component: string) {
|
||||
const keys = Object.keys(dynamicViewsModules);
|
||||
const keys = Object.keys(dynamicViewsModules)
|
||||
|
||||
const matchKeys = keys.filter((key) => {
|
||||
const k = key.replace(/..\/views|../, '');
|
||||
return k.startsWith(`${component}.vue`);
|
||||
});
|
||||
const k = key.replace(/..\/views|../, "")
|
||||
return k.startsWith(`${component}.vue`)
|
||||
})
|
||||
if (matchKeys?.length === 1) {
|
||||
const matchKey = matchKeys[0];
|
||||
return dynamicViewsModules[matchKey];
|
||||
const matchKey = matchKeys[0]
|
||||
return dynamicViewsModules[matchKey]
|
||||
}
|
||||
if (matchKeys?.length > 1) {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -58,7 +58,7 @@
|
||||
<script setup lang="ts">
|
||||
import { nanoid } from "nanoid"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { type rowVU } from "./packageUnit.vue"
|
||||
import { type rowVU } from "./package-unit.vue"
|
||||
|
||||
export interface rowVC {
|
||||
id: string
|
||||
+53
-58
@@ -1,20 +1,10 @@
|
||||
<template>
|
||||
<el-row>
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="商户" prop="merchantId">-->
|
||||
<!-- <select-mch v-model="form.merchantId" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="货号" prop="productCode">
|
||||
<el-input v-model.trim="form.productCode" placeholder="请输入货号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="自编码/条码" prop="barcode">-->
|
||||
<!-- <el-input v-model.trim="form.barcode" placeholder="请输入自编码/条码" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="商品名称" prop="productName">
|
||||
<el-input v-model.trim="form.productName" placeholder="请输入商品名称" />
|
||||
@@ -51,44 +41,6 @@
|
||||
<upload-img v-model:imageUrl="form.picUrl"></upload-img>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="单位" prop="unit">-->
|
||||
<!-- <!– <el-alert type="warning" show-icon>–>-->
|
||||
<!-- <!– <p>最小售卖的基本单位</p>–>-->
|
||||
<!-- <!– </el-alert>–>-->
|
||||
<!-- <el-input placeholder="请输入单位" v-model.trim="form.unit" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="14" class="mb20">-->
|
||||
<!-- <el-form-item label="内装数" prop="packageNum">-->
|
||||
<!-- <!– <el-alert type="warning" show-icon >–>-->
|
||||
<!-- <!– <p>注:内装数据必须为该商品的基本单位的内装数,否则无法完成库存数量转换。–>-->
|
||||
<!-- <!– 例如:零售一瓶矿泉水内装数为1,按一箱售卖矿泉水内装填'24'</p>–>-->
|
||||
<!-- <!– </el-alert>–>-->
|
||||
<!-- <el-input-number v-model="form.packageNum" :min="0" :precision="0" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="零售价" prop="retailPrice">-->
|
||||
<!-- <el-input-number v-model="form.retailPrice" :min="0" :precision="2" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="进价" prop="purchasePrice">-->
|
||||
<!-- <el-input-number v-model="form.purchasePrice" :min="0" :precision="2" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="促销价" prop="promotionPrice">-->
|
||||
<!-- <el-input-number v-model="form.promotionPrice" :min="0" :precision="2" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="成本价" prop="costPrice">-->
|
||||
<!-- <el-input-number v-model="form.costPrice" :min="0" :precision="2" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="商品状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
@@ -96,16 +48,6 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="12" class="mb20">-->
|
||||
<!-- <el-form-item label="规格" prop="spec">-->
|
||||
<!-- <el-input placeholder="请输入规格" v-model.trim="form.spec" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="产地" prop="origin">
|
||||
<el-input v-model.trim="form.origin" placeholder="请输入产地" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="排序字段" prop="sort">
|
||||
<el-input-number :min="0" :max="1000" :precision="0" v-model="form.sort" />
|
||||
@@ -116,6 +58,59 @@
|
||||
<el-input-number v-model="form.grossMargin" :min="0" :precision="2" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" class="mb20">
|
||||
<el-form-item label="产地" prop="origin">
|
||||
<el-input v-model.trim="form.origin" placeholder="请输入产地" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="条码" prop="barCode">
|
||||
<el-input v-model.trim="form.barCode" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="规格" prop="spec">
|
||||
<el-input v-model.trim="form.spec" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="单位" prop="unit">
|
||||
<el-input v-model.trim="form.unit" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="单位状态" prop="unitStatus">
|
||||
<el-radio-group v-model="form.unitStatus">
|
||||
<el-radio label="0" border>正常</el-radio>
|
||||
<el-radio label="1" border>停销</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="内装数" prop="packageNum">
|
||||
<el-input-number v-model="form.packageNum" :min="0" :precision="0" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="进价(元)" prop="purchasePrice">
|
||||
<el-input-number v-model="form.purchasePrice" :min="0" :precision="2" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="零售价(元)" prop="retailPrice">
|
||||
<el-input-number v-model="form.retailPrice" :min="0" :precision="2" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="促销价(元)" prop="promotionPrice">
|
||||
<el-input-number v-model="form.promotionPrice" :min="0" :precision="2" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="成本价(元)" prop="costPrice">
|
||||
<el-input-number v-model="form.costPrice" :min="0" :precision="2" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
+26
-17
@@ -62,13 +62,13 @@
|
||||
<vxe-column field="status" title="状态" :edit-render="{}">
|
||||
<template #edit="{ row }">
|
||||
<el-select v-model="row.status">
|
||||
<el-option label="正常" :value="0" />
|
||||
<el-option label="停销" :value="1" />
|
||||
<el-option label="正常" value="0" />
|
||||
<el-option label="停销" value="1" />
|
||||
</el-select>
|
||||
</template>
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.status === 0">正常</span>
|
||||
<span v-else-if="row.status === 1">停销</span>
|
||||
<span v-if="row.status == '0'">正常</span>
|
||||
<span v-else-if="row.status == '1'">停销</span>
|
||||
<span v-else style="color: #c0c4cf">请选择</span>
|
||||
</template>
|
||||
</vxe-column>
|
||||
@@ -113,6 +113,7 @@ export interface rowVU {
|
||||
costPrice: number
|
||||
isNew?: boolean
|
||||
isBase?: boolean | null
|
||||
flag?: string
|
||||
}
|
||||
|
||||
const packageUnitList = defineModel<rowVU[]>("modelValue", {
|
||||
@@ -145,20 +146,27 @@ const validRules = {
|
||||
}
|
||||
|
||||
// 底部表格行新增
|
||||
const pushEvent = () => {
|
||||
const newRow: rowVU = {
|
||||
id: nanoid(5),
|
||||
barCode: "",
|
||||
spec: "",
|
||||
unit: "",
|
||||
status: "",
|
||||
packageNum: 0,
|
||||
purchasePrice: 0,
|
||||
retailPrice: 0,
|
||||
promotionPrice: null,
|
||||
costPrice: 0,
|
||||
isNew: true,
|
||||
const pushEvent = (row?: rowVU | null) => {
|
||||
const newRow = {} as rowVU
|
||||
if (row) {
|
||||
Object.assign(newRow, row)
|
||||
} else {
|
||||
row = {
|
||||
id: nanoid(5),
|
||||
barCode: "",
|
||||
spec: "",
|
||||
unit: "",
|
||||
status: "",
|
||||
packageNum: 0,
|
||||
purchasePrice: 0,
|
||||
retailPrice: 0,
|
||||
promotionPrice: null,
|
||||
costPrice: 0,
|
||||
isNew: true,
|
||||
}
|
||||
Object.assign(newRow, row)
|
||||
}
|
||||
|
||||
packageUnitList.value.push(newRow)
|
||||
nextTick(() => {
|
||||
const $table = editableTableRef.value
|
||||
@@ -216,5 +224,6 @@ defineExpose({
|
||||
editableTableValidate,
|
||||
getRadioEvent,
|
||||
setRadioRow,
|
||||
pushEvent,
|
||||
})
|
||||
</script>
|
||||
File renamed without changes.
@@ -1,44 +1,48 @@
|
||||
<template>
|
||||
<el-dialog width="80%" :title="form.id ? '编辑' : '新增'" v-model="visible" :close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="auto" v-loading="loading">
|
||||
<el-tabs v-model="tabPaneActiveName" @tab-change="handleTabChange">
|
||||
<el-tab-pane class="el-tab-pane" label="基础信息" name="基础信息">
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="150px" v-loading="loading">
|
||||
<el-tabs class="el-tabs" v-model="tabPaneActiveName" @tab-change="handleTabChange" type="border-card">
|
||||
<el-tab-pane class="el-tab-pane" label="基础信息" name="基础信息" :disabled="true">
|
||||
<base-info v-model="form" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="el-tab-pane" label="包装单位" name="包装单位">
|
||||
<el-tab-pane class="el-tab-pane" label="包装单位" name="包装单位" :disabled="true">
|
||||
<package-unit ref="packageUnitRef" v-model="form.smErpUnitEntityList" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="el-tab-pane" label="库存" name="库存">
|
||||
<el-tab-pane class="el-tab-pane" label="库存" name="库存" :disabled="true">
|
||||
<product-inventory
|
||||
v-model:stock="form.stock"
|
||||
v-model:inventoryUpperLimit="form.inventoryUpperLimit"
|
||||
v-model:inventoryLowerLimit="form.inventoryLowerLimit"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane class="el-tab-pane" label="辅助条码" name="辅助条码">
|
||||
<el-tab-pane class="el-tab-pane" label="辅助条码" name="辅助条码" :disabled="true">
|
||||
<auxiliary-code :smErpUnitEntityList="form.smErpUnitEntityList" v-model="form.smErpAuxiliaryCodeEntityList" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<!-- <el-button @click="visible = false">取消</el-button> -->
|
||||
<el-button v-if="currentTabPaneIndex != 0" type="primary" @click="currentTabPaneIndex--" :disabled="loading">上一步</el-button>
|
||||
<el-button v-if="currentTabPaneIndex != 3" type="primary" @click="currentTabPaneIndex++">下一步</el-button>
|
||||
<el-button v-if="currentTabPaneIndex == 0" type="primary" @click="addPackageUnitNextStep">下一步</el-button>
|
||||
<el-button v-if="currentTabPaneIndex == 1 || currentTabPaneIndex == 2" type="primary" @click="currentTabPaneIndex++">
|
||||
下一步
|
||||
</el-button>
|
||||
<el-button v-if="currentTabPaneIndex == 3" type="primary" @click="onSubmit" :disabled="loading">提 交</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import baseInfo from "./components/baseInfo.vue"
|
||||
import packageUnit, { type rowVU } from "./components/packageUnit.vue"
|
||||
import productInventory from "./components/productInventory.vue"
|
||||
import auxiliaryCode, { type rowVC } from "./components/auxiliaryCode.vue"
|
||||
import BaseInfo from "./components/base-info.vue"
|
||||
import PackageUnit, { type rowVU } from "./components/package-unit.vue"
|
||||
import ProductInventory from "./components/product-inventory.vue"
|
||||
import AuxiliaryCode, { type rowVC } from "./components/auxiliary-code.vue"
|
||||
import { getObj, addObj, putObj } from "/@/api/supermarketerp/supermarketSpu"
|
||||
import { TabPaneName } from "element-plus"
|
||||
import { useMessage } from "/@/hooks/message"
|
||||
import { displayPrice, storePrice } from "/@/utils/formatMoney"
|
||||
import { nanoid } from "nanoid"
|
||||
|
||||
const emit = defineEmits(["refresh"])
|
||||
|
||||
@@ -55,39 +59,39 @@ const form = reactive<any>({
|
||||
id: "",
|
||||
merchantId: "",
|
||||
productCode: "",
|
||||
barcode: "",
|
||||
productName: "",
|
||||
unit: "",
|
||||
categoryId: "",
|
||||
brandId: "",
|
||||
picUrl: "",
|
||||
sliderPicUrls: "",
|
||||
sort: 0,
|
||||
status: "0",
|
||||
costPrice: 0,
|
||||
stock: 0,
|
||||
spec: "",
|
||||
origin: "",
|
||||
packageNum: 0,
|
||||
retailPrice: 0,
|
||||
purchasePrice: 0,
|
||||
supplierId: "",
|
||||
promotionPrice: 0,
|
||||
productNature: "",
|
||||
inventoryUpperLimit: 0,
|
||||
inventoryLowerLimit: 0,
|
||||
grossMargin: 0,
|
||||
smErpUnitEntityList: [],
|
||||
smErpAuxiliaryCodeEntityList: [],
|
||||
|
||||
barCode: "",
|
||||
spec: "",
|
||||
unit: "",
|
||||
unitStatus: "0",
|
||||
packageNum: 0,
|
||||
purchasePrice: 0,
|
||||
retailPrice: 0,
|
||||
promotionPrice: 0,
|
||||
costPrice: 0,
|
||||
})
|
||||
// 定义校验规则
|
||||
const dataRules = {
|
||||
productNature: [{ required: true, message: "请选择商品性质", trigger: "blur" }],
|
||||
merchantId: [{ required: true, message: "商户不能为空", trigger: "blur" }],
|
||||
productCode: [{ required: true, message: "货号不能为空", trigger: "blur" }],
|
||||
barcode: [{ required: true, message: "自编码/条码不能为空", trigger: "blur" }],
|
||||
productName: [{ required: true, message: "商品名称不能为空", trigger: "blur" }],
|
||||
unit: [{ required: true, message: "单位不能为空", trigger: "blur" }],
|
||||
categoryId: [{ required: true, message: "商品分类不能为空", trigger: "blur" }],
|
||||
// brandId: [{ required: true, message: "品牌不能为空", trigger: "blur" }],
|
||||
// picUrl: [{ required: true, message: "商品封面图不能为空", trigger: "blur" }],
|
||||
@@ -95,15 +99,18 @@ const dataRules = {
|
||||
supplierId: [{ required: true, message: "请选择货商", trigger: "blur" }],
|
||||
smErpUnitEntityList: [{ required: true, message: "请添加包装单位", trigger: "change" }],
|
||||
smErpAuxiliaryCodeEntityList: [{ required: true, message: "请添加辅助条码", trigger: "change" }],
|
||||
retailPrice: [{ required: true, message: "零售价不能为空", trigger: "blur" }],
|
||||
purchasePrice: [{ required: true, message: "进价不能为空", trigger: "blur" }],
|
||||
promotionPrice: [{ required: true, message: "促销价不能为空", trigger: "blur" }],
|
||||
costPrice: [{ required: true, message: "成本价不能为空", trigger: "blur" }],
|
||||
packageNum: [{ required: true, message: "内装数不能为空", trigger: "blur" }],
|
||||
|
||||
stock: [{ required: true, message: "总库存不能为空", trigger: "blur" }],
|
||||
inventoryUpperLimit: [{ required: true, message: "库存上限不能为空", trigger: "blur" }],
|
||||
inventoryLowerLimit: [{ required: true, message: "库存下限不能为空", trigger: "blur" }],
|
||||
|
||||
// barCode: [{ required: true, message: "条码不能为空", trigger: "blur" }],
|
||||
// unit: [{ required: true, message: "单位不能为空", trigger: "blur" }],
|
||||
// unitStatus: [{ required: true, message: "单位状态不能为空", trigger: "blur" }],
|
||||
// packageNum: [{ required: true, message: "内装数不能为空", trigger: "blur" }],
|
||||
// purchasePrice: [{ required: true, message: "进价不能为空", trigger: "blur" }],
|
||||
// retailPrice: [{ required: true, message: "零售价不能为空", trigger: "blur" }],
|
||||
// promotionPrice: [{ required: true, message: "促销价不能为空", trigger: "blur" }],
|
||||
// costPrice: [{ required: true, message: "成本价不能为空", trigger: "blur" }],
|
||||
}
|
||||
|
||||
// 打开弹窗
|
||||
@@ -158,6 +165,28 @@ const resetForm = () => {
|
||||
form.smErpAuxiliaryCodeEntityList = []
|
||||
}
|
||||
|
||||
// 第一步的下一步
|
||||
const addPackageUnitNextStep = () => {
|
||||
currentTabPaneIndex.value++
|
||||
const row = {
|
||||
id: nanoid(5),
|
||||
barCode: form.barCode,
|
||||
spec: form.spec,
|
||||
unit: form.unit,
|
||||
status: form.unitStatus,
|
||||
packageNum: form.packageNum,
|
||||
purchasePrice: form.purchasePrice,
|
||||
retailPrice: form.retailPrice,
|
||||
promotionPrice: form.promotionPrice,
|
||||
costPrice: form.costPrice,
|
||||
isNew: true,
|
||||
flag: "addPackageUnitNextStep",
|
||||
}
|
||||
const isFlagRowExist = form.smErpUnitEntityList.some((item: rowVU) => item.flag === "addPackageUnitNextStep")
|
||||
if (isFlagRowExist) return
|
||||
packageUnitRef.value.pushEvent(row)
|
||||
}
|
||||
|
||||
// tab栏切换
|
||||
const handleTabChange = (name: TabPaneName) => (currentTabPaneIndex.value = tabPaneEnum.findIndex((item) => item === name))
|
||||
|
||||
@@ -253,4 +282,8 @@ defineExpose({
|
||||
overflow-y: auto;
|
||||
height: 60vh;
|
||||
}
|
||||
::v-deep .el-tabs .el-tabs__nav .is-active {
|
||||
color: #2e5cf6 !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user