Skip to content

Commit 47f20e6

Browse files
YunaiVgitee-org
authored andcommitted
!152 合并最新的 Vue3 重构
Merge pull request !152 from 芋道源码/dev
2 parents fa618ca + 16561b1 commit 47f20e6

File tree

47 files changed

+2531
-557
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2531
-557
lines changed

src/api/mall/product/category.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ export interface CategoryVO {
1717
*/
1818
name: string
1919
/**
20-
* 分类图片
20+
* 移动端分类图
2121
*/
2222
picUrl: string
2323
/**
24-
* 分类排序
24+
* PC 端分类图
2525
*/
26-
sort?: number
26+
bigPicUrl?: string
2727
/**
28-
* 分类描述
28+
* 分类排序
2929
*/
30-
description?: string
30+
sort: number
3131
/**
3232
* 开启状态
3333
*/
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import request from '@/config/axios'
2+
import type { SpuType } from './type/spuType' // TODO @puhui999: type 和 api 一起放,简单一点哈~
3+
4+
// TODO @puhui999:中英文之间有空格
5+
6+
// 获得spu列表 TODO @puhui999:这个是 getSpuPage 哈
7+
export const getSpuList = (params: PageParam) => {
8+
return request.get({ url: '/product/spu/page', params })
9+
}
10+
11+
// 获得spu列表tabsCount
12+
export const getTabsCount = () => {
13+
return request.get({ url: '/product/spu/tabsCount' })
14+
}
15+
16+
// 创建商品spu
17+
export const createSpu = (data: SpuType) => {
18+
return request.post({ url: '/product/spu/create', data })
19+
}
20+
21+
// 更新商品spu
22+
export const updateSpu = (data: SpuType) => {
23+
return request.put({ url: '/product/spu/update', data })
24+
}
25+
26+
// 更新商品spu status
27+
export const updateStatus = (data: { id: number; status: number }) => {
28+
return request.put({ url: '/product/spu/updateStatus', data })
29+
}
30+
31+
// 获得商品 spu
32+
export const getSpu = (id: number) => {
33+
return request.get({ url: `/product/spu/get-detail?id=${id}` })
34+
}
35+
36+
// 删除商品Spu
37+
export const deleteSpu = (id: number) => {
38+
return request.delete({ url: `/product/spu/delete?id=${id}` })
39+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
export interface Property {
2+
/**
3+
* 属性编号
4+
*
5+
* 关联 {@link ProductPropertyDO#getId()}
6+
*/
7+
propertyId?: number
8+
/**
9+
* 属性值编号
10+
*
11+
* 关联 {@link ProductPropertyValueDO#getId()}
12+
*/
13+
valueId?: number
14+
/**
15+
* 属性值名称
16+
*/
17+
valueName?: string
18+
}
19+
20+
export interface SkuType {
21+
/**
22+
* 商品 SKU 编号,自增
23+
*/
24+
id?: number
25+
/**
26+
* SPU 编号
27+
*/
28+
spuId?: number
29+
/**
30+
* 属性数组,JSON 格式
31+
*/
32+
properties?: Property[]
33+
/**
34+
* 商品价格,单位:分
35+
*/
36+
price?: number
37+
/**
38+
* 市场价,单位:分
39+
*/
40+
marketPrice?: number
41+
/**
42+
* 成本价,单位:分
43+
*/
44+
costPrice?: number
45+
/**
46+
* 商品条码
47+
*/
48+
barCode?: string
49+
/**
50+
* 图片地址
51+
*/
52+
picUrl?: string
53+
/**
54+
* 库存
55+
*/
56+
stock?: number
57+
/**
58+
* 商品重量,单位:kg 千克
59+
*/
60+
weight?: number
61+
/**
62+
* 商品体积,单位:m^3 平米
63+
*/
64+
volume?: number
65+
66+
/**
67+
* 一级分销的佣金,单位:分
68+
*/
69+
subCommissionFirstPrice?: number
70+
/**
71+
* 二级分销的佣金,单位:分
72+
*/
73+
subCommissionSecondPrice?: number
74+
75+
/**
76+
* 商品销量
77+
*/
78+
salesCount?: number
79+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { SkuType } from './skuType'
2+
3+
export interface SpuType {
4+
id?: number
5+
name?: string // 商品名称
6+
categoryId?: number | null // 商品分类
7+
keyword?: string // 关键字
8+
unit?: number | null // 单位
9+
picUrl?: string // 商品封面图
10+
sliderPicUrls?: string[] // 商品轮播图
11+
introduction?: string // 商品简介
12+
deliveryTemplateId?: number // 运费模版
13+
specType?: boolean // 商品规格
14+
subCommissionType?: boolean // 分销类型
15+
skus: SkuType[] // sku数组
16+
description?: string // 商品详情
17+
sort?: string // 商品排序
18+
giveIntegral?: number // 赠送积分
19+
virtualSalesCount?: number // 虚拟销量
20+
recommendHot?: boolean // 是否热卖
21+
recommendBenefit?: boolean // 是否优惠
22+
recommendBest?: boolean // 是否精品
23+
recommendNew?: boolean // 是否新品
24+
recommendGood?: boolean // 是否优品
25+
}

src/api/mall/product/property.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ export const getPropertyList = (params: any) => {
7171
}
7272

7373
// 获得属性项列表
74-
export const getPropertyListAndValue = (params: any) => {
75-
return request.get({ url: '/product/property/get-value-list', params })
74+
export const getPropertyListAndValue = (data: any) => {
75+
return request.post({ url: '/product/property/get-value-list', data })
7676
}
7777

7878
// ------------------------ 属性值 -------------------

src/api/mp/account/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import request from '@/config/axios'
22

33
export interface AccountVO {
4-
id?: number
4+
id: number
55
name: string
66
}
77

src/components/Form/src/helper.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Slots } from 'vue'
22
import { getSlot } from '@/utils/tsxHelper'
3-
import { PlaceholderMoel } from './types'
3+
import { PlaceholderModel } from './types'
44
import { FormSchema } from '@/types/form'
55
import { ColProps } from '@/types/components'
66

@@ -10,7 +10,7 @@ import { ColProps } from '@/types/components'
1010
* @returns 返回提示信息对象
1111
* @description 用于自动设置placeholder
1212
*/
13-
export const setTextPlaceholder = (schema: FormSchema): PlaceholderMoel => {
13+
export const setTextPlaceholder = (schema: FormSchema): PlaceholderModel => {
1414
const { t } = useI18n()
1515
const textMap = ['Input', 'Autocomplete', 'InputNumber', 'InputPassword']
1616
const selectMap = ['Select', 'SelectV2', 'TimePicker', 'DatePicker', 'TimeSelect', 'TimeSelect']
@@ -108,8 +108,8 @@ export const setItemComponentSlots = (
108108
/**
109109
*
110110
* @param schema Form表单结构化数组
111-
* @param formModel FormMoel
112-
* @returns FormMoel
111+
* @param formModel FormModel
112+
* @returns FormModel
113113
* @description 生成对应的formModel
114114
*/
115115
export const initModel = (schema: FormSchema[], formModel: Recordable) => {

src/components/Form/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { FormSchema } from '@/types/form'
22

3-
export interface PlaceholderMoel {
3+
export interface PlaceholderModel {
44
placeholder?: string
55
startPlaceholder?: string
66
endPlaceholder?: string

src/router/modules/remaining.ts

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { Layout } from '@/utils/routerHelper'
22

33
const { t } = useI18n()
44
/**
5-
* redirect: noredirect 当设置 noredirect 的时候该路由在面包屑导航中不可被点击
6-
* name:'router-name' 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
7-
* meta : {
5+
* redirect: noredirect 当设置 noredirect 的时候该路由在面包屑导航中不可被点击
6+
* name:'router-name' 设定路由的名字,一定要填写不然使用<keep-alive>时会出现各种问题
7+
* meta : {
88
hidden: true 当设置 true 的时候该路由不会再侧边栏出现 如404,login等页面(默认 false)
99
1010
alwaysShow: true 当你一个路由下面的 children 声明的路由大于1个时,自动会变成嵌套的模式,
@@ -31,7 +31,7 @@ const { t } = useI18n()
3131
3232
canTo: true 设置为true即使hidden为true,也依然可以进行路由跳转(默认 false)
3333
}
34-
**/
34+
**/
3535
const remainingRouter: AppRouteRecordRaw[] = [
3636
{
3737
path: '/redirect',
@@ -345,6 +345,29 @@ const remainingRouter: AppRouteRecordRaw[] = [
345345
meta: { title: '商品属性值', icon: '', activeMenu: '/product/property' }
346346
}
347347
]
348+
},
349+
{
350+
path: '/product',
351+
component: Layout,
352+
name: 'ProductManagementEdit',
353+
meta: {
354+
hidden: true
355+
},
356+
children: [
357+
{
358+
path: 'productManagementAdd', // TODO @puhui999:最好拆成 add 和 edit 两个路由;添加商品;修改商品
359+
component: () => import('@/views/mall/product/spu/addForm.vue'),
360+
name: 'ProductManagementAdd',
361+
meta: {
362+
noCache: true,
363+
hidden: true,
364+
canTo: true,
365+
icon: 'ep:edit',
366+
title: '添加商品',
367+
activeMenu: '/product/product-management'
368+
}
369+
}
370+
]
348371
}
349372
]
350373

src/styles/index.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
width: 100% !important;
1111
}
1212

13+
// 解决表格内容超过表格总宽度后,横向滚动条前端顶不到表格边缘的问题
14+
.el-scrollbar__bar {
15+
display: flex;
16+
justify-content: flex-start;
17+
}
18+
1319
/* nprogress 适配 element-plus 的主题色 */
1420
#nprogress {
1521
& .bar {

0 commit comments

Comments
 (0)