国外MOSE官网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

226 lines
4.9 KiB

3 days ago
3 days ago
3 days ago
3 days ago
3 days ago
3 days ago
3 days ago
3 days ago
  1. <template>
  2. <view class="points-detail">
  3. <!-- 顶部导航栏 -->
  4. <!-- Tab切换栏 -->
  5. <view class="tab-container">
  6. <view
  7. class="tab-item"
  8. :class="{ active: activeTab === 'income' }"
  9. @click="switchTab('income')"
  10. >
  11. <text class="tab-text">收入明细</text>
  12. </view>
  13. <view
  14. class="tab-item"
  15. :class="{ active: activeTab === 'expense' }"
  16. @click="switchTab('expense')"
  17. >
  18. <text class="tab-text">支出明细</text>
  19. </view>
  20. </view>
  21. <!-- 列表内容 -->
  22. <view class="list-container">
  23. <!-- 收入明细列表 -->
  24. <view v-if="activeTab === 'income'" class="income-list">
  25. <view
  26. v-for="(item, index) in incomeList"
  27. :key="index"
  28. class="list-item"
  29. >
  30. <view class="item-left">
  31. <image src="/subPages/static/商品_积分@2x.png" class="item-icon"></image>
  32. <view class="item-info">
  33. <text class="item-title">{{ item.title }}</text>
  34. <text class="item-time">{{ item.createTime }}</text>
  35. </view>
  36. </view>
  37. <view class="item-right">
  38. <text class="points-text income">+{{ item.score }}积分</text>
  39. </view>
  40. </view>
  41. </view>
  42. <!-- 支出明细列表 -->
  43. <view v-if="activeTab === 'expense'" class="expense-list">
  44. <view
  45. v-for="(item, index) in expenseList"
  46. :key="index"
  47. class="list-item"
  48. >
  49. <view class="item-left">
  50. <image src="/subPages/static/商品_积分@2x.png" class="item-icon"></image>
  51. <view class="item-info">
  52. <text class="item-title">{{ item.title }}</text>
  53. <text class="item-time">{{ item.createTime }}</text>
  54. </view>
  55. </view>
  56. <view class="item-right">
  57. <text class="points-text expense">-{{ item.score }}积分</text>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. export default {
  66. name: 'PointsDetail',
  67. data() {
  68. return {
  69. activeTab: 'income', // 当前激活的tab
  70. incomeList: [],
  71. expenseList: [],
  72. pageNo: 1
  73. // type: 0 // 0-收入 1-支出
  74. }
  75. },
  76. methods: {
  77. switchTab(tab) {
  78. this.activeTab = tab;
  79. this.initData()
  80. this.queryScoreList()
  81. },
  82. initData() {
  83. this.pageNo = 1
  84. this.incomeList = []
  85. this.expenseList = []
  86. },
  87. async queryScoreList() {
  88. const res = await this.$api.score.queryScoreList({
  89. pageNo: this.pageNo,
  90. pageSize: 10,
  91. type: this.activeTab === 'income' ? 0 : 1
  92. })
  93. if (res.result.records.length) {
  94. if (this.activeTab === 'income') {
  95. this.incomeList.push(...res.result.records)
  96. } else {
  97. this.expenseList.push(...res.result.records)
  98. }
  99. this.pageNo++
  100. }else {
  101. uni.showToast({
  102. title: '没有更多数据了',
  103. icon: 'none'
  104. })
  105. }
  106. }
  107. },
  108. onLoad() {
  109. this.queryScoreList()
  110. },
  111. onReachBottom() {
  112. this.queryScoreList()
  113. },
  114. async onPullDownRefresh() {
  115. this.initData()
  116. await this.queryScoreList()
  117. uni.stopPullDownRefresh()
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. .points-detail {
  123. background: #f8f8f8;
  124. min-height: 100vh;
  125. }
  126. .tab-container {
  127. display: flex;
  128. background: #ffffff;
  129. margin: 20rpx;
  130. border-radius: 50rpx;
  131. padding: 8rpx;
  132. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  133. .tab-item {
  134. flex: 1;
  135. height: 80rpx;
  136. display: flex;
  137. align-items: center;
  138. justify-content: center;
  139. border-radius: 40rpx;
  140. transition: all 0.3s ease;
  141. &.active {
  142. background: #1488DB;
  143. .tab-text {
  144. color: #ffffff;
  145. font-weight: bold;
  146. }
  147. }
  148. .tab-text {
  149. font-size: 28rpx;
  150. color: #666666;
  151. transition: all 0.3s ease;
  152. }
  153. }
  154. }
  155. .list-container {
  156. padding: 0 20rpx;
  157. }
  158. .list-item {
  159. background: #ffffff;
  160. margin-bottom: 20rpx;
  161. padding: 30rpx;
  162. border-radius: 15rpx;
  163. display: flex;
  164. align-items: center;
  165. justify-content: space-between;
  166. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  167. .item-left {
  168. display: flex;
  169. align-items: center;
  170. flex: 1;
  171. .item-icon {
  172. width: 60rpx;
  173. height: 60rpx;
  174. margin-right: 20rpx;
  175. border-radius: 50%;
  176. }
  177. .item-info {
  178. flex: 1;
  179. .item-title {
  180. font-size: 28rpx;
  181. color: #333333;
  182. display: block;
  183. margin-bottom: 10rpx;
  184. line-height: 1.4;
  185. }
  186. .item-time {
  187. font-size: 24rpx;
  188. color: #999999;
  189. display: block;
  190. }
  191. }
  192. }
  193. .item-right {
  194. .points-text {
  195. font-size: 28rpx;
  196. font-weight: bold;
  197. &.income {
  198. color: #1488DB;
  199. }
  200. &.expense {
  201. color: #ff4757;
  202. }
  203. }
  204. }
  205. }
  206. </style>