Commit 99a826e8 by liangjianmin

feat(shipOut): 增强搜索功能,支持多种输入类型并优化搜索参数管理

parent 96e9174a
Showing with 38 additions and 11 deletions
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<!-- 搜索 --> <!-- 搜索 -->
<view class="search-box row bothSide verCenter"> <view class="search-box row bothSide verCenter">
<view class="sn row rowCenter verCenter"> <view class="sn row rowCenter verCenter">
<picker :value="index" :range="array"> <picker :value="index" :range="array" @change="bindSearchTypeChange">
<view class="row verCenter"> <view class="row verCenter">
<view class="uni-input">{{ array[index] }}</view> <view class="uni-input">{{ array[index] }}</view>
<view class="uni-arrow"></view> <view class="uni-arrow"></view>
...@@ -34,9 +34,13 @@ ...@@ -34,9 +34,13 @@
<view class="search-bar row bothSide verCenter"> <view class="search-bar row bothSide verCenter">
<view class="row verCenter"> <view class="row verCenter">
<text class="iconfont icon-juxing1"></text> <text class="iconfont icon-juxing1"></text>
<input class="uni-input" placeholder="请扫描或输入号码" placeholder-style="color:#919399" v-model="searchParams.stock_out_sn" @input="handleInput" :focus="is_focus" /> <!-- 根据index直接判断显示不同的输入框 -->
<input v-if="index == 0" class="uni-input" placeholder="请扫描或输入出库单号" placeholder-style="color:#919399" v-model="searchParams.stock_out_sn" @input="handleInput" :focus="is_focus" />
<input v-else-if="index == 1" class="uni-input" placeholder="请扫描或输入物流单号" placeholder-style="color:#919399" v-model="searchParams.shipping_code" @input="handleInput" :focus="is_focus" />
<input v-else-if="index == 2" class="uni-input" placeholder="请扫描或输入回单号" placeholder-style="color:#919399" v-model="searchParams.kdn_return_sn" @input="handleInput" :focus="is_focus" />
<input v-else-if="index == 3" class="uni-input" placeholder="请输入货品名称" placeholder-style="color:#919399" v-model="searchParams.goods_name" @input="handleInput" :focus="is_focus" />
</view> </view>
<text class="iconfont icon-a-juxing11" @click="clearInput()" v-if="input_flag"></text> <text class="iconfont icon-a-juxing11" @click="clearInput()" v-if="searchParams.stock_out_sn || searchParams.shipping_code || searchParams.kdn_return_sn || searchParams.goods_name"></text>
</view> </view>
</view> </view>
<!-- 时间筛选 --> <!-- 时间筛选 -->
...@@ -366,7 +370,7 @@ ...@@ -366,7 +370,7 @@
is_focus: true, is_focus: true,
list: [], list: [],
index: 0, index: 0,
array: ['出库单号'], array: ['出库单号', '物流单号', '回单号', '货品名称'],
detail: {}, detail: {},
maxNum: 10, //最大上传图片数量 maxNum: 10, //最大上传图片数量
real_shipping_type_index: -1, real_shipping_type_index: -1,
...@@ -377,6 +381,9 @@ ...@@ -377,6 +381,9 @@
real_shipping_mode_data: [], //物流模式数据 real_shipping_mode_data: [], //物流模式数据
searchParams: { searchParams: {
stock_out_sn: '', stock_out_sn: '',
shipping_code: '',
kdn_return_sn: '',
goods_name: '',
create_start_time: formatDate(new Date()), //开始时间 create_start_time: formatDate(new Date()), //开始时间
create_end_time: formatDate(new Date()) //结束时间 create_end_time: formatDate(new Date()) //结束时间
}, },
...@@ -437,6 +444,25 @@ ...@@ -437,6 +444,25 @@
}, },
methods: { methods: {
/** /**
* 搜索类型切换
* @param {Object} e
*/
bindSearchTypeChange(e) {
this.index = e.detail.value;
// 清空所有搜索参数
this.searchParams.stock_out_sn = '';
this.searchParams.shipping_code = '';
this.searchParams.kdn_return_sn = '';
this.searchParams.goods_name = '';
// 重置焦点
this.clearInputAndFocus();
// 重置并获取数据
this.resetChange();
this.getData();
},
/**
* @param {Object} type 1:交货方式 2:物流公司 3:物流模式 4:物流付费 * @param {Object} type 1:交货方式 2:物流公司 3:物流模式 4:物流付费
* @param {Object} e * @param {Object} e
*/ */
...@@ -592,8 +618,11 @@ ...@@ -592,8 +618,11 @@
//清除结束时间 //清除结束时间
this.searchParams.create_end_time = ''; this.searchParams.create_end_time = '';
} else { } else {
this.input_flag = false; // 清空所有搜索参数
this.searchParams.stock_out_sn = ''; this.searchParams.stock_out_sn = '';
this.searchParams.shipping_code = '';
this.searchParams.kdn_return_sn = '';
this.searchParams.goods_name = '';
this.clearInputAndFocus(); this.clearInputAndFocus();
} }
this.getData(); this.getData();
...@@ -618,12 +647,10 @@ ...@@ -618,12 +647,10 @@
*/ */
handleInput: debounce(function (event) { handleInput: debounce(function (event) {
this.resetChange(); this.resetChange();
var val = event.target.value; // 检查是否有任何搜索参数有值
if (val) { var hasValue = this.searchParams.stock_out_sn || this.searchParams.shipping_code || this.searchParams.kdn_return_sn || this.searchParams.goods_name;
this.input_flag = true;
} else { this.input_flag = !!hasValue;
this.input_flag = false;
}
this.getData(); this.getData();
}, 500), }, 500),
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment