index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. <template>
  2. <view class="container">
  3. <!-- 自定义头部 -->
  4. <view class="custom-header">
  5. <view class="header-left" @click="navBack">
  6. <image class="back-icon" src="/static/icons/chevron_right_dark.svg" style="transform: rotate(180deg);"></image>
  7. </view>
  8. <text class="header-title">履约者等级权益</text>
  9. <view class="header-right"></view>
  10. </view>
  11. <view class="header-placeholder"></view>
  12. <!-- 等级 Switcher -->
  13. <view class="swiper-container">
  14. <swiper
  15. class="level-swiper"
  16. previous-margin="80rpx"
  17. next-margin="80rpx"
  18. :current="currentIndex"
  19. @change="swiperChange">
  20. <swiper-item v-for="(level, index) in levels" :key="index" @click="changeLevel(index)">
  21. <view class="level-card" :class="'level-card-' + (index + 1)" :style="{transform: currentIndex === index ? 'scale(1)' : 'scale(0.9)'}">
  22. <view class="card-content">
  23. <view class="card-header">
  24. <view class="level-badge">{{ level.id }}</view>
  25. <view class="current-badge" v-if="level.isCurrent">当前等级</view>
  26. </view>
  27. <text class="level-name">{{ level.name }}</text>
  28. <text class="level-score">{{ level.score }}</text>
  29. <!-- Crown graphic overlay -->
  30. <image class="crown-overlay" src="/static/icons/crown.svg" mode="aspectFit"></image>
  31. </view>
  32. </view>
  33. </swiper-item>
  34. </swiper>
  35. <!-- 自定义指示点 -->
  36. <view class="swiper-dots">
  37. <view
  38. class="dot"
  39. v-for="(item, index) in levels"
  40. :key="index"
  41. :class="{ active: currentIndex === index }">
  42. </view>
  43. </view>
  44. </view>
  45. <!-- 权益标题 -->
  46. <view class="benefits-title-row">
  47. <text class="benefits-title">{{ currentLevel.id }} 专属权益</text>
  48. <text class="benefits-count">({{ currentLevel.benefits.length }})</text>
  49. </view>
  50. <!-- 权益列表 -->
  51. <view class="benefits-grid">
  52. <view
  53. class="benefit-item"
  54. v-for="(benefit, index) in currentLevel.benefits"
  55. :key="index"
  56. @click="showBenefitDetail(benefit)">
  57. <view class="benefit-icon-wrapper">
  58. <image class="benefit-icon" :src="benefit.icon" mode="aspectFit" v-if="benefit.icon"></image>
  59. <view class="benefit-icon-placeholder" v-else>{{ benefit.name[0] }}</view>
  60. </view>
  61. <text class="benefit-name">{{ benefit.name }}</text>
  62. </view>
  63. </view>
  64. <!-- 权益详情弹窗 -->
  65. <view class="popup-mask" :class="{ 'show': isPopupShow }" @click="closePopup" @touchmove.stop.prevent>
  66. <view class="popup-modal" @click.stop>
  67. <view class="popup-icon-wrapper">
  68. <image class="benefit-icon-large" :src="currentBenefit.icon" mode="aspectFit" v-if="currentBenefit && currentBenefit.icon"></image>
  69. <view class="benefit-icon-placeholder-large" v-else>{{ currentBenefit ? currentBenefit.name[0] : '' }}</view>
  70. </view>
  71. <text class="popup-title">{{ currentBenefit ? currentBenefit.name : '' }}</text>
  72. <text class="popup-desc">{{ currentBenefit ? currentBenefit.desc : '' }}</text>
  73. <button class="popup-btn" @click="closePopup">我知道了</button>
  74. </view>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. export default {
  80. data() {
  81. return {
  82. currentIndex: 2, // 默认选中 L3
  83. levels: [
  84. {
  85. id: 'L1',
  86. name: '青铜履约者',
  87. score: '需成长值 0',
  88. isCurrent: false,
  89. benefits: [
  90. { name: '新手任务', desc: '完成新手任务可获得额外奖励', icon: '/static/icons/reward.svg' }
  91. ]
  92. },
  93. {
  94. id: 'L2',
  95. name: '白银履约者',
  96. score: '需成长值 200',
  97. isCurrent: false,
  98. benefits: [
  99. { name: '新手任务', desc: '完成新手任务可获得额外奖励', icon: '/static/icons/reward.svg' },
  100. { name: '优先派单', desc: '系统将优先为您派送附近的优质订单', icon: '' }
  101. ]
  102. },
  103. {
  104. id: 'L3',
  105. name: '黄金履约者',
  106. score: '需成长值 500',
  107. isCurrent: true,
  108. benefits: [
  109. { name: '极速提现', desc: '提现申请 2 小时内极速到账,无需等待。', icon: '' },
  110. { name: '晋升奖励', desc: '晋升等级可获得现金红包奖励。', icon: '/static/icons/reward.svg' },
  111. { name: '优先派单', desc: '系统将优先为您派送附近的优质订单。', icon: '' }
  112. ]
  113. },
  114. {
  115. id: 'L4',
  116. name: '钻石履约者',
  117. score: '需成长值 2000',
  118. isCurrent: false,
  119. benefits: [
  120. { name: '专属客服', desc: '享受 7x24 小时专属客服通道。', icon: '/static/icons/service.svg' },
  121. { name: '生日礼包', desc: '生日当天获赠专属礼包。', icon: '/static/icons/reward.svg' },
  122. { name: '装备免费换', desc: '每年可免费更换一套履约装备。', icon: '' },
  123. { name: '医疗互助', desc: '享受平台提供的医疗互助保障。', icon: '' }
  124. ]
  125. }
  126. ],
  127. isPopupShow: false,
  128. currentBenefit: null
  129. }
  130. },
  131. computed: {
  132. currentLevel() {
  133. return this.levels[this.currentIndex];
  134. }
  135. },
  136. methods: {
  137. navBack() {
  138. uni.navigateBack({
  139. delta: 1
  140. });
  141. },
  142. swiperChange(e) {
  143. this.currentIndex = e.detail.current;
  144. },
  145. changeLevel(index) {
  146. this.currentIndex = index;
  147. },
  148. showBenefitDetail(benefit) {
  149. this.currentBenefit = benefit;
  150. this.isPopupShow = true;
  151. },
  152. closePopup() {
  153. this.isPopupShow = false;
  154. }
  155. }
  156. }
  157. </script>
  158. <style>
  159. /* ... Header styles keep same ... */
  160. page {
  161. background-color: #fff;
  162. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  163. }
  164. .custom-header {
  165. position: fixed;
  166. top: 0;
  167. left: 0;
  168. width: 100%;
  169. height: 88rpx;
  170. padding-top: var(--status-bar-height);
  171. background-color: #fff;
  172. display: flex;
  173. align-items: center;
  174. justify-content: space-between;
  175. padding-left: 30rpx;
  176. padding-right: 30rpx;
  177. box-sizing: border-box;
  178. z-index: 100;
  179. }
  180. .header-placeholder {
  181. height: calc(88rpx + var(--status-bar-height));
  182. }
  183. .back-icon {
  184. width: 40rpx;
  185. height: 40rpx;
  186. }
  187. .header-title {
  188. font-size: 32rpx;
  189. font-weight: bold;
  190. color: #333;
  191. }
  192. .header-right {
  193. width: 40rpx;
  194. }
  195. .swiper-container {
  196. position: relative;
  197. padding-bottom: 30rpx;
  198. }
  199. .level-swiper {
  200. height: 360rpx;
  201. margin-top: 20rpx;
  202. }
  203. .level-card {
  204. height: 320rpx;
  205. border-radius: 30rpx;
  206. margin: 0 10rpx;
  207. transition: transform 0.3s;
  208. overflow: hidden;
  209. position: relative;
  210. box-shadow: 0 10rpx 20rpx rgba(0,0,0,0.1);
  211. }
  212. /* Gradients */
  213. .level-card-1 { background: linear-gradient(135deg, #E0E0E0 0%, #BDBDBD 100%); }
  214. .level-card-2 { background: linear-gradient(135deg, #CFD8DC 0%, #B0BEC5 100%); }
  215. .level-card-3 { background: linear-gradient(135deg, #FFC107 0%, #FF9800 100%); }
  216. .level-card-4 { background: linear-gradient(135deg, #4FC3F7 0%, #039BE5 100%); }
  217. .card-content {
  218. padding: 30rpx;
  219. position: relative;
  220. z-index: 2;
  221. height: 100%;
  222. box-sizing: border-box;
  223. display: flex;
  224. flex-direction: column;
  225. }
  226. .card-header {
  227. display: flex;
  228. justify-content: space-between;
  229. align-items: flex-start;
  230. margin-bottom: auto; /* Push content down */
  231. }
  232. .level-badge {
  233. border: 1px solid rgba(255,255,255,0.6);
  234. padding: 2rpx 12rpx;
  235. border-radius: 10rpx;
  236. font-size: 24rpx;
  237. color: #fff;
  238. }
  239. .current-badge {
  240. background-color: rgba(255,255,255,0.9);
  241. color: #333;
  242. font-size: 20rpx;
  243. padding: 4rpx 12rpx;
  244. border-radius: 20rpx;
  245. font-weight: bold;
  246. }
  247. .level-name {
  248. font-size: 44rpx;
  249. font-weight: bold;
  250. color: #fff;
  251. margin-bottom: 10rpx;
  252. text-shadow: 0 2rpx 4rpx rgba(0,0,0,0.1);
  253. }
  254. .level-score {
  255. font-size: 24rpx;
  256. color: rgba(255,255,255,0.8);
  257. margin-bottom: 20rpx;
  258. }
  259. .crown-overlay {
  260. position: absolute;
  261. bottom: -30rpx;
  262. right: -30rpx;
  263. width: 260rpx;
  264. height: 260rpx;
  265. opacity: 0.1;
  266. z-index: 1;
  267. }
  268. /* Dots */
  269. .swiper-dots {
  270. display: flex;
  271. justify-content: center;
  272. margin-top: 10rpx;
  273. }
  274. .dot {
  275. width: 12rpx;
  276. height: 12rpx;
  277. background-color: #E0E0E0;
  278. border-radius: 50%;
  279. margin: 0 6rpx;
  280. transition: all 0.3s;
  281. }
  282. .dot.active {
  283. width: 24rpx;
  284. background-color: #333;
  285. border-radius: 6rpx;
  286. }
  287. .benefits-title-row {
  288. padding: 20rpx 30rpx;
  289. display: flex;
  290. align-items: baseline;
  291. }
  292. .benefits-title {
  293. font-size: 32rpx;
  294. font-weight: bold;
  295. color: #333;
  296. }
  297. .benefits-count {
  298. font-size: 28rpx;
  299. color: #999;
  300. margin-left: 10rpx;
  301. }
  302. .benefits-grid {
  303. display: flex;
  304. flex-wrap: wrap;
  305. padding: 0 20rpx;
  306. }
  307. .benefit-item {
  308. width: 25%; /* 4 items per row */
  309. display: flex;
  310. flex-direction: column;
  311. align-items: center;
  312. margin-bottom: 30rpx;
  313. }
  314. .benefit-icon-wrapper {
  315. width: 88rpx;
  316. height: 88rpx;
  317. background-color: #F8F8F8; /* Or very light color based on current level? Keep simple for now */
  318. border-radius: 24rpx;
  319. display: flex;
  320. align-items: center;
  321. justify-content: center;
  322. margin-bottom: 12rpx;
  323. }
  324. .benefit-icon {
  325. width: 44rpx;
  326. height: 44rpx;
  327. }
  328. .benefit-icon-placeholder {
  329. font-size: 36rpx;
  330. font-weight: bold;
  331. color: #FFB300;
  332. }
  333. .benefit-name {
  334. font-size: 22rpx; /* Smaller font as requested matching image roughly */
  335. color: #666;
  336. text-align: center;
  337. }
  338. /* Modal */
  339. .popup-mask {
  340. position: fixed;
  341. top: 0;
  342. left: 0;
  343. right: 0;
  344. bottom: 0;
  345. background-color: rgba(0,0,0,0.5); /* Semi-transparent black */
  346. z-index: 999;
  347. display: none; /* Hidden by default */
  348. align-items: center;
  349. justify-content: center;
  350. }
  351. .popup-mask.show {
  352. display: flex; /* Show when active */
  353. }
  354. .popup-modal {
  355. width: 480rpx; /* Narrower width */
  356. background-color: #fff;
  357. border-radius: 30rpx;
  358. padding: 50rpx 40rpx;
  359. display: flex;
  360. flex-direction: column;
  361. align-items: center;
  362. box-shadow: 0 10rpx 40rpx rgba(0,0,0,0.2); /* Drop shadow */
  363. }
  364. .popup-icon-wrapper {
  365. width: 120rpx;
  366. height: 120rpx;
  367. background-color: #FFF8E1;
  368. border-radius: 50%;
  369. display: flex;
  370. align-items: center;
  371. justify-content: center;
  372. margin-bottom: 30rpx;
  373. }
  374. .benefit-icon-large {
  375. width: 60rpx;
  376. height: 60rpx;
  377. }
  378. .benefit-icon-placeholder-large {
  379. font-size: 50rpx;
  380. font-weight: bold;
  381. color: #FFB300;
  382. }
  383. .popup-title {
  384. font-size: 32rpx;
  385. font-weight: bold;
  386. color: #333;
  387. margin-bottom: 20rpx;
  388. }
  389. .popup-desc {
  390. font-size: 26rpx;
  391. color: #666;
  392. text-align: center;
  393. line-height: 1.5;
  394. margin-bottom: 40rpx;
  395. }
  396. .popup-btn {
  397. width: 80%;
  398. height: 72rpx;
  399. line-height: 72rpx;
  400. background-color: #212121;
  401. color: #fff;
  402. font-size: 28rpx;
  403. border-radius: 36rpx;
  404. }
  405. </style>