feat(用户道具流水): 搜索功能参数调整

This commit is contained in:
hzj 2026-02-28 15:30:53 +08:00
parent 81a77fbf87
commit e1fd24328e

View File

@ -1,6 +1,7 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<div class="filter-container"> <div class="filter-container">
<!-- 选择内容 -->
<div class="filter-item"> <div class="filter-item">
<el-autocomplete <el-autocomplete
v-model="listQuery.origin" v-model="listQuery.origin"
@ -11,16 +12,21 @@
@select="handleSelect" @select="handleSelect"
@clear="handleSelect" @clear="handleSelect"
> >
<i <i slot="suffix" class="el-icon-edit el-input__icon" />
slot="suffix"
class="el-icon-edit el-input__icon"
/>
<template slot-scope="{ item }"> <template slot-scope="{ item }">
<span :label="item.name">{{ item.name }}</span> <span :label="item.name">{{ item.name }}</span>
<div :key="item.value" :value="item.value" style="font-size:12px; color:#d8d0d0">{{ item.value }}</div> <div
:key="item.value"
:value="item.value"
style="font-size:12px; color:#d8d0d0"
>
{{ item.value }}
</div>
</template> </template>
</el-autocomplete> </el-autocomplete>
</div> </div>
<!-- 道具ID -->
<el-input <el-input
v-model.trim="listQuery.propsId" v-model.trim="listQuery.propsId"
v-number v-number
@ -28,13 +34,18 @@
style="width: 200px;" style="width: 200px;"
class="filter-item" class="filter-item"
/> />
<!-- 购买人ID -->
<div class="filter-item"> <div class="filter-item">
<account-input v-model="listQuery.buyerId" placeholder="购买人ID" /> <account-input v-model="listQuery.buyerId" placeholder="购买人ID" />
</div> </div>
<!-- 接收人ID -->
<div class="filter-item"> <div class="filter-item">
<account-input v-model="listQuery.receiverId" placeholder="接收人ID" /> <account-input v-model="listQuery.receiverId" placeholder="接收人ID" />
</div> </div>
<!-- 时间范围 -->
<div class="filter-item"> <div class="filter-item">
<el-date-picker <el-date-picker
v-model="rangeDate" v-model="rangeDate"
@ -46,6 +57,8 @@
end-placeholder="创建日期结束" end-placeholder="创建日期结束"
/> />
</div> </div>
<!-- 搜索按钮 -->
<el-button <el-button
class="filter-item" class="filter-item"
type="primary" type="primary"
@ -54,8 +67,9 @@
> >
搜索 搜索
</el-button> </el-button>
</div> </div>
<!-- 表单 -->
<el-table <el-table
v-loading="listLoading" v-loading="listLoading"
:data="list" :data="list"
@ -63,19 +77,46 @@
fit fit
highlight-current-row highlight-current-row
> >
<!-- 流水ID -->
<!-- <el-table-column prop="id" label="流水ID" align="center" /> --> <!-- <el-table-column prop="id" label="流水ID" align="center" /> -->
<!-- 购买人 -->
<el-table-column label="购买人" align="center" min-width="200"> <el-table-column label="购买人" align="center" min-width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<user-table-exhibit :user-profile="scope.row.buyerUserProfile" :query-details="true" /> <user-table-exhibit
:user-profile="scope.row.buyerUserProfile"
:query-details="true"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="propsCandy" label="金额" align="center" min-width="100" />
<!-- 金额 -->
<el-table-column
prop="propsCandy"
label="金额"
align="center"
min-width="100"
/>
<!-- 接收人信息 -->
<el-table-column label="接收人" align="center" min-width="200"> <el-table-column label="接收人" align="center" min-width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<user-table-exhibit :user-profile="scope.row.receiverUserProfile" :query-details="true" /> <user-table-exhibit
:user-profile="scope.row.receiverUserProfile"
:query-details="true"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="propsOriginDesc" label="来源描述" align="center" min-width="200" />
<!-- 来源 -->
<el-table-column
prop="propsOriginDesc"
label="来源描述"
align="center"
min-width="200"
/>
<!-- 封面 -->
<el-table-column label="封面" align="center" min-width="80"> <el-table-column label="封面" align="center" min-width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<el-image <el-image
@ -84,14 +125,37 @@
/> />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="propsId" label="道具ID" align="center" min-width="200" />
<el-table-column prop="propsName" label="道具名称" align="center" min-width="200" /> <!-- 道具ID -->
<el-table-column prop="createTime" label="创建时间" align="center" width="200"> <el-table-column
prop="propsId"
label="道具ID"
align="center"
min-width="200"
/>
<!-- 道具名称 -->
<el-table-column
prop="propsName"
label="道具名称"
align="center"
min-width="200"
/>
<!-- 创建时间 -->
<el-table-column
prop="createTime"
label="创建时间"
align="center"
width="200"
>
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.createTime | dateFormat }} {{ scope.row.createTime | dateFormat }}
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页组件 -->
<pagination <pagination
v-show="total > 0" v-show="total > 0"
:total="total" :total="total"
@ -100,28 +164,28 @@
@pagination="renderData" @pagination="renderData"
/> />
<!-- 用户详情组件 -->
<user-deatils-drawer <user-deatils-drawer
v-if="userDeatilsDrawer" v-if="userDeatilsDrawer"
:user-id="thatSelectedUserId" :user-id="thatSelectedUserId"
@close="userDeatilsDrawer=false" @close="userDeatilsDrawer = false"
/> />
</div> </div>
</template> </template>
<script> <script>
import { userPropsTable } from '@/api/user' import { userPropsTable } from "@/api/user";
import Pagination from '@/components/Pagination' import Pagination from "@/components/Pagination";
import { pickerOptions } from '@/constant/el-const' import { pickerOptions } from "@/constant/el-const";
import { propsOrigins } from '@/constant/type' import { propsOrigins } from "@/constant/type";
export default { export default {
name: 'UserPropsTable', name: "UserPropsTable",
components: { Pagination }, components: { Pagination },
data() { data() {
return { return {
thatRow: {}, thatRow: {},
userDeatilsDrawer: false, userDeatilsDrawer: false,
thatSelectedUserId: '', thatSelectedUserId: "",
pickerOptions, pickerOptions,
propsOrigins, propsOrigins,
list: [], list: [],
@ -130,15 +194,15 @@ export default {
listQuery: { listQuery: {
cursor: 1, cursor: 1,
limit: 20, limit: 20,
startCreateDate: '', startTime: "",
endCreateDate: '', endTime: "",
buyerAccount: '', buyerAccount: "",
receiverAccount: '', receiverAccount: "",
origin: '' origin: ""
}, },
listLoading: true, listLoading: true,
rangeDate: '' rangeDate: ""
} };
}, },
watch: { watch: {
rangeDate: { rangeDate: {
@ -146,59 +210,68 @@ export default {
deep: true, deep: true,
handler(newVal) { handler(newVal) {
if (newVal && newVal.length > 0) { if (newVal && newVal.length > 0) {
this.listQuery.startCreateDate = newVal[0] this.listQuery.startTime = newVal[0];
this.listQuery.endCreateDate = newVal[1] this.listQuery.endTime = newVal[1];
return return;
} }
this.listQuery.startCreateDate = '' this.listQuery.startTime = "";
this.listQuery.endCreateDate = '' this.listQuery.endTime = "";
} }
} }
}, },
created() { created() {
this.renderData(true) this.renderData(true);
}, },
methods: { methods: {
handleImageUrl(row) { handleImageUrl(row) {
return row.propsCover ? row.propsCover : '' return row.propsCover ? row.propsCover : "";
}, },
renderData(isReset) { renderData(isReset) {
const that = this const that = this;
if (isReset === true) { if (isReset === true) {
that.listQuery.cursor = 1 that.listQuery.cursor = 1;
} }
that.listLoading = true that.listLoading = true;
userPropsTable(that.listQuery).then(res => { userPropsTable(that.listQuery).then(res => {
const { body } = res const { body } = res;
that.total = body.total || 0 that.total = body.total || 0;
that.list = body.records that.list = body.records;
that.listLoading = false that.listLoading = false;
}) });
}, },
queryUserDetails(userId) { queryUserDetails(userId) {
this.userDeatilsDrawer = true this.userDeatilsDrawer = true;
this.thatSelectedUserId = userId this.thatSelectedUserId = userId;
}, },
handleSearch() { handleSearch() {
if (this.listQuery.origin !== '') { if (this.listQuery.origin !== "") {
const origins = this.propsOrigins.filter(this.createFilter(this.listQuery.origin)) const origins = this.propsOrigins.filter(
this.listQuery.origin = origins.length > 0 ? origins[0].value : this.listQuery.origin this.createFilter(this.listQuery.origin)
);
this.listQuery.origin =
origins.length > 0 ? origins[0].value : this.listQuery.origin;
} }
this.renderData(true) this.renderData(true);
}, },
querySearch(queryString, cb) { querySearch(queryString, cb) {
var restaurants = this.propsOrigins var restaurants = this.propsOrigins;
var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants var results = queryString
cb(results) ? restaurants.filter(this.createFilter(queryString))
: restaurants;
cb(results);
}, },
handleSelect(item) { handleSelect(item) {
this.renderData(true) this.renderData(true);
}, },
createFilter(queryString) { createFilter(queryString) {
return (restaurant) => { return restaurant => {
return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) >= 0) || (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) >= 0) return (
} restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) >=
0 ||
restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) >= 0
);
};
} }
} }
} };
</script> </script>