selectContractNo.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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">
  7. <view class="title">最新合同</view>
  8. <view class="item-contnet">
  9. <view class="item-list" v-for="(item,index) in newList" :key="index" @click="confirm(item)">
  10. {{item.contractNo}}
  11. </view>
  12. </view>
  13. </view>
  14. <view class="content3" v-if="inputKeyword">
  15. <view class="search-item-list" v-for="(item,index) in filterNewList" :key="index" @click="confirm(item)">
  16. {{item.contractNo}}
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import helper from '@/common/helper.js';
  23. export default {
  24. data() {
  25. return {
  26. inputKeyword: '',
  27. newList: [],
  28. filterNewList: [],
  29. compId: ''
  30. }
  31. },
  32. onShow() {},
  33. onLoad(options) {
  34. this.compId = options.compId
  35. console.log(helper.selectContractNo);
  36. this.getContractNoList()
  37. },
  38. watch: {
  39. inputKeyword(val) {
  40. this.filterNewList = this.newList.filter(function(item) {
  41. if (item.contractNo.indexOf(val) > -1) {
  42. return item
  43. }
  44. })
  45. }
  46. },
  47. methods: {
  48. confirm(item){
  49. uni.setStorageSync('ContractNo', item);
  50. uni.navigateBack({})
  51. },
  52. getContractNoList() {
  53. this.$api.doRequest('get', '/warehouseBaseInfo/selectContractNoList', {
  54. compId: this.compId,
  55. flag: 5,
  56. }).then(res => {
  57. if (res.data.code == 200) {
  58. console.log(res)
  59. this.newList = res.data.data
  60. }
  61. })
  62. },
  63. }
  64. }
  65. </script>
  66. <style scoped lang="scss">
  67. .content1 {
  68. background: white;
  69. padding: 20rpx;
  70. border-radius: 0 0 20rpx 20rpx;
  71. }
  72. .content2 {
  73. background: white;
  74. margin-top: 20rpx;
  75. padding: 20rpx;
  76. border-radius: 20rpx 20rpx 0 0;
  77. .title {
  78. font-size: 28rpx;
  79. font-weight: 400;
  80. color: #AFB3BF;
  81. }
  82. .item-contnet {
  83. display: flex;
  84. flex-wrap: wrap;
  85. justify-content: space-between;
  86. }
  87. .item-list {
  88. width: 45%;
  89. background: #F5F6F9;
  90. margin: 20rpx 0;
  91. padding: 10rpx 15rpx;
  92. border-radius: 30rpx;
  93. text-align: center;
  94. }
  95. }
  96. .content3 {
  97. height: calc(100vh - 192rpx);
  98. background: white;
  99. padding: 20rpx;
  100. box-sizing: border-box;
  101. }
  102. .search-item-list {
  103. margin: 20rpx;
  104. border-bottom: 1px solid #EEEEEE;
  105. padding-bottom: 20rpx;
  106. }
  107. </style>