珠宝小程序前端代码
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.

683 lines
15 KiB

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