list.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <u-cell-group>
  3. <u-cell
  4. center
  5. isLink
  6. v-for="item in list"
  7. :key="item.id"
  8. @click="toEdit(item)"
  9. >
  10. <view slot="label">
  11. <view class="u-kh">
  12. <view>
  13. {{item.checkWarehouseNo}}
  14. </view>
  15. <view style="padding: 0 10rpx;" v-if="item.sourceType=='HAND'">
  16. <u-icon name="android-fill" size="16" color="#00aaff"></u-icon>
  17. </view>
  18. </view>
  19. <view class="u-time">创建时间:{{item.createDate}}</view>
  20. </view>
  21. <view slot="value">
  22. <text class="u-text" :style="{color: item.sourceType=='HAND'&&item.state=='WAIT_SUBMIT' ? '#00aaff' : '#999'}">{{item.stateDictValue}}</text>
  23. </view>
  24. </u-cell>
  25. <view v-if="list.length==0&&status != 'loading'">
  26. <u-empty :iconSize="60" text="无盘点记录" :marginTop="100" mode="history"></u-empty>
  27. </view>
  28. <view style="padding: 30rpx 0;">
  29. <u-loadmore :status="status" />
  30. </view>
  31. </u-cell-group>
  32. </template>
  33. <script>
  34. import { checkWarehouseQueryList } from '@/config/api.js'
  35. export default{
  36. data(){
  37. return {
  38. list: [],
  39. pageSize: 10,
  40. pageNo: 1,
  41. total: 0,
  42. status: 'loadmore'
  43. }
  44. },
  45. onLoad() {
  46. var _this = this
  47. this.status = 'loading'
  48. this.getList()
  49. // 刷新
  50. uni.$on('refashList', function(content) {
  51. _this.status = 'loading'
  52. _this.getList()
  53. })
  54. },
  55. onUnload() {
  56. uni.$off("refashList")
  57. },
  58. methods:{
  59. getList(){
  60. checkWarehouseQueryList({pageSize:this.pageSize,pageNo:this.pageNo}).then(res => {
  61. console.log(res)
  62. if(res.status == 200){
  63. const list = res.data.list
  64. this.total = res.data.count
  65. if(this.pageNo == 1){
  66. this.list = list
  67. }else{
  68. this.list = this.list.concat(list)
  69. }
  70. if(this.list.length < this.total){
  71. this.status = 'loadmore'
  72. }else{
  73. this.status = 'nomore'
  74. }
  75. }
  76. })
  77. },
  78. toEdit(item){
  79. // 待提交
  80. if(item.state == 'WAIT_SUBMIT' && item.sourceType == 'HAND'){
  81. uni.navigateTo({
  82. url:"/pages/stockPan/index?id="+item.id + "&checkWarehouseSn="+item.checkWarehouseSn
  83. })
  84. }else{
  85. // 查看详情
  86. uni.navigateTo({
  87. url:"/pages/stockPan/viewDetail?id="+item.id + "&checkWarehouseSn="+item.checkWarehouseSn
  88. })
  89. }
  90. },
  91. onReachBottom(){
  92. const pageNums = Math.ceil(this.total / this.pageSize)
  93. if(this.pageNo < pageNums){
  94. this.pageNo = this.pageNo + 1
  95. this.status = 'loading'
  96. this.getList()
  97. }else{
  98. this.status = 'nomore'
  99. }
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss">
  105. .u-time{
  106. color: $uni-text-color-grey;
  107. font-size: 30upx;
  108. }
  109. .u-kh{
  110. font-size: 34upx;
  111. display: flex;
  112. }
  113. .u-text{
  114. font-size: 30upx;
  115. }
  116. </style>