This commit is contained in:
李远 2026-04-02 18:18:58 +08:00
parent a782aa74c4
commit 3145335e6b
6 changed files with 96 additions and 41 deletions

View File

@ -1,6 +1,11 @@
import { request } from '@/api'; import { request } from '@/api';
// 获取订单列表 // 获取交易订单列表
export const getCustomTradeOrderListApi = (params: any) => { export const getCustomTradeOrderListApi = (params: any) => {
return request.get('/orderRecords/getList', {...params}) return request.get('/orderRecords/getList', {...params})
}
//查询子账户列表
export const getSubAccountListApi = (params: any) => {
return request.get('/user/getAllAccount', {...params})
} }

View File

@ -8,7 +8,7 @@
<!-- 输入框 --> <!-- 输入框 -->
<el-input v-if="item.type === 'input'" v-model="searchForm[item.prop]" <el-input v-if="item.type === 'input'" v-model="searchForm[item.prop]"
:placeholder="item.placeholder || `请输入${item.label}`" :clearable="item.clearable ?? true" :placeholder="item.placeholder || `请输入${item.label}`" :clearable="item.clearable ?? true"
:disabled="item.disabled" /> :disabled="item.disabled" @blur="handleBlur"/>
<!-- 选择器 --> <!-- 选择器 -->
<el-select v-else-if="item.type === 'select'" v-model="searchForm[item.prop]" <el-select v-else-if="item.type === 'select'" v-model="searchForm[item.prop]"
@ -96,7 +96,11 @@ const props = defineProps({
}) })
// //
defineEmits(['search', 'reset']) const emit = defineEmits(['search', 'reset','blur-input'])
// 3. 👇
const handleBlur = () => {
emit('blur-input')
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -2,7 +2,7 @@
<div> <div>
<!-- 搜索 --> <!-- 搜索 -->
<CustomerTradeOrderSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch" <CustomerTradeOrderSearch :search-form="searchForm" :search-options="searchOptions" @search="handleSearch"
@reset="handleReset"> @reset="handleReset" @blur-input="getSubAccountList">
</CustomerTradeOrderSearch> </CustomerTradeOrderSearch>
<div class="bar" v-if="searchForm.orderId === '1'"> <div class="bar" v-if="searchForm.orderId === '1'">
<div>持仓量:0</div> <div>持仓量:0</div>
@ -14,7 +14,7 @@
<!-- 分页 --> <!-- 分页 -->
<CustomerTradeOrderPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total" <CustomerTradeOrderPagination v-model="currentPage" v-model:pageSizeValue="pageSize" :total="total"
@pagination-change="handlePaginationChange" /> @pagination-change="handlePaginationChange" />
</div> </div>
</template> </template>
@ -28,10 +28,9 @@ import CustomerTradeOrderPagination from '@/components/common/Pagination.vue'
import { search, tradeOrderTableColumns, positionOrderTableColumns } from './options' import { search, tradeOrderTableColumns, positionOrderTableColumns } from './options'
// //
import { getCustomTradeOrderListApi } from '@/api/modules/agent/customerTradeOrder' import { getCustomTradeOrderListApi, getSubAccountListApi } from '@/api/modules/agent/customerTradeOrder'
//
import { getStorage } from '@/utils/storage'
// //
@ -44,8 +43,13 @@ const searchForm = ref({
tradeType: '', tradeType: '',
startTime: '', startTime: '',
endTime: '', endTime: '',
subAccountName: '',
}) })
const searchOptions = ref(search) const searchOptions = ref(search)
const subAccountOptions = ref([])
//
const userInfo: any = getStorage('userInfo')
/** /**
* @description: 定义表格数据 * @description: 定义表格数据
*/ */
@ -67,12 +71,13 @@ const getCustomerTradeOrderList = async () => {
page: currentPage.value, page: currentPage.value,
page_size: pageSize.value, page_size: pageSize.value,
user_name: searchForm.value.accountName, user_name: searchForm.value.accountName,
account_id: searchForm.value.accountName, account_id: searchForm.value.subAccountName,
order_no: '', order_no: '',
type: searchForm.value.tradeType, type: searchForm.value.tradeType,
start_time: searchForm.value.startTime.length > 0 ? `${searchForm.value.startTime} 0:00:00` : '2026-01-01 0:00:00', start_time: '',
end_time: searchForm.value.endTime.length > 0 ? `${searchForm.value.endTime} 23:59:59` : '2026-01-01 23:59:59', end_time: '',
} }
console.log(params)
const data: any = await getCustomTradeOrderListApi(params) const data: any = await getCustomTradeOrderListApi(params)
// //
@ -94,12 +99,39 @@ const getCustomerTradeOrderList = async () => {
currentPage.value = data.current_page currentPage.value = data.current_page
pageSize.value = Number(data.per_page) pageSize.value = Number(data.per_page)
} }
const getSubAccountList = async () => {
const accountName = searchForm.value.accountName
//
if (!accountName) {
subAccountOptions.value = []
searchForm.value.subAccountName = ''
return
}
try {
const params = {
username: userInfo.username === searchForm.value.accountName ? '' : accountName,
}
const data: any = await getSubAccountListApi(params)
subAccountOptions.value = data.map((item: any) => ({
label: item.name || item.account_name, //
value: item.id || item.account_id //
}))
searchOptions.value.find(item => item.prop === 'subAccountName')!.options = subAccountOptions.value
} catch (error) {
subAccountOptions.value = []
console.error('获取子账户失败', error)
}
}
/** /**
* @description: 页面加载完成需要请求的数据 * @description: 页面加载完成需要请求的数据
*/ */
onMounted(() => { onMounted(() => {
getCustomerTradeOrderList() getCustomerTradeOrderList()
}) })
/** /**
* @description: 定义搜索方法 * @description: 定义搜索方法
*/ */
@ -113,6 +145,7 @@ const handleReset = () => {
tradeType: '', tradeType: '',
startTime: '', startTime: '',
endTime: '', endTime: '',
subAccountName: '',
} }
getCustomerTradeOrderList() getCustomerTradeOrderList()
} }

View File

@ -2,14 +2,7 @@
* @description: * @description:
*/ */
export const search = [ export const search = [
// 账户名 // 订单类型
{
label: '账户名',
prop: 'accountName',
type: 'input' as const,
placeholder: '请输入账户名',
width: '140px'
},
{ {
label: '订单', label: '订单',
prop: 'orderId', prop: 'orderId',
@ -26,6 +19,23 @@ export const search = [
], ],
width: '140px' width: '140px'
}, },
// 账户名
{
label: '账户名',
prop: 'accountName',
type: 'input' as const,
placeholder: '请输入账户名',
width: '140px'
},
// 子账号
{
label: '子账号',
prop: 'subAccountName',
type: 'select' as const,
placeholder: '请选择子账号',
width: '140px',
options: []
},
// 选择交易类型 // 选择交易类型
{ {
label: '交易类型', label: '交易类型',
@ -47,18 +57,18 @@ export const search = [
], ],
width: '140px' width: '140px'
}, },
// 开始时间 // // 开始时间
{ // {
prop: "startTime", label: '注册开始时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器 // prop: "startTime", label: '注册开始时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器
valueFormat: 'YYYY-MM-DD', // valueFormat: 'YYYY-MM-DD',
width: '140px' // width: '140px'
}, // },
// 结束时间 // // 结束时间
{ // {
prop: "endTime", label: '注册结束时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器 // prop: "endTime", label: '注册结束时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器
valueFormat: 'YYYY-MM-DD', // valueFormat: 'YYYY-MM-DD',
width: '140px' // width: '140px'
}, // },
] ]
/** /**

View File

@ -9,15 +9,15 @@ export const search = [
//账号 //账号
{ prop: 'account', label: '账号', type: 'select' as const, placeholder: '请选择账号',width: '150px' }, { prop: 'account', label: '账号', type: 'select' as const, placeholder: '请选择账号',width: '150px' },
//开始时间 //开始时间
{ // {
prop: 'startTime', label: '开始时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器 // prop: 'startTime', label: '开始时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器
valueFormat: 'YYYY-MM-DD', placeholder: '请选择开始时间', width: '150px' // valueFormat: 'YYYY-MM-DD', placeholder: '请选择开始时间', width: '150px'
}, // },
//结束时间 // //结束时间
{ // {
prop: 'endTime', label: '结束时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器 // prop: 'endTime', label: '结束时间', type: 'date' as const, dateType: 'date' as const, // 时间范围选择器
valueFormat: 'YYYY-MM-DD', placeholder: '请选择结束时间', width: '150px' // valueFormat: 'YYYY-MM-DD', placeholder: '请选择结束时间', width: '150px'
}, // },
] ]
export const tableColumns = [ export const tableColumns = [

View File

@ -76,5 +76,8 @@ export default defineConfig(({ mode }) => {
// }, // },
// } : {}, // } : {},
}, },
server: {
host: true,
},
} }
}) })