猎豆优选小程序

my.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. <template>
  2. <view class="page-wrap" :style="{ 'padding-top': `${statusBarHeight + 16}px;` }">
  3. <!-- 剪切板弹框 -->
  4. <clipboard v-if="is_clipbpard" @close="clipbpardClose"></clipboard>
  5. <!-- S 我的信息 -->
  6. <block>
  7. <!-- 我的信息 - 未登录 -->
  8. <view v-if="!isLogin" class="unlogin-wrap" @click="onClickToLogin">
  9. <image class="avatar" src="https://ld.726p.com/ldyx_static/imgs/avatar-unlogin.png" />
  10. <view class="login-btn">点击登录</view>
  11. </view>
  12. <!-- 我的信息 - 已登录 -->
  13. <view v-else class="login-wrap">
  14. <view class="lt-wrap">
  15. <image class="avatar" :src="userInfo.img" />
  16. <image v-if="userInfo.user_level == 1" class="tag" src="https://ld.726p.com/ldyx_static/imgs/tag-vip.png" />
  17. <image v-else-if="userInfo.user_level == 2" class="tag" src="https://ld.726p.com/ldyx_static/imgs/tag-svip.png" />
  18. <image v-else-if="userInfo.user_level == 3" class="tag" src="https://ld.726p.com/ldyx_static/imgs/tag-yys.png" />
  19. </view>
  20. <view class="rt-wrap">
  21. <view class="flex-center">
  22. <view class="phone">{{ userInfo.name }}</view>
  23. <view class="copy-yqm" v-if="userInfo.user_level != 1" @click="copyEvent">复制邀请码</view>
  24. </view>
  25. <view class="bm-wrap" style="margin-top:20rpx" v-if="userInfo.user_level != 1">
  26. <view @click="goFriendPage">好友 {{ userInfo.all_friends || '0' }}</view>
  27. <view class="money" @click="onClickWithdraw">余额 ¥{{ userInfo.account_balance }}</view>
  28. <view class="take-btn" @click="onClickWithdraw">提现</view>
  29. </view>
  30. </view>
  31. </view>
  32. </block>
  33. <!-- E 我的信息 -->
  34. <!-- S 我的收益 -->
  35. <view class="income-wrap" v-if="isLogin && userInfo.user_level != 1">
  36. <view class="tp-wrap">
  37. <view class="tp-lt-wrap">
  38. <text>我的收益</text>
  39. <text v-if="isLogin" class="money">¥{{ userInfo.all_settlement_income || '-' }}</text>
  40. <text v-else class="money">¥--</text>
  41. </view>
  42. <view v-if="isLogin" class="tp-rt-wrap" @click="goProfitPage()">
  43. <text>+{{ userInfo.this_day_forecast_income }}元</text>
  44. <image class="arrow-rt" src="https://ld.726p.com/ldyx_static/imgs/arrow-rt.png" />
  45. </view>
  46. </view>
  47. <view class="bm-wrap">每月25号可提现上月结算收益</view>
  48. </view>
  49. <!-- E 我的收益 -->
  50. <!-- S 会员升级提示 -->
  51. <view v-if="isLogin && userInfo.user_level == 1" class="level-tips-wrap">
  52. <view class="lt-wrap">
  53. <image class="icon" src="https://ld.726p.com/ldyx_static/imgs/icon-notice.png" />
  54. <text class="tips">升级到超级会员才有佣金收益,联系服务商升级</text>
  55. </view>
  56. <view class="rt-btn" @click="showService = true">升级</view>
  57. </view>
  58. <!-- E 会员升级提示 -->
  59. <!-- S 常用功能 -->
  60. <view class="menu-wrap">
  61. <view class="menu-header">常用功能</view>
  62. <view class="menu-content">
  63. <!-- for-5 -->
  64. <view class="menu-item" v-for="item in menu1" :key="item.id" @click="onClickMenu(item.id)">
  65. <button class="inviteFriend" v-if="item.id === 'yqhy'" open-type="share" data-source="inviteFriend">
  66. <image class="item-icon" :src="item.icon" />
  67. <text class="item-label">{{ item.label }}</text>
  68. </button>
  69. <block v-else>
  70. <image class="item-icon" :src="item.icon" />
  71. <text class="item-label">{{ item.label }}</text>
  72. </block>
  73. </view>
  74. </view>
  75. </view>
  76. <!-- E 常用功能 -->
  77. <!-- S 必备工具 -->
  78. <view class="menu-wrap">
  79. <view class="menu-header">必备工具</view>
  80. <view class="menu-content">
  81. <view class="menu-item" v-for="item in menu2" :key="item.id" @click="onClickMenu(item.id)">
  82. <image class="item-icon2" :src="item.icon" />
  83. <text class="item-label">{{ item.label }}</text>
  84. </view>
  85. </view>
  86. </view>
  87. <!-- E 必备工具 -->
  88. <!-- 版本号 -->
  89. <view class="version-wrap">
  90. <!-- #ifdef H5 -->
  91. <icp></icp>
  92. <!-- #endif -->
  93. <!-- #ifdef MP-WEIXIN -->
  94. 当前版本:V{{ version }}
  95. <!-- #endif -->
  96. </view>
  97. <!-- 客服弹框 -->
  98. <serviceProvider :show="showService" @close="showService=false" hint="升级超级会员,请联系服务商!"></serviceProvider>
  99. </view>
  100. </template>
  101. <script>
  102. const app = getApp()
  103. const $router = app.globalData.$router
  104. import packageConfig from '../../package.json'
  105. import serviceProvider from '@/components/serviceProvider.vue'
  106. export default {
  107. components:{serviceProvider},
  108. data() {
  109. return {
  110. statusBarHeight: app.globalData.statusBarHeight,
  111. version: packageConfig.version,
  112. menu1: [
  113. {
  114. icon: 'https://ld.726p.com/ldyx_static/imgs/menu-wdsy.png',
  115. label: '我的收益',
  116. id: 'wdsy',
  117. },
  118. {
  119. icon: 'https://ld.726p.com/ldyx_static/imgs/menu-wddd.png',
  120. label: '我的订单',
  121. id: 'wddd',
  122. },
  123. {
  124. icon: 'https://ld.726p.com/ldyx_static/imgs/menu-wdhy.png',
  125. label: '我的好友',
  126. id: 'wdhy',
  127. },
  128. {
  129. icon: 'https://ld.726p.com/ldyx_static/imgs/menu-yqhy.png',
  130. label: '邀请好友',
  131. id: 'yqhy',
  132. },
  133. {
  134. icon: '/static/imgs/icon-fyb.png',
  135. label: '分佣榜',
  136. id: 'fyb',
  137. },
  138. ],
  139. menu2: [
  140. {
  141. icon: 'https://ld.726p.com/ldyx_static/imgs/menu2-scll.png',
  142. label: '收藏/浏览',
  143. id: 'scll',
  144. },
  145. {
  146. icon: 'https://ld.726p.com/ldyx_static/imgs/menu2-xszn.png',
  147. label: '新手指南',
  148. id: 'xszn',
  149. },
  150. {
  151. icon: 'https://ld.726p.com/ldyx_static/imgs/menu2-zskf.png',
  152. label: '专属客服',
  153. id: 'zskf',
  154. },
  155. {
  156. icon: 'https://ld.726p.com/ldyx_static/imgs/menu2-tqjs.png',
  157. label: '特权介绍',
  158. id: 'tqjs',
  159. },
  160. {
  161. icon: 'https://ld.726p.com/ldyx_static/imgs/menu2-yysht.png',
  162. label: '运营商后台',
  163. id: 'yysht',
  164. },
  165. {
  166. icon: 'https://ld.726p.com/ldyx_static/imgs/menu2-yhfk.png',
  167. label: '用户反馈',
  168. id: 'yhfk',
  169. },
  170. {
  171. icon: 'https://ld.726p.com/ldyx_static/imgs/menu2-cjwt.png',
  172. label: '常见问题',
  173. id: 'cjwt',
  174. },
  175. {
  176. icon: 'https://ld.726p.com/ldyx_static/imgs/menu2-sz.png',
  177. label: '设置',
  178. id: 'sz',
  179. },
  180. ],
  181. isLogin: false, // 用户是否已登录
  182. userInfo: {}, // 用户信息
  183. showService:false
  184. };
  185. },
  186. onShow() {
  187. this.handleSetUserInfo()
  188. },
  189. //下拉刷新
  190. async onPullDownRefresh(){
  191. let userInfo = uni.getStorageSync('userInfo') || ''
  192. if (userInfo) {
  193. await app.handleGetUserInfo() // 获取用户信息
  194. let userInfo = uni.getStorageSync('userInfo') || ''
  195. this.userInfo = {...userInfo}
  196. this.isLogin = true
  197. } else {
  198. this.isLogin = false
  199. }
  200. uni.stopPullDownRefresh()
  201. },
  202. methods: {
  203. // 点击提现
  204. onClickWithdraw() {
  205. $router.navigateTo({
  206. url: `/pages/subPackages/my/withdrawDetail`
  207. })
  208. },
  209. // 监听点击"登录"
  210. onClickToLogin() {
  211. $router.navigateTo({
  212. url: `/pages/subPackages/login/loginPhone`
  213. })
  214. },
  215. // 去我的收益页面
  216. goProfitPage(){
  217. $router.navigateTo({
  218. url: `/pages/subPackages/my/profit`
  219. })
  220. },
  221. // 监听点击菜单按钮
  222. onClickMenu(menuId) {
  223. if (menuId === 'yqhy') return; //邀请好友
  224. if (menuId === 'wdsy') { // 我的收益
  225. if (this.isLogin) {
  226. if (this.userInfo.user_level == 1) { // 普通会员无此权限
  227. app.handleShowModal('升级到超级会员才有此功能权限,联系服务商升级!').then(()=>{
  228. this.showService = true
  229. })
  230. } else {
  231. this.goProfitPage()
  232. }
  233. } else { // 未登录,去登录
  234. this.onClickToLogin()
  235. }
  236. } else if (menuId === 'wddd') { // 我的订单
  237. if (this.isLogin) {
  238. if (this.userInfo.user_level == 1) { // 普通会员无此权限
  239. app.handleShowModal('升级到超级会员才有此功能权限,联系服务商升级!').then(()=>{
  240. this.showService = true
  241. })
  242. } else {
  243. $router.navigateTo({
  244. url: `/pages/subPackages/myOrderList/index`
  245. })
  246. }
  247. } else { // 未登录,去登录
  248. this.onClickToLogin()
  249. }
  250. } else if (menuId === 'wdhy') {
  251. if (this.isLogin) {
  252. if (this.userInfo.user_level == 1) { // 普通会员无此权限
  253. app.handleShowModal('升级到超级会员才有此功能权限,联系服务商升级!').then(()=>{
  254. this.showService = true
  255. })
  256. } else {
  257. this.goFriendPage()
  258. }
  259. } else { // 未登录,去登录
  260. this.onClickToLogin()
  261. }
  262. } else if (menuId === 'scll') { // 收藏浏览
  263. $router.navigateTo({
  264. url: `/pages/subPackages/my/scll`
  265. })
  266. } else if (menuId === 'zskf') { // 专属客服
  267. $router.navigateTo({
  268. url: `/pages/subPackages/my/zskf`
  269. })
  270. } else if (menuId === 'xszn') { // 新手指南
  271. $router.navigateTo({
  272. url: `/pages/subPackages/my/xszn`
  273. })
  274. } else if (menuId === 'tqjs') { //特权介绍
  275. $router.navigateTo({
  276. url: `/pages/subPackages/my/tqjs`
  277. })
  278. } else if (menuId === 'yysht') { // 运营商后台
  279. //判断是否登录,如果没有登录去登录页
  280. if (this.isLogin) {
  281. if (this.userInfo.user_level != 3) { //判断用户是不是运营商
  282. uni.showToast({ title: '您还不是运营商', icon: 'none' })
  283. } else { // 联系运营商,升级为超级会员
  284. this.showService = true
  285. }
  286. } else { // 未登录,去登录
  287. this.onClickToLogin()
  288. }
  289. } else if (menuId === 'yhfk') { // 用户反馈
  290. $router.navigateTo({
  291. url: `/pages/subPackages/my/feedback`
  292. })
  293. } else if (menuId === 'cjwt') { // 常见问题
  294. $router.navigateTo({
  295. url: `/pages/subPackages/my/commonProblem`
  296. })
  297. } else if (menuId === 'sz') { // 设置
  298. $router.navigateTo({
  299. url: `/pages/subPackages/my/setup`
  300. })
  301. } else if (menuId === 'fyb') { // 分佣榜
  302. $router.navigateTo({
  303. url: `/pages/subPackages/my/commissionRank`
  304. })
  305. } else {
  306. uni.showToast({ title: '敬请期待', icon: 'none' })
  307. }
  308. },
  309. // 去我的好友页面
  310. goFriendPage(){
  311. $router.navigateTo({
  312. url: `/pages/subPackages/my/friendList`
  313. })
  314. },
  315. // 去webview页面
  316. goWebViewPage(type){
  317. // 去运营商后台页面
  318. if(type == 'yys'){
  319. let url = encodeURIComponent(this.userInfo.operator_system)
  320. $router.navigateTo({
  321. url: `/pages/webView/webView?url=${url}&title=运营商后台`
  322. })
  323. }
  324. },
  325. // 监听点击版本号
  326. onClickVersion() {
  327. console.log('onClickVersion => ')
  328. },
  329. // 从本地存储中读取用户信息 => 回显到页面中
  330. async handleSetUserInfo() {
  331. let userInfo = uni.getStorageSync('userInfo') || ''
  332. if (userInfo) {
  333. await app.handleGetUserInfo(true) // 获取用户信息
  334. let userInfo = uni.getStorageSync('userInfo') || ''
  335. this.userInfo = {...userInfo}
  336. this.isLogin = true
  337. } else {
  338. this.isLogin = false
  339. }
  340. },
  341. //复制邀请码
  342. copyEvent(){
  343. this.$copyEvent({text:this.userInfo.invite_code})
  344. },
  345. },
  346. }
  347. </script>
  348. <style lang="scss" scoped>
  349. .page-wrap {
  350. position: relative;
  351. min-height: 100vh;
  352. background-image: url("https://ld.726p.com/ldyx_static/imgs/my-bg.png");
  353. background-repeat: no-repeat;
  354. background-attachment: fixed;
  355. background-size: 100% 370rpx;
  356. background-color: #F5F5F5;
  357. .unlogin-wrap {
  358. display: flex;
  359. align-items: center;
  360. padding: 40rpx 0 0 40rpx;
  361. .avatar {
  362. width: 112rpx;
  363. height: 112rpx;
  364. }
  365. .login-btn {
  366. margin-left: 20rpx;
  367. font-size: 36rpx;
  368. color: #fff;
  369. }
  370. }
  371. .login-wrap {
  372. display: flex;
  373. align-items: center;
  374. padding: 40rpx 0 0 40rpx;
  375. .lt-wrap {
  376. display: flex;
  377. flex-direction: column;
  378. align-items: center;
  379. .avatar {
  380. width: 112rpx;
  381. height: 112rpx;
  382. border-radius: 50%;
  383. }
  384. .tag {
  385. position: relative;
  386. top: -10rpx;
  387. width: 114rpx;
  388. height: 26rpx;
  389. }
  390. }
  391. .rt-wrap {
  392. margin-left: 20rpx;
  393. .phone {
  394. font-size: 34rpx;
  395. color: #fff;
  396. }
  397. .bm-wrap {
  398. margin-top: 36rpx;
  399. display: flex;
  400. align-items: center;
  401. font-size: 30rpx;
  402. color: #fff;
  403. .money {
  404. margin: 0 30rpx;
  405. }
  406. .take-btn {
  407. font-size: 26rpx;
  408. color: #F6DB4A;
  409. }
  410. }
  411. }
  412. }
  413. .income-wrap {
  414. margin: 50rpx auto 0;
  415. padding: 24rpx 18rpx 24rpx 10rpx;
  416. width: 95%;
  417. background-color: #fff;
  418. border-radius: 20rpx;
  419. .tp-wrap {
  420. display: flex;
  421. justify-content: space-between;
  422. align-items: center;
  423. .tp-lt-wrap {
  424. font-size: 30rpx;
  425. color: #555;
  426. .money {
  427. margin-left: 20rpx;
  428. color: #F52B18;
  429. font-size: 32rpx;
  430. font-weight: 500;
  431. }
  432. }
  433. .tp-rt-wrap {
  434. color: #F52B18;
  435. font-size: 30rpx;
  436. .arrow-rt {
  437. margin-left: 20rpx;
  438. width: 14rpx;
  439. height: 22rpx;
  440. }
  441. }
  442. }
  443. .bm-wrap {
  444. margin-top: 20rpx;
  445. font-size: 26rpx;
  446. color: #999;
  447. }
  448. }
  449. .level-tips-wrap {
  450. display: flex;
  451. justify-content: space-between;
  452. align-items: center;
  453. margin: 20rpx auto 0;
  454. padding: 20rpx;
  455. width: 95%;
  456. background-color: #fff;
  457. border-radius: 20rpx;
  458. .lt-wrap {
  459. display: flex;
  460. align-items: center;
  461. .icon {
  462. width: 34rpx;
  463. height: 28rpx;
  464. }
  465. .tips {
  466. margin-left: 10rpx;
  467. font-size: 26rpx;
  468. color: #F10B00;
  469. }
  470. }
  471. .rt-btn {
  472. width: 80rpx;
  473. text-align: center;
  474. font-size: 27rpx;
  475. border-radius: 34rpx;
  476. border: 2rpx solid #F10B00;
  477. color: #F10B00;
  478. }
  479. }
  480. .menu-wrap {
  481. margin: 20rpx auto 0;
  482. width: 95%;
  483. background-color: #fff;
  484. border-radius: 20rpx;
  485. .menu-header {
  486. padding: 20rpx 0 6rpx 30rpx;
  487. font-size: 30rpx;
  488. color: #555;
  489. border-bottom: 2rpx solid #eee;
  490. }
  491. .menu-content {
  492. padding: 30rpx 0 10rpx;
  493. display: flex;
  494. justify-content: flex-start;
  495. flex-wrap: wrap;
  496. .menu-item {
  497. display: flex;
  498. flex-direction: column;
  499. align-items: center;
  500. margin-bottom: 30rpx;
  501. margin-right: 20rpx;
  502. width: calc((100% - 60rpx) / 4); // 30rpx 是前3个元素的右间距之和(20 * 3)
  503. &:nth-of-type(4n + 0) {
  504. margin-right: 0;
  505. }
  506. &.for-5 {
  507. width: calc((100% - 80rpx) / 5); // 40rpx 是前4个元素的右间距之和(20 * 4)
  508. &:nth-of-type(5n + 0) {
  509. margin-right: 0;
  510. }
  511. }
  512. .inviteFriend{
  513. display: flex;
  514. flex-direction: column;
  515. align-items: center;
  516. background-color: transparent;
  517. padding: 0;
  518. &::after{
  519. border: none;
  520. }
  521. }
  522. .item-icon {
  523. width: 46rpx;
  524. height: 48rpx;
  525. }
  526. .item-icon2 {
  527. width: 38rpx;
  528. height: 46rpx;
  529. }
  530. .item-label {
  531. margin-top: 10rpx;
  532. font-size: 26rpx;
  533. color: #666;
  534. line-height: 40rpx;
  535. }
  536. }
  537. }
  538. }
  539. .version-wrap {
  540. position: absolute;
  541. left: 0;
  542. right: 0;
  543. bottom: 80rpx;
  544. text-align: center;
  545. font-size: 28rpx;
  546. color: #aaa;
  547. }
  548. }
  549. .flex-center{
  550. display: flex;
  551. align-items: center;
  552. }
  553. .copy-yqm{
  554. font-size: 20rpx;
  555. line-height: 30rpx;
  556. border: 2rpx solid #FFFFFF;
  557. padding: 0 20rpx;
  558. border-radius: 30rpx;
  559. color: #FFFFFF;
  560. margin-left: 40rpx;
  561. }
  562. </style>