detail.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  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="content-area">
  13. <!-- Tabs -->
  14. <view class="tabs-row">
  15. <view class="tab-item" :class="{ active: currentTab === 0 }" @click="switchTab(0)">
  16. <text>全部</text>
  17. <view class="tab-line" v-if="currentTab === 0"></view>
  18. </view>
  19. <view class="tab-item" :class="{ active: currentTab === 1 }" @click="switchTab(1)">
  20. <text>获取</text>
  21. <view class="tab-line" v-if="currentTab === 1"></view>
  22. </view>
  23. <view class="tab-item" :class="{ active: currentTab === 2 }" @click="switchTab(2)">
  24. <text>扣减</text>
  25. <view class="tab-line" v-if="currentTab === 2"></view>
  26. </view>
  27. </view>
  28. <!-- 列表 -->
  29. <scroll-view scroll-y class="bill-list">
  30. <view v-for="(group, gIndex) in displayGroups" :key="gIndex" class="month-group">
  31. <!-- 月份头 -->
  32. <view class="group-header">
  33. <text class="month-title">{{ group.month }}</text>
  34. <text class="month-summary">获取 {{ group.income }} 扣减 {{ group.expense }}</text>
  35. </view>
  36. <!-- 列表项 -->
  37. <view class="list-item" v-for="(item, index) in group.items" :key="index">
  38. <!-- 图标 -->
  39. <view class="item-icon-box" :class="item.type">
  40. <text class="item-icon-symbol">{{ item.type === 'income' ? '+' : '-' }}</text>
  41. </view>
  42. <!-- 中间内容 -->
  43. <view class="item-center">
  44. <text class="item-title">{{ item.title }}</text>
  45. <text class="item-desc">{{ item.time }} {{ item.desc }}</text>
  46. </view>
  47. <!-- 右侧数据 -->
  48. <view class="item-right">
  49. <text class="item-amount" :class="{ income: item.type === 'income', expense: item.type === 'expense' }">
  50. {{ item.type === 'income' ? '+' : '' }}{{ item.amount }}
  51. </text>
  52. <view class="item-tag">
  53. <text>{{ item.tag }}</text>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="list-padding-bottom"></view>
  59. </scroll-view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. currentTab: 0,
  68. // 模拟数据结构
  69. groups: [
  70. {
  71. month: '2月 2026',
  72. income: '15',
  73. expense: '10',
  74. items: [
  75. {
  76. title: '订单完成奖励',
  77. desc: '订单完成',
  78. time: '02-05 18:42',
  79. amount: '10',
  80. type: 'income',
  81. tag: '订单'
  82. },
  83. {
  84. title: '好评奖励',
  85. desc: '五星好评',
  86. time: '02-05 19:00',
  87. amount: '5',
  88. type: 'income',
  89. tag: '奖励'
  90. },
  91. {
  92. title: '超时扣分',
  93. desc: '订单超时',
  94. time: '02-04 10:20',
  95. amount: '-10',
  96. type: 'expense',
  97. tag: '惩罚'
  98. }
  99. ]
  100. },
  101. {
  102. month: '1月 2026',
  103. income: '100',
  104. expense: '0',
  105. items: [
  106. {
  107. title: '新用户奖励',
  108. desc: '注册赠送',
  109. time: '01-10 09:00',
  110. amount: '100',
  111. type: 'income',
  112. tag: '系统'
  113. }
  114. ]
  115. }
  116. ]
  117. }
  118. },
  119. computed: {
  120. displayGroups() {
  121. if (this.currentTab === 0) return this.groups;
  122. return this.groups.map(group => {
  123. const filteredItems = group.items.filter(item => {
  124. const type = this.currentTab === 1 ? 'income' : 'expense';
  125. return item.type === type;
  126. });
  127. return {
  128. ...group,
  129. items: filteredItems
  130. };
  131. }).filter(group => group.items.length > 0);
  132. }
  133. },
  134. methods: {
  135. navBack() {
  136. uni.navigateBack();
  137. },
  138. switchTab(index) {
  139. this.currentTab = index;
  140. }
  141. }
  142. }
  143. </script>
  144. <style>
  145. /* 基础容器 */
  146. .container {
  147. background-color: #F5F7FA;
  148. min-height: 100vh;
  149. display: flex;
  150. flex-direction: column;
  151. }
  152. /* 导航栏 */
  153. .nav-bar {
  154. background-color: #fff;
  155. padding-top: var(--status-bar-height);
  156. padding-left: 30rpx;
  157. padding-right: 30rpx;
  158. height: 88rpx;
  159. box-sizing: content-box;
  160. display: flex;
  161. justify-content: space-between;
  162. align-items: center;
  163. position: sticky;
  164. top: 0;
  165. z-index: 100;
  166. }
  167. .nav-left {
  168. height: 100%;
  169. display: flex;
  170. align-items: center;
  171. width: 60rpx;
  172. }
  173. .back-icon {
  174. width: 40rpx;
  175. height: 40rpx;
  176. transform: rotate(180deg);
  177. }
  178. .nav-title {
  179. font-size: 28rpx; /* 14pt (Strict) */
  180. font-weight: bold;
  181. color: #333;
  182. }
  183. .nav-right {
  184. width: 60rpx;
  185. }
  186. /* 内容区域 */
  187. .content-area {
  188. flex: 1;
  189. display: flex;
  190. flex-direction: column;
  191. }
  192. /* Tabs */
  193. .tabs-row {
  194. background-color: #fff;
  195. display: flex;
  196. justify-content: space-around;
  197. padding-top: 20rpx;
  198. padding-bottom: 2rpx;
  199. margin-bottom: 20rpx;
  200. }
  201. .tab-item {
  202. padding-bottom: 16rpx;
  203. font-size: 28rpx;
  204. color: #666;
  205. position: relative;
  206. display: flex;
  207. flex-direction: column;
  208. align-items: center;
  209. min-width: 100rpx;
  210. }
  211. .tab-item.active {
  212. font-weight: bold;
  213. color: #FF9800;
  214. }
  215. .tab-line {
  216. width: 40rpx;
  217. height: 4rpx;
  218. background-color: #FF9800;
  219. border-radius: 4rpx;
  220. position: absolute;
  221. bottom: 0;
  222. }
  223. /* 列表容器 */
  224. .bill-list {
  225. flex: 1;
  226. padding: 0 20rpx;
  227. box-sizing: border-box;
  228. }
  229. /* 月份卡片 */
  230. .month-group {
  231. background-color: #fff;
  232. border-radius: 16rpx;
  233. padding: 0 20rpx;
  234. margin-bottom: 20rpx;
  235. box-shadow: 0 2rpx 6rpx rgba(0,0,0,0.02);
  236. }
  237. .group-header {
  238. display: flex;
  239. justify-content: space-between;
  240. align-items: center;
  241. padding: 24rpx 10rpx;
  242. border-bottom: 1rpx solid #f9f9f9;
  243. }
  244. .month-title {
  245. font-size: 30rpx;
  246. font-weight: bold;
  247. color: #333;
  248. }
  249. .month-summary {
  250. font-size: 24rpx;
  251. color: #999;
  252. }
  253. /* 列表项 */
  254. .list-item {
  255. display: flex;
  256. align-items: center;
  257. padding: 30rpx 10rpx;
  258. border-bottom: 1rpx solid #f9f9f9;
  259. }
  260. .list-item:last-child {
  261. border-bottom: none;
  262. }
  263. /* 左侧图标 */
  264. .item-icon-box {
  265. width: 80rpx;
  266. height: 80rpx;
  267. border-radius: 50%;
  268. display: flex;
  269. justify-content: center;
  270. align-items: center;
  271. margin-right: 20rpx;
  272. flex-shrink: 0;
  273. }
  274. .item-icon-box.income {
  275. background-color: #FFF8E1; /* Light Yellow for Points */
  276. }
  277. .item-icon-box.expense {
  278. background-color: #F5F5F5; /* Light Grey for Points */
  279. }
  280. .item-icon-symbol {
  281. font-size: 40rpx;
  282. font-weight: 300;
  283. line-height: 1;
  284. margin-top: -4rpx;
  285. }
  286. .item-icon-box.income .item-icon-symbol {
  287. color: #FF9800; /* Orange */
  288. }
  289. .item-icon-box.expense .item-icon-symbol {
  290. color: #333; /* Black */
  291. }
  292. /* 中间内容 */
  293. .item-center {
  294. flex: 1;
  295. display: flex;
  296. flex-direction: column;
  297. justify-content: space-around;
  298. height: 80rpx;
  299. }
  300. .item-title {
  301. font-size: 28rpx;
  302. font-weight: 500;
  303. color: #333;
  304. }
  305. .item-desc {
  306. font-size: 22rpx;
  307. color: #999;
  308. margin-top: 8rpx;
  309. }
  310. /* 右侧数据 */
  311. .item-right {
  312. display: flex;
  313. flex-direction: column;
  314. align-items: flex-end;
  315. justify-content: space-around;
  316. height: 80rpx;
  317. margin-left: 10rpx;
  318. }
  319. .item-amount {
  320. font-size: 30rpx;
  321. font-weight: bold;
  322. }
  323. .item-amount.income {
  324. color: #FF9800;
  325. }
  326. .item-amount.expense {
  327. color: #333;
  328. }
  329. .item-tag {
  330. display: inline-flex;
  331. justify-content: flex-end;
  332. margin-top: 6rpx;
  333. }
  334. .item-tag text {
  335. background-color: #FFFFFF;
  336. border: 1rpx solid #eee;
  337. padding: 2rpx 8rpx;
  338. border-radius: 6rpx;
  339. font-size: 20rpx;
  340. color: #999;
  341. }
  342. .list-padding-bottom {
  343. height: 40rpx;
  344. }
  345. </style>