search.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <view>
  3. <van-sticky>
  4. <view class="top-wrap">
  5. <view @click="handleBack">
  6. <van-search disabled use-left-icon-slot shape="round" :value="keyword" placeholder="客户名称/社会信用码">
  7. <view slot="left-icon">
  8. <image src="../static/search-icon.png" mode="aspectFill" class="search-icon"></image>
  9. </view>
  10. </van-search>
  11. </view>
  12. </view>
  13. </van-sticky>
  14. <van-empty description="暂无数据" :image="require('@/static/empty.png')" v-if="finished&&list.length===0"/>
  15. <view class="list-wrap" v-else>
  16. <view class="item white-wrap" v-for="item in list" :key="item.ContractCode" @click="handleGoDetail(item)">
  17. <view class="title flex">
  18. <image src="../../static/man.png" mode="aspectFill" class="icon"></image>
  19. <view>{{item.CompanyName}}</view>
  20. </view>
  21. <view class="message-content">
  22. <view class="info">合同期限:{{item.StartDate|formatDate}}~{{item.EndDate|formatDate}}</view>
  23. <view class="info">合同金额:<text style="color:#FF4343">{{item.Price}}</text></view>
  24. <view class="info">合同类型:{{item.ContractType}}</view>
  25. <view class="info">销&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;售:{{item.SellerName}}</view>
  26. <view class="info">更新时间:{{item.ModifyTime|formatTime}}</view>
  27. </view>
  28. <image :src="item.statusImg" mode="aspectFill" class="status-img"></image>
  29. </view>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. import {apiContractSearchV2} from '@/api/approve/contract.js'
  35. export default{
  36. filters:{
  37. formatDate(e){
  38. if(e==='0001-01-01T00:00:00Z'){
  39. return ''
  40. }else{
  41. return e.split('T')[0].replace(/-/g,'.')
  42. }
  43. }
  44. },
  45. data() {
  46. return {
  47. keyword:'',
  48. list:[],
  49. page:1,
  50. finished:false
  51. }
  52. },
  53. onLoad(options) {
  54. this.keyword=options.val
  55. this.getList()
  56. },
  57. methods: {
  58. handleBack(){
  59. uni.navigateBack({
  60. delta:1
  61. })
  62. },
  63. handleGoDetail(e){
  64. uni.navigateTo({
  65. url:`./detail?ContractId=${e.ContractId}&ContractApprovalId=0&ContractApprovalRecordId=0`
  66. })
  67. },
  68. async getList() {
  69. const res=await apiContractSearchV2({
  70. CurrentIndex:this.page,
  71. // Keyword:this.keyword
  72. KeywordEq:this.keyword
  73. })
  74. if(res.code===200){
  75. if(res.data.Paging.IsEnd){
  76. this.finished=true
  77. }
  78. let arr=res.data.List.map(item=>{
  79. let statusImg=''
  80. switch(item.Status){
  81. case '已作废':
  82. statusImg=require('../static/cancel-icon.png')
  83. break;
  84. case '已驳回':
  85. statusImg=require('../static/fail-icon.png')
  86. break;
  87. case '已审批':
  88. statusImg=require('../static/pass-icon.png')
  89. break;
  90. case '待审批':
  91. statusImg=require('@/pages-todomessages/static/icon-2.png')
  92. break;
  93. case '已签回':
  94. statusImg=require('../static/draw-back-icon.png')
  95. break;
  96. case '已解约':
  97. statusImg=require('../static/jieyue-icon.png')
  98. break;
  99. }
  100. return{
  101. ...item,
  102. statusImg
  103. }
  104. })
  105. this.list=[...this.list,...arr]
  106. }
  107. }
  108. },
  109. }
  110. </script>
  111. <style lang="scss">
  112. .search-icon {
  113. width: 40rpx;
  114. height: 40rpx;
  115. display: block;
  116. position: relative;
  117. top: 4rpx;
  118. margin-right: 10rpx;
  119. }
  120. .list-wrap {
  121. padding: 20rpx;
  122. .item {
  123. padding: 30rpx;
  124. box-shadow: 0px 3px 12px rgba(175, 175, 175, 0.16);
  125. border-radius: 8px;
  126. margin-bottom: 20rpx;
  127. position: relative;
  128. .status-img{
  129. width: 184rpx;
  130. height: 184rpx;
  131. position: absolute;
  132. right: 0;
  133. top: 80rpx;
  134. }
  135. .title {
  136. font-size: 16px;
  137. font-weight: bold;
  138. margin-bottom: 30rpx;
  139. .icon {
  140. width: 31rpx;
  141. height: 34rpx;
  142. flex-shrink: 0;
  143. margin-right: 10rpx;
  144. position: relative;
  145. top: 4rpx;
  146. }
  147. }
  148. .message-content {
  149. font-size: 14px;
  150. color: #666;
  151. .info {
  152. margin-bottom: 16rpx;
  153. }
  154. .info:last-child {
  155. margin-bottom: 0;
  156. }
  157. }
  158. .status {
  159. text-align: right;
  160. }
  161. }
  162. }
  163. </style>