四零语境前端代码仓库
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.

414 lines
9.2 KiB

  1. <template>
  2. <view class="container">
  3. <view class="header">
  4. <view class="header-bg">
  5. <image
  6. src="/static/会员背景.png"
  7. class="header-img"
  8. mode="scaleToFill"
  9. />
  10. <text class="header-title">会员开通</text>
  11. <!-- 加一个推出箭头 -->
  12. <view class="header-icon" @click="goBack">
  13. <uv-icon name="arrow-left" color="#000" size="20" />
  14. </view>
  15. <!-- 轮播容器 -->
  16. <view class="uv-demo-block swiper-container">
  17. <uv-swiper
  18. bgColor="transparent"
  19. :list="list"
  20. previousMargin="70"
  21. nextMargin="70"
  22. acceleration
  23. height="85"
  24. circular
  25. :autoplay="false"
  26. radius="5"
  27. >
  28. </uv-swiper>
  29. <button class="swiper-btn">
  30. 已选择
  31. </button>
  32. <image
  33. class="swiper-arrow"
  34. src="/static/修饰箭头.png"
  35. mode="aspectFill"
  36. />
  37. </view>
  38. </view>
  39. </view>
  40. <!-- 会员套餐选择容器 -->
  41. <view class="membership-container">
  42. <!-- 套餐选择 -->
  43. <view class="package-list">
  44. <view
  45. class="package-item"
  46. :class="{ 'active': selectedPackage === index }"
  47. v-for="(item, index) in packageList"
  48. :key="index"
  49. @click="selectPackage(index)"
  50. >
  51. <view class="info">
  52. <!-- 赠送标识 -->
  53. <view class="gift-tag" v-if="item.gift">
  54. 赠送{{ item.gift }}
  55. </view>
  56. <view class="package-title">{{ item.title }}</view>
  57. <view class="package-price">¥{{ getInt(item.price) }}.<text class="package-decimal">{{ getDecimal(item.price) }}</text></view>
  58. <view class="package-original">¥{{ item.originalPrice }}</view>
  59. </view>
  60. <view class="package-btn" :class="{ 'active': selectedPackage === index }">
  61. {{ selectedPackage === index ? '已选择' : '点击选择' }}
  62. </view>
  63. </view>
  64. </view>
  65. <!-- 优惠券选择 -->
  66. <view class="coupon-section">
  67. <view class="coupon-title">选择优惠券</view>
  68. <view class="coupon-selector" @click="selectCoupon">
  69. <text class="coupon-text">请选择</text>
  70. <uv-icon name="arrow-right" color="#999" size="16" />
  71. </view>
  72. </view>
  73. </view>
  74. <!-- 会员权益 -->
  75. <view class="benefits-section">
  76. <view class="benefits-title">会员权益</view>
  77. <view class="benefits-list">
  78. <!-- 碎片学习 系统掌握 -->
  79. <view class="benefit-item">
  80. <view class="benefit-content">
  81. <view class="benefit-title">碎片学习 系统掌握</view>
  82. <view class="benefit-desc">根据薄弱点智能推荐每节课3-5分钟碎片化完成系统学习</view>
  83. </view>
  84. <view class="benefit-icon">
  85. <image src="/static/会员图片1.png" mode="aspectFit"></image>
  86. </view>
  87. </view>
  88. <!-- 匹配水平 -->
  89. <view class="benefit-item">
  90. <view class="benefit-content">
  91. <view class="benefit-title">匹配水平</view>
  92. <view class="benefit-desc">依据水平精准推课不做无用功快速提升</view>
  93. </view>
  94. <view class="benefit-icon">
  95. <image src="/static/会员图片2.png" mode="aspectFit"></image>
  96. </view>
  97. </view>
  98. <!-- 科学闭环测 讲练结合 -->
  99. <view class="benefit-item">
  100. <view class="benefit-content">
  101. <view class="benefit-title">科学闭环测 讲练结合</view>
  102. <view class="benefit-desc">精心设计科学的学习流程 测试-讲解-练习-检验知识掌握更牢固</view>
  103. </view>
  104. <view class="benefit-icon">
  105. <image src="/static/会员图片3.png" mode="aspectFit"></image>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. </template>
  112. <script>
  113. export default {
  114. data() {
  115. return {
  116. list: [
  117. '/static/会员1.png',
  118. '/static/会员2.png',
  119. '/static/会员3.png'
  120. ],
  121. selectedPackage: 0, // 默认选择第一个套餐
  122. packageList: [
  123. {
  124. title: '30天会员',
  125. price: '36.00',
  126. originalPrice: '128',
  127. gift: null
  128. },
  129. {
  130. title: '90天会员',
  131. price: '88.00',
  132. originalPrice: '384',
  133. gift: '180'
  134. },
  135. {
  136. title: '180天会员',
  137. price: '128.00',
  138. originalPrice: '384',
  139. gift: null
  140. }
  141. ]
  142. }
  143. },
  144. methods: {
  145. // 截取价格的整数与小数部分
  146. getInt(price){
  147. if (price.indexOf('.') === -1) {
  148. return price
  149. }
  150. if (price === null) {
  151. return '0'
  152. }
  153. return String(price).split('.')[0]
  154. },
  155. getDecimal(price){
  156. if (price === null) return '00'
  157. const parts = String(price).split('.')
  158. return parts[1] ? parts[1].padEnd(2, '0') : '00'
  159. },
  160. selectPackage(index) {
  161. this.selectedPackage = index
  162. },
  163. selectCoupon() {
  164. uni.showToast({
  165. title: '功能开发中',
  166. icon: 'none'
  167. })
  168. },
  169. goBack() {
  170. uni.navigateBack({
  171. delta: 1
  172. })
  173. },
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .container {
  179. min-height: 100%;
  180. }
  181. .header{
  182. width: 100%;
  183. .header-bg{
  184. position: relative;
  185. width: 100%;
  186. height: 500rpx;
  187. // background: red;
  188. .header-img{
  189. width: 100%;
  190. height: 500rpx;
  191. }
  192. .header-title{
  193. font-size: 32rpx;
  194. color: black;
  195. position: absolute;
  196. top: 100rpx;
  197. font-weight: 500;
  198. left: 50%;
  199. transform: translateX(-50%);
  200. }
  201. .header-icon{
  202. position: absolute;
  203. top: 100rpx;
  204. left: 30rpx;
  205. }
  206. .swiper-container{
  207. margin-top: -300rpx;
  208. .swiper-arrow{
  209. width: 100%;
  210. height: 22rpx;
  211. }
  212. .swiper-btn{
  213. margin: 35rpx auto 15rpx;
  214. width: 150rpx;
  215. height: 52rpx;
  216. border-radius: 999px;
  217. background: #06DADC;
  218. color: white;
  219. font-size: 28rpx;
  220. font-weight: 500;
  221. text-align: center;
  222. line-height: 52rpx;
  223. }
  224. }
  225. }
  226. }
  227. // 会员套餐选择容器
  228. .membership-container {
  229. background: linear-gradient(180deg, #DEFFFF 0%, #FBFEFF 22.65%, #FFFFFF 100%);
  230. padding: 40rpx 30rpx;
  231. margin-top: 20rpx;
  232. .package-list {
  233. display: flex;
  234. justify-content: space-between;
  235. gap: 16rpx;
  236. margin-bottom: 20rpx;
  237. .package-item {
  238. position: relative;
  239. flex: 1;
  240. background: #fff;
  241. border-radius: 20rpx;
  242. text-align: center;
  243. border: 2rpx solid #EEEEEE;
  244. transition: all 0.3s;
  245. // width: 119;
  246. height: 210rpx;
  247. // width: 238rpx;
  248. .info{
  249. padding: 16rpx 16rpx 0 16rpx ;
  250. }
  251. &.active {
  252. border-color: $primary-color;
  253. // box-shadow: 0 4rpx 20rpx rgba(34, 242, 235, 0.2);
  254. }
  255. .gift-tag {
  256. position: absolute;
  257. top: -30rpx;
  258. left: 0;
  259. // transform: translateX(-50%);
  260. background: #FF4800;
  261. color: #fff;
  262. font-size: 24rpx;
  263. padding: 8rpx 16rpx;
  264. border-radius: 999rpx 999rpx 999rpx 0;
  265. white-space: nowrap;
  266. }
  267. .package-title {
  268. font-size: 28rpx;
  269. color: #000;
  270. margin-bottom: 16rpx;
  271. font-weight: 500;
  272. }
  273. .package-price {
  274. font-size: 36rpx;
  275. color: #FF4800;
  276. font-weight: 500;
  277. margin-bottom: 8rpx;
  278. .package-decimal{
  279. font-size: 24rpx;
  280. }
  281. }
  282. .package-original {
  283. font-size: 24rpx;
  284. color: #8B8B8B;
  285. line-height: 1.4;
  286. text-decoration: line-through;
  287. margin-bottom: 8rpx;
  288. }
  289. .package-btn {
  290. background: #E4E7EB;
  291. color: #191919;
  292. font-size: 28rpx;
  293. // padding: 12rpx 20rpx;
  294. width: 100%;
  295. // border-radius: 30rpx;
  296. transition: all 0.3s;
  297. height: 52rpx;
  298. line-height: 52rpx;
  299. border-radius: 0 0 24rpx 24rpx;
  300. &.active {
  301. background: $primary-color;
  302. color: #fff;
  303. }
  304. }
  305. }
  306. }
  307. .coupon-section {
  308. .coupon-title {
  309. font-size: 26rpx;
  310. color: #181818;
  311. margin-bottom: 10rpx;
  312. // font-weight: 500;
  313. }
  314. .coupon-selector {
  315. background: #fff;
  316. border-radius: 16rpx;
  317. padding: 10rpx 0;
  318. display: flex;
  319. justify-content: space-between;
  320. align-items: center;
  321. border-bottom: 2rpx solid #f0f0f0;
  322. .coupon-text {
  323. font-size: 32rpx;
  324. color: #C6C6C6;
  325. }
  326. }
  327. }
  328. }
  329. /* 会员权益样式 */
  330. .benefits-section {
  331. margin-top: 40rpx;
  332. padding: 0 30rpx;
  333. }
  334. .benefits-title {
  335. font-size: 36rpx;
  336. font-weight: bold;
  337. color: #191919;
  338. margin-bottom: 32rpx;
  339. }
  340. .benefits-list {
  341. display: flex;
  342. flex-direction: column;
  343. gap: 32rpx;
  344. }
  345. .benefit-item {
  346. background: #F8F8F8;
  347. border: 1px solid #FFFFFF;
  348. border-radius: 48rpx;
  349. padding: 27rpx 40rpx;
  350. display: flex;
  351. align-items: center;
  352. justify-content: space-between;
  353. }
  354. .benefit-content {
  355. flex: 1;
  356. margin-right: 40rpx;
  357. }
  358. .benefit-title {
  359. font-size: 32rpx;
  360. font-weight: 600;
  361. color: #333;
  362. margin-bottom: 16rpx;
  363. }
  364. .benefit-desc {
  365. font-size: 24rpx;
  366. color: #09B1B3;
  367. line-height: 36rpx;
  368. }
  369. .benefit-icon {
  370. width: 152rpx;
  371. height: 152rpx;
  372. // flex-shrink: 0;
  373. }
  374. .benefit-icon image {
  375. width: 100%;
  376. height: 100%;
  377. }
  378. </style>