borrow-record.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <view class="home">
  3. <view class="list-area" v-for="item in dataList" :key="item.id" @click="toDetail(item.id,item.assetBarCode,item.isreturn)">
  4. <u-cell :isLink="true">
  5. <view slot="title" class="u-slot-title">
  6. <i class="iconfont icon-shijian"></i>
  7. <text>{{item.isreturn=="0"?"借用时间:"+item.borrowDate:"归还时间:"+item.actualReturnDate}}</text>
  8. </view>
  9. <view slot="label" class="u-slot-label">
  10. <text class="list-name">设备:{{item.assetBarCode}}</text>
  11. <text class="list-status">{{isReturn(item.isreturn)}}</text>
  12. </view>
  13. </u-cell>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import { getBorrowList } from '@/api/asset.js'
  19. export default {
  20. data() {
  21. return {
  22. dataList:[]
  23. };
  24. },
  25. methods:{
  26. scroll(){
  27. console.log(111)
  28. },
  29. init(){
  30. getBorrowList({
  31. pageNum:1,
  32. pageSize:10
  33. }).then(res=>{
  34. console.log(res)
  35. this.dataList = res.data.rows
  36. })
  37. },
  38. isReturn(val){
  39. if(val=="0"){
  40. return "未归还"
  41. }else if(val=="1"){
  42. return "已归还"
  43. }
  44. },
  45. toDetail(id,bar,isreturn){
  46. // 0 未还 1 已还
  47. if(isreturn=="0"){
  48. uni.navigateTo({
  49. url:'/pages/borrow/borrow?number='+bar,
  50. })
  51. }else{
  52. uni.navigateTo({
  53. url:'/pages/return/return?id='+id
  54. })
  55. }
  56. }
  57. },
  58. onLoad() {
  59. this.init()
  60. }
  61. }
  62. </script>
  63. <style lang="scss">
  64. page{
  65. background-color: #eae9e9;
  66. }
  67. .home{
  68. width: 100%;
  69. height: 100%;
  70. padding:20rpx 30rpx;
  71. background-color: #eae9e9;
  72. box-sizing: border-box;
  73. .ul-area{
  74. padding: 20rpx 30rpx 0;
  75. box-sizing: border-box;
  76. }
  77. }
  78. .list-area{
  79. background-color: $uni-bg-color;
  80. margin: 0 0 20rpx 0;
  81. line-height: 150%;
  82. .u-slot-title{
  83. display: flex;
  84. align-items: center;
  85. .iconfont{
  86. margin-right: 20rpx;
  87. font-size: 38rpx;
  88. font-weight: bold;
  89. }
  90. }
  91. .u-slot-label{
  92. position: relative;
  93. .list-status{
  94. position: absolute;
  95. right: 140rpx;
  96. }
  97. }
  98. }
  99. </style>