木邻有你前端代码仓库
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.

240 lines
5.6 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="exchange-record">
  3. <!-- 自定义tabs -->
  4. <view class="custom-tabs">
  5. <view
  6. v-for="(tab, index) in tabList"
  7. :key="index"
  8. class="tab-item"
  9. @click="tabChange(index)"
  10. >
  11. <text class="tab-text" :class="{ active: currentTab === index }">{{ tab.name }}</text>
  12. <view v-if="currentTab === index" class="tab-line"></view>
  13. </view>
  14. </view>
  15. <!-- 兑换记录列表 -->
  16. <view class="record-list">
  17. <view
  18. v-for="(item, index) in list"
  19. :key="index"
  20. class="record-item"
  21. @click="viewDetail(item)"
  22. >
  23. <image class="record-image" :src="item.image" mode="aspectFit"></image>
  24. <view class="record-content">
  25. <view class="record-info">
  26. <view class="title-row">
  27. <text class="record-title">{{ item.title }}</text>
  28. </view>
  29. <view class="record-points">
  30. <uv-icon name="integral" size="16" color="#218cdd"></uv-icon>
  31. <text class="points-text">{{ item.price }}积分</text>
  32. </view>
  33. <view class="record-time">
  34. <uv-icon name="clock" size="14" color="#999"></uv-icon>
  35. <text class="time-text">兑换时间{{ item.createTime }}</text>
  36. </view>
  37. </view>
  38. <view class="record-action">
  39. <uv-button
  40. v-if="item.status === '0'"
  41. type="primary"
  42. size="small"
  43. text="确认领取"
  44. shape="circle"
  45. @click.stop="viewDetail(item)"
  46. ></uv-button>
  47. <uv-button
  48. v-else-if="item.status === '1'"
  49. type="success"
  50. size="small"
  51. text="查看详情"
  52. shape="circle"
  53. @click.stop="viewDetail(item)"
  54. ></uv-button>
  55. <uv-button
  56. v-else
  57. type="error"
  58. size="small"
  59. text="已取消"
  60. shape="circle"
  61. disabled
  62. ></uv-button>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. import MixinList from '@/mixins/list'
  71. export default {
  72. mixins: [MixinList],
  73. data() {
  74. return {
  75. currentTab: 0,
  76. mixinListApi: 'user.queryOrderList',
  77. tabList: [
  78. { name: '待领取' },
  79. { name: '已领取' },
  80. { name: '系统取消' }
  81. ],
  82. }
  83. },
  84. methods: {
  85. mixinSetParams() {
  86. return {
  87. status: this.currentTab
  88. }
  89. },
  90. tabChange(index) {
  91. this.currentTab = index
  92. this.initPage()
  93. this.getList(true)
  94. },
  95. viewDetail(item) {
  96. // 查看详情逻辑 - 跳转到兑换详情页面
  97. let status = 'pending'
  98. if (this.currentTab === 1) {
  99. status = 'received'
  100. } else if (this.currentTab === 2) {
  101. status = 'cancelled'
  102. }
  103. uni.navigateTo({
  104. url: `/subPages/my/exchangeDetail?id=${item.id}&status=${status}`
  105. })
  106. },
  107. }
  108. }
  109. </script>
  110. <style lang="scss" scoped>
  111. .exchange-record {
  112. background-color: #f5f5f5;
  113. min-height: 100vh;
  114. .custom-tabs {
  115. display: flex;
  116. background-color: #fff;
  117. border-bottom: 1rpx solid #e5e5e5;
  118. .tab-item {
  119. flex: 1;
  120. position: relative;
  121. display: flex;
  122. flex-direction: column;
  123. align-items: center;
  124. padding: 30rpx 0;
  125. cursor: pointer;
  126. .tab-text {
  127. font-size: 28rpx;
  128. color: #666;
  129. transition: color 0.3s;
  130. &.active {
  131. color: #218cdd;
  132. font-weight: bold;
  133. }
  134. }
  135. .tab-line {
  136. position: absolute;
  137. bottom: 0;
  138. left: 50%;
  139. transform: translateX(-50%);
  140. width: 60rpx;
  141. height: 4rpx;
  142. background-color: #218cdd;
  143. border-radius: 2rpx;
  144. }
  145. }
  146. }
  147. .record-list {
  148. padding: 20rpx;
  149. .record-item {
  150. display: flex;
  151. align-items: flex-start;
  152. margin-bottom: 30rpx;
  153. background: #fff;
  154. border-radius: 12rpx;
  155. padding: 20rpx;
  156. .record-image {
  157. width: 215rpx;
  158. height: 215rpx;
  159. border-radius: 8rpx;
  160. margin-right: 20rpx;
  161. flex-shrink: 0;
  162. }
  163. .record-content {
  164. flex: 1;
  165. display: flex;
  166. flex-direction: column;
  167. .record-info {
  168. display: flex;
  169. flex-direction: column;
  170. margin-bottom: 20rpx;
  171. .title-row {
  172. margin-bottom: 10rpx;
  173. }
  174. .record-title {
  175. font-size: 22rpx;
  176. // font-weight: bold;
  177. color: #000;
  178. line-height: 1.4;
  179. display: -webkit-box;
  180. -webkit-box-orient: vertical;
  181. -webkit-line-clamp: 2;
  182. overflow: hidden;
  183. }
  184. .record-points {
  185. display: flex;
  186. align-items: center;
  187. margin-bottom: 8rpx;
  188. .points-text {
  189. font-size: 26rpx;
  190. color: #218cdd;
  191. font-weight: bold;
  192. margin-left: 6rpx;
  193. }
  194. }
  195. .record-time {
  196. display: flex;
  197. align-items: center;
  198. .time-text {
  199. font-size: 22rpx;
  200. color: #999;
  201. margin-left: 6rpx;
  202. }
  203. }
  204. }
  205. .record-action {
  206. display: flex;
  207. justify-content: flex-end;
  208. // padding-top: 10rpx;
  209. border-top: 1rpx solid #f0f0f0;
  210. }
  211. }
  212. }
  213. }
  214. }
  215. </style>