|
|
@@ -25,7 +25,8 @@
|
|
|
</view>
|
|
|
<button class="admin-button-com middle" @click="changeSearchStyle()">{{searchStyle==0?'客户':'编号'}}</button>
|
|
|
<view class="search-container">
|
|
|
- <AppSearchModule placeholder="填写" v-model="searchText" @input="searchFn"/>
|
|
|
+ <AppSearchModule ref="searchRef" placeholder="填写" v-model="searchText" @input="searchFn"/>
|
|
|
+ <view v-if="customId != 0" class="search-clear-overlay" @click.stop="clearFn">清空</view>
|
|
|
</view>
|
|
|
<button class="admin-button-com middle blue filter-btn" @click.stop="openFilterPanel">
|
|
|
筛选
|
|
|
@@ -208,6 +209,8 @@ export default {
|
|
|
repeat:-1,
|
|
|
searchStyle:0,//0客户 1编号
|
|
|
searchText:'',
|
|
|
+ lastSearchText:'',
|
|
|
+ searchKey: 0,
|
|
|
// 面板相关
|
|
|
showFilterPanel: false,
|
|
|
repeatOptions: [
|
|
|
@@ -255,6 +258,11 @@ export default {
|
|
|
this.getOrderList()
|
|
|
this.refreshPage = 0
|
|
|
}
|
|
|
+
|
|
|
+ // 重置搜索
|
|
|
+ if (this.customId !== 0) {
|
|
|
+ this.clearFn()
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
// 面板相关
|
|
|
@@ -301,11 +309,22 @@ export default {
|
|
|
searchFn(e) {
|
|
|
let that = this
|
|
|
if(this.searchStyle == 0){
|
|
|
+ // 首次点击搜索框:searchText 为空,lastSearchText 也为空 → 跳过搜索
|
|
|
+ if (this.$util.isEmpty(this.searchText) && this.$util.isEmpty(this.lastSearchText)) {
|
|
|
+ // console.log('000001')
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ // console.log('000002')
|
|
|
+ }
|
|
|
+
|
|
|
if(that.$util.isEmpty(e)){
|
|
|
that.showSearch = false
|
|
|
- that.searchList = []
|
|
|
+ that.searchList = []
|
|
|
+ // console.log('111 空 111')
|
|
|
}else{
|
|
|
- getList({ page:1,name:e,type:0}).then((res) => {
|
|
|
+ // console.log('222222')
|
|
|
+ this.lastSearchText = this.searchText;
|
|
|
+ getList({ page:1, name:e, type:0}).then((res) => {
|
|
|
if (!that.$util.isEmpty(res.data) && !that.$util.isEmpty(res.data.list)){
|
|
|
that.showSearch = true
|
|
|
that.searchList = res.data.list
|
|
|
@@ -316,6 +335,19 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
}else{
|
|
|
+ // console.log('333333')
|
|
|
+ // 首次点击搜索框:searchText 为空,lastSearchText 也为空 → 跳过搜索
|
|
|
+ if (this.$util.isEmpty(this.searchText) && this.$util.isEmpty(this.lastSearchText)) {
|
|
|
+ // console.log('33333-空')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.searchText === this.lastSearchText) {
|
|
|
+ // console.log('33333-111')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.lastSearchText = this.searchText;
|
|
|
this.resetList()
|
|
|
this.getOrderList()
|
|
|
}
|
|
|
@@ -381,14 +413,19 @@ export default {
|
|
|
selectStaffFn(){
|
|
|
this.$refs.getStaffRef.open('top')
|
|
|
},
|
|
|
- cancelFn(){
|
|
|
+ clearFn(){
|
|
|
this.resetList();
|
|
|
this.shopAdminId = 0
|
|
|
this.searchText = ''
|
|
|
+ this.lastSearchText = ''
|
|
|
+ this.showSearch = false
|
|
|
this.customId = 0
|
|
|
this.searchTime = ''
|
|
|
this.startTime = ''
|
|
|
this.endTime = ''
|
|
|
+ if (this.$refs && this.$refs.searchRef) {
|
|
|
+ this.$refs.searchRef.search = ''
|
|
|
+ }
|
|
|
this.getOrderList()
|
|
|
},
|
|
|
printOrder(item){
|
|
|
@@ -500,6 +537,7 @@ export default {
|
|
|
.search-container {
|
|
|
flex: 1;
|
|
|
min-width: 0;
|
|
|
+ position: relative;
|
|
|
}
|
|
|
|
|
|
button {
|
|
|
@@ -521,6 +559,19 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ .search-clear-overlay {
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ right: 20upx;
|
|
|
+ transform: translateY(-50%);
|
|
|
+ z-index: 11;
|
|
|
+ padding: 10upx 20upx;
|
|
|
+ border-radius: 24upx;
|
|
|
+ font-size: 24upx;
|
|
|
+ color: #09C567;
|
|
|
+ border: 1upx solid #09C567;
|
|
|
+ background-color: rgba(255,255,255,0.9);
|
|
|
+ }
|
|
|
.list-wrap {
|
|
|
padding-top: 115upx;
|
|
|
.list {
|