index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <view class="member-center">
  3. <scroll-view class="page" scroll-y>
  4. <!-- 会员状态卡 -->
  5. <view class="status-card">
  6. <view class="status-badge" :class="isFree ? 'badge-free' : 'badge-family'">
  7. <text class="badge-icon">{{ isFree ? '○' : '●' }}</text>
  8. <text class="badge-text">{{ currentLevelName }}</text>
  9. </view>
  10. <view class="status-body" v-if="membership && membership.levelCode !== 'FREE'">
  11. <view class="expiry-row">
  12. <text class="expiry-label">到期时间</text>
  13. <text class="expiry-value">{{ formatDate(membership.endDate) }}</text>
  14. </view>
  15. <view class="days-remaining" v-if="membership.isActive">
  16. <text class="days-num">{{ membership.daysRemaining || 0 }}</text>
  17. <text class="days-unit">天剩余</text>
  18. </view>
  19. <view class="expired-msg" v-else>
  20. <text class="expired-text">会员已过期,续费恢复权益</text>
  21. </view>
  22. </view>
  23. <view class="status-body" v-else>
  24. <text class="free-hint">当前为免费版,开通会员解锁全部特权</text>
  25. </view>
  26. </view>
  27. <!-- 会员权益亮点 -->
  28. <view class="benefit-card">
  29. <text class="benefit-card-title">{{ isFree ? '开通会员,即刻享有' : '您的会员权益' }}</text>
  30. <view class="feature-list">
  31. <view class="feature-item" v-for="(feature, idx) in features" :key="idx">
  32. <text class="feature-check">✓</text>
  33. <text class="feature-text">{{ feature }}</text>
  34. </view>
  35. </view>
  36. <!-- 主按钮:非会员开通 / 会员续费 -->
  37. <button class="btn-main" :class="isFree ? 'btn-upgrade' : 'btn-renew'" @click="goUpgrade">
  38. {{ isFree ? '立即开通会员' : '立即续费' }}
  39. </button>
  40. <view class="benefits-entry" @click="goBenefits">
  41. <text class="benefits-entry-icon">👑</text>
  42. <text class="benefits-entry-text">查看我的权益</text>
  43. <text class="benefits-entry-arrow">›</text>
  44. </view>
  45. </view>
  46. <!-- 我的管家入口 -->
  47. <view class="butler-entry" @click="goButlerSelect">
  48. <view class="butler-entry-icon">🤵</view>
  49. <view class="butler-entry-main">
  50. <text class="butler-entry-title">{{ butlerEntryTitle }}</text>
  51. <text class="butler-entry-sub">{{ butlerEntrySub }}</text>
  52. </view>
  53. <text class="butler-entry-arrow">›</text>
  54. </view>
  55. <!-- 权益对比表 -->
  56. <view class="compare-section">
  57. <text class="section-title">权益对比</text>
  58. <view class="compare-table">
  59. <view class="compare-row header-row">
  60. <text class="compare-cell cell-feature">权益项</text>
  61. <text class="compare-cell cell-free">免费</text>
  62. <text class="compare-cell cell-basic">体验会员</text>
  63. <text class="compare-cell cell-family">家庭会员</text>
  64. <text class="compare-cell cell-premium">高级会员</text>
  65. </view>
  66. <view class="compare-row" v-for="(item, idx) in compareData" :key="idx">
  67. <text class="compare-cell cell-feature">{{ item.name }}</text>
  68. <text class="compare-cell cell-free">{{ item.free }}</text>
  69. <text class="compare-cell cell-basic">{{ item.basic }}</text>
  70. <text class="compare-cell cell-family">{{ item.family }}</text>
  71. <text class="compare-cell cell-premium">{{ item.premium }}</text>
  72. </view>
  73. </view>
  74. </view>
  75. </scroll-view>
  76. </view>
  77. </template>
  78. <script>
  79. import { getMyMembership, getMyButler, reportAppEnter
  80. } from '../../utils/api.js'
  81. import { parseDate } from '../../utils/format.js'
  82. export default {
  83. data() {
  84. return {
  85. membership: null,
  86. isFree: true,
  87. currentLevelName: '免费用户',
  88. features: ['折扣购物', '家庭管理', '推荐佣金', '专属活动', '任务特权', '成长报告'],
  89. compareData: [
  90. { name: '商品折扣', free: '普通价格', basic: '会员折扣', family: '会员折扣', premium: '会员折扣' },
  91. { name: '家庭管理', free: '基础功能', basic: '3个孩子', family: '10个孩子', premium: '20个孩子' },
  92. { name: 'AI健康顾问', free: '—', basic: '3次/月', family: '不限', premium: '不限' },
  93. { name: '报告解读', free: '—', basic: '1次/月', family: '不限', premium: '深度解读' },
  94. { name: '测评预约', free: '仅查看', basic: '1次/月', family: '不限', premium: '优先' },
  95. { name: '管家服务', free: '—', basic: '—', family: '月1次', premium: '周1次' },
  96. { name: '推荐佣金', free: '不可参与', basic: '可参与', family: '可参与', premium: '可参与' },
  97. { name: '专属活动', free: '部分参与', basic: '部分参与', family: '全部参与', premium: '优先参与' }
  98. ],
  99. myButlerInfo: null,
  100. isL2Active: false
  101. }
  102. },
  103. computed: {
  104. butlerEntryTitle() {
  105. return this.myButlerInfo ? ('我的管家 · ' + this.myButlerInfo.nickname) : '我的管家'
  106. },
  107. butlerEntrySub() {
  108. return this.myButlerInfo ? '点击查看或更换' : '久久一生会员可自助选择专属管家'
  109. }
  110. },
  111. onShow() {
  112. reportAppEnter('membership');
  113. this.loadData()
  114. this.loadButlerEntry()
  115. },
  116. methods: {
  117. loadData() {
  118. var that = this
  119. getMyMembership().then(function(res) {
  120. var m = res.data || {}
  121. that.membership = m
  122. if (m.levelCode && m.levelCode !== 'FREE') {
  123. that.isFree = false
  124. that.currentLevelName = m.levelName || '家庭会员'
  125. if (m.levelCode === 'BASIC') {
  126. that.currentLevelName = '体验会员'
  127. } else if (m.levelCode === 'FAMILY') {
  128. that.currentLevelName = '家庭会员'
  129. } else if (m.levelCode === 'PREMIUM') {
  130. that.currentLevelName = '高级会员'
  131. }
  132. } else {
  133. that.isFree = true
  134. that.currentLevelName = '免费用户'
  135. }
  136. }).catch(function() {})
  137. },
  138. goUpgrade() {
  139. uni.navigateTo({ url: '/pages/membership/upgrade' })
  140. },
  141. goBenefits() {
  142. uni.navigateTo({ url: '/pages/membership/benefits' })
  143. },
  144. goButlerSelect() {
  145. uni.navigateTo({ url: '/pages/butler/select' })
  146. },
  147. loadButlerEntry() {
  148. var that = this
  149. getMyButler().then(function (res) {
  150. if (res && res.code === 200 && res.data) {
  151. that.myButlerInfo = res.data
  152. }
  153. }).catch(function () {})
  154. },
  155. formatDate(date) {
  156. if (!date) return ''
  157. var d = parseDate(date)
  158. if (!d) return ''
  159. var month = d.getMonth() + 1
  160. var day = d.getDate()
  161. return d.getFullYear() + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day)
  162. }
  163. }
  164. }
  165. </script>
  166. <style scoped>
  167. .page {
  168. min-height: 100vh;
  169. background: #FFF7ED;
  170. padding: 30rpx;
  171. box-sizing: border-box;
  172. }
  173. /* ===== 状态卡片 ===== */
  174. .status-card {
  175. background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
  176. border-radius: 20rpx;
  177. padding: 40rpx;
  178. margin-bottom: 30rpx;
  179. }
  180. .status-badge {
  181. display: inline-flex;
  182. align-items: center;
  183. padding: 10rpx 24rpx;
  184. border-radius: 9999rpx;
  185. font-size: 24rpx;
  186. }
  187. .badge-free {
  188. background: rgba(255,255,255,0.2);
  189. color: #fff;
  190. }
  191. .badge-family {
  192. background: rgba(255,255,255,0.3);
  193. color: #fff;
  194. }
  195. .badge-icon {
  196. font-size: 20rpx;
  197. margin-right: 8rpx;
  198. }
  199. .badge-text {
  200. font-weight: 600;
  201. }
  202. .status-body {
  203. margin-top: 24rpx;
  204. }
  205. .expiry-row {
  206. display: flex;
  207. justify-content: space-between;
  208. align-items: center;
  209. }
  210. .expiry-label {
  211. font-size: 26rpx;
  212. color: rgba(255,255,255,0.8);
  213. }
  214. .expiry-value {
  215. font-size: 28rpx;
  216. color: #fff;
  217. font-weight: 500;
  218. }
  219. .days-remaining {
  220. display: flex;
  221. align-items: baseline;
  222. justify-content: center;
  223. margin-top: 20rpx;
  224. }
  225. .days-num {
  226. font-size: 56rpx;
  227. font-weight: bold;
  228. color: #FEF3C7;
  229. }
  230. .days-unit {
  231. font-size: 26rpx;
  232. color: rgba(255,255,255,0.7);
  233. margin-left: 8rpx;
  234. }
  235. .expired-msg {
  236. text-align: center;
  237. margin-top: 16rpx;
  238. }
  239. .expired-text {
  240. font-size: 26rpx;
  241. color: #FEF3C7;
  242. }
  243. .free-hint {
  244. font-size: 26rpx;
  245. color: rgba(255,255,255,0.85);
  246. text-align: center;
  247. display: block;
  248. }
  249. /* ===== 权益卡片 ===== */
  250. .benefit-card {
  251. background: #FFFFFF;
  252. border-radius: 20rpx;
  253. padding: 40rpx;
  254. margin-bottom: 30rpx;
  255. box-shadow: 0 4rpx 24rpx rgba(249, 115, 22, 0.08);
  256. }
  257. .benefit-card-title {
  258. font-size: 32rpx;
  259. font-weight: bold;
  260. color: #1E293B;
  261. display: block;
  262. text-align: center;
  263. margin-bottom: 16rpx;
  264. }
  265. .feature-list {
  266. margin: 16rpx 0 24rpx;
  267. }
  268. .feature-item {
  269. display: flex;
  270. align-items: center;
  271. padding: 12rpx 0;
  272. }
  273. .feature-check {
  274. width: 36rpx;
  275. height: 36rpx;
  276. border-radius: 50%;
  277. background: #F97316;
  278. color: #fff;
  279. font-size: 22rpx;
  280. display: flex;
  281. align-items: center;
  282. justify-content: center;
  283. margin-right: 16rpx;
  284. flex-shrink: 0;
  285. }
  286. .feature-text {
  287. font-size: 28rpx;
  288. color: #334155;
  289. }
  290. .btn-main {
  291. width: 100%;
  292. border-radius: 44rpx;
  293. font-size: 32rpx;
  294. font-weight: bold;
  295. padding: 24rpx 0;
  296. border: none;
  297. line-height: 1.4;
  298. }
  299. .btn-upgrade {
  300. background: linear-gradient(135deg, #F97316, #FB923C);
  301. color: #fff;
  302. }
  303. .btn-renew {
  304. background: linear-gradient(135deg, #6366F1, #818CF8);
  305. color: #fff;
  306. }
  307. .btn-main::after {
  308. border: none;
  309. }
  310. .benefits-entry {
  311. display: flex;
  312. align-items: center;
  313. justify-content: center;
  314. margin-top: 24rpx;
  315. padding: 20rpx;
  316. background: #FFF7ED;
  317. border-radius: 16rpx;
  318. }
  319. .benefits-entry-icon {
  320. font-size: 32rpx;
  321. margin-right: 8rpx;
  322. }
  323. .benefits-entry-text {
  324. font-size: 28rpx;
  325. color: #F97316;
  326. font-weight: 500;
  327. }
  328. .benefits-entry-arrow {
  329. font-size: 28rpx;
  330. color: #F97316;
  331. margin-left: 8rpx;
  332. }
  333. /* ===== 权益对比表 ===== */
  334. .compare-section {
  335. background: #FFFFFF;
  336. border-radius: 20rpx;
  337. padding: 30rpx;
  338. box-shadow: 0 4rpx 24rpx rgba(249, 115, 22, 0.08);
  339. }
  340. .section-title {
  341. font-size: 30rpx;
  342. font-weight: bold;
  343. color: #1E293B;
  344. display: block;
  345. margin-bottom: 20rpx;
  346. }
  347. .compare-table {
  348. width: 100%;
  349. }
  350. .compare-row {
  351. display: flex;
  352. padding: 14rpx 0;
  353. border-bottom: 1rpx solid #F1F5F9;
  354. }
  355. .compare-row:last-child {
  356. border-bottom: none;
  357. }
  358. .header-row {
  359. border-bottom: 2rpx solid #FED7AA;
  360. }
  361. .compare-cell {
  362. flex: 1;
  363. font-size: 22rpx;
  364. color: #475569;
  365. text-align: center;
  366. word-break: break-all;
  367. }
  368. .cell-feature {
  369. flex: 1.2;
  370. text-align: left;
  371. color: #334155;
  372. font-weight: 500;
  373. }
  374. .header-row .compare-cell {
  375. color: #F97316;
  376. font-weight: bold;
  377. }
  378. /* ===== 我的管家入口 ===== */
  379. .butler-entry { display: flex; align-items: center; background: #fff; border-radius: 16rpx; padding: 28rpx; margin: 20rpx 0; }
  380. .butler-entry-icon { font-size: 48rpx; margin-right: 20rpx; }
  381. .butler-entry-main { flex: 1; display: flex; flex-direction: column; }
  382. .butler-entry-title { font-size: 30rpx; font-weight: bold; color: #333; }
  383. .butler-entry-sub { font-size: 24rpx; color: #999; margin-top: 6rpx; }
  384. .butler-entry-arrow { font-size: 40rpx; color: #ccc; }
  385. </style>