Skip to content

Commit 5c7b2c8

Browse files
YunaiVgitee-org
authored andcommitted
!228 同步商城最新代码
Merge pull request !228 from 芋道源码/dev
2 parents e6a9dd0 + 135c88a commit 5c7b2c8

File tree

19 files changed

+747
-103
lines changed

19 files changed

+747
-103
lines changed

src/api/mall/trade/afterSale/index.ts

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import request from '@/config/axios'
2+
3+
export interface TradeAfterSaleVO {
4+
id?: number | null // 售后编号,主键自增
5+
no?: string // 售后单号
6+
status?: number | null // 退款状态
7+
way?: number | null // 售后方式
8+
type?: number | null // 售后类型
9+
userId?: number | null // 用户编号
10+
applyReason?: string // 申请原因
11+
applyDescription?: string // 补充描述
12+
applyPicUrls?: string[] // 补充凭证图片
13+
orderId?: number | null // 交易订单编号
14+
orderNo?: string // 订单流水号
15+
orderItemId?: number | null // 交易订单项编号
16+
spuId?: number | null // 商品 SPU 编号
17+
spuName?: string // 商品 SPU 名称
18+
skuId?: number | null // 商品 SKU 编号
19+
properties?: ProductPropertiesVO[] // 属性数组
20+
picUrl?: string // 商品图片
21+
count?: number | null // 退货商品数量
22+
auditTime?: Date // 审批时间
23+
auditUserId?: number | null // 审批人
24+
auditReason?: string // 审批备注
25+
refundPrice?: number | null // 退款金额,单位:分。
26+
payRefundId?: number | null // 支付退款编号
27+
refundTime?: Date // 退款时间
28+
logisticsId?: number | null // 退货物流公司编号
29+
logisticsNo?: string // 退货物流单号
30+
deliveryTime?: Date // 退货时间
31+
receiveTime?: Date // 收货时间
32+
receiveReason?: string // 收货备注
33+
}
34+
35+
export interface ProductPropertiesVO {
36+
propertyId?: number | null // 属性的编号
37+
propertyName?: string // 属性的名称
38+
valueId?: number | null //属性值的编号
39+
valueName?: string // 属性值的名称
40+
}
41+
42+
// 获得交易售后分页
43+
export const getAfterSalePage = async (params) => {
44+
return await request.get({ url: `/trade/after-sale/page`, params })
45+
}
46+
47+
// 获得交易售后详情
48+
export const getAfterSale = async (id: any) => {
49+
return await request.get({ url: `/trade/after-sale/get-detail?id=${id}` })
50+
}
51+
52+
// 同意售后
53+
export const agree = async (id: any) => {
54+
return await request.put({ url: `/trade/after-sale/agree?id=${id}` })
55+
}
56+
57+
// 拒绝售后
58+
export const disagree = async (data: any) => {
59+
return await request.put({ url: `/trade/after-sale/disagree`, data })
60+
}
61+
62+
// 确认收货
63+
export const receive = async (id: any) => {
64+
return await request.put({ url: `/trade/after-sale/receive?id=${id}` })
65+
}
66+
67+
// 拒绝收货
68+
export const refuse = async (id: any) => {
69+
return await request.put({ url: `/trade/after-sale/refuse?id=${id}` })
70+
}
71+
72+
// 确认退款
73+
export const refund = async (id: any) => {
74+
return await request.put({ url: `/trade/after-sale/refund?id=${id}` })
75+
}

src/router/modules/remaining.ts

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -195,23 +195,6 @@ const remainingRouter: AppRouteRecordRaw[] = [
195195
noTagsView: true
196196
}
197197
},
198-
{
199-
path: '/trade/order',
200-
component: Layout,
201-
name: 'order',
202-
meta: {
203-
hidden: true
204-
},
205-
children: [
206-
{
207-
path: 'detail',
208-
name: 'TradeOrderDetail',
209-
// component: () => import('@/views/mall/trade/order/tradeOrderDetail.vue'),
210-
component: () => import('@/views/mall/trade/order/detail/index.vue'),
211-
meta: { title: '订单详情', hidden: true }
212-
}
213-
]
214-
},
215198
{
216199
path: '/403',
217200
component: () => import('@/views/Error/403.vue'),
@@ -357,7 +340,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
357340
children: [
358341
{
359342
path: 'spu/add',
360-
component: () => import('@/views/mall/product/spu/addForm.vue'),
343+
component: () => import('@/views/mall/product/spu/form/index.vue'),
361344
name: 'ProductSpuAdd',
362345
meta: {
363346
noCache: true,
@@ -370,7 +353,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
370353
},
371354
{
372355
path: 'spu/edit/:spuId(\\d+)',
373-
component: () => import('@/views/mall/product/spu/addForm.vue'),
356+
component: () => import('@/views/mall/product/spu/form/index.vue'),
374357
name: 'ProductSpuEdit',
375358
meta: {
376359
noCache: true,
@@ -383,7 +366,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
383366
},
384367
{
385368
path: 'spu/detail/:spuId(\\d+)',
386-
component: () => import('@/views/mall/product/spu/addForm.vue'),
369+
component: () => import('@/views/mall/product/spu/form/index.vue'),
387370
name: 'ProductSpuDetail',
388371
meta: {
389372
noCache: true,
@@ -410,18 +393,24 @@ const remainingRouter: AppRouteRecordRaw[] = [
410393
]
411394
},
412395
{
413-
path: '/trade/order',
396+
path: '/trade',
414397
component: Layout,
415-
name: 'Detail',
398+
name: 'Order',
416399
meta: {
417400
hidden: true
418401
},
419402
children: [
420403
{
421-
path: 'detail/:orderId(\\d+)',
404+
path: 'order/detail/:orderId(\\d+)',
422405
component: () => import('@/views/mall/trade/order/detail/index.vue'),
423-
name: 'TradeOrderDetailForm',
406+
name: 'TradeOrderDetail',
424407
meta: { title: '订单详情', icon: '', activeMenu: '/trade/trade/order' }
408+
},
409+
{
410+
path: 'after-sale/detail/:orderId(\\d+)',
411+
component: () => import('@/views/mall/trade/afterSale/detail/index.vue'),
412+
name: 'TradeAfterSaleDetail',
413+
meta: { title: '退款详情', icon: '', activeMenu: '/trade/trade/after-sale' }
425414
}
426415
]
427416
},
Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
import BasicInfoForm from './BasicInfoForm.vue'
2-
import DescriptionForm from './DescriptionForm.vue'
3-
import OtherSettingsForm from './OtherSettingsForm.vue'
4-
import ProductAttributes from './ProductAttributes.vue'
5-
import ProductPropertyAddForm from './ProductPropertyAddForm.vue'
61
import SkuList from './SkuList.vue'
72

8-
import { Spu } from '@/api/mall/product/spu'
9-
103
interface PropertyAndValues {
114
id: number
125
name: string
@@ -29,42 +22,4 @@ interface RuleConfig {
2922
message: string
3023
}
3124

32-
/**
33-
* 获得商品的规格列表
34-
*
35-
* @param spu
36-
* @return PropertyAndValues 规格列表
37-
*/
38-
const getPropertyList = (spu: Spu): PropertyAndValues[] => {
39-
// 直接拿返回的 skus 属性逆向生成出 propertyList
40-
const properties: PropertyAndValues[] = []
41-
// 只有是多规格才处理
42-
if (spu.specType) {
43-
spu.skus?.forEach((sku) => {
44-
sku.properties?.forEach(({ propertyId, propertyName, valueId, valueName }) => {
45-
// 添加属性
46-
if (!properties?.some((item) => item.id === propertyId)) {
47-
properties.push({ id: propertyId!, name: propertyName!, values: [] })
48-
}
49-
// 添加属性值
50-
const index = properties?.findIndex((item) => item.id === propertyId)
51-
if (!properties[index].values?.some((value) => value.id === valueId)) {
52-
properties[index].values?.push({ id: valueId!, name: valueName! })
53-
}
54-
})
55-
})
56-
}
57-
return properties
58-
}
59-
60-
export {
61-
BasicInfoForm,
62-
DescriptionForm,
63-
OtherSettingsForm,
64-
ProductAttributes,
65-
ProductPropertyAddForm,
66-
SkuList,
67-
getPropertyList,
68-
PropertyAndValues,
69-
RuleConfig
70-
}
25+
export { SkuList, PropertyAndValues, RuleConfig }

src/views/mall/product/spu/components/BasicInfoForm.vue renamed to src/views/mall/product/spu/form/BasicInfoForm.vue

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,17 @@ import { propTypes } from '@/utils/propTypes'
175175
import { checkSelectedNode, defaultProps, handleTree, treeToString } from '@/utils/tree'
176176
import { createImageViewer } from '@/components/ImageViewer'
177177
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
178-
import { UploadImg, UploadImgs } from '@/components/UploadFile'
179-
import { getPropertyList, ProductAttributes, ProductPropertyAddForm, SkuList } from './index'
178+
import { PropertyAndValues, SkuList } from '@/views/mall/product/spu/components/index.ts'
179+
import ProductAttributes from './ProductAttributes.vue'
180+
import ProductPropertyAddForm from './ProductPropertyAddForm.vue'
180181
import { basicInfoSchema } from './spu.data'
181182
import type { Spu } from '@/api/mall/product/spu'
182183
import * as ProductCategoryApi from '@/api/mall/product/category'
183-
import { getSimpleBrandList } from '@/api/mall/product/brand'
184-
import { getSimpleTemplateList } from '@/api/mall/trade/delivery/expressTemplate/index'
184+
import * as ProductBrandApi from '@/api/mall/product/brand'
185+
import * as ExpressTemplateApi from '@/api/mall/trade/delivery/expressTemplate'
186+
187+
defineOptions({ name: 'ProductSpuBasicInfoForm' })
188+
185189
// ====== 商品详情相关操作 ======
186190
const { allSchemas } = useCrudSchemas(basicInfoSchema)
187191
/** 商品图预览 */
@@ -198,9 +202,36 @@ const imagePreview = (args) => {
198202
urlList
199203
})
200204
}
201-
// ====== end ======
202205
203-
defineOptions({ name: 'ProductSpuBasicInfoForm' })
206+
/**
207+
* 获得商品的规格列表
208+
*
209+
* @param spu
210+
* @return PropertyAndValues 规格列表
211+
*/
212+
const getPropertyList = (spu: Spu): PropertyAndValues[] => {
213+
// 直接拿返回的 skus 属性逆向生成出 propertyList
214+
const properties: PropertyAndValues[] = []
215+
// 只有是多规格才处理
216+
if (spu.specType) {
217+
spu.skus?.forEach((sku) => {
218+
sku.properties?.forEach(({ propertyId, propertyName, valueId, valueName }) => {
219+
// 添加属性
220+
if (!properties?.some((item) => item.id === propertyId)) {
221+
properties.push({ id: propertyId!, name: propertyName!, values: [] })
222+
}
223+
// 添加属性值
224+
const index = properties?.findIndex((item) => item.id === propertyId)
225+
if (!properties[index].values?.some((value) => value.id === valueId)) {
226+
properties[index].values?.push({ id: valueId!, name: valueName! })
227+
}
228+
})
229+
})
230+
}
231+
return properties
232+
}
233+
234+
// ====== end ======
204235
205236
const message = useMessage() // 消息弹窗
206237
@@ -346,8 +377,8 @@ onMounted(async () => {
346377
const data = await ProductCategoryApi.getCategoryList({})
347378
categoryList.value = handleTree(data, 'id', 'parentId')
348379
// 获取商品品牌列表
349-
brandList.value = await getSimpleBrandList()
380+
brandList.value = await ProductBrandApi.getSimpleBrandList()
350381
// 获取运费模版
351-
deliveryTemplateList.value = await getSimpleTemplateList()
382+
deliveryTemplateList.value = await ExpressTemplateApi.getSimpleTemplateList()
352383
})
353384
</script>

src/views/mall/product/spu/components/ProductPropertyAddForm.vue renamed to src/views/mall/product/spu/form/ProductPropertyAddForm.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ const submitForm = async () => {
8080
if (res[0].values === null) {
8181
res[0].values = []
8282
}
83+
// 不需要属性值
84+
res[0].values = []
8385
attributeList.value.push(res[0]) // 因为只用一个
8486
}
8587
message.success(t('common.createSuccess'))

src/views/mall/product/spu/addForm.vue renamed to src/views/mall/product/spu/form/index.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@
3939
<script lang="ts" setup>
4040
import { cloneDeep } from 'lodash-es'
4141
import { useTagsViewStore } from '@/store/modules/tagsView'
42-
import { BasicInfoForm, DescriptionForm, OtherSettingsForm } from './components'
43-
// 业务api
4442
import * as ProductSpuApi from '@/api/mall/product/spu'
43+
import BasicInfoForm from './BasicInfoForm.vue'
44+
import DescriptionForm from './DescriptionForm.vue'
45+
import OtherSettingsForm from './OtherSettingsForm.vue'
4546
import { convertToInteger, floatToFixed2, formatToFraction } from '@/utils'
4647
47-
// TODO @芋艿:后续稍微调整下;
48-
4948
defineOptions({ name: 'ProductSpuForm' })
5049
5150
const { t } = useI18n() // 国际化

0 commit comments

Comments
 (0)