This commit is contained in:
@@ -39,10 +39,10 @@
|
||||
})
|
||||
|
||||
// 合并默认配置和自定义配置
|
||||
const config = reactive({
|
||||
const config = computed(() => ({
|
||||
placeholder: `${t('table.searchBar.searchSelectPlaceholder')}${prop.item.label}`,
|
||||
...(prop.item.config || {})
|
||||
})
|
||||
}))
|
||||
|
||||
// 选择框值变化处理函数
|
||||
const changeValue = (val: unknown): void => {
|
||||
|
||||
@@ -239,7 +239,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { h } from 'vue'
|
||||
import { CommissionService } from '@/api/modules'
|
||||
import { CommissionService, OrderService } from '@/api/modules'
|
||||
import { ElMessage, ElTag } from 'element-plus'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import type {
|
||||
@@ -252,6 +252,7 @@
|
||||
WithdrawalStatus
|
||||
} from '@/types/api/commission'
|
||||
import { WithdrawalMethod } from '@/types/api/commission'
|
||||
import type { Order, OrderQueryParams } from '@/types/api/order'
|
||||
import { WithdrawalStatusMap, WithdrawalMethodMap } from '@/config/constants/commission'
|
||||
import type { SearchFormItem } from '@/types'
|
||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||
@@ -301,6 +302,34 @@
|
||||
// 搜索表单
|
||||
const commissionSearchForm = reactive({ ...initialCommissionSearchState })
|
||||
|
||||
const orderOptions = ref<Order[]>([])
|
||||
const orderSearchLoading = ref(false)
|
||||
let orderSearchRequestId = 0
|
||||
|
||||
const searchCommissionOrders = async (query: string) => {
|
||||
const requestId = ++orderSearchRequestId
|
||||
const orderNo = query.trim()
|
||||
|
||||
orderSearchLoading.value = true
|
||||
try {
|
||||
const params: OrderQueryParams = {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
order_no: orderNo || undefined
|
||||
}
|
||||
const res = await OrderService.getOrders(params)
|
||||
if (res.code === 0 && requestId === orderSearchRequestId) {
|
||||
orderOptions.value = res.data.items || []
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Search commission orders failed:', error)
|
||||
} finally {
|
||||
if (requestId === orderSearchRequestId) {
|
||||
orderSearchLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索表单配置
|
||||
const commissionSearchItems = computed<SearchFormItem[]>(() => [
|
||||
{
|
||||
@@ -352,9 +381,19 @@
|
||||
{
|
||||
label: '订单号',
|
||||
prop: 'order_no',
|
||||
type: 'input',
|
||||
type: 'select',
|
||||
options: () =>
|
||||
orderOptions.value.map((order) => ({
|
||||
label: order.order_no,
|
||||
value: order.order_no
|
||||
})),
|
||||
config: {
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
remote: true,
|
||||
reserveKeyword: true,
|
||||
loading: orderSearchLoading.value,
|
||||
remoteMethod: (query: string) => searchCommissionOrders(query),
|
||||
placeholder: '请输入订单号'
|
||||
}
|
||||
},
|
||||
@@ -933,6 +972,7 @@
|
||||
}
|
||||
loadSummary()
|
||||
getCommissionList()
|
||||
searchCommissionOrders('')
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user