hexiao_pending_detail.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view class="page-container">
  3. <view class="info-card" v-for="item in detail">
  4. <view class="info-row">
  5. <text class="info-label">核销业务员</text>
  6. <text class="info-value">{{ item.ywyName }}</text>
  7. </view>
  8. <view class="info-row">
  9. <text class="info-label">单号</text>
  10. <text class="info-value">{{ item.orderNo }}</text>
  11. </view>
  12. <view class="info-row">
  13. <text class="info-label">上传时间</text>
  14. <text class="info-value">{{ item.uploadTime }}</text>
  15. </view>
  16. <view class="info-row">
  17. <text class="info-label">申请时间</text>
  18. <text class="info-value">{{ item.applyTime }}</text>
  19. </view>
  20. <view class="info-row" v-for="shiwu in item.totals">
  21. <text class="info-label">{{ shiwu.categoryName }}</text>
  22. <text class="info-value">{{ shiwu.num }}</text>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import {queryPendingWriteOffDetail} from "@/api/hexiao";
  29. export default {
  30. data() {
  31. return {
  32. id:"",
  33. // 总览信息
  34. recordInfo: {
  35. storeName: '湖南长沙超吉炫旗舰店',
  36. verificationTime: '2025-08-11 09:30:00',
  37. },
  38. // 分类汇总数据
  39. summaryData: [
  40. ],
  41. // 所有明细的列表
  42. detailsList: [],
  43. // 分页加载相关
  44. pagination: { page: 1, limit: 15 },
  45. loadStatus: 'more', // 'more', 'loading', 'noMore'
  46. isLoading: false,
  47. detail:{totals:[]}
  48. };
  49. },
  50. onLoad(opt) {
  51. // 页面加载时,获取第一页数据
  52. // options.id 可以用来从上个页面传递记录ID
  53. this.id = opt.id
  54. this.getDetail(true);
  55. },
  56. onPullDownRefresh() {
  57. this.fetchDetails(true);
  58. },
  59. methods: {
  60. getDetail(){
  61. queryPendingWriteOffDetail({ywyId:this.id}).then(res=>{
  62. this.detail = res.data;
  63. })
  64. },
  65. // 模拟从API获取明细数据
  66. async fetchDetails(isRefresh = false) {
  67. if (this.isLoading || (this.loadStatus === 'noMore' && !isRefresh)) {
  68. return;
  69. }
  70. if (isRefresh) {
  71. this.pagination.page = 1;
  72. this.detailsList = [];
  73. this.loadStatus = 'more';
  74. }
  75. this.isLoading = true;
  76. this.loadStatus = 'loading';
  77. console.log(`请求第 ${this.pagination.page} 页明细...`);
  78. await new Promise(resolve => setTimeout(resolve, 1000));
  79. const mockData = Array.from({ length: this.pagination.limit }, (_, i) => {
  80. const id = (this.pagination.page - 1) * this.pagination.limit + i + 1;
  81. return {
  82. name: `超吉炫10元精制槟榔 - ${id}`,
  83. code: `BH2025010020${String(id).padStart(3, '0')}`
  84. };
  85. });
  86. const noMoreData = this.pagination.page >= 5; // 模拟加载4页后没有更多
  87. uni.stopPullDownRefresh();
  88. if (mockData.length > 0 && !noMoreData) {
  89. this.detailsList = [...this.detailsList, ...mockData];
  90. this.pagination.page++;
  91. this.loadStatus = 'more';
  92. } else {
  93. this.loadStatus = 'noMore';
  94. }
  95. this.isLoading = false;
  96. },
  97. // 滚动到底部加载更多
  98. loadMore() {
  99. this.fetchDetails();
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .page-container {
  106. display: flex;
  107. flex-direction: column;
  108. height: 100vh;
  109. background-color: #f5f6fa;
  110. }
  111. .info-card {
  112. background-color: #ffffff;
  113. border-radius: 16rpx;
  114. margin: 20rpx;
  115. padding: 20rpx 30rpx;
  116. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
  117. }
  118. .info-row {
  119. display: flex;
  120. justify-content: space-between;
  121. align-items: center;
  122. font-size: 28rpx;
  123. padding: 15rpx 0;
  124. .info-label { color: #666; }
  125. .info-value { color: #333; }
  126. }
  127. .summary-card {
  128. display: flex;
  129. justify-content: space-around;
  130. background: linear-gradient(to right, #6ca1ff, #3c82f8);
  131. border-radius: 16rpx;
  132. margin: 0 20rpx 20rpx;
  133. padding: 20rpx 10rpx;
  134. color: #ffffff;
  135. }
  136. .summary-tab {
  137. display: flex;
  138. flex-direction: column;
  139. align-items: center;
  140. padding: 10rpx;
  141. .tab-category {
  142. font-size: 26rpx;
  143. opacity: 0.9;
  144. }
  145. .tab-count {
  146. font-size: 28rpx;
  147. font-weight: bold;
  148. margin-top: 10rpx;
  149. }
  150. }
  151. .details-list {
  152. flex: 1;
  153. height: 100%;
  154. padding: 0 20rpx;
  155. }
  156. .empty-tip {
  157. text-align: center;
  158. color: #999;
  159. padding-top: 100rpx;
  160. }
  161. .detail-item-card {
  162. background-color: #ffffff;
  163. border-radius: 16rpx;
  164. padding: 30rpx;
  165. margin-bottom: 20rpx;
  166. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
  167. .item-name {
  168. display: block;
  169. font-size: 30rpx;
  170. font-weight: bold;
  171. color: #333;
  172. }
  173. .item-code {
  174. display: block;
  175. font-size: 26rpx;
  176. color: #999;
  177. margin-top: 15rpx;
  178. }
  179. }
  180. </style>