hexiao_detail.vue 5.1 KB

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