order:完善订单聚合搜索

(cherry picked from commit 615763d415)
This commit is contained in:
puhui999 2023-09-09 23:08:28 +08:00 committed by shizhong
parent 2e4cad38bb
commit 4dda8d2ab7

View File

@ -104,13 +104,19 @@
<el-form-item label="聚合搜索"> <el-form-item label="聚合搜索">
<el-input <el-input
v-show="true" v-show="true"
v-model="queryType.v" v-model="queryParams[queryType.k]"
class="!w-280px" class="!w-280px"
clearable clearable
placeholder="请输入" placeholder="请输入"
> >
<template #prepend> <template #prepend>
<el-select v-model="queryType.k" class="!w-110px" clearable placeholder="全部"> <el-select
v-model="queryType.k"
class="!w-110px"
clearable
placeholder="全部"
@change="inputChangeSelect"
>
<el-option <el-option
v-for="dict in searchList" v-for="dict in searchList"
:key="dict.value" :key="dict.value"
@ -335,41 +341,41 @@ const total = ref(2) // 列表的总页数
const list = ref<TradeOrderApi.OrderVO[]>([]) // const list = ref<TradeOrderApi.OrderVO[]>([]) //
const queryFormRef = ref<FormInstance>() // const queryFormRef = ref<FormInstance>() //
// //
const queryParams = reactive({ const queryParams = ref({
pageNo: 1, // pageNo: 1, //
pageSize: 10, // pageSize: 10, //
no: '', status: null, //
userId: '', payChannelCode: null, //
userNickname: '', createTime: null, //
userMobile: '', terminal: null, //
receiverName: '', type: null, //
receiverMobile: '', deliveryType: null, //
logisticsId: null, //
terminal: '', pickUpStoreId: null //
type: null,
status: null,
payChannelCode: '',
createTime: [],
deliveryType: null,
spuName: '',
itemCount: '',
pickUpStoreId: [],
logisticsId: null,
all: ''
}) })
const queryType = reactive({ k: '', v: '' }) // kv const queryType = reactive({ k: '' }) // k
/**
* 订单聚合搜索 // select
* 商品名称商品件数全部
*
* 需要后端支持 TODO
*/
const searchList = ref([ const searchList = ref([
{ value: 'no', label: '订单号' }, { value: 'no', label: '订单号' },
{ value: 'userId', label: '用户UID' }, { value: 'userId', label: '用户UID' },
{ value: 'userNickname', label: '用户昵称' }, { value: 'userNickname', label: '用户昵称' },
{ value: 'userMobile', label: '用户电话' } { value: 'userMobile', label: '用户电话' }
]) ])
/**
* 聚合搜索切换查询对象时触发
* @param val
*/
const inputChangeSelect = (val: string) => {
searchList.value
.filter((item) => item.value !== val)
?.forEach((item1) => {
//
if (queryParams.value.hasOwnProperty(item1.value)) {
delete queryParams.value[item1.value]
}
})
}
const headerStyle = ({ row, columnIndex }: any) => { const headerStyle = ({ row, columnIndex }: any) => {
// 8 // 8
@ -417,7 +423,7 @@ const spanMethod = ({ row, rowIndex, columnIndex }: SpanMethodProps) => {
const getList = async () => { const getList = async () => {
loading.value = true loading.value = true
try { try {
const data = await TradeOrderApi.getOrderPage(queryParams) const data = await TradeOrderApi.getOrderPage(unref(queryParams))
list.value = data.list list.value = data.list
total.value = data.total total.value = data.total
} finally { } finally {
@ -427,13 +433,25 @@ const getList = async () => {
/** 搜索按钮操作 */ /** 搜索按钮操作 */
const handleQuery = async () => { const handleQuery = async () => {
queryParams.pageNo = 1 queryParams.value.pageNo = 1
await getList() await getList()
} }
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = () => { const resetQuery = () => {
queryFormRef.value?.resetFields() queryFormRef.value?.resetFields()
queryParams.value = {
pageNo: 1, //
pageSize: 10, //
status: null, //
payChannelCode: null, //
createTime: null, //
terminal: null, //
type: null, //
deliveryType: null, //
logisticsId: null, //
pickUpStoreId: null //
}
handleQuery() handleQuery()
} }