This commit is contained in:
BinBin Song 2025-07-09 23:11:39 +08:00
commit 7bb9f39f49

View File

@ -112,26 +112,76 @@ const onRefresherrefresh = async () => {
//
isTriggered.value = false
}
// const searchVal = ref('')
const searchVal = ref("");
// const dataListDefault = ref([])
// const handleSearch = async () => {
// const code = searchVal.value
// if (code) {
// dataListDefault.value = dataList.value
// dataList.value = dataList.value.filter((e) => {
// return e.code == code
// })
// } else {
// dataList.value = dataListDefault.value
// }
// }
const handleSearch = async (e) => {
queryParams.subOrDetailName = e.inputValue;
queryParams.pageNo = 1;
isFinish.value = false;
dataList.value = [];
await getListData();
};
const handleScan = () => {
uni.scanCode({
success: (res) => {
searchVal.value = res.result
handleSearch({ inputValue: res.result })
},
fail: () => {
uni.showToast({ title: '扫码失败', icon: 'none' })
}
})
}
</script>
<template>
<view class="cont">
<!-- <view class="search" v-if="dataList.length > 5">
<view class="title"></view>
<input class="uni-input" v-model="searchVal" @change="handleSearch" placeholder="根据编号搜索" />
</view> -->
<view class="search" v-if="props.orderState == '0,1'">
<view
style="
width: 100%;
display: flex;
align-items: center;
background: #e2f3ff;
border-radius: 20rpx;
padding: 0 8rpx;
height: 50px;
"
>
<input
class="uni-input"
v-model="searchVal"
placeholder="请输入项目或子项目名称"
:placeholder-style="'color:#28A0F8;'"
style="
flex: 1;
background: transparent;
border: none;
outline: none;
font-size: 25rpx;
color: #28a0f8;
height: 50px;
line-height: 50px;
"
@input="handleSearch({ inputValue: searchVal })"
clearable
/>
<view
style="
background: none;
border: none;
padding: 0 10rpx;
height: 50px;
display: flex;
align-items: center;
"
@click="handleScan"
>
<uni-icons type="scan" size="28" color="#28A0F8"></uni-icons>
</view>
</view>
</view>
<scroll-view enable-back-to-top scroll-y class="data-list" refresher-enabled :refresher-triggered="isTriggered"
@refresherrefresh="onRefresherrefresh" @scrolltolower="getListData">
<view class="item" v-for="item in dataList" :key="item.id" @click="handleDetail(item)">
@ -185,17 +235,24 @@ const onRefresherrefresh = async () => {
<style lang="scss">
//
.search {
padding: 4rpx;
width: 80%;
margin: 30rpx auto;
padding: 0rpx;
width: 90%;
margin: auto;
margin-top: 20rpx;
position: relative;
.uni-input {
border: 1px solid #D1D6DB;
border: 1px solid #d1d6db;
height: 60rpx;
line-height: 60rpx;
padding: 4rpx 10rpx;
font-size: 32rpx;
border-radius: 6rpx;
border-radius: 10rpx;
}
.icons {
width: 30rpx;
position: absolute;
right: 40rpx;
top: 0rpx;
}
}