| | |
| | | <view class="search-box"> |
| | | <view class="search-area"> |
| | | <view class="search-icon"><uni-icons type="search" size="25" color="#a5a5a5"></uni-icons></view> |
| | | <input type="text" v-model="condition" placeholder="请输入商品编码 / 名称"/> |
| | | <input type="text" @focus="inputF" v-model="condition" placeholder="请输入商品编码 / 名称"/> |
| | | <view class="close-icon" @click="reset()"><uni-icons type="closeempty" size="25" color="#a5a5a5"></uni-icons></view> |
| | | </view> |
| | | <view class="search-btn"><button @click="search(condition)" class="cu-btn bg-blue">搜索</button></view> |
| | |
| | | </label> |
| | | </checkbox-group> |
| | | </scroll-view> |
| | | <!-- <view class="record"> |
| | | |
| | | </view> --> |
| | | <view class="record" v-show="recordShow"> |
| | | <label class="record-card" v-for="(item,index) in record" :key="index" @click="chose(index)"> |
| | | <view style="padding: 0 5rpx 0 10rpx;">{{item}}</view> |
| | | <uni-icons style="padding: 0 5rpx 0 5rpx;" type="closeempty" size="22" color="#a5a5a5" @click="del(index)"></uni-icons> |
| | | </label> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | condition:null, |
| | | tag: [], |
| | | data: [], |
| | | record: [], |
| | | recordShow: false, |
| | | } |
| | | }, |
| | | onLoad() { |
| | |
| | | eventChannel.on('commonUrl', function(data) { |
| | | that.commonUrl = data.commonUrl |
| | | that.showTag(1) |
| | | that.record = uni.getStorageSync("record") |
| | | }) |
| | | }, |
| | | methods: { |
| | |
| | | this.condition = null |
| | | uni.vibrateShort(); |
| | | }, |
| | | // 聚焦 |
| | | inputF() { |
| | | if (this.record.length == 0) { |
| | | return |
| | | } |
| | | this.recordShow = true |
| | | }, |
| | | search(condition) { |
| | | let that = this |
| | | that.tag = null |
| | | that.data = null |
| | | that.recordShow = false |
| | | uni.vibrateShort(); |
| | | uni.showLoading({ |
| | | title: '搜索中...' |
| | |
| | | var res = result.data |
| | | if (res.code === 200 ) { |
| | | that.data = res.data |
| | | that.save() |
| | | } else if (res.code == 403) { |
| | | uni.showToast({title: res.msg, icon: "none", position: 'top'}) |
| | | setTimeout(() => { |
| | |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | // 保存 |
| | | save() { |
| | | if (this.record === '') { |
| | | this.record = [] |
| | | } |
| | | this.record.push(this.condition) |
| | | for (var i = 0; i < this.record.length; i++) { |
| | | for (var j = i + 1;j < this.record.length; j++) { |
| | | if (this.record[i] ===this.record[j]){ |
| | | this.record.splice(j,1); |
| | | j--; |
| | | } |
| | | } |
| | | } |
| | | |
| | | uni.setStorageSync("record",this.record) |
| | | }, |
| | | // 删除 |
| | | del(i) { |
| | | this.record.splice(i,1) |
| | | uni.setStorageSync("record",this.record) |
| | | }, |
| | | chose(i) { |
| | | this.condition = this.record[i] |
| | | }, |
| | | showTag(parentId) { |
| | | let that = this |
| | |
| | | |
| | | <style> |
| | | .record { |
| | | display: flex; |
| | | align-items: center; |
| | | flex-wrap: wrap; |
| | | z-index: 1; |
| | | position: fixed; |
| | | top: 188rpx; |
| | | width: 100%; |
| | | min-height: 50rpx; |
| | | background-color: #6f6f6f; |
| | | background-color: #E4E7ED; |
| | | } |
| | | .record-card { |
| | | display: flex; |
| | | align-items: center; |
| | | min-width: 100rpx; |
| | | height: 60rpx; |
| | | background-color: #C0C4CC; |
| | | margin: 10rpx 10rpx 10rpx 10rpx; |
| | | border-radius: 10rpx; |
| | | } |
| | | .matnr { |
| | | margin-left: 60rpx; |