selectContractNo.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="warp">
  3. <view class="content1">
  4. <u-search placeholder="输入合同编号" :show-action="false" v-model="inputKeyword"></u-search>
  5. </view>
  6. <view class="content2" v-if="!inputKeyword&&newSelectList.length!=0">
  7. <view class="title" v-if="">最新选择</view>
  8. <view class="item-contnet">
  9. <view class="item-list" v-for="(item,index) in newSelectList" :key="index" @click="confirm(item)">
  10. {{item.contractNo}}
  11. </view>
  12. </view>
  13. </view>
  14. <view class="content2" v-if="!inputKeyword&&moreList.length!=0 ">
  15. <view class="title" v-if="">更多合同</view>
  16. <view class="item-contnet">
  17. <view class="item-list" v-for="(item,index) in moreList" :key="index" @click="confirm(item)">
  18. {{item.contractNo}}
  19. </view>
  20. </view>
  21. </view>
  22. <view class="content3" v-if="inputKeyword">
  23. <view class="search-item-list" v-for="(item,index) in filterNewList" :key="index" @click="confirm(item)">
  24. {{item.contractNo}}
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import helper from '@/common/helper.js';
  31. export default {
  32. data() {
  33. return {
  34. inputKeyword: '',
  35. newList: [],
  36. newSelectList:[],
  37. filterNewList: [],
  38. moreList:[],
  39. compId: ''
  40. }
  41. },
  42. onShow() {},
  43. onLoad(options) {debugger
  44. this.compId = options.compId
  45. console.log(helper.selectContractNo);
  46. this.getContractNoList()
  47. },
  48. watch: {
  49. inputKeyword(val) {
  50. this.filterNewList = this.newList.filter(function(item) {
  51. if (item.contractNo.indexOf(val) > -1&&item.flag==7) {
  52. return item
  53. }
  54. })
  55. }
  56. },
  57. methods: {
  58. confirm(item){
  59. let _list = uni.setStorageSync('erpContractNoList');
  60. if(_list.length<=20){
  61. _list.unshift()
  62. }else{
  63. _list.unshift().pop()
  64. }
  65. uni.setStorageSync('erpContractNoList', _list);
  66. uni.navigateBack({})
  67. },
  68. makeMoreList(){
  69. let _data = this.newList
  70. for(let i=0;i<_data;i++){
  71. if(_data[i].status=='执行中'&&_data[i].flag==6){
  72. this.moreList.push(_data[i])
  73. }
  74. }
  75. },
  76. getContractNoList() {
  77. this.$api.doRequest('get', '/warehouseBaseInfo/selectContractNoList', {
  78. compId: this.compId,
  79. flag: 5,
  80. }).then(res => {
  81. if (res.data.code == 200) {
  82. console.log(res)
  83. this.newList = res.data.data
  84. this.makeMoreList()
  85. }
  86. })
  87. },
  88. }
  89. }
  90. </script>
  91. <style scoped lang="scss">
  92. .content1 {
  93. background: white;
  94. padding: 20rpx;
  95. border-radius: 0 0 20rpx 20rpx;
  96. }
  97. .content2 {
  98. background: white;
  99. margin-top: 20rpx;
  100. padding: 20rpx;
  101. border-radius: 20rpx 20rpx 0 0;
  102. .title {
  103. font-size: 28rpx;
  104. font-weight: 400;
  105. color: #AFB3BF;
  106. }
  107. .item-contnet {
  108. display: flex;
  109. flex-wrap: wrap;
  110. justify-content: space-between;
  111. }
  112. .item-list {
  113. width: 45%;
  114. background: #F5F6F9;
  115. margin: 20rpx 0;
  116. padding: 10rpx 15rpx;
  117. border-radius: 30rpx;
  118. text-align: center;
  119. }
  120. }
  121. .content3 {
  122. height: calc(100vh - 192rpx);
  123. background: white;
  124. padding: 20rpx;
  125. box-sizing: border-box;
  126. }
  127. .search-item-list {
  128. margin: 20rpx;
  129. border-bottom: 1px solid #EEEEEE;
  130. padding-bottom: 20rpx;
  131. }
  132. </style>