diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index c6c95e80..50283e23 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -331,9 +331,8 @@ const remainingRouter: AppRouteRecordRaw[] = [ ] }, { - path: '/product', + path: '/mall/product', // 商品中心 component: Layout, - name: 'Product', meta: { hidden: true }, @@ -348,11 +347,11 @@ const remainingRouter: AppRouteRecordRaw[] = [ canTo: true, icon: 'ep:edit', title: '添加商品', - activeMenu: '/product/product-spu' + activeMenu: '/mall/product/spu' } }, { - path: 'spu/edit/:spuId(\\d+)', + path: 'spu/edit/:id(\\d+)', component: () => import('@/views/mall/product/spu/form/index.vue'), name: 'ProductSpuEdit', meta: { @@ -361,11 +360,11 @@ const remainingRouter: AppRouteRecordRaw[] = [ canTo: true, icon: 'ep:edit', title: '编辑商品', - activeMenu: '/product/product-spu' + activeMenu: '/mall/product/spu' } }, { - path: 'spu/detail/:spuId(\\d+)', + path: 'spu/detail/:id(\\d+)', component: () => import('@/views/mall/product/spu/form/index.vue'), name: 'ProductSpuDetail', meta: { @@ -374,7 +373,7 @@ const remainingRouter: AppRouteRecordRaw[] = [ canTo: true, icon: 'ep:view', title: '商品详情', - activeMenu: '/product/product-spu' + activeMenu: '/mall/product/spu' } }, { @@ -393,9 +392,8 @@ const remainingRouter: AppRouteRecordRaw[] = [ ] }, { - path: '/trade', + path: '/trade', // 交易中心 component: Layout, - name: 'Order', meta: { hidden: true }, diff --git a/src/utils/index.ts b/src/utils/index.ts index c73b8d2f..c63f899a 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -230,6 +230,7 @@ export const yuanToFen = (amount: string | number): number => { /** * 分转元 */ -export const fenToYuan = (amount: string | number): number => { - return Number((Number(amount) / 100).toFixed(2)) +export const fenToYuan = (price: string | number): number => { + price = Number(price) + return (price / 100.0).toFixed(2) } diff --git a/src/utils/tree.ts b/src/utils/tree.ts index c8503f54..91059ef9 100644 --- a/src/utils/tree.ts +++ b/src/utils/tree.ts @@ -13,7 +13,8 @@ export const defaultProps = { children: 'children', label: 'name', value: 'id', - isLeaf: 'leaf' + isLeaf: 'leaf', + emitPath: false // 用于 cascader 组件:在选中节点改变时,是否返回由该节点所在的各级菜单的值所组成的数组,若设置 false,则只返回该节点的值 } const getConfig = (config: Partial) => Object.assign({}, DEFAULT_CONFIG, config) @@ -377,10 +378,10 @@ export const treeToString = (tree: any[], nodeId) => { function performAThoroughValidation(arr) { for (const item of arr) { if (item.id === nodeId) { - str += `/${item.name}` + str += ` / ${item.name}` return true } else if (typeof item.children !== 'undefined' && item.children.length !== 0) { - str += `/${item.name}` + str += ` / ${item.name}` if (performAThoroughValidation(item.children)) { return true } diff --git a/src/views/mall/product/spu/form/index.vue b/src/views/mall/product/spu/form/index.vue index e6364f5d..b55dd31f 100644 --- a/src/views/mall/product/spu/form/index.vue +++ b/src/views/mall/product/spu/form/index.vue @@ -102,7 +102,7 @@ const getDetail = async () => { if ('ProductSpuDetail' === name) { isDetail.value = true } - const id = params.spuId as unknown as number + const id = params.id as unknown as number if (id) { formLoading.value = true try { diff --git a/src/views/mall/product/spu/index.vue b/src/views/mall/product/spu/index.vue index 1596df3f..6fc14ca3 100644 --- a/src/views/mall/product/spu/index.vue +++ b/src/views/mall/product/spu/index.vue @@ -18,15 +18,14 @@ /> - @@ -78,7 +77,7 @@ /> - + - +