123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <template>
- <view class="warp">
- <view class="content1">
- <u-search placeholder="输入合同编号" :show-action="false" v-model="inputKeyword" maxlength="20"></u-search>
- </view>
- <view class="content2" v-if="!inputKeyword&&newSelectList.length!=0">
- <view class="title" v-if="">最新选择</view>
- <view class="item-contnet">
- <view class="item-list" v-for="(item,index) in newSelectList" :key="index" @click="confirm(item)">
- {{item.contractNo}}
- </view>
- </view>
- </view>
- <view class="content2" v-if="!inputKeyword&&moreList.length!=0 ">
- <view class="title" v-if="">更多合同</view>
- <view class="item-contnet">
- <view class="item-list" v-for="(item,index) in moreList" :key="index" @click="confirm(item)">
- {{item.contractNo}}
- </view>
- </view>
- </view>
- <view class="content3" v-if="inputKeyword">
- <view class="search-item-list" v-for="(item,index) in filterNewList" :key="index" @click="confirm(item)">
- {{item.contractNo}}
- </view>
- </view>
- </view>
- </template>
- <script>
- import helper from '@/common/helper.js';
- export default {
- data() {
- return {
- inputKeyword: '',
- newList: [],
- newSelectList:[],
- filterNewList: [],
- moreList:[],
- compId: '',
- flag:""
- }
- },
- onShow() {
- this.newSelectList = uni.getStorageSync('reContractNoList');
- },
- onLoad(options) {
- this.compId = helper.erpWarehouse.compId
- this.getContractNoList()
- },
- watch: {
- inputKeyword(val) {
- this.filterNewList = this.newList.filter(function(item) {
- if (item.contractNo.indexOf(val) > -1) {
- return item
- }
- })
- }
- },
- methods: {
- confirm(item){
- let _list = uni.getStorageSync('reContractNoList');
- if(_list==''){
- _list=[]
- }
- if(_list.length<=20){
- _list = _list.filter(function(val) {
- if (val.contractNo!=item.contractNo) {
- return val
- }
- })
- _list.unshift(item)
- }else{
- _list.unshift(item).pop(item)
- }
- uni.setStorageSync('reContractNoList', _list);
- uni.setStorageSync('reContractNo', item);
- uni.navigateBack({
- delta: 1
- });
- },
- getContractNoList() {
- this.$api.doRequest('get', '/warehouseBaseInfo/selectContractNoList', {
- compId: this.compId,
- flag: 11,
- }).then(res => {
- if (res.data.code == 200) {
- this.newList = res.data.data
- this.moreList = res.data.data
- }
- })
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .content1 {
- background: white;
- padding: 20rpx;
- border-radius: 0 0 20rpx 20rpx;
- }
- .content2 {
- background: white;
- margin-top: 20rpx;
- padding: 20rpx;
- border-radius: 20rpx 20rpx 0 0;
- .title {
- font-size: 28rpx;
- font-weight: 400;
- color: #AFB3BF;
- }
- .item-contnet {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- }
- .item-list {
- width: 45%;
- background: #F5F6F9;
- margin: 20rpx 0;
- padding: 10rpx 15rpx;
- border-radius: 30rpx;
- text-align: center;
- }
- }
- .content3 {
- height: calc(100vh - 192rpx);
- background: white;
- padding: 20rpx;
- box-sizing: border-box;
- }
- .search-item-list {
- margin: 20rpx;
- border-bottom: 1px solid #EEEEEE;
- padding-bottom: 20rpx;
- }
- </style>
|