index.vue 10 KB

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