index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view :style="colorStyle">
  3. <view v-if="records.length" class="verify-wrapper">
  4. <view v-for="section in records" :key="section.time" class="section">
  5. <view class="head">{{ section.time }}</view>
  6. <view class="body">
  7. <view v-for="item in section.list" :key="item.id" class="item">
  8. <image class="image" :src="item.cartInfo.attrInfo.image" mode=""></image>
  9. <view class="detail">
  10. <view class="title">{{ item.cartInfo.productInfo.store_name }}</view>
  11. <view class="attribute">{{ item.cartInfo.attrInfo.suk }}</view>
  12. <view class="money">¥{{ item.cartInfo.attrInfo.price }}</view>
  13. </view>
  14. <view class="count">x {{ item.writeoff_num }}</view>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <empty-page v-else-if="loadend" title="暂无核销记录哦~"></empty-page>
  20. <view class='loadingicon acea-row row-center-wrapper'>
  21. <text class='loading iconfont icon-jiazai' :hidden="!loading"></text>
  22. <template v-if="!loading && records.length">{{ loadend ? '没有更多内容啦~' : '加载更多' }}</template>
  23. </view>
  24. <home v-if="navigation"></home>
  25. </view>
  26. </template>
  27. <script>
  28. import home from '@/components/home/index.vue';
  29. import emptyPage from '@/components/emptyPage.vue';
  30. import color from '@/mixins/color.js';
  31. import {
  32. orderWriteRecords
  33. } from '@/api/order.js';
  34. export default {
  35. components: {
  36. home,
  37. emptyPage
  38. },
  39. mixins: [color],
  40. data() {
  41. return {
  42. oid: 0,
  43. page: 1,
  44. limit: 20,
  45. loading: false,
  46. loadend: false,
  47. list: [],
  48. time: [],
  49. records: []
  50. }
  51. },
  52. onLoad(options) {
  53. this.oid = options.oid;
  54. this.orderWriteRecords();
  55. },
  56. onReachBottom() {
  57. this.orderWriteRecords();
  58. },
  59. methods: {
  60. orderWriteRecords() {
  61. if (this.loading || this.loadend) {
  62. return;
  63. }
  64. this.loading = true;
  65. orderWriteRecords(this.oid, {
  66. page: this.page++,
  67. limit: this.limit
  68. }).then(res => {
  69. let {
  70. count,
  71. list,
  72. time
  73. } = res.data;
  74. this.list = [...this.list, ...list];
  75. this.time = [...new Set([...this.time, ...time])];
  76. this.records = this.time.map(time => ({
  77. time,
  78. list: this.list.filter(item => item.time_key === time)
  79. }));
  80. this.loading = false;
  81. this.loadend = this.list.length === count;
  82. }).catch(err => {
  83. this.loading = false;
  84. this.$util.Tips({
  85. title: err
  86. });
  87. });
  88. }
  89. },
  90. }
  91. </script>
  92. <style lang="scss" scoped>
  93. .verify-wrapper {
  94. .section {
  95. background-color: #FFFFFF;
  96. +.section {
  97. margin-top: 20rpx;
  98. }
  99. }
  100. .head {
  101. display: flex;
  102. align-items: center;
  103. padding: 22rpx 30rpx;
  104. font-size: 28rpx;
  105. line-height: 42rpx;
  106. color: #999999;
  107. }
  108. .body {
  109. padding-left: 30rpx;
  110. border-top: 1rpx solid #F0F0F0;
  111. }
  112. .item {
  113. display: flex;
  114. padding: 25rpx 30rpx 25rpx 0;
  115. +.item {
  116. border-top: 1rpx solid #F0F0F0;
  117. }
  118. }
  119. .image {
  120. width: 130rpx;
  121. height: 130rpx;
  122. }
  123. .detail {
  124. flex: 1;
  125. min-width: 0;
  126. padding: 0 22rpx;
  127. .title {
  128. overflow: hidden;
  129. white-space: nowrap;
  130. text-overflow: ellipsis;
  131. font-size: 28rpx;
  132. line-height: 40rpx;
  133. color: #333333;
  134. }
  135. .attribute {
  136. margin-top: 8rpx;
  137. font-size: 20rpx;
  138. line-height: 28rpx;
  139. color: #999999;
  140. }
  141. .money {
  142. margin-top: 18rpx;
  143. font-size: 26rpx;
  144. line-height: 32rpx;
  145. color: var(--view-priceColor);
  146. }
  147. }
  148. .count {
  149. font-size: 26rpx;
  150. line-height: 40rpx;
  151. color: #999999;
  152. }
  153. }
  154. </style>