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

409 lines
9.1 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" >
  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. }
  170. }
  171. </script>
  172. <style lang="scss" scoped>
  173. .container {
  174. min-height: 100%;
  175. }
  176. .header{
  177. width: 100%;
  178. .header-bg{
  179. position: relative;
  180. width: 100%;
  181. height: 500rpx;
  182. // background: red;
  183. .header-img{
  184. width: 100%;
  185. height: 500rpx;
  186. }
  187. .header-title{
  188. font-size: 32rpx;
  189. color: black;
  190. position: absolute;
  191. top: 100rpx;
  192. font-weight: 500;
  193. left: 50%;
  194. transform: translateX(-50%);
  195. }
  196. .header-icon{
  197. position: absolute;
  198. top: 100rpx;
  199. left: 30rpx;
  200. }
  201. .swiper-container{
  202. margin-top: -300rpx;
  203. .swiper-arrow{
  204. width: 100%;
  205. height: 22rpx;
  206. }
  207. .swiper-btn{
  208. margin: 35rpx auto 15rpx;
  209. width: 150rpx;
  210. height: 52rpx;
  211. border-radius: 999px;
  212. background: #06DADC;
  213. color: white;
  214. font-size: 28rpx;
  215. font-weight: 500;
  216. text-align: center;
  217. line-height: 52rpx;
  218. }
  219. }
  220. }
  221. }
  222. // 会员套餐选择容器
  223. .membership-container {
  224. background: linear-gradient(180deg, #DEFFFF 0%, #FBFEFF 22.65%, #FFFFFF 100%);
  225. padding: 40rpx 30rpx;
  226. margin-top: 20rpx;
  227. .package-list {
  228. display: flex;
  229. justify-content: space-between;
  230. gap: 16rpx;
  231. margin-bottom: 20rpx;
  232. .package-item {
  233. position: relative;
  234. flex: 1;
  235. background: #fff;
  236. border-radius: 20rpx;
  237. text-align: center;
  238. border: 2rpx solid #EEEEEE;
  239. transition: all 0.3s;
  240. // width: 119;
  241. height: 210rpx;
  242. // width: 238rpx;
  243. .info{
  244. padding: 16rpx 16rpx 0 16rpx ;
  245. }
  246. &.active {
  247. border-color: $primary-color;
  248. // box-shadow: 0 4rpx 20rpx rgba(34, 242, 235, 0.2);
  249. }
  250. .gift-tag {
  251. position: absolute;
  252. top: -10rpx;
  253. left: 50%;
  254. transform: translateX(-50%);
  255. background: #FF6B6B;
  256. color: #fff;
  257. font-size: 20rpx;
  258. padding: 8rpx 16rpx;
  259. border-radius: 20rpx;
  260. white-space: nowrap;
  261. }
  262. .package-title {
  263. font-size: 28rpx;
  264. color: #000;
  265. margin-bottom: 16rpx;
  266. font-weight: 500;
  267. }
  268. .package-price {
  269. font-size: 36rpx;
  270. color: #FF4800;
  271. font-weight: 500;
  272. margin-bottom: 8rpx;
  273. .package-decimal{
  274. font-size: 24rpx;
  275. }
  276. }
  277. .package-original {
  278. font-size: 24rpx;
  279. color: #8B8B8B;
  280. line-height: 1.4;
  281. text-decoration: line-through;
  282. margin-bottom: 8rpx;
  283. }
  284. .package-btn {
  285. background: #E4E7EB;
  286. color: #191919;
  287. font-size: 28rpx;
  288. // padding: 12rpx 20rpx;
  289. width: 100%;
  290. // border-radius: 30rpx;
  291. transition: all 0.3s;
  292. height: 52rpx;
  293. line-height: 52rpx;
  294. border-radius: 0 0 24rpx 24rpx;
  295. &.active {
  296. background: $primary-color;
  297. color: #fff;
  298. }
  299. }
  300. }
  301. }
  302. .coupon-section {
  303. .coupon-title {
  304. font-size: 26rpx;
  305. color: #181818;
  306. margin-bottom: 10rpx;
  307. // font-weight: 500;
  308. }
  309. .coupon-selector {
  310. background: #fff;
  311. border-radius: 16rpx;
  312. padding: 10rpx 0;
  313. display: flex;
  314. justify-content: space-between;
  315. align-items: center;
  316. border-bottom: 2rpx solid #f0f0f0;
  317. .coupon-text {
  318. font-size: 32rpx;
  319. color: #C6C6C6;
  320. }
  321. }
  322. }
  323. }
  324. /* 会员权益样式 */
  325. .benefits-section {
  326. margin-top: 40rpx;
  327. padding: 0 30rpx;
  328. }
  329. .benefits-title {
  330. font-size: 36rpx;
  331. font-weight: bold;
  332. color: #191919;
  333. margin-bottom: 32rpx;
  334. }
  335. .benefits-list {
  336. display: flex;
  337. flex-direction: column;
  338. gap: 32rpx;
  339. }
  340. .benefit-item {
  341. background: #F8F8F8;
  342. border: 1px solid #FFFFFF;
  343. border-radius: 48rpx;
  344. padding: 27rpx 40rpx;
  345. display: flex;
  346. align-items: center;
  347. justify-content: space-between;
  348. }
  349. .benefit-content {
  350. flex: 1;
  351. margin-right: 40rpx;
  352. }
  353. .benefit-title {
  354. font-size: 32rpx;
  355. font-weight: 600;
  356. color: #333;
  357. margin-bottom: 16rpx;
  358. }
  359. .benefit-desc {
  360. font-size: 24rpx;
  361. color: #09B1B3;
  362. line-height: 36rpx;
  363. }
  364. .benefit-icon {
  365. width: 152rpx;
  366. height: 152rpx;
  367. // flex-shrink: 0;
  368. }
  369. .benefit-icon image {
  370. width: 100%;
  371. height: 100%;
  372. }
  373. </style>