Skip to content

Commit 4f74de0

Browse files
committed
trade:增加管理后台的订单详情接口
1 parent 247712c commit 4f74de0

File tree

3 files changed

+126
-95
lines changed

3 files changed

+126
-95
lines changed

src/api/mall/trade/order.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import request from '@/utils/request'
2+
3+
// 获得交易订单分页
4+
export function getOrderPage(query) {
5+
return request({
6+
url: '/trade/order/page',
7+
method: 'get',
8+
params: query
9+
})
10+
}
11+
12+
// 获得交易订单详情
13+
export function getOrderDetail(id) {
14+
return request({
15+
url: '/trade/order/get-detail?id=' + id,
16+
method: 'get',
17+
})
18+
}

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<template>
22
<div class="app-container order-detail-page">
3+
<!-- 订单信息 -->
4+
<el-descriptions title="订单信息">
5+
<el-descriptions-item label="支付单号">123</el-descriptions-item>
6+
</el-descriptions>
7+
38
<template v-for="(group, index) in detailGroups">
49
<el-descriptions v-bind="group.groupProps" :key="`group_${index}`" :title="group.title">
510
<!-- 商品信息 -->
@@ -92,6 +97,9 @@
9297
</template>
9398

9499
<script>
100+
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
101+
import { getOrderDetail } from "@/api/mall/trade/order";
102+
95103
export default {
96104
name: "detail",
97105
data () {
@@ -100,7 +108,7 @@ export default {
100108
{
101109
title: '订单详情',
102110
children: [
103-
{ label: '交易流水号', valueKey: 'jylsh'},
111+
{ label: '支付单号', valueKey: 'jylsh'},
104112
{ label: '配送方式', valueKey: 'psfs'},
105113
{ label: '营销活动', valueKey: 'yxhd'},
106114
{ label: '订单编号', valueKey: 'ddbh'},
@@ -242,9 +250,17 @@ export default {
242250
}
243251
],
244252
goodsInfo: [] // 商品详情tableData
245-
}
253+
},
254+
order: {
255+
items: [],
256+
},
246257
}
247258
},
259+
created() {
260+
getOrderDetail(this.$route.query.id).then(res => {
261+
this.order = res.data
262+
})
263+
},
248264
methods: {
249265
clipboardSuccess() {
250266
this.$modal.msgSuccess("复制成功");

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

Lines changed: 90 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<el-form-item label="搜索方式" prop="searchValue">
99
<el-input v-model="queryParams.searchValue" style="width: 240px">
1010
<el-select v-model="queryParams.searchType" slot="prepend" style="width: 100px">
11-
<el-option v-for="dict in dicData.searchType" v-bind="dict" :key="dict.value"/>
11+
<el-option v-for="dict in searchTypes" :key="dict.value" :label="dict.label" :value="dict.value"/>
1212
</el-select>
1313
</el-input>
1414
</el-form-item>
@@ -156,103 +156,100 @@ import { getOrderPage } from "@/api/mall/trade/order";
156156
import { datePickerOptions } from "@/utils/constants";
157157
import { DICT_TYPE, getDictDatas } from "@/utils/dict";
158158
159-
const dicData = {
160-
searchType: [
161-
{ label: '订单号', value: 'no' },
162-
{ label: '会员编号', value: 'userId' },
163-
{ label: '会员昵称', value: 'userNickname' },
164-
{ label: '会员手机号', value: 'userMobile' },
165-
{ label: '收货人姓名', value: 'receiverName' },
166-
{ label: '收货人手机号码', value: 'receiverMobile' },
167-
],
168-
}
169-
export default {
170-
name: "index",
171-
data () {
172-
return {
173-
dicData,
174-
// 遮罩层
175-
loading: true,
176-
// 导出遮罩层
177-
exportLoading: false,
178-
// 显示搜索条件
179-
showSearch: true,
180-
// 总条数
181-
total: 0,
182-
// 交易售后列表
183-
list: [],
184-
queryParams: {
185-
pageNo: 1,
186-
pageSize: 10,
187-
searchType: 'no',
188-
searchValue: '',
189-
type: null,
190-
status: null,
191-
payChannelCode: null,
192-
createTime: [],
193-
},
194-
// Tab 筛选
195-
activeTab: 'all',
196-
statusTabs: [{
197-
label: '全部',
198-
value: 'all'
199-
}],
200-
// 静态变量
201-
datePickerOptions: datePickerOptions
202-
}
159+
export default {
160+
name: "index",
161+
data () {
162+
return {
163+
// 遮罩层
164+
loading: true,
165+
// 导出遮罩层
166+
exportLoading: false,
167+
// 显示搜索条件
168+
showSearch: true,
169+
// 总条数
170+
total: 0,
171+
// 交易售后列表
172+
list: [],
173+
queryParams: {
174+
pageNo: 1,
175+
pageSize: 10,
176+
searchType: 'no',
177+
searchValue: '',
178+
type: null,
179+
status: null,
180+
payChannelCode: null,
181+
createTime: [],
182+
},
183+
// Tab 筛选
184+
activeTab: 'all',
185+
statusTabs: [{
186+
label: '全部',
187+
value: 'all'
188+
}],
189+
// 静态变量
190+
datePickerOptions: datePickerOptions,
191+
searchTypes: [
192+
{ label: '订单号', value: 'no' },
193+
{ label: '会员编号', value: 'userId' },
194+
{ label: '会员昵称', value: 'userNickname' },
195+
{ label: '会员手机号', value: 'userMobile' },
196+
{ label: '收货人姓名', value: 'receiverName' },
197+
{ label: '收货人手机号码', value: 'receiverMobile' },
198+
],
199+
}
200+
},
201+
created() {
202+
this.getList();
203+
// 设置 statuses 过滤
204+
for (const dict of getDictDatas(DICT_TYPE.TRADE_ORDER_STATUS)) {
205+
this.statusTabs.push({
206+
label: dict.label,
207+
value: dict.value
208+
})
209+
}
210+
},
211+
methods: {
212+
/** 查询列表 */
213+
getList() {
214+
this.loading = true;
215+
// 执行查询
216+
getOrderPage({
217+
...this.queryParams,
218+
searchType: undefined,
219+
searchValue: undefined,
220+
no: this.queryParams.searchType === 'no' ? this.queryParams.searchValue : undefined,
221+
userId: this.queryParams.searchType === 'userId' ? this.queryParams.searchValue : undefined,
222+
userNickname: this.queryParams.searchType === 'userNickname' ? this.queryParams.searchValue : undefined,
223+
userMobile: this.queryParams.searchType === 'userMobile' ? this.queryParams.searchValue : undefined,
224+
receiverName: this.queryParams.searchType === 'receiverName' ? this.queryParams.searchValue : undefined,
225+
receiverMobile: this.queryParams.searchType === 'receiverMobile' ? this.queryParams.searchValue : undefined,
226+
}).then(response => {
227+
this.list = response.data.list;
228+
this.total = response.data.total;
229+
this.loading = false;
230+
});
203231
},
204-
created() {
232+
/** 搜索按钮操作 */
233+
handleQuery() {
234+
this.queryParams.pageNo = 1;
235+
this.activeTab = this.queryParams.status ? this.queryParams.status : 'all'; // 处理 tab
205236
this.getList();
206-
// 设置 statuses 过滤
207-
for (const dict of getDictDatas(DICT_TYPE.TRADE_ORDER_STATUS)) {
208-
this.statusTabs.push({
209-
label: dict.label,
210-
value: dict.value
211-
})
212-
}
213237
},
214-
methods: {
215-
/** 查询列表 */
216-
getList() {
217-
this.loading = true;
218-
// 执行查询
219-
getOrderPage({
220-
...this.queryParams,
221-
searchType: undefined,
222-
searchValue: undefined,
223-
no: this.queryParams.searchType === 'no' ? this.queryParams.searchValue : undefined,
224-
userId: this.queryParams.searchType === 'userId' ? this.queryParams.searchValue : undefined,
225-
userNickname: this.queryParams.searchType === 'userNickname' ? this.queryParams.searchValue : undefined,
226-
userMobile: this.queryParams.searchType === 'userMobile' ? this.queryParams.searchValue : undefined,
227-
receiverName: this.queryParams.searchType === 'receiverName' ? this.queryParams.searchValue : undefined,
228-
receiverMobile: this.queryParams.searchType === 'receiverMobile' ? this.queryParams.searchValue : undefined,
229-
}).then(response => {
230-
this.list = response.data.list;
231-
this.total = response.data.total;
232-
this.loading = false;
233-
});
234-
},
235-
/** 搜索按钮操作 */
236-
handleQuery() {
237-
this.queryParams.pageNo = 1;
238-
this.activeTab = this.queryParams.status ? this.queryParams.status : 'all'; // 处理 tab
239-
this.getList();
240-
},
241-
/** 重置按钮操作 */
242-
resetQuery() {
243-
this.resetForm("queryForm");
244-
this.handleQuery();
245-
},
246-
/** tab 切换 */
247-
tabClick(tab) {
248-
this.queryParams.status = tab.name === 'all' ? undefined : tab.name;
249-
this.getList();
250-
},
251-
goToDetail (row) {
252-
this.$router.push({ path: '/mall/trade/order/detail', query: { orderNo: row.orderNo }})
253-
}
238+
/** 重置按钮操作 */
239+
resetQuery() {
240+
this.resetForm("queryForm");
241+
this.handleQuery();
242+
},
243+
/** tab 切换 */
244+
tabClick(tab) {
245+
this.queryParams.status = tab.name === 'all' ? undefined : tab.name;
246+
this.getList();
247+
},
248+
goToDetail (row) {
249+
this.$router.push({ path: '/mall/trade/order/detail', query: { id: row.id }})
254250
}
255251
}
252+
}
256253
</script>
257254

258255
<style lang="scss" scoped>

0 commit comments

Comments
 (0)