推拿小程序前端代码仓库
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.

390 lines
8.1 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. <!-- 会员中心页面 -->
  2. <template>
  3. <view class="page">
  4. <!-- 导航栏 -->
  5. <navbar title="会员中心" leftClick @leftClick="$utils.navigateBack" color="#fff" />
  6. <view class="content">
  7. <view class="flex user">
  8. <image class="user-avatar" :src="userInfo.headImage" mode="aspectFill"></image>
  9. <view class="user-info">
  10. <view class="flex user-name">
  11. <text>{{ userInfo.nickName }}</text>
  12. <template v-if="role === 'member-personal'">
  13. <image class="icon icon-role" src="@/static/image/center/icon-member-personal.png" mode="widthFix"></image>
  14. </template>
  15. <template v-else-if="role === 'member-business'">
  16. <image class="icon icon-role" src="@/static/image/center/icon-member-business.png" mode="widthFix"></image>
  17. </template>
  18. </view>
  19. <view class="user-desc">
  20. <template v-if="role">
  21. <!-- todo: 换回接口字段 -->
  22. <text>{{ `将于${'2026-12-12'} 到期` }}</text>
  23. </template>
  24. <template v-else>
  25. <text>暂未开通会员</text>
  26. </template>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="consumption" v-if="!role">
  31. <!-- todo: 对接接口 -->
  32. <progress :current="1000" :total="3800"></progress>
  33. <text class="consumption-desc">{{ `累积消费达到${3800}元或直接充值即可成为会员` }}</text>
  34. </view>
  35. <view class="charge">
  36. <view class="charge-header">
  37. <view class="flex charge-header-title">充值会员</view>
  38. <view class="charge-header-mask"></view>
  39. </view>
  40. <view class="charge-content">
  41. <view class="flex charge-selection">
  42. <view class="flex charge-option"
  43. v-for="item in chargeOptions"
  44. :key="item.id"
  45. :class="[selectedChargeId === item.id ? 'is-active' : '']"
  46. @click="onSelectCharge(item.id)"
  47. >
  48. <view class="charge-option-value">
  49. <text class="charge-option-unit">¥</text>
  50. <text>{{ item.value }}</text>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="charge-rights">
  55. <view class="flex charge-rights-header">
  56. <image class="title" src="../static/memberCenter/title-rights.png" mode="widthFix"></image>
  57. </view>
  58. <view class="charge-rights-content">
  59. <view class="charge-rights-item"
  60. v-for="(item, index) in rights"
  61. :key="item"
  62. >
  63. {{ `${index+1}${item}` }}
  64. </view>
  65. <image class="icon" src="../static/memberCenter/icon-rights.png" mode="widthFix"></image>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="flex bar">
  72. <view class="flex count">
  73. <text>合计</text>
  74. <view class="price">
  75. <text class="price-unit">¥</text>
  76. <!-- todo: check -->
  77. <text>{{ totalPrice }}</text>
  78. </view>
  79. </view>
  80. <view class="btn btn-pay" @click="submit">
  81. 开通会员
  82. </view>
  83. </view>
  84. </view>
  85. </template>
  86. <script>
  87. import progress from '../components/progress.vue'
  88. import {
  89. mapState
  90. } from 'vuex'
  91. export default {
  92. name: "MemberCenter",
  93. components: {
  94. progress,
  95. },
  96. data() {
  97. return {
  98. role: 'member-business', // member-personal | member-business | merchant
  99. // todo: fetch
  100. chargeOptions: [
  101. {
  102. id: '001',
  103. value: 800,
  104. rights: [
  105. '会员享受专属折扣和优惠活动',
  106. '会员积分累积与抵扣功能',
  107. '成为会员后,得到平台发放的代金券',
  108. ]
  109. },
  110. {
  111. id: '002',
  112. value: 1800,
  113. rights: [
  114. '会员享受专属折扣和优惠活动',
  115. '会员积分累积与抵扣功能',
  116. '成为会员后,得到平台发放的代金券',
  117. ]
  118. },
  119. {
  120. id: '003',
  121. value: 2800,
  122. rights: [
  123. '会员享受专属折扣和优惠活动',
  124. '会员积分累积与抵扣功能',
  125. '成为会员后,得到平台发放的代金券',
  126. ]
  127. },
  128. ],
  129. selectedChargeId: '001'
  130. }
  131. },
  132. computed: {
  133. ...mapState(['userInfo']),
  134. selectedChargeObj() {
  135. return this.chargeOptions.find(item => item.id === this.selectedChargeId)
  136. },
  137. rights() {
  138. return this.selectedChargeObj?.rights || []
  139. },
  140. totalPrice() {
  141. return this.selectedChargeObj?.value || 0
  142. }
  143. },
  144. methods: {
  145. onSelectCharge(id) {
  146. // todo
  147. this.selectedChargeId = id
  148. },
  149. submit() {
  150. // todo: check jump to create order ?
  151. }
  152. }
  153. }
  154. </script>
  155. <style scoped lang="scss">
  156. $bar-height: 132rpx;
  157. .page {
  158. padding-bottom: calc(#{$bar-height} + env(safe-area-inset-bottom));
  159. background-color: $uni-fg-color;
  160. min-height: 100vh;
  161. position: relative;
  162. /deep/ .nav-bar__view {
  163. padding-bottom: 413rpx;
  164. background-image: linear-gradient(#84A73F, #D8FF8F);
  165. }
  166. }
  167. .content {
  168. position: absolute;
  169. top: 175rpx;
  170. width: 100vw;
  171. z-index: 999;
  172. }
  173. .user {
  174. align-items: flex-start;
  175. color: $uni-text-color-inverse;
  176. font-size: 22rpx;
  177. margin: 0 18rpx;
  178. &-avatar {
  179. width: 147rpx;
  180. height: 147rpx;
  181. margin-right: 8rpx;
  182. }
  183. &-info {
  184. flex: 1;
  185. }
  186. &-name {
  187. font-size: 32rpx;
  188. margin-top: 16rpx;
  189. justify-content: flex-start;
  190. .icon {
  191. height: auto;
  192. &-role {
  193. width: 138rpx;
  194. }
  195. }
  196. }
  197. &-desc {
  198. margin-top: 26rpx;
  199. }
  200. }
  201. .consumption {
  202. margin: 0 28rpx;
  203. &-desc {
  204. color: $uni-text-color-inverse;
  205. font-size: 22rpx;
  206. margin-top: 1rpx;
  207. }
  208. }
  209. .charge {
  210. background-color: $uni-fg-color;
  211. border-top-left-radius: 18rpx;
  212. border-top-right-radius: 18rpx;
  213. margin-top: 45rpx;
  214. &-header {
  215. $header-height: 90rpx;
  216. height: $header-height;
  217. position: relative;
  218. &-title {
  219. width: calc(50% + 25rpx);
  220. height: 100%;
  221. color: $uni-text-color-inverse;
  222. font-size: 28rpx;
  223. background-image: linear-gradient(#84A73F, #D8FF8F);
  224. box-sizing: border-box;
  225. border-top-left-radius: 18rpx;
  226. border-bottom-right-radius: 90rpx;
  227. }
  228. &-mask {
  229. $marsk-width: 50rpx;
  230. position: absolute;
  231. top: 0;
  232. right: 50%;
  233. transform: translateX(25rpx);
  234. // height: 100%;
  235. // width: 70rpx;
  236. width: 0;
  237. height: 0;
  238. border-top: calc(#{$header-height}/2) solid transparent;
  239. border-left: calc(#{$marsk-width}/2) solid transparent;
  240. border-bottom: calc(#{$header-height}/2) solid $uni-fg-color;
  241. border-right: calc(#{$marsk-width}/2) solid $uni-fg-color;
  242. }
  243. }
  244. &-content {
  245. padding: 57rpx 14rpx;
  246. }
  247. &-selection {
  248. justify-content: space-between;
  249. font-size: 0;
  250. }
  251. &-option {
  252. width: 230rpx;
  253. height: 248rpx;
  254. box-sizing: border-box;
  255. background-color: #F5F5F5;
  256. border: 3rpx solid #C7C7C7;
  257. border-radius: 16rpx;
  258. box-shadow: 0rpx 3rpx 6rpx 0rpx #eef3e3;
  259. color: #999999;
  260. &-value {
  261. font-size: 61rpx;
  262. }
  263. &-unit {
  264. font-size: 34rpx;
  265. margin-right: 6rpx;
  266. }
  267. &.is-active {
  268. background-color: rgba($color: #E9FFC3, $alpha: 0.74);
  269. border-color: $uni-color-light;
  270. color: #F64041;
  271. }
  272. }
  273. &-rights {
  274. margin-top: 67rpx;
  275. &-header {
  276. .title {
  277. width: 202rpx;
  278. height: auto;
  279. }
  280. }
  281. &-content {
  282. margin-top: 31rpx;
  283. background-color: rgba($color: #E2FFAE, $alpha: 0.71);
  284. border-radius: 16rpx;
  285. padding: 29rpx 30rpx;
  286. width: 100%;
  287. min-height: 500rpx;
  288. box-sizing: border-box;
  289. position: relative;
  290. .icon {
  291. position: absolute;
  292. top: 23rpx;
  293. right: 11rpx;
  294. width: 131rpx;
  295. height: auto;
  296. }
  297. }
  298. &-item {
  299. margin-top: 26rpx;
  300. color: $uni-color-light;
  301. font-size: 28rpx;
  302. }
  303. }
  304. }
  305. // 下单
  306. .bar {
  307. position: fixed;
  308. z-index: 1000;
  309. bottom: 0;
  310. left: 0;
  311. width: 100vw;
  312. height: $bar-height;
  313. padding-bottom: env(safe-area-inset-bottom);
  314. background-color: $uni-fg-color;
  315. .count {
  316. flex: 1;
  317. color: #000000;
  318. font-size: 28rpx;
  319. margin-left: 48rpx;
  320. justify-content: flex-start;
  321. .price {
  322. color: #FF2A2A;
  323. font-size: 30rpx;
  324. &-unit {
  325. font-size: 18rpx;
  326. }
  327. }
  328. }
  329. .btn {
  330. border: none;
  331. line-height: 1;
  332. background-color: transparent;
  333. padding: 0;
  334. width: auto;
  335. height: auto;
  336. margin: 0;
  337. &-pay {
  338. margin-right: 41rpx;
  339. padding: 24rpx 137rpx;
  340. color: $uni-text-color-inverse;
  341. font-size: 28rpx;
  342. border-radius: 44rpx;
  343. background-image: linear-gradient(to right, #84A73F, #D8FF8F);
  344. }
  345. }
  346. }
  347. </style>