国外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.

319 lines
8.2 KiB

2 days 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 currentRecordList"
  19. :key="index"
  20. class="record-item"
  21. @click="handleItemClick(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.points }}积分</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.exchangeTime }}</text>
  36. </view>
  37. </view>
  38. <view class="record-action">
  39. <uv-button
  40. v-if="currentTab === 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="currentTab === 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. export default {
  71. data() {
  72. return {
  73. currentTab: 0,
  74. tabList: [
  75. { name: '待领取' },
  76. { name: '已领取' },
  77. { name: '系统取消' }
  78. ],
  79. // 待领取记录列表
  80. pendingList: [
  81. {
  82. id: 1,
  83. title: '咖吧之夜童话海新款教育咖吧放内艺术手办树脂伴学生小礼品',
  84. image: '/static/商城_商品1.png',
  85. points: 100,
  86. exchangeTime: '2025-06-12 14:30:12'
  87. },
  88. {
  89. id: 2,
  90. title: '咖吧之夜童话海新款教育咖吧放内艺术手办树脂伴学生小礼品',
  91. image: '/static/商城_商品2.png',
  92. points: 100,
  93. exchangeTime: '2025-06-12 14:30:12'
  94. },
  95. {
  96. id: 3,
  97. title: '咖吧之夜童话海新款教育咖吧放内艺术手办树脂伴学生小礼品',
  98. image: '/static/商城_商品1.png',
  99. points: 100,
  100. exchangeTime: '2025-06-12 14:30:12'
  101. },
  102. {
  103. id: 4,
  104. title: '咖吧之夜童话海新款教育咖吧放内艺术手办树脂伴学生小礼品',
  105. image: '/static/商城_商品2.png',
  106. points: 100,
  107. exchangeTime: '2025-06-12 14:30:12'
  108. }
  109. ],
  110. // 已领取记录列表
  111. receivedList: [
  112. {
  113. id: 5,
  114. title: '咖吧之夜童话海新款教育咖吧放内艺术手办树脂伴学生小礼品',
  115. image: '/static/商城_商品1.png',
  116. points: 100,
  117. exchangeTime: '2025-06-12 14:30:12'
  118. }
  119. ],
  120. // 系统取消记录列表
  121. cancelledList: [
  122. {
  123. id: 6,
  124. title: '咖吧之夜童话海新款教育咖吧放内艺术手办树脂伴学生小礼品',
  125. image: '/static/商城_商品2.png',
  126. points: 100,
  127. exchangeTime: '2025-06-12 14:30:12'
  128. }
  129. ]
  130. }
  131. },
  132. computed: {
  133. currentRecordList() {
  134. if (this.currentTab === 0) {
  135. return this.pendingList
  136. } else if (this.currentTab === 1) {
  137. return this.receivedList
  138. } else {
  139. return this.cancelledList
  140. }
  141. }
  142. },
  143. methods: {
  144. tabChange(index) {
  145. this.currentTab = index
  146. },
  147. handleItemClick(item) {
  148. if (this.currentTab === 0) {
  149. this.viewDetail(item)
  150. } else if (this.currentTab === 1) {
  151. this.viewDetail(item)
  152. } else if (this.currentTab === 2) {
  153. this.viewDetail(item)
  154. }
  155. },
  156. confirmReceive(item) {
  157. // 确认领取逻辑
  158. uni.showModal({
  159. title: '确认领取',
  160. content: '确认已领取该商品?',
  161. success: (res) => {
  162. if (res.confirm) {
  163. // 移动到已领取列表
  164. const index = this.pendingList.findIndex(record => record.id === item.id)
  165. if (index !== -1) {
  166. const record = this.pendingList.splice(index, 1)[0]
  167. this.receivedList.unshift(record)
  168. }
  169. uni.showToast({
  170. title: '领取成功',
  171. icon: 'success'
  172. })
  173. }
  174. }
  175. })
  176. },
  177. viewDetail(item) {
  178. // 查看详情逻辑 - 跳转到兑换详情页面
  179. let status = 'pending'
  180. if (this.currentTab === 1) {
  181. status = 'received'
  182. } else if (this.currentTab === 2) {
  183. status = 'cancelled'
  184. }
  185. uni.navigateTo({
  186. url: `/subPages/my/exchangeDetail?id=${item.id}&status=${status}`
  187. })
  188. }
  189. }
  190. }
  191. </script>
  192. <style lang="scss" scoped>
  193. .exchange-record {
  194. background-color: #f5f5f5;
  195. min-height: 100vh;
  196. .custom-tabs {
  197. display: flex;
  198. background-color: #fff;
  199. border-bottom: 1rpx solid #e5e5e5;
  200. .tab-item {
  201. flex: 1;
  202. position: relative;
  203. display: flex;
  204. flex-direction: column;
  205. align-items: center;
  206. padding: 30rpx 0;
  207. cursor: pointer;
  208. .tab-text {
  209. font-size: 28rpx;
  210. color: #666;
  211. transition: color 0.3s;
  212. &.active {
  213. color: #218cdd;
  214. font-weight: bold;
  215. }
  216. }
  217. .tab-line {
  218. position: absolute;
  219. bottom: 0;
  220. left: 50%;
  221. transform: translateX(-50%);
  222. width: 60rpx;
  223. height: 4rpx;
  224. background-color: #218cdd;
  225. border-radius: 2rpx;
  226. }
  227. }
  228. }
  229. .record-list {
  230. padding: 20rpx;
  231. .record-item {
  232. display: flex;
  233. align-items: flex-start;
  234. margin-bottom: 30rpx;
  235. background: #fff;
  236. border-radius: 12rpx;
  237. padding: 20rpx;
  238. .record-image {
  239. width: 215rpx;
  240. height: 215rpx;
  241. border-radius: 8rpx;
  242. margin-right: 20rpx;
  243. flex-shrink: 0;
  244. }
  245. .record-content {
  246. flex: 1;
  247. display: flex;
  248. flex-direction: column;
  249. .record-info {
  250. display: flex;
  251. flex-direction: column;
  252. margin-bottom: 20rpx;
  253. .title-row {
  254. margin-bottom: 10rpx;
  255. }
  256. .record-title {
  257. font-size: 22rpx;
  258. // font-weight: bold;
  259. color: #000;
  260. line-height: 1.4;
  261. display: -webkit-box;
  262. -webkit-box-orient: vertical;
  263. -webkit-line-clamp: 2;
  264. overflow: hidden;
  265. }
  266. .record-points {
  267. display: flex;
  268. align-items: center;
  269. margin-bottom: 8rpx;
  270. .points-text {
  271. font-size: 26rpx;
  272. color: #218cdd;
  273. font-weight: bold;
  274. margin-left: 6rpx;
  275. }
  276. }
  277. .record-time {
  278. display: flex;
  279. align-items: center;
  280. .time-text {
  281. font-size: 22rpx;
  282. color: #999;
  283. margin-left: 6rpx;
  284. }
  285. }
  286. }
  287. .record-action {
  288. display: flex;
  289. justify-content: flex-end;
  290. // padding-top: 10rpx;
  291. border-top: 1rpx solid #f0f0f0;
  292. }
  293. }
  294. }
  295. }
  296. }
  297. </style>