Skip to content

Commit ef15261

Browse files
YunaiVgitee-org
authored andcommitted
!240 完善前端 mall-order 模块相关问题
Merge pull request !240 from puhui999/dev-to-dev
2 parents 0e2ea39 + 5dc0c6e commit ef15261

File tree

10 files changed

+86
-75
lines changed

10 files changed

+86
-75
lines changed

src/api/mall/product/spu.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export interface Sku {
2020
stock?: number // 库存
2121
weight?: number // 商品重量,单位:kg 千克
2222
volume?: number // 商品体积,单位:m^3 平米
23-
subCommissionFirstPrice?: number | string // 一级分销的佣金
24-
subCommissionSecondPrice?: number | string // 二级分销的佣金
23+
firstBrokerageRecord?: number | string // 一级分销的佣金
24+
secondBrokerageRecord?: number | string // 二级分销的佣金
2525
salesCount?: number // 商品销量
2626
}
2727

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,10 @@ export interface OrderVO {
5151
avatar?: string
5252
}
5353
// 订单操作日志
54-
logs?: logs[]
54+
logs?: OrderLogRespVO[]
5555
}
5656

57-
// TODO @puhui999:OrderLogRespVO 会不会更好哈。
58-
export interface logs {
57+
export interface OrderLogRespVO {
5958
content?: string
6059
createTime?: Date
6160
userType?: number

src/config/axios/service.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,6 @@ service.interceptors.response.use(
191191
}
192192
return Promise.reject('error')
193193
} else {
194-
// TODO @puhui999:这个先不用支持哈;
195-
// 前端处理 data 为 null 的情况,进行提示
196-
if (data.msg !== '') {
197-
ElNotification.error({ title: msg })
198-
}
199194
return data
200195
}
201196
},

src/views/Login/components/LoginForm.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ const getCookie = () => {
230230
}
231231
}
232232
}
233+
const loading = ref() // ElLoading.service 返回的实例
233234
// 登录
234235
const handleLogin = async (params) => {
235236
loginLoading.value = true
@@ -244,7 +245,7 @@ const handleLogin = async (params) => {
244245
if (!res) {
245246
return
246247
}
247-
ElLoading.service({
248+
loading.value = ElLoading.service({
248249
lock: true,
249250
text: '正在加载系统中...',
250251
background: 'rgba(0, 0, 0, 0.7)'
@@ -264,13 +265,9 @@ const handleLogin = async (params) => {
264265
} else {
265266
push({ path: redirect.value || permissionStore.addRouters[0].path })
266267
}
267-
} catch {
268-
loginLoading.value = false
269268
} finally {
270-
setTimeout(() => {
271-
const loadingInstance = ElLoading.service()
272-
loadingInstance.close()
273-
}, 400)
269+
loginLoading.value = false
270+
loading.value.close()
274271
}
275272
}
276273

src/views/mall/product/spu/components/SkuList.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<el-table-column align="center" label="一级返佣(元)" min-width="168">
8181
<template #default="{ row }">
8282
<el-input-number
83-
v-model="row.subCommissionFirstPrice"
83+
v-model="row.firstBrokerageRecord"
8484
:min="0"
8585
:precision="2"
8686
:step="0.1"
@@ -91,7 +91,7 @@
9191
<el-table-column align="center" label="二级返佣(元)" min-width="168">
9292
<template #default="{ row }">
9393
<el-input-number
94-
v-model="row.subCommissionSecondPrice"
94+
v-model="row.secondBrokerageRecord"
9595
:min="0"
9696
:precision="2"
9797
:step="0.1"
@@ -181,12 +181,12 @@
181181
<template v-if="formData!.subCommissionType">
182182
<el-table-column align="center" label="一级返佣(元)" min-width="80">
183183
<template #default="{ row }">
184-
{{ row.subCommissionFirstPrice }}
184+
{{ row.firstBrokerageRecord }}
185185
</template>
186186
</el-table-column>
187187
<el-table-column align="center" label="二级返佣(元)" min-width="80">
188188
<template #default="{ row }">
189-
{{ row.subCommissionSecondPrice }}
189+
{{ row.secondBrokerageRecord }}
190190
</template>
191191
</el-table-column>
192192
</template>
@@ -295,8 +295,8 @@ const skuList = ref<Sku[]>([
295295
stock: 0, // 库存
296296
weight: 0, // 商品重量
297297
volume: 0, // 商品体积
298-
subCommissionFirstPrice: 0, // 一级分销的佣金
299-
subCommissionSecondPrice: 0 // 二级分销的佣金
298+
firstBrokerageRecord: 0, // 一级分销的佣金
299+
secondBrokerageRecord: 0 // 二级分销的佣金
300300
}
301301
]) // 批量添加时的临时数据
302302
@@ -415,8 +415,8 @@ const generateTableData = (propertyList: any[]) => {
415415
stock: 0,
416416
weight: 0,
417417
volume: 0,
418-
subCommissionFirstPrice: 0,
419-
subCommissionSecondPrice: 0
418+
firstBrokerageRecord: 0,
419+
secondBrokerageRecord: 0
420420
}
421421
// 如果存在属性相同的 sku 则不做处理
422422
const index = formData.value!.skus!.findIndex(
@@ -491,8 +491,8 @@ watch(
491491
stock: 0,
492492
weight: 0,
493493
volume: 0,
494-
subCommissionFirstPrice: 0,
495-
subCommissionSecondPrice: 0
494+
firstBrokerageRecord: 0,
495+
secondBrokerageRecord: 0
496496
}
497497
]
498498
}

src/views/mall/product/spu/form/BasicInfoForm.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,8 @@ defineExpose({ validate })
332332
const changeSubCommissionType = () => {
333333
// 默认为零,类型切换后也要重置为零
334334
for (const item of formData.skus) {
335-
item.subCommissionFirstPrice = 0
336-
item.subCommissionSecondPrice = 0
335+
item.firstBrokerageRecord = 0
336+
item.secondBrokerageRecord = 0
337337
}
338338
}
339339
@@ -352,8 +352,8 @@ const onChangeSpec = () => {
352352
stock: 0,
353353
weight: 0,
354354
volume: 0,
355-
subCommissionFirstPrice: 0,
356-
subCommissionSecondPrice: 0
355+
firstBrokerageRecord: 0,
356+
secondBrokerageRecord: 0
357357
}
358358
]
359359
}

src/views/mall/product/spu/form/index.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ const formData = ref<ProductSpuApi.Spu>({
8282
stock: 0, // 库存
8383
weight: 0, // 商品重量
8484
volume: 0, // 商品体积
85-
subCommissionFirstPrice: 0, // 一级分销的佣金
86-
subCommissionSecondPrice: 0 // 二级分销的佣金
85+
firstBrokerageRecord: 0, // 一级分销的佣金
86+
secondBrokerageRecord: 0 // 二级分销的佣金
8787
}
8888
],
8989
description: '', // 商品详情
@@ -112,15 +112,15 @@ const getDetail = async () => {
112112
item.price = floatToFixed2(item.price)
113113
item.marketPrice = floatToFixed2(item.marketPrice)
114114
item.costPrice = floatToFixed2(item.costPrice)
115-
item.subCommissionFirstPrice = floatToFixed2(item.subCommissionFirstPrice)
116-
item.subCommissionSecondPrice = floatToFixed2(item.subCommissionSecondPrice)
115+
item.firstBrokerageRecord = floatToFixed2(item.firstBrokerageRecord)
116+
item.secondBrokerageRecord = floatToFixed2(item.secondBrokerageRecord)
117117
} else {
118118
// 回显价格分转元
119119
item.price = formatToFraction(item.price)
120120
item.marketPrice = formatToFraction(item.marketPrice)
121121
item.costPrice = formatToFraction(item.costPrice)
122-
item.subCommissionFirstPrice = formatToFraction(item.subCommissionFirstPrice)
123-
item.subCommissionSecondPrice = formatToFraction(item.subCommissionSecondPrice)
122+
item.firstBrokerageRecord = formatToFraction(item.firstBrokerageRecord)
123+
item.secondBrokerageRecord = formatToFraction(item.secondBrokerageRecord)
124124
}
125125
})
126126
formData.value = res
@@ -149,8 +149,8 @@ const submitForm = async () => {
149149
item.price = convertToInteger(item.price)
150150
item.marketPrice = convertToInteger(item.marketPrice)
151151
item.costPrice = convertToInteger(item.costPrice)
152-
item.subCommissionFirstPrice = convertToInteger(item.subCommissionFirstPrice)
153-
item.subCommissionSecondPrice = convertToInteger(item.subCommissionSecondPrice)
152+
item.firstBrokerageRecord = convertToInteger(item.firstBrokerageRecord)
153+
item.secondBrokerageRecord = convertToInteger(item.secondBrokerageRecord)
154154
})
155155
// 处理轮播图列表
156156
const newSliderPicUrls: any[] = []

src/views/mall/trade/afterSale/detail/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ const getDetail = async () => {
195195
if (id) {
196196
const res = await AfterSaleApi.getAfterSale(id)
197197
// 没有表单信息则关闭页面返回
198-
if (res === null) {
198+
if (res == null) {
199+
message.notifyError('售后订单不存在')
199200
close()
200201
}
201202
formData.value = res

src/views/mall/trade/order/detail/index.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,10 @@ const { params } = useRoute() // 查询参数
245245
const getDetail = async () => {
246246
const id = params.orderId as unknown as number
247247
if (id) {
248-
const res = (await TradeOrderApi.getOrder(id)) as TradeOrderApi.OrderVO
248+
const res = (await TradeOrderApi.getOrder(66666)) as TradeOrderApi.OrderVO
249249
// 没有表单信息则关闭页面返回
250-
if (res === null) {
250+
if (res == null) {
251+
message.error('交易订单不存在')
251252
close()
252253
}
253254
formData.value = res
@@ -259,7 +260,7 @@ const { delView } = useTagsViewStore() // 视图操作
259260
const { push, currentRoute } = useRouter() // 路由
260261
const close = () => {
261262
delView(unref(currentRoute))
262-
push({ name: 'TradeAfterSale' })
263+
push({ name: 'TradeOrder' })
263264
}
264265
265266
/** 复制 */

src/views/mall/trade/order/index.vue

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,19 @@
104104
<el-form-item label="聚合搜索">
105105
<el-input
106106
v-show="true"
107-
v-model="queryType.v"
107+
v-model="queryParams[queryType.k]"
108108
class="!w-280px"
109109
clearable
110110
placeholder="请输入"
111111
>
112112
<template #prepend>
113-
<el-select v-model="queryType.k" class="!w-110px" clearable placeholder="全部">
113+
<el-select
114+
v-model="queryType.k"
115+
class="!w-110px"
116+
clearable
117+
placeholder="全部"
118+
@change="inputChangeSelect"
119+
>
114120
<el-option
115121
v-for="dict in searchList"
116122
:key="dict.value"
@@ -335,41 +341,41 @@ const total = ref(2) // 列表的总页数
335341
const list = ref<TradeOrderApi.OrderVO[]>([]) // 列表的数据
336342
const queryFormRef = ref<FormInstance>() // 搜索的表单
337343
// 表单搜索
338-
const queryParams = reactive({
339-
pageNo: 1, //首页
340-
pageSize: 10, //页面大小
341-
no: '',
342-
userId: '',
343-
userNickname: '',
344-
userMobile: '',
345-
receiverName: '',
346-
receiverMobile: '',
347-
348-
terminal: '',
349-
type: null,
350-
status: null,
351-
payChannelCode: '',
352-
createTime: [],
353-
deliveryType: null,
354-
spuName: '',
355-
itemCount: '',
356-
pickUpStoreId: [],
357-
logisticsId: null,
358-
all: ''
344+
const queryParams = ref({
345+
pageNo: 1, // 页数
346+
pageSize: 10, // 每页显示数量
347+
status: null, // 订单状态
348+
payChannelCode: null, // 支付方式
349+
createTime: null, // 创建时间
350+
terminal: null, // 订单来源
351+
type: null, // 订单类型
352+
deliveryType: null, // 配送方式
353+
logisticsId: null, // 快递公司
354+
pickUpStoreId: null // 自提门店
359355
})
360-
const queryType = reactive({ k: '', v: '' }) // 订单搜索类型kv
361-
/**
362-
* 订单聚合搜索
363-
* 商品名称、商品件数、全部
364-
*
365-
* 需要后端支持 TODO
366-
*/
356+
const queryType = reactive({ k: '' }) // 订单搜索类型 k
357+
358+
// 订单聚合搜索 select 类型配置
367359
const searchList = ref([
368360
{ value: 'no', label: '订单号' },
369361
{ value: 'userId', label: '用户UID' },
370362
{ value: 'userNickname', label: '用户昵称' },
371363
{ value: 'userMobile', label: '用户电话' }
372364
])
365+
/**
366+
* 聚合搜索切换查询对象时触发
367+
* @param val
368+
*/
369+
const inputChangeSelect = (val: string) => {
370+
searchList.value
371+
.filter((item) => item.value !== val)
372+
?.forEach((item1) => {
373+
// 清除集合搜索无用属性
374+
if (queryParams.value.hasOwnProperty(item1.value)) {
375+
delete queryParams.value[item1.value]
376+
}
377+
})
378+
}
373379
374380
const headerStyle = ({ row, columnIndex }: any) => {
375381
// 表头第一行第一列占 8
@@ -417,7 +423,7 @@ const spanMethod = ({ row, rowIndex, columnIndex }: SpanMethodProps) => {
417423
const getList = async () => {
418424
loading.value = true
419425
try {
420-
const data = await TradeOrderApi.getOrderPage(queryParams)
426+
const data = await TradeOrderApi.getOrderPage(unref(queryParams))
421427
list.value = data.list
422428
total.value = data.total
423429
} finally {
@@ -427,13 +433,25 @@ const getList = async () => {
427433
428434
/** 搜索按钮操作 */
429435
const handleQuery = async () => {
430-
queryParams.pageNo = 1
436+
queryParams.value.pageNo = 1
431437
await getList()
432438
}
433439
434440
/** 重置按钮操作 */
435441
const resetQuery = () => {
436442
queryFormRef.value?.resetFields()
443+
queryParams.value = {
444+
pageNo: 1, // 页数
445+
pageSize: 10, // 每页显示数量
446+
status: null, // 订单状态
447+
payChannelCode: null, // 支付方式
448+
createTime: null, // 创建时间
449+
terminal: null, // 订单来源
450+
type: null, // 订单类型
451+
deliveryType: null, // 配送方式
452+
logisticsId: null, // 快递公司
453+
pickUpStoreId: null // 自提门店
454+
}
437455
handleQuery()
438456
}
439457

0 commit comments

Comments
 (0)