123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <template>
- <view class="warp">
- <view class="content1">
- <u-search placeholder="输入合同编号" :show-action="false" v-model="inputKeyword"></u-search>
- </view>
- <view class="content2" v-if="!inputKeyword">
- <view class="title">最新合同</view>
- <view class="item-contnet">
- <view class="item-list" v-for="(item,index) in newList" :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: [],
- filterNewList: [],
- compId: ''
- }
- },
- onShow() {},
- onLoad(options) {
- this.compId = options.compId
- console.log(helper.selectContractNo);
- this.getContractNoList()
- },
- watch: {
- inputKeyword(val) {
- this.filterNewList = this.newList.filter(function(item) {
- if (item.contractNo.indexOf(val) > -1) {
- return item
- }
- })
- }
- },
- methods: {
- confirm(item){
- uni.setStorageSync('ContractNo', item);
- uni.navigateBack({})
- },
- getContractNoList() {
- this.$api.doRequest('get', '/warehouseBaseInfo/selectContractNoList', {
- compId: this.compId,
- flag: 5,
- }).then(res => {
- if (res.data.code == 200) {
- console.log(res)
- this.newList = 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>
|