goodsHandle.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <view>
  3. <navigation-bar title="商品管理" background-color="#fff" front-color="#000000" />
  4. <u-list class="list" width="100%" @scrolltolower="scrolltolower">
  5. <u-list-item v-for="(item, index) in goods" :key="index">
  6. <view class="card" @click="toDetails(item.id)">
  7. <view class="card-body">
  8. <image
  9. src="https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg"
  10. mode="aspectFill" class="img"></image>
  11. <view class="txt">
  12. <view style="font-size: 30rpx;height: 140rpx;">{{item.goodsName}}</view>
  13. <view class="piece">{{item.price}} 元</view>
  14. </view>
  15. </view>
  16. </view>
  17. </u-list-item>
  18. <u-loadmore v-if="goods" :status="loadmoreStatus" margin-top="20" @loadmore="clickLoadMore" margin-bottom="50" />
  19. </u-list>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. loadmoreStatus: 'loadmore',
  27. goods: []
  28. }
  29. },
  30. onLoad() {
  31. this.getTransitList()
  32. },
  33. methods: {
  34. getTransitList() {
  35. this.$api.getTransitList().then(res => {
  36. this.goods = res.data
  37. this.goods.forEach((item, index) => {
  38. if (index === this.goods.length - 1) {
  39. this.loadmoreStatus = 'nomore'
  40. } else {
  41. this.loadmoreStatus = 'loadmore'
  42. }
  43. })
  44. })
  45. },
  46. scrolltolower() {
  47. this.getTransitList()
  48. },
  49. toDetails(id) {
  50. this.$common.to('/pages/goodsDetails/goodsDetails?id='+id)
  51. }
  52. }
  53. }
  54. </script>
  55. <style>
  56. .list {
  57. height: 100%;
  58. border-radius: 10rpx;
  59. background-color: #fff;
  60. }
  61. .card {
  62. padding: 10rpx;
  63. }
  64. .card-body {
  65. display: flex;
  66. height: 300rpx;
  67. width: 100%;
  68. /* border: #888 1rpx solid; */
  69. box-shadow: 1rpx 1rpx #888;
  70. border-radius: 10rpx;
  71. }
  72. .img {
  73. height: 300rpx;
  74. width: 300rpx;
  75. margin-right: 10rpx;
  76. }
  77. .txt {
  78. padding: 10rpx;
  79. width: 300rpx;
  80. }
  81. .piece {
  82. margin: 50rpx 10rpx;
  83. color: red;
  84. position: relative;
  85. top: 50rpx;
  86. /* left: 5rpx; */
  87. }
  88. </style>