orderDetailList.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <view class="u-page">
  3. <u-list @scrolltolower="scrolltolower">
  4. <view class="list-wrap">
  5. <view v-for="(item, index) in detailList" :key="index" class="card-item">
  6. <view class="info-item">
  7. <u-col span="6">
  8. <text class="label">商品名称:{{item.itemName}}</text>
  9. </u-col>
  10. <u-col span="6">
  11. <text class="label">体积:{{ item.cube }} m³</text>
  12. </u-col>
  13. </view>
  14. <view class="info-item">
  15. <u-col span="6">
  16. <text class="label">重量:{{ item.weight }} kg</text>
  17. </u-col>
  18. <u-col span="6">
  19. <text class="label">数量:{{ item.peiceNum }} 件</text>
  20. </u-col>
  21. </view>
  22. </view>
  23. </view>
  24. </u-list>
  25. </view>
  26. </template>
  27. <script>
  28. import { getOrderDetailList } from '@/api/index.js';
  29. export default {
  30. data() {
  31. return {
  32. detailList: [],
  33. page: 1,
  34. limit: 10,
  35. // loadStatus: 'loadmore',
  36. total: 0
  37. };
  38. },
  39. onLoad(options) {
  40. console.log(options)
  41. let item = {}
  42. item.accountId = options.accountId
  43. item.orderCenterOrderId = options.orderCenterOrderId
  44. this.getDetailList(item);
  45. },
  46. methods: {
  47. // 获取明细列表数据
  48. // let params = {
  49. // accountId: item.ACCOUNT_ID,
  50. // userId: item.USER_ID,
  51. // orderCenterOrderId: item.ORDER_CENTER_ORDER_ID
  52. // }
  53. // getOrderDetailList(params).then(res => {
  54. // if (res.data) {
  55. // console.log(res.data)
  56. // }
  57. // })
  58. async getDetailList(item) {
  59. try {
  60. // this.loadStatus = 'loading';
  61. // 这里替换为实际的API调用
  62. const res = await getOrderDetailList({
  63. accountId: item.accountId,
  64. userId: item.userId,
  65. orderCenterOrderId: item.orderCenterOrderId
  66. });
  67. console.log(1111)
  68. console.log(res)
  69. if (res.code === 'success') {
  70. this.detailList = res.data
  71. } else {
  72. // this.loadStatus = 'loadmore';
  73. uni.$u.toast(res.message || '获取数据失败');
  74. }
  75. } catch (error) {
  76. // this.loadStatus = 'loadmore';
  77. uni.$u.toast('获取数据失败');
  78. }
  79. },
  80. // // 滚动到底部触发
  81. // scrolltolower() {
  82. // if (this.loadStatus === 'loadmore') {
  83. // this.page++;
  84. // this.getDetailList();
  85. // }
  86. // }
  87. }
  88. };
  89. </script>
  90. <style lang="scss" scoped>
  91. .u-page {
  92. padding: 0;
  93. }
  94. .list-wrap {
  95. padding: 15px;
  96. background-color: #f8f8f8;
  97. }
  98. .card-item {
  99. margin-bottom: 15px;
  100. background-color: #ffffff;
  101. border-radius: 8px;
  102. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  103. padding: 12px;
  104. border: 1px solid #eaeaea;
  105. }
  106. .info-item {
  107. flex: 1;
  108. display: flex;
  109. align-items: center;
  110. padding: 8px 0;
  111. &:not(:last-child) {
  112. border-bottom: 1px solid #f0f0f0;
  113. }
  114. .label {
  115. color: #333;
  116. font-size: 14px;
  117. margin-right: 5px;
  118. white-space: nowrap;
  119. &::after {
  120. content: '';
  121. display: inline-block;
  122. width: 1px;
  123. height: 12px;
  124. background-color: #dcdfe6;
  125. margin: 0 8px;
  126. vertical-align: middle;
  127. }
  128. }
  129. .value {
  130. color: #666;
  131. font-size: 14px;
  132. flex: 1;
  133. }
  134. }
  135. </style>