| | |
| | | <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="searchFoucs" @blur="serchBlur" 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> |
| | |
| | | <view class="cu-tag bg-cyan ">商品</view> |
| | | </view> |
| | | <view class="matnr"><text style="width: 400rpx;">{{item.matnr}}</text></view> |
| | | <view class="matnr"><text style="width: 400rpx;">{{item.maktx}}</text></view> |
| | | <view class="matnr"><text style="width: 400rpx;">{{item.specs}}</text></view> |
| | | </view> |
| | | </label> |
| | | </checkbox-group> |
| | | </scroll-view> |
| | | <view v-if="reList.length > 0" > |
| | | <scroll-view scroll-y class="record" v-if="recordShow"> |
| | | <view class="record-data" v-for="(item,index) in reList" :key="index" > |
| | | <text style="margin-right: 10rpx;" @click="choseMatnr(item)">{{item}}</text> |
| | | <view style="height: 50rpx;display: inline-block;" @click="removeRecord(index)"> |
| | | <uni-icons type="closeempty" size="15" color="#a5a5a5"></uni-icons> |
| | | </view> |
| | | </view> |
| | | |
| | | |
| | | </scroll-view> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | condition:null, |
| | | tag: [], |
| | | data: [], |
| | | baseHttp:'http://', |
| | | baseIP:'', |
| | | basePORT:'', |
| | | baseUrl:'/lywms' |
| | | reList: [], |
| | | recordShow: false, |
| | | } |
| | | }, |
| | | onLoad() { |
| | |
| | | const eventChannel = this.getOpenerEventChannel(); |
| | | |
| | | // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据 |
| | | eventChannel.on('acceptDataFromOpenerPage', function(data) { |
| | | eventChannel.on('commonUrl', function(data) { |
| | | that.commonUrl = data.commonUrl |
| | | |
| | | that.showTag(1) |
| | | }) |
| | | }, |
| | | methods: { |
| | | removeRecord(index) { |
| | | this.reList.splice(index,1) |
| | | uni.setStorageSync('recordList',this.reList) |
| | | }, |
| | | choseMatnr(matnr) { |
| | | this.condition = matnr |
| | | }, |
| | | searchFoucs() { |
| | | var reL = uni.getStorageSync('recordList') |
| | | if (reL.length == 0) { |
| | | reL = [] |
| | | } |
| | | this.reList = reL |
| | | this.recordShow = true |
| | | }, |
| | | serchBlur() { |
| | | // this.recordShow = false |
| | | }, |
| | | checkbox() { |
| | | |
| | | }, |
| | |
| | | uni.vibrateShort(); |
| | | }, |
| | | search(condition) { |
| | | this.recordShow = false |
| | | let that = this |
| | | // that.reList.push(that.condition) |
| | | // uni.setStorageSync('recordList',that.reList) |
| | | that.tag = null |
| | | that.data = null |
| | | uni.vibrateShort(); |
| | |
| | | var res = result.data |
| | | if (res.code === 200 ) { |
| | | that.data = res.data |
| | | if (that.reList.length == 0) { |
| | | that.reList.push(that.condition) |
| | | uni.setStorageSync('recordList',that.reList) |
| | | return |
| | | } |
| | | for(var i = 0;i < that.reList.length;i++) { |
| | | if (that.reList[i] == that.condition) { |
| | | that.reList.splice(i,1) |
| | | } |
| | | } |
| | | that.reList.unshift(that.condition) |
| | | uni.setStorageSync('recordList',that.reList) |
| | | } else if (res.code == 403) { |
| | | uni.showToast({title: res.msg, icon: "none", position: 'top'}) |
| | | setTimeout(() => { |
| | |
| | | 'token':uni.getStorageSync('token'), |
| | | }, |
| | | success(result) { |
| | | console.log(result) |
| | | uni.hideLoading(); |
| | | that.tag = null |
| | | that.data = null |
| | | var res = result.data |
| | |
| | | } else { |
| | | uni.showToast({title: res.msg, icon: "none",position: 'top'}) |
| | | } |
| | | uni.hideLoading(); |
| | | |
| | | } |
| | | }); |
| | | }, |
| | | showMat(tagId) { |
| | | uni.vibrateShort(); |
| | | uni.showLoading(); |
| | | let that = this |
| | | if (tagId == null || tagId == '' || tagId == undefined) { |
| | | return; |
| | |
| | | 'token':uni.getStorageSync('token'), |
| | | }, |
| | | success(result) { |
| | | console.log(result) |
| | | uni.hideLoading(); |
| | | that.tag = null |
| | | var res = result.data |
| | | if (res.code === 200) { |
| | | if (res.data != null && res.data.length > 0) { |
| | | uni.showLoading(); |
| | | that.data = res.data |
| | | uni.hideLoading(); |
| | | |
| | | } else { |
| | | // that.tagId = parentId |
| | | } |
| | |
| | | } else { |
| | | uni.showToast({title: res.msg, icon: "none",position: 'top'}) |
| | | } |
| | | |
| | | |
| | | } |
| | | }); |
| | | }, |
| | |
| | | </script> |
| | | |
| | | <style> |
| | | .record-data { |
| | | height: 60rpx; |
| | | background-color: #FFF; |
| | | line-height: 60rpx; |
| | | padding-left: 20rpx; |
| | | padding-right: 20rpx; |
| | | margin-left: 20rpx; |
| | | margin-top: 10rpx; |
| | | display: inline-block; |
| | | border-radius: 20rpx; |
| | | text-align: center; |
| | | } |
| | | .record-data:last-child { |
| | | margin-bottom: 10rpx; |
| | | } |
| | | .record { |
| | | z-index: 11; |
| | | display: flex; |
| | | flex-direction: column; |
| | | flex-wrap: wrap; |
| | | position: absolute; |
| | | top:94rpx; |
| | | /* #ifdef APP-PLUS */ |
| | | top: 94rpx; |
| | | /* #endif */ |
| | | width: 100%; |
| | | min-height: 80rpx; |
| | | max-height: 600rpx; |
| | | background-color: #6f6f6f; |
| | | } |
| | | .matnr { |
| | | margin-left: 60rpx; |
| | | margin-top: 20rpx; |