敢为人鲜小程序前端代码仓库
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.

581 lines
18 KiB

  1. <template>
  2. <view class="page">
  3. <!-- 导航栏 -->
  4. <navbar title="个人中心" leftClick @leftClick="$utils.navigateBack" bgColor="#E3441A" color="#fff" />
  5. <!-- 头部 -->
  6. <view class="head">
  7. <view class="headImage">
  8. <image :src="userInfo.headImage" mode="aspectFill"></image>
  9. </view>
  10. <view class="user-info">
  11. <view class="user-base-info">
  12. <view class="user-base-top">
  13. <view class="user-name">{{ userInfo.nickName }}</view>
  14. <view class="member-level">
  15. <image v-if="userInfo.role == 1" :src="configList.vip_user" mode="aspectFill" class="level">
  16. </image>
  17. <image v-if="userInfo.role == 2" src="@/static/image/center/gold-min.png" mode="aspectFill"
  18. class="level">
  19. </image>
  20. <image v-if="userInfo.role == 3" src="@/static/image/center/sliver-min.png"
  21. mode="aspectFill" class="level">
  22. </image>
  23. </view>
  24. <view class="user-tag">
  25. {{ userRole[userInfo.isPay] }}
  26. </view>
  27. </view>
  28. <view class="edit-user" @click="$utils.navigateTo('/pages_order/mine/updateUser?back=true')">
  29. <image src="@/static/image/center/edit-icon.png" mode="aspectFill" class="edit-icon"></image>
  30. <view class="edit-btn">
  31. 修改资料
  32. </view>
  33. </view>
  34. </view>
  35. <view class="user-phone">
  36. 手机号:{{ userInfo.phone }}
  37. </view>
  38. </view>
  39. </view>
  40. <!-- 会员卡片 -->
  41. <view @click="$utils.navigateTo({ url: '/pages_order/mine/memberCenter' })" v-if="userInfo.role != 0"
  42. class="earnings">
  43. <view v-if="index + 1 == userInfo.role" v-for="(item, index) in vipList" :key="item.id" class="member-item">
  44. <image :src="item.headImage" mode="aspectFill" class="member-image"></image>
  45. <view class="member-info">
  46. <view class="profile-photo">
  47. <image :src="userInfo.headImage" mode="aspectFill" class="pro-img"></image>
  48. <view class="open-status">
  49. 开通时间{{ riceInfo.openTime }}
  50. </view>
  51. </view>
  52. <view class="open">
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <!-- 佣金数据 -->
  58. <view @click="$utils.navigateTo('/pages_order/mine/withdraw')" class="brokerage-data"
  59. :class="{ 'brokerage-data-mt': !userInfo.role }">
  60. <view class="brokerage">
  61. <image :src="configList.money_image" mode="aspectFill" class="brokerage-img"></image>
  62. <div class="main">
  63. <div class="title">我的佣金</div>
  64. <div class="money">{{ riceInfo.canWithdraw || 0 }}</div>
  65. </div>
  66. </view>
  67. <view class="balance">
  68. <image :src="configList.price_image" mode="aspectFill" class="balance-img"></image>
  69. <div class="main">
  70. <div class="title">我的余额</div>
  71. <div class="money">{{ riceInfo.balance || 0 }}</div>
  72. </div>
  73. </view>
  74. </view>
  75. <!-- 我的服务 -->
  76. <view class="myServer">
  77. <view class="server-title">
  78. 我的服务
  79. </view>
  80. <view class="box">
  81. <view class="boxs" @click="$utils.navigateTo('/pages/index/order?type=0')">
  82. <image src="@/static/image/center/1.png" mode="aspectFill" />
  83. <view class="title">我的订单</view>
  84. </view>
  85. <view class="boxs" @click="$utils.navigateTo('/pages_order/mine/partner')">
  86. <image src="@/static/image/center/2.png" mode="aspectFill" />
  87. <view class="title">我的团队</view>
  88. </view>
  89. <view class="boxs" @click="$utils.navigateTo('/pages_order/home/contact')">
  90. <image src="@/static/image/center/3.png" mode="aspectFill" />
  91. <view class="title">联系客服</view>
  92. </view>
  93. <view class="boxs" @click="$utils.navigateTo('/pages_order/mine/promotion')">
  94. <image src="@/static/image/center/4.png" mode="aspectFill" />
  95. <view class="title">邀请好友</view>
  96. </view>
  97. </view>
  98. <view class="box">
  99. <view class="boxs" @click="$utils.navigateTo('/pages_order/mine/recruit')">
  100. <image src="@/static/image/center/5.png" mode="aspectFill" />
  101. <view class="title">合伙人招募</view>
  102. </view>
  103. <view class="boxs" @click="$utils.navigateTo('/pages_order/mine/memberCenter')">
  104. <image src="@/static/image/center/6.png" mode="aspectFill" />
  105. <view class="title">会员权益</view>
  106. </view>
  107. <view class="boxs" @click="$utils.navigateTo('/pages_order/mine/coupon')">
  108. <image src="@/static/image/center/7.png" mode="aspectFill" />
  109. <view class="title">优惠券</view>
  110. </view>
  111. <view class="boxs" @click="$utils.navigateTo('/pages_order/mine/help')">
  112. <image src="@/static/image/center/8.png" mode="aspectFill" />
  113. <view class="title">帮助与反馈</view>
  114. </view>
  115. </view>
  116. <view class="box">
  117. <view class="boxs" @click="$utils.navigateTo('/pages_order/mine/address')">
  118. <image src="@/static/image/center/address.png" mode="aspectFill" />
  119. <view class="title">我的地址</view>
  120. </view>
  121. <view class="boxs" @click="$utils.navigateTo('/pages_order/order/giftList')">
  122. <image src="@/static/image/center/9.png" mode="aspectFill" />
  123. <view class="title">礼包列表</view>
  124. </view>
  125. <view class="boxs" @click="logout">
  126. <image src="@/static/image/center/logout.png" mode="aspectFill" />
  127. <view class="title">退出登录</view>
  128. </view>
  129. </view>
  130. </view>
  131. <!-- 广告 -->
  132. <div v-if="showAdvertising" class="ad" @click="$utils.navigateTo('/pages_order/mine/recruit')">
  133. <swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="true" :interval="2000"
  134. :duration="duration">
  135. <swiper-item v-for="(item, index) in adList" :key="index">
  136. <view class="swiper-main">
  137. <view @click="closeAdvertising" class="close">
  138. <image src="@/static/image/center/close.png" mode="aspectFill" class="close-img"></image>
  139. </view>
  140. <image :src="item" mode="aspectFill" class="swiper-main-img"></image>
  141. <div class="ad-tag">
  142. <image src="@/static/image/center/ad-tag.png" mode="aspectFill" class="ad-tag-img"></image>
  143. </div>
  144. </view>
  145. </swiper-item>
  146. </swiper>
  147. </div>
  148. <customerServicePopup ref="customerServicePopup" />
  149. <tabber select="center" />
  150. </view>
  151. </template>
  152. <script>
  153. import tabber from '@/components/base/tabbar.vue'
  154. import {
  155. mapState
  156. } from 'vuex'
  157. import customerServicePopup from '@/components/config/customerServicePopup.vue'
  158. export default {
  159. components: {
  160. tabber,
  161. customerServicePopup,
  162. },
  163. computed: {
  164. ...mapState(['riceInfo']),
  165. adList() {
  166. let arr = [];
  167. if (this.configList?.shop_get_image) {
  168. arr = this.configList?.shop_get_image?.split(',')
  169. }
  170. return arr
  171. }
  172. },
  173. data() {
  174. return {
  175. vipType: ['普通会员', '黄金会员', '渠道商'],
  176. vipImage: ['vip_vip', 'vip_user', 'vip_shop'],
  177. vipList: [],
  178. showAdvertising: true,
  179. userRole: ['会员', '用户', '渠道'],
  180. indicatorDots: true,
  181. duration: 500
  182. }
  183. },
  184. onShow() {
  185. this.$store.commit('getUserInfo')
  186. this.$store.commit('getRiceInfo')
  187. this.getMemberCardData();
  188. },
  189. methods: {
  190. clickNo() {
  191. uni.showModal({
  192. title: '暂未开放',
  193. })
  194. },
  195. logout() {
  196. uni.showModal({
  197. title: '确认退出登录吗',
  198. success: (r) => {
  199. if (r.confirm) {
  200. this.$store.commit('logout', true)
  201. }
  202. }
  203. })
  204. },
  205. //关闭广告
  206. closeAdvertising() {
  207. this.showAdvertising = false;
  208. },
  209. //获取会员卡片数据
  210. getMemberCardData() {
  211. this.$api('getRiceVipList', res => {
  212. if (res.code == 200) {
  213. this.vipList = res.result
  214. }
  215. })
  216. }
  217. }
  218. }
  219. </script>
  220. <style scoped lang="scss">
  221. .page {
  222. // 头部
  223. .head {
  224. display: flex;
  225. align-items: center;
  226. padding: 60rpx 20rpx 120rpx 20rpx;
  227. background: $uni-color;
  228. .headImage {
  229. width: 130rpx;
  230. height: 130rpx;
  231. background-image: url(/static/image/center/head-img.png);
  232. background-repeat: no-repeat;
  233. background-position: 50%, 50%;
  234. background-size: 100%;
  235. overflow: hidden;
  236. border-radius: 50%;
  237. margin-right: 20rpx;
  238. image {
  239. width: 100%;
  240. height: 100%;
  241. }
  242. }
  243. .user-info {
  244. width: calc(100% - 130rpx);
  245. .user-base-info {
  246. display: flex;
  247. flex-wrap: wrap;
  248. justify-content: space-between;
  249. .user-base-top {
  250. width: 65%;
  251. display: flex;
  252. align-items: center;
  253. flex-wrap: wrap;
  254. color: white;
  255. .user-name {
  256. max-width: calc(100% - 240rpx);
  257. white-space: nowrap;
  258. text-overflow: ellipsis;
  259. overflow: hidden;
  260. font-size: 34rpx;
  261. }
  262. .member-level {
  263. margin-left: 10rpx;
  264. .level {
  265. width: 120rpx;
  266. height: 60rpx;
  267. }
  268. }
  269. .user-tag {
  270. display: flex;
  271. align-items: center;
  272. justify-content: center;
  273. background: #000;
  274. width: 100rpx;
  275. height: 40rpx;
  276. border-radius: 20rpx;
  277. font-size: 24rpx;
  278. margin-left: 10rpx;
  279. }
  280. }
  281. .edit-user {
  282. width: 35%;
  283. display: flex;
  284. align-items: center;
  285. justify-content: flex-end;
  286. .edit-icon {
  287. width: 30rpx;
  288. height: 30rpx;
  289. }
  290. .edit-btn {
  291. color: white;
  292. margin-left: 10rpx;
  293. }
  294. }
  295. }
  296. .user-phone {
  297. color: white;
  298. font-size: 24rpx;
  299. }
  300. }
  301. }
  302. // 会员卡片
  303. .earnings {
  304. padding: 0rpx 20rpx;
  305. box-sizing: border-box;
  306. margin-top: -18%;
  307. .member-item {
  308. position: relative;
  309. .member-image {
  310. width: 100%;
  311. height: 300rpx;
  312. border-radius: 20rpx;
  313. }
  314. .member-info {
  315. position: absolute;
  316. bottom: 30rpx;
  317. left: 0rpx;
  318. display: flex;
  319. align-items: center;
  320. padding: 0rpx 40rpx;
  321. box-sizing: border-box;
  322. width: 100%;
  323. .profile-photo {
  324. display: flex;
  325. justify-content: center;
  326. align-items: center;
  327. .pro-img {
  328. width: 60rpx;
  329. height: 60rpx;
  330. border-radius: 50%;
  331. }
  332. .open-status {
  333. color: #F8A95F;
  334. border: 1px solid #F8A95F;
  335. border-radius: 30rpx;
  336. padding: 7rpx 20rpx;
  337. margin-left: 10rpx;
  338. }
  339. }
  340. .open {
  341. font-size: 26rpx;
  342. margin-left: 20rpx;
  343. }
  344. }
  345. }
  346. }
  347. // 佣金数据
  348. .brokerage-data {
  349. padding: 20rpx;
  350. background: white;
  351. border-radius: 20rpx;
  352. display: flex;
  353. flex-wrap: wrap;
  354. box-sizing: border-box;
  355. margin: 20rpx 20rpx 20rpx 20rpx;
  356. .brokerage,
  357. .balance {
  358. display: flex;
  359. flex-wrap: wrap;
  360. width: 50%;
  361. .brokerage-img,
  362. .balance-img {
  363. width: 50%;
  364. height: auto;
  365. }
  366. .main {
  367. display: flex;
  368. flex-direction: column;
  369. justify-content: space-around;
  370. width: 50%;
  371. box-sizing: border-box;
  372. padding: 30rpx 0rpx;
  373. .title {
  374. font-size: 34rpx;
  375. }
  376. .money {
  377. font-size: 40rpx;
  378. color: $uni-color;
  379. font-weight: bold;
  380. }
  381. }
  382. }
  383. }
  384. .brokerage-data-mt {
  385. margin-top: 50rpx;
  386. }
  387. // 我的服务
  388. .myServer {
  389. margin: 0rpx 20rpx 20rpx 20rpx;
  390. background: white;
  391. border-radius: 20rpx;
  392. padding: 30rpx 20rpx;
  393. box-sizing: border-box;
  394. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);
  395. .server-title {
  396. margin-bottom: 30rpx;
  397. font-size: 36rpx;
  398. font-weight: 600;
  399. color: #333;
  400. position: relative;
  401. padding-left: 20rpx;
  402. &::before {
  403. content: '';
  404. position: absolute;
  405. left: 0;
  406. top: 50%;
  407. transform: translateY(-50%);
  408. width: 8rpx;
  409. height: 32rpx;
  410. background: $uni-color;
  411. border-radius: 4rpx;
  412. }
  413. }
  414. .box {
  415. display: flex;
  416. width: 100%;
  417. margin-bottom: 30rpx;
  418. gap: 20rpx;
  419. .boxs {
  420. width: 23%;
  421. display: flex;
  422. flex-direction: column;
  423. justify-content: center;
  424. align-items: center;
  425. padding: 20rpx 0;
  426. border-radius: 16rpx;
  427. transition: all 0.3s ease;
  428. position: relative;
  429. overflow: hidden;
  430. &::after {
  431. content: '';
  432. position: absolute;
  433. top: 0;
  434. left: 0;
  435. width: 100%;
  436. height: 100%;
  437. background: rgba(227, 68, 26, 0.05);
  438. opacity: 0;
  439. transition: opacity 0.3s ease;
  440. z-index: 1;
  441. }
  442. &:active {
  443. transform: scale(0.95);
  444. &::after {
  445. opacity: 1;
  446. }
  447. }
  448. image {
  449. width: 70rpx;
  450. height: 70rpx;
  451. display: block;
  452. margin: 0rpx auto 16rpx auto;
  453. position: relative;
  454. z-index: 2;
  455. transition: transform 0.3s ease;
  456. }
  457. .title {
  458. font-size: 26rpx;
  459. color: #333;
  460. position: relative;
  461. z-index: 2;
  462. transition: color 0.3s ease;
  463. }
  464. &:active {
  465. image {
  466. transform: translateY(-4rpx);
  467. }
  468. .title {
  469. color: $uni-color;
  470. }
  471. }
  472. }
  473. &:last-child {
  474. margin-bottom: 0rpx;
  475. }
  476. }
  477. }
  478. // 广告
  479. .ad {
  480. margin: 0rpx 20rpx;
  481. .swiper {
  482. .swiper-main {
  483. position: relative;
  484. .close {
  485. position: absolute;
  486. top: 20rpx;
  487. right: 20rpx;
  488. .close-img {
  489. width: 40rpx;
  490. height: 40rpx;
  491. }
  492. }
  493. .swiper-main-img {
  494. width: 100%;
  495. height: 200rpx;
  496. border-radius: 20rpx;
  497. }
  498. .ad-tag {
  499. position: absolute;
  500. left: 20rpx;
  501. bottom: 20rpx;
  502. .ad-tag-img {
  503. width: 120rpx;
  504. height: auto;
  505. }
  506. }
  507. }
  508. }
  509. }
  510. }
  511. </style>