index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <template>
  2. <view class="container">
  3. <!-- 导航栏 -->
  4. <view class="nav-bar">
  5. <view class="nav-left" @click="navBack">
  6. <image class="back-icon" src="/static/icons/chevron_right_dark.svg"></image>
  7. </view>
  8. <text class="nav-title">我的积分</text>
  9. <view class="nav-right"></view>
  10. </view>
  11. <!-- 顶部卡片 -->
  12. <view class="points-card">
  13. <view class="card-header">
  14. <view class="equity-btn" @click="navToEquity">
  15. <image class="equity-icon" src="/static/icons/diamond_white.svg"></image>
  16. <text>积分权益</text>
  17. </view>
  18. <view class="detail-link" @click="navToDetail">
  19. <text>明细</text>
  20. </view>
  21. </view>
  22. <view class="card-body">
  23. <text class="label">当前积分</text>
  24. <text class="value">1200</text>
  25. </view>
  26. <!-- 装饰背景 -->
  27. <image class="bg-decor" src="/static/icons/star_decor.svg" mode="aspectFit"></image>
  28. </view>
  29. <!-- 最近变动 -->
  30. <view class="record-container">
  31. <view class="record-header">
  32. <text class="header-title">最近积分变动</text>
  33. <view class="header-more" @click="navToDetail">
  34. <text>查看全部</text>
  35. <image class="more-icon" src="/static/icons/chevron_right.svg"></image>
  36. </view>
  37. </view>
  38. <!-- Tabs -->
  39. <view class="tabs-row">
  40. <view class="tab-item" :class="{ active: currentTab === 0 }" @click="switchTab(0)">
  41. <text>全部</text>
  42. <view class="tab-line" v-if="currentTab === 0"></view>
  43. </view>
  44. <view class="tab-item" :class="{ active: currentTab === 1 }" @click="switchTab(1)">
  45. <text>获取</text>
  46. <view class="tab-line" v-if="currentTab === 1"></view>
  47. </view>
  48. <view class="tab-item" :class="{ active: currentTab === 2 }" @click="switchTab(2)">
  49. <text>扣减</text>
  50. <view class="tab-line" v-if="currentTab === 2"></view>
  51. </view>
  52. </view>
  53. <!-- 列表 (文本模式) -->
  54. <view class="record-list">
  55. <view class="list-item" v-for="(item, index) in displayList" :key="index">
  56. <view class="item-left">
  57. <text class="item-title">{{ item.title }}</text>
  58. <text class="item-desc">{{ item.desc }}</text>
  59. <text class="item-time">{{ item.time }}</text>
  60. </view>
  61. <view class="item-right">
  62. <text class="item-amount" :class="{ income: item.type === 'income', expense: item.type === 'expense' }">
  63. {{ item.type === 'income' ? '+' : '' }}{{ item.amount }}
  64. </text>
  65. <view class="item-tag">
  66. <text>{{ item.tag }}</text>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. export default {
  76. data() {
  77. return {
  78. currentTab: 0,
  79. list: [
  80. {
  81. title: '订单完成奖励',
  82. desc: '订单 T1002839 完成',
  83. time: '2026-02-05 18:42',
  84. amount: '10',
  85. type: 'income',
  86. tag: '订单'
  87. },
  88. {
  89. title: '好评奖励',
  90. desc: '获得五星好评',
  91. time: '2026-02-05 19:00',
  92. amount: '5',
  93. type: 'income',
  94. tag: '奖励'
  95. },
  96. {
  97. title: '超时扣分',
  98. desc: '订单 T1002830 超时送达',
  99. time: '2026-02-04 10:20',
  100. amount: '-10',
  101. type: 'expense',
  102. tag: '惩罚'
  103. }
  104. ]
  105. }
  106. },
  107. computed: {
  108. displayList() {
  109. if (this.currentTab === 0) return this.list;
  110. const type = this.currentTab === 1 ? 'income' : 'expense';
  111. return this.list.filter(item => item.type === type);
  112. }
  113. },
  114. methods: {
  115. navBack() {
  116. uni.navigateBack();
  117. },
  118. navToDetail() {
  119. uni.navigateTo({
  120. url: '/pages/mine/points/detail'
  121. });
  122. },
  123. navToEquity() {
  124. // TODO: 跳转权益页
  125. },
  126. switchTab(index) {
  127. this.currentTab = index;
  128. }
  129. }
  130. }
  131. </script>
  132. <style>
  133. .container {
  134. background-color: #F8F9FA;
  135. min-height: 100vh;
  136. }
  137. .nav-bar {
  138. background-color: #fff;
  139. padding-top: var(--status-bar-height);
  140. padding-left: 30rpx;
  141. padding-right: 30rpx;
  142. height: 88rpx;
  143. box-sizing: content-box;
  144. display: flex;
  145. justify-content: space-between;
  146. align-items: center;
  147. position: sticky;
  148. top: 0;
  149. z-index: 100;
  150. }
  151. .nav-left {
  152. height: 100%;
  153. display: flex;
  154. align-items: center;
  155. width: 60rpx;
  156. }
  157. .back-icon {
  158. width: 40rpx;
  159. height: 40rpx;
  160. transform: rotate(180deg);
  161. }
  162. .nav-title {
  163. font-size: 28rpx;
  164. font-weight: bold;
  165. color: #333;
  166. }
  167. .nav-right {
  168. width: 60rpx;
  169. }
  170. /* 积分卡片 */
  171. .points-card {
  172. margin: 20rpx 30rpx;
  173. height: 300rpx;
  174. background: linear-gradient(135deg, #FFB74D 0%, #FF9800 100%);
  175. border-radius: 20rpx;
  176. position: relative;
  177. padding: 30rpx;
  178. box-sizing: border-box;
  179. overflow: hidden;
  180. color: #fff;
  181. box-shadow: 0 4rpx 16rpx rgba(255, 152, 0, 0.2);
  182. }
  183. .bg-decor {
  184. position: absolute;
  185. right: -20rpx;
  186. bottom: -20rpx;
  187. width: 180rpx;
  188. height: 180rpx;
  189. opacity: 0.3;
  190. }
  191. .card-header {
  192. display: flex;
  193. justify-content: space-between;
  194. align-items: center;
  195. }
  196. .equity-btn {
  197. display: flex;
  198. align-items: center;
  199. font-size: 26rpx;
  200. }
  201. .equity-icon {
  202. width: 32rpx; /* placeholder icon */
  203. height: 32rpx;
  204. margin-right: 8rpx;
  205. border-radius: 50%;
  206. background: rgba(255,255,255,0.3); /* circle bg for icon */
  207. }
  208. .detail-link {
  209. font-size: 24rpx;
  210. opacity: 0.9;
  211. }
  212. .card-body {
  213. margin-top: 60rpx;
  214. }
  215. .label {
  216. font-size: 26rpx;
  217. opacity: 0.9;
  218. display: block;
  219. margin-bottom: 10rpx;
  220. }
  221. .value {
  222. font-size: 64rpx;
  223. font-weight: bold;
  224. }
  225. /* 记录区域 */
  226. .record-container {
  227. background-color: #fff;
  228. border-radius: 20rpx 20rpx 0 0;
  229. padding: 30rpx;
  230. min-height: 500rpx;
  231. }
  232. .record-header {
  233. display: flex;
  234. justify-content: space-between;
  235. align-items: center;
  236. margin-bottom: 20rpx;
  237. }
  238. .header-title {
  239. font-size: 30rpx;
  240. font-weight: bold;
  241. color: #333;
  242. }
  243. .header-more {
  244. display: flex;
  245. align-items: center;
  246. }
  247. .header-more text {
  248. font-size: 24rpx;
  249. color: #999;
  250. }
  251. .more-icon {
  252. width: 24rpx;
  253. height: 24rpx;
  254. margin-left: 4rpx;
  255. }
  256. /* Tabs */
  257. .tabs-row {
  258. display: flex;
  259. border-bottom: 1rpx solid #f5f5f5;
  260. margin-bottom: 20rpx;
  261. }
  262. .tab-item {
  263. margin-right: 40rpx;
  264. padding-bottom: 12rpx;
  265. font-size: 28rpx;
  266. color: #666;
  267. position: relative;
  268. display: flex;
  269. flex-direction: column;
  270. align-items: center;
  271. }
  272. .tab-item.active {
  273. font-weight: bold;
  274. color: #333;
  275. }
  276. .tab-line {
  277. width: 28rpx;
  278. height: 4rpx;
  279. background-color: #FF9800; /* Match card color */
  280. border-radius: 4rpx;
  281. position: absolute;
  282. bottom: 0;
  283. }
  284. /* 列表 */
  285. .list-item {
  286. display: flex;
  287. justify-content: space-between;
  288. padding: 24rpx 0;
  289. border-bottom: 1rpx solid #f9f9f9;
  290. }
  291. .item-left {
  292. display: flex;
  293. flex-direction: column;
  294. }
  295. .item-title {
  296. font-size: 28rpx;
  297. color: #333;
  298. margin-bottom: 8rpx;
  299. font-weight: 500;
  300. }
  301. .item-desc {
  302. font-size: 24rpx;
  303. color: #999;
  304. margin-bottom: 6rpx;
  305. }
  306. .item-time {
  307. font-size: 22rpx;
  308. color: #ccc;
  309. }
  310. .item-right {
  311. display: flex;
  312. flex-direction: column;
  313. align-items: flex-end;
  314. }
  315. .item-amount {
  316. font-size: 30rpx;
  317. font-weight: bold;
  318. margin-bottom: 8rpx;
  319. }
  320. .item-amount.income {
  321. color: #FF9800; /* Orange for points income */
  322. }
  323. .item-amount.expense {
  324. color: #333;
  325. }
  326. .item-tag {
  327. display: inline-flex;
  328. justify-content: flex-end;
  329. }
  330. .item-tag text {
  331. background-color: #F5F5F5;
  332. padding: 4rpx 12rpx;
  333. border-radius: 6rpx;
  334. font-size: 22rpx;
  335. color: #999;
  336. }
  337. </style>