code review:订单列表

pull/174/head^2
YunaiV 2023-06-17 21:02:29 +08:00
parent 867c47de61
commit e3f250fff0
4 changed files with 100 additions and 99 deletions

View File

@ -1,6 +1,7 @@
import request from '@/config/axios' import request from '@/config/axios'
// 获得交易订单分页 // 获得交易订单分页
// TODO @xiaobai改成 getOrderPage
export const getOrderList = (params: PageParam) => { export const getOrderList = (params: PageParam) => {
return request.get({ url: '/trade/order/page', params }) return request.get({ url: '/trade/order/page', params })
} }

View File

@ -1,3 +1,6 @@
// TODO @xiaobai这个放到 order/index.ts 里哈
// TODO @xiaobai注释放到变量后面这样简洁一点
// TODO @xiaobai这个改成 TradeOrderRespVO
export interface TradeOrderPageItemRespVO { export interface TradeOrderPageItemRespVO {
// 订单编号 // 订单编号
id: number id: number
@ -85,6 +88,7 @@ export interface TradeOrderPageItemRespVO {
items: TradeOrderItemBaseVO[] items: TradeOrderItemBaseVO[]
} }
// TODO @xiaobai这个改成 TradeOrderItemRespVO
/** /**
* Base VO VO 使 * Base VO VO 使
* VO Swagger * VO Swagger

View File

@ -156,6 +156,13 @@ export enum DICT_TYPE {
// ========== MALL - 交易模块 ========== // ========== MALL - 交易模块 ==========
EXPRESS_CHARGE_MODE = 'trade_delivery_express_charge_mode', //快递的计费方式 EXPRESS_CHARGE_MODE = 'trade_delivery_express_charge_mode', //快递的计费方式
TRADE_AFTER_SALE_STATUS = 'trade_after_sale_status', // 售后 - 状态
TRADE_AFTER_SALE_WAY = 'trade_after_sale_way', // 售后 - 方式
TRADE_AFTER_SALE_TYPE = 'trade_after_sale_type', // 售后 - 类型
TRADE_ORDER_TYPE = 'trade_order_type', // 订单 - 类型
TRADE_ORDER_STATUS = 'trade_order_status', // 订单 - 状态
TRADE_ORDER_ITEM_AFTER_SALE_STATUS = 'trade_order_item_after_sale_status', // 订单项 - 售后状态
TERMINAL = 'terminal', // 终端
// ========== MALL - 营销模块 ========== // ========== MALL - 营销模块 ==========
PROMOTION_DISCOUNT_TYPE = 'promotion_discount_type', // 优惠类型 PROMOTION_DISCOUNT_TYPE = 'promotion_discount_type', // 优惠类型
@ -164,16 +171,5 @@ export enum DICT_TYPE {
PROMOTION_COUPON_STATUS = 'promotion_coupon_status', // 优惠劵的状态 PROMOTION_COUPON_STATUS = 'promotion_coupon_status', // 优惠劵的状态
PROMOTION_COUPON_TAKE_TYPE = 'promotion_coupon_take_type', // 优惠劵的领取方式 PROMOTION_COUPON_TAKE_TYPE = 'promotion_coupon_take_type', // 优惠劵的领取方式
PROMOTION_ACTIVITY_STATUS = 'promotion_activity_status', // 优惠活动的状态 PROMOTION_ACTIVITY_STATUS = 'promotion_activity_status', // 优惠活动的状态
PROMOTION_CONDITION_TYPE = 'promotion_condition_type', // 营销的条件类型枚举 PROMOTION_CONDITION_TYPE = 'promotion_condition_type' // 营销的条件类型枚举
//===add by 20230530====
// ========== MALL - ORDER 模块 ==========
TRADE_AFTER_SALE_STATUS = 'trade_after_sale_status', // 售后 - 状态
TRADE_AFTER_SALE_WAY = 'trade_after_sale_way', // 售后 - 方式
TRADE_AFTER_SALE_TYPE = 'trade_after_sale_type', // 售后 - 类型
TRADE_ORDER_TYPE = 'trade_order_type', // 订单 - 类型
TRADE_ORDER_STATUS = 'trade_order_status', // 订单 - 状态
TRADE_ORDER_ITEM_AFTER_SALE_STATUS = 'trade_order_item_after_sale_status', // 订单项 - 售后状态
TERMINAL = 'terminal'
} }

View File

@ -64,9 +64,8 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="订单搜索" prop="searchValue"> <el-form-item label="订单搜索" prop="searchValue">
<!-- item绑定2个变量用于reset时没法重置 --> <!-- item 绑定 2 个变量用于 reset 时没法重置 -->
<el-form-item class="!w-280px" prop="searchType"> <el-form-item class="!w-280px" prop="searchType">
<el-input <el-input
class="!w-280px" class="!w-280px"
@ -101,7 +100,7 @@
<Icon class="mr-5px" icon="ep:refresh" /> <Icon class="mr-5px" icon="ep:refresh" />
重置 重置
</el-button> </el-button>
<!-- v-hasPermi="['trade:order:export']" <!-- v-hasPermi="['trade:order:export']" TODO 待开发
需要将选中的数据存入orderSelect.multipleSelection中 需要将选中的数据存入orderSelect.multipleSelection中
需要考虑全选时数据如何处理--> 需要考虑全选时数据如何处理-->
<el-button type="success" plain @click="handleExport" :loading="exportLoading"> <el-button type="success" plain @click="handleExport" :loading="exportLoading">
@ -110,9 +109,9 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
<!-- 表格 -->
<!-- 列表 -->
<ContentWrap> <ContentWrap>
<!-- 表单 -->
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column type="expand" fixed="left"> <el-table-column type="expand" fixed="left">
<template #default="scope"> <template #default="scope">
@ -136,7 +135,6 @@
<template #header> <template #header>
<el-dropdown icon="eq:search" @command="handleDropType"> <el-dropdown icon="eq:search" @command="handleDropType">
<el-button link type="primary">全选({{ orderSelect.checkTotal }}) </el-button> <el-button link type="primary">全选({{ orderSelect.checkTotal }}) </el-button>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item command="1">当前页</el-dropdown-item> <el-dropdown-item command="1">当前页</el-dropdown-item>
@ -162,7 +160,6 @@
<dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="scope.row.type" /> <dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="scope.row.type" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="订单来源" align="center" min-width="100"> <el-table-column label="订单来源" align="center" min-width="100">
<template #default="scope"> <template #default="scope">
<dict-tag <dict-tag
@ -173,8 +170,8 @@
<span v-else>{{ scope.terminal }}</span> <span v-else>{{ scope.terminal }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="用户信息" align="center" min-width="100">
<el-table-column label="用户信息(id)" align="center" min-width="100"> <!-- TODO xiaobai展示昵称跳转到用户详情 -->
<template #default="scope"> <template #default="scope">
<el-button link type="primary" @click="goUserDetail(scope.row)">{{ <el-button link type="primary" @click="goUserDetail(scope.row)">{{
scope.row.userId scope.row.userId
@ -207,6 +204,7 @@
<div v-for="item in scope.row.items" :key="item"> <div v-for="item in scope.row.items" :key="item">
<div> <div>
<p>{{ item.spuName }}</p> <p>{{ item.spuName }}</p>
<!-- TODO @xiaobai不用 parseFloat 操作直接 / 100.0 -->
<p>{{ <p>{{
'¥ ' + parseFloat(item.payPrice / 100).toFixed(2) + '元 x ' + item.count '¥ ' + parseFloat(item.payPrice / 100).toFixed(2) + '元 x ' + item.count
}}</p> }}</p>
@ -215,7 +213,6 @@
</el-popover> </el-popover>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="实际支付(元)" align="center" prop="payPrice" min-width="100"> <el-table-column label="实际支付(元)" align="center" prop="payPrice" min-width="100">
<template #default="scope"> <template #default="scope">
{{ '¥ ' + parseFloat(scope.row.payPrice / 100).toFixed(2) }} {{ '¥ ' + parseFloat(scope.row.payPrice / 100).toFixed(2) }}
@ -228,6 +225,7 @@
prop="payTime" prop="payTime"
min-width="180" min-width="180"
/> />
<!-- TODO @xiaobai增加一个 createTime 时间的展示 -->
<el-table-column label="支付类型" align="center" min-width="100" prop="payChannelCode"> <el-table-column label="支付类型" align="center" min-width="100" prop="payChannelCode">
<template #default="scope"> <template #default="scope">
<dict-tag <dict-tag
@ -239,8 +237,9 @@
</el-table-column> </el-table-column>
<el-table-column label="订单状态" align="center" prop="status" min-width="100"> <el-table-column label="订单状态" align="center" prop="status" min-width="100">
<template #default="scope"> <template #default="scope">
<!-- TODO @xiaobai不用做判断直接 dict-tag 渲染就好列 -->
<dict-tag <dict-tag
v-if="scope.row.status == ''" v-if="scope.row.status === ''"
:type="DICT_TYPE.TRADE_ORDER_STATUS" :type="DICT_TYPE.TRADE_ORDER_STATUS"
:value="scope.row.status" :value="scope.row.status"
/> />
@ -249,17 +248,16 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" fixed="right" min-width="150"> <el-table-column label="操作" align="center" fixed="right" min-width="150">
<template #default="scope"> <template #default="scope">
<el-button v-if="scope.row.status == '0'" link type="primary" @click="sendXX(scope.row)" <el-button v-if="scope.row.status === 0" link type="primary" @click="sendXX(scope.row)">
>待支付</el-button 待支付
> </el-button>
<el-button v-if="scope.row.status == '10'" link type="primary" @click="sendXX(scope.row)" <el-button v-if="scope.row.status === 10" link type="primary" @click="sendXX(scope.row)">
>发货</el-button 发货
> </el-button>
<el-button link type="primary" @click="showOrderDetail(scope.row)"></el-button> <el-button link type="primary" @click="showOrderDetail(scope.row)"></el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页 --> <!-- 分页 -->
<Pagination <Pagination
v-model:limit="queryParams.pageSize" v-model:limit="queryParams.pageSize"
@ -279,7 +277,8 @@ import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
import * as TradeOrderApi from '@/api/mall/trade/order' import * as TradeOrderApi from '@/api/mall/trade/order'
import { dateFormatter, formatDate } from '@/utils/formatTime' import { dateFormatter, formatDate } from '@/utils/formatTime'
import download from '@/utils/download' import download from '@/utils/download'
// import TradeOrderDetail from './tradeOrderDetail.vue' const message = useMessage() //
const { push } = useRouter() //
interface CurrentType { interface CurrentType {
checkTotal: number // checkTotal: number //
currentType: string //, 0-noPage 1-currentPage 2-allPage currentType: string //, 0-noPage 1-currentPage 2-allPage
@ -295,24 +294,17 @@ const orderSelect: CurrentType = reactive({
pageNoList: [] pageNoList: []
}) })
const message = useMessage() const loading = ref(false) //
const total = ref(0) //
const { push } = useRouter() const list = ref<any>([]) //
const queryFormRef = ref() // const queryFormRef = ref() //
const queryParams = ref({ const queryParams = ref({
pageNo: 1, // pageNo: 1, //
pageSize: 10, // pageSize: 10, //
tabIndex: 0 // tabIndex: 0 //
}) })
const exportLoading = ref(false) //
const loading = ref(false) //
const exportLoading = ref(false)
//
const total = ref(0)
//
const list = ref<any>([])
//
const searchList = ref([ const searchList = ref([
{ {
value: 'orderNo', value: 'orderNo',
@ -323,19 +315,19 @@ const searchList = ref([
label: '用户UID' label: '用户UID'
}, },
{ {
value: 'userName', value: 'userName', // TODO @xiaobaiuserNickname
label: '用户姓名' label: '用户姓名'
}, },
{ {
value: 'userTel', value: 'userTel', // TODO @xiaobaiuserMobile
label: '用户电话' label: '用户电话'
}, },
{ {
value: 'itemName', value: 'itemName', // TODO @xiaobai
label: '商品名称' label: '商品名称'
}, },
{ {
value: 'itemCount', value: 'itemCount', // TODO @xiaobai
label: '商品件数' label: '商品件数'
} }
]) ])
@ -344,6 +336,7 @@ const imgViewVisible = ref(false) // 商品图预览
const imageViewerList = ref<string[]>([]) // const imageViewerList = ref<string[]>([]) //
// TODO @xiaobai
/**当前页 所有页 暂不考虑数据本地化 会导致选中当前页 从后台重新拉取数据时出现数据不一致*/ /**当前页 所有页 暂不考虑数据本地化 会导致选中当前页 从后台重新拉取数据时出现数据不一致*/
const handleDropType = (command: string) => { const handleDropType = (command: string) => {
orderSelect.currentType = command orderSelect.currentType = command
@ -408,51 +401,8 @@ const handcheckclick = (row: any) => {
orderSelect.checkTotal = orderSelect.checkTotal + 1 orderSelect.checkTotal = orderSelect.checkTotal + 1
} }
} }
/**
* 导出数据
*/
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
//TODO(?)
download.excel(orderSelect.multipleSelection as any, '订单信息.xls') //
} catch {
} finally {
exportLoading.value = false
}
//TODO
exportLoading.value = false
}
/** 搜索按钮操作 */
const handleQuery = () => {
//
orderSelect.checkTotal = 0
orderSelect.currentType = '0'
orderSelect.multipleSelection = []
orderSelect.pageNoList = []
orderSelect.selectAll = false
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
//
orderSelect.checkTotal = 0
orderSelect.currentType = '0'
orderSelect.multipleSelection = []
orderSelect.pageNoList = []
orderSelect.selectAll = false
queryFormRef.value.resetFields()
handleQuery()
}
/** 查询列表 */
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
try { try {
@ -480,27 +430,77 @@ const getList = async () => {
} }
} }
/** 搜索按钮操作 */
const handleQuery = () => {
//
orderSelect.checkTotal = 0
orderSelect.currentType = '0'
orderSelect.multipleSelection = []
orderSelect.pageNoList = []
orderSelect.selectAll = false
// queryParams.pageNo = 1 TODO @xiaobai
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
//
orderSelect.checkTotal = 0
orderSelect.currentType = '0'
orderSelect.multipleSelection = []
orderSelect.pageNoList = []
orderSelect.selectAll = false
queryFormRef.value.resetFields()
handleQuery()
}
/**
* 导出数据
*/
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
//TODO(?)
download.excel(orderSelect.multipleSelection as any, '订单信息.xls') //
} catch {
} finally {
exportLoading.value = false
}
//TODO
exportLoading.value = false
}
/** /**
* 跳转订单详情 * 跳转订单详情
*/ */
const showOrderDetail = (row: any) => { const showOrderDetail = (row: any) => {
console.log('TODO Order Detail: ' + row.id) push({
push({ name: 'TradeOrderDetail', query: { id: row.id } }) name: 'TradeOrderDetail',
query: {
id: row.id
}
})
} }
/** /**
* 跳转用户详情 * 跳转用户详情 TODO
*/ */
const goUserDetail = (row: any) => { const goUserDetail = (row: any) => {
console.log('TODO User Detail: ' + row.userId) console.log('TODO User Detail: ' + row.userId)
} }
/** /**
* 发货 * 发货 TODO
*/ */
const sendXX = (row: any) => { const sendXX = (row: any) => {
console.log('TODO Send XX: ' + row.no) console.log('TODO Send XX: ' + row.no)
} }
// TOPDO @xiaobaihttps://kailong110120130.gitee.io/vue-element-plus-admin-doc/components/image-viewer.html 使
/** /**
* 商品图预览 * 商品图预览
* @param imgUrl * @param imgUrl