borrow-record.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view>
  3. <scroll-view
  4. style="height: 100vh;padding:20rpx 20rpx;box-sizing: border-box;"
  5. scroll-y="true"
  6. @scrolltolower="scroll">
  7. <!-- <view
  8. class="list-area"
  9. v-for="item in dataList"
  10. :key="item.id"
  11. @click="toDetail(item.id,item.assetBarCode,item.isreturn)">
  12. <u-cell :isLink="true">
  13. <view slot="title" class="u-slot-title">
  14. <i class="iconfont icon-shijian"></i>
  15. <text>{{item.isreturn=="0"?"借用时间:"+item.borrowDate:"归还时间:"+item.actualReturnDate}}</text>
  16. </view>
  17. <view slot="label" class="u-slot-label" :style="{color:`${item.isreturn==='0'?'#439dea':'#000000'}`}">
  18. <text class="list-name">设备:{{item.assetBarCode}}</text>
  19. <text class="list-status">{{isReturn(item.isreturn)}}</text>
  20. </view>
  21. </u-cell>
  22. 借用时间 borrowDate
  23. 归还时间 actualReturnDate
  24. 设备编号 assetBarCode
  25. 借用状态 isreturn
  26. 借用地点 borrowPlaceName
  27. <view class="borrow">
  28. <view class="b1">
  29. <view class="name"><i class="iconfont icon-shebei" style="color: #409EFF"></i>设备:{{item.assetBarCode}}</view>
  30. <text style="font-size: 28rpx;">借用地点:{{item.borrowPlaceName}}</text>
  31. <view style="font-size: 28rpx;">{{item.isreturn=="0"?"借用时间:"+item.borrowDate:"归还时间:"+item.actualReturnDate}}</view>
  32. </view>
  33. <view class="b2">
  34. <view :style="{'color': item.isreturn=='0' ? '#F56C6C' : '#5CB87A'}">{{isReturn(item.isreturn)}}</view>
  35. </view>
  36. </view>
  37. </view> -->
  38. <u-list @scrolltolower="scrolltolower" height="100%">
  39. <u-list-item
  40. v-for="(item, index) in dataList"
  41. :key="item.id"
  42. >
  43. <view class="data-box" @click="toDetail(item.id,item.assetBarCode,item.isreturn)">
  44. <view style="display: flex;justify-content: space-between;margin-bottom: 30rpx;">
  45. <view class="data-header">
  46. <image style="width: 40rpx;height: 40rpx;margin-right: 10rpx;"
  47. :src="require('@/static/images/shebeiname1.png')"
  48. mode="aspectFit"></image>
  49. <text>设备:<text style="letter-spacing: -1rpx;">{{item.assetBarCode}}</text></text>
  50. </view>
  51. <text :style="{color:`${item.isreturn==='0'? '#F56C6C' : '#5CB87A'}`}">{{isReturn(item.isreturn)}}</text>
  52. </view>
  53. <view class="data-content">
  54. <text>借用地点:{{item.borrowPlaceName}}</text><br/>
  55. <text>{{item.isreturn=="0"?"借用时间:"+item.borrowDate:"归还时间:"+item.actualReturnDate}}</text>
  56. </view>
  57. </view>
  58. </u-list-item>
  59. </u-list>
  60. </scroll-view>
  61. </view>
  62. </template>
  63. <script>
  64. import { getBorrowList } from '@/api/asset.js'
  65. export default {
  66. data() {
  67. return {
  68. dataList:[],
  69. isOver:false,
  70. page:1,
  71. };
  72. },
  73. methods:{
  74. scroll(){
  75. if(this.isOver){
  76. return;
  77. }
  78. this.init(this.page,false)
  79. },
  80. init(page,init){
  81. if(init){
  82. this.dataList=[]
  83. }
  84. getBorrowList({
  85. pageNum: page,
  86. pageSize:10
  87. }).then(res=>{
  88. res.data.rows.forEach(item=>{
  89. this.dataList.push(item)
  90. })
  91. let num = Math.ceil(res.data.total/10)
  92. console.log(num)
  93. if(page == num){
  94. this.isOver = true
  95. }else{
  96. this.isOver = false
  97. this.page++
  98. }
  99. })
  100. },
  101. isReturn(val){
  102. if(val=="0"){
  103. return "未归还"
  104. }else if(val=="1"){
  105. return "已归还"
  106. }
  107. },
  108. toDetail(id,bar,isreturn){
  109. // 0 未还 1 已还
  110. if(isreturn=="0"){
  111. uni.navigateTo({
  112. url:'/pages/borrow/borrow?number='+bar,
  113. })
  114. }else{
  115. uni.navigateTo({
  116. url:'/pages/return/return?id='+id
  117. })
  118. }
  119. },
  120. scrolltolower(){
  121. if(!this.isOver){
  122. this.init(this.page,false)
  123. }
  124. }
  125. },
  126. onShow() {
  127. this.init(1,true)
  128. }
  129. }
  130. </script>
  131. <style lang="scss">
  132. page{
  133. background-color: #f5f6fa;
  134. }
  135. .home{
  136. padding: 0 24rpx 30rpx;
  137. // display: flex;
  138. // flex-direction: column;
  139. height: 100vh;
  140. // box-sizing: border-box;
  141. }
  142. .u-slot-value {
  143. display: flex;
  144. justify-content: center;
  145. align-items: center;
  146. i {
  147. flex: 1
  148. }
  149. text {
  150. flex: 4
  151. }
  152. }
  153. /deep/ .u-cell-group__wrapper{
  154. border-left: 1rpx solid #d6d7d9;
  155. border-right: 1rpx solid #d6d7d9;
  156. }
  157. .data-box{
  158. // border: 1px solid black;
  159. margin: 26rpx 0;
  160. padding: 30rpx;
  161. background-color: #fff;
  162. border-radius: 18rpx;
  163. color: #252525;
  164. .data-header{
  165. display: flex;
  166. align-items: center;
  167. font-size: 36rpx;
  168. letter-spacing: 4rpx;
  169. }
  170. .data-content{
  171. line-height: 200%;
  172. font-size: 30rpx;
  173. }
  174. }
  175. // .borrow{
  176. // display: flex;
  177. // background-color: $uni-bg-color;
  178. // margin: 0 0 30rpx 0;
  179. // border-radius: 10rpx;
  180. // padding: 20rpx;
  181. // align-items: center;
  182. // .b1 {
  183. // flex: 5;
  184. // text-align: left;
  185. // line-height: 52rpx;
  186. // .name {
  187. // display: flex;
  188. // i {
  189. // padding-right: 10rpx;
  190. // }
  191. // }
  192. // }
  193. // .b2 {
  194. // flex: 1;
  195. // font-size: 28rpx;
  196. // }
  197. // }
  198. // .list-area{
  199. // background-color: $uni-bg-color;
  200. // margin: 0 0 20rpx 0;
  201. // line-height: 150%;
  202. // border-radius: 10rpx;
  203. // padding: 10rpx 20rpx;
  204. // .u-slot-title{
  205. // display: flex;
  206. // align-items: center;
  207. // .iconfont{
  208. // margin-right: 20rpx;
  209. // font-size: 38rpx;
  210. // font-weight: bold;
  211. // }
  212. // }
  213. // .u-slot-label{
  214. // position: relative;
  215. // .list-status{
  216. // position: absolute;
  217. // right: 140rpx;
  218. // }
  219. // }
  220. // }
  221. </style>