index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. <template>
  2. <view :style="colorStyle">
  3. <view class='my-promotion'>
  4. <view class="header header-height">
  5. <view class="user-msg">
  6. <view class="acator">
  7. <image :src="userInfo.avatar" mode=""></image>
  8. </view>
  9. <view class="msg">
  10. <view class="name">{{userInfo.nickname}}</view>
  11. <view class="process" v-if="levelList.length">
  12. <view :style="{width: `${speedAll}%`}" class="fill"></view>
  13. </view>
  14. <view class="level-info" v-if="levelInfo.id">
  15. <text class="mr20">一级上浮 {{levelInfo.one_brokerage}}%</text>
  16. <text>二级上浮 {{levelInfo.two_brokerage}}%</text>
  17. </view>
  18. <view v-else class="level-info">普通用户</view>
  19. </view>
  20. <view class="invite" @click="jumbPath(5)">
  21. <view class="poster-in">
  22. <image src="../static/gz.png" mode=""></image>
  23. </view>
  24. <text class="text">活动规则</text>
  25. </view>
  26. </view>
  27. <view class="tesk" v-if="levelList.length">
  28. <view class="tesk-l">
  29. <view class="upgrade">
  30. <image src="../static/sj.png" mode=""></image>
  31. </view>
  32. <view class="line"></view>
  33. <view class="">
  34. <view class="fx-leavel" @click="jumbPath(10)">
  35. <view class="">
  36. {{levelInfo.name}}
  37. </view>
  38. <view class="point"></view>
  39. </view>
  40. <view class="fx-trip">
  41. 下单、邀请好友等均可提高等级
  42. </view>
  43. </view>
  44. </view>
  45. <view class="tesk-r" @click="taskShow = true">
  46. 做任务
  47. </view>
  48. </view>
  49. </view>
  50. <view class="price-box" :class="!headerStatus ? 'header-height':''">
  51. <view class="box-top">
  52. <view class="" @click="jumbPath(6)">
  53. 可提现金额
  54. <text class="iconfont icon-xiangyou"></text>
  55. </view>
  56. <view class="" @click="jumbPath(7)">
  57. 提现记录
  58. <text class="iconfont icon-xiangyou"></text>
  59. </view>
  60. </view>
  61. <view class="com-count" @click="jumbPath(6)">
  62. {{userInfo.commissionCount}}
  63. </view>
  64. <view class="box-btn">
  65. <view class="item">
  66. <view class="text">
  67. 待提现佣金
  68. </view>
  69. <view class="num">
  70. {{userInfo.brokerage_price}}
  71. </view>
  72. </view>
  73. <view class="item in">
  74. <view class="item-cn">
  75. <view class="text">
  76. 已提现佣金
  77. </view>
  78. <view class="num">
  79. {{userInfo.extract_price}}
  80. </view>
  81. </view>
  82. </view>
  83. <view class="item in">
  84. <view class="item-cn">
  85. <view class="text">
  86. 冻结佣金
  87. </view>
  88. <view class="num">
  89. {{userInfo.broken_commission}}
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. <view class="btn" @click="jumbPath(0)">
  95. 立即提现
  96. </view>
  97. </view>
  98. <view class="statistics">
  99. <view class="item mb" @click="jumbPath(9)">
  100. <view class="img">
  101. <text class="iconfont icon-wodetuandui"></text>
  102. </view>
  103. <view class="item-r">
  104. <view class="text">我的团队</view>
  105. <view class="trip">{{userInfo.spread_count || 0}}人</view>
  106. </view>
  107. </view>
  108. <view class="item mb" @click="jumbPath(8)">
  109. <view class="img">
  110. <text class="iconfont icon-fenxiaodingdan"></text>
  111. </view>
  112. <view class="item-r">
  113. <view class="text">分销订单</view>
  114. <view class="trip">{{userInfo.spread_order_count || 0}}笔</view>
  115. </view>
  116. </view>
  117. <view class="item mb" @click="jumbPath(5)">
  118. <view class="img">
  119. <text class="iconfont icon-yaoqinghaoyou1"></text>
  120. </view>
  121. <view class="item-r">
  122. <view class="text">邀请好友</view>
  123. <view class="trip">邀请好友赚奖励</view>
  124. </view>
  125. </view>
  126. <view class="item mb" @click="jumbPath(10)">
  127. <view class="img">
  128. <text class="iconfont icon-xingzhuangjiehe"></text>
  129. </view>
  130. <view class="item-r">
  131. <view class="text">等级说明</view>
  132. <view class="trip">分销等级说明</view>
  133. </view>
  134. </view>
  135. <view class="item" @click="jumbPath(2)">
  136. <view class="img">
  137. <text class="iconfont icon-yongjinpaihang1"></text>
  138. </view>
  139. <view class="item-r">
  140. <view class="text">佣金排行</view>
  141. <view class="trip">您的排名为{{userInfo.position_count}}</view>
  142. </view>
  143. </view>
  144. <view class="item" @click="jumbPath(1)">
  145. <view class="img">
  146. <text class="iconfont icon-tuiguangrenpaihang1"></text>
  147. </view>
  148. <view class="item-r">
  149. <view class="text">推广人排行</view>
  150. <view class="trip">您的排名为{{userInfo.rank_count}}</view>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. <task :inv-show="taskShow" :task="task" @inv-close="()=>{taskShow= false}"></task>
  156. </view>
  157. </template>
  158. <script>
  159. import {
  160. getUserInfo,
  161. agentLevelList,
  162. agentLevelTaskList,
  163. moneyList,
  164. spreadOrder,
  165. spreadPeople
  166. } from '@/api/user.js';
  167. import {
  168. openExtrctSubscribe
  169. } from '@/utils/SubscribeMessage.js';
  170. import {
  171. toLogin
  172. } from '@/libs/login.js';
  173. import task from './components/task.vue'
  174. import {
  175. mapGetters
  176. } from "vuex";
  177. import home from '@/components/home';
  178. import colors from '@/mixins/color.js'
  179. export default {
  180. components: {
  181. home,
  182. task
  183. },
  184. mixins: [colors],
  185. data() {
  186. return {
  187. userInfo: {},
  188. taskShow: false,
  189. yesterdayPrice: 0.00,
  190. isAuto: false, //没有授权的不会自动授权
  191. isShowAuth: false, //是否隐藏授权
  192. distributionLevel: [],
  193. levelList: [],
  194. task: [],
  195. levelInfo: {},
  196. tabs: [{
  197. name: '佣金',
  198. }, {
  199. name: '订单'
  200. }, {
  201. name: '推广人'
  202. }],
  203. listData: [],
  204. sel: 0,
  205. speedAll: 0,
  206. headerStatus: false
  207. };
  208. },
  209. computed: mapGetters(['isLogin']),
  210. watch: {
  211. isLogin: {
  212. handler: function(newV, oldV) {
  213. if (newV) {
  214. this.getUserInfo();
  215. }
  216. },
  217. deep: true
  218. }
  219. },
  220. onLoad() {
  221. if (this.isLogin) {
  222. this.agentLevelList()
  223. // this.getUserInfo()
  224. this.clickTab(0);
  225. } else {
  226. toLogin();
  227. }
  228. },
  229. onShow() {
  230. uni.removeStorageSync('form_type_cart');
  231. },
  232. methods: {
  233. agentLevelList() {
  234. agentLevelList().then(res => {
  235. const {
  236. level_info,
  237. level_list,
  238. task,
  239. user
  240. } = res.data;
  241. this.levelInfo = level_info;
  242. this.userInfo = user;
  243. this.taskInfo = task;
  244. this.levelList = level_list;
  245. this.headerStatus = level_list.length ? true : false;
  246. this.level_id = level_info.id || 0;
  247. const index = level_list.findIndex((
  248. grade, v
  249. ) =>
  250. grade.id === user.agent_level
  251. );
  252. console.log(index)
  253. if (index !== -1) {
  254. this.swiperIndex = index === -1 ? 0 : (index + 1);
  255. }
  256. this.level_id = this.levelList[index === -1 ? 0 : (index + 1)].id || 0;
  257. this.getTask()
  258. });
  259. },
  260. /**
  261. * 获取任务要求
  262. */
  263. getTask() {
  264. let that = this;
  265. that.taskNum = 0
  266. agentLevelTaskList(that.level_id).then(res => {
  267. that.task = res.data.list
  268. that.speedAll = res.data.speedAll
  269. });
  270. },
  271. onLoadFun() {
  272. this.getUserInfo();
  273. },
  274. //跳转
  275. jumbPath(type) {
  276. let path = [
  277. '/pages/users/user_cash/index',
  278. '/pages/users/promoter_rank/index',
  279. '/pages/users/commission_rank/index',
  280. '/pages/users/user_spread_code/index',
  281. '/pages/users/user_vip/index',
  282. '/pages/extension/invite_friend/index',
  283. '/pages/users/user_spread_money/index?type=1',
  284. '/pages/users/user_spread_money/index?type=4',
  285. '/pages/users/promoter-order/index',
  286. '/pages/users/promoter-list/index',
  287. '/pages/users/user_distribution_level/index',
  288. ]
  289. uni.navigateTo({
  290. url: path[type]
  291. })
  292. },
  293. // 授权关闭
  294. authColse(e) {
  295. this.isShowAuth = e
  296. },
  297. openSubscribe(page) {
  298. uni.showLoading({
  299. title: '正在加载',
  300. })
  301. openExtrctSubscribe().then(res => {
  302. uni.hideLoading();
  303. uni.navigateTo({
  304. url: page,
  305. });
  306. }).catch(() => {
  307. uni.hideLoading();
  308. });
  309. },
  310. /**
  311. * 获取个人用户信息
  312. */
  313. getUserInfo() {
  314. let that = this;
  315. getUserInfo().then(res => {
  316. that.$set(that, 'userInfo', res.data);
  317. if (!res.data.spread_status) {
  318. that.$util.Tips({
  319. title: "您目前暂无推广权限"
  320. }, {
  321. tab: 4,
  322. url: '/pages/index/index'
  323. });
  324. }
  325. });
  326. },
  327. clickTab(index) {
  328. this.sel = index
  329. let mets = [moneyList, spreadOrder, spreadPeople]
  330. let data = {
  331. keyword: "",
  332. start: 0,
  333. stop: 0,
  334. page: 1,
  335. limit: 10
  336. }
  337. if (index == 2) {
  338. data = {
  339. ...data,
  340. grade: 0,
  341. sort: '',
  342. }
  343. }
  344. mets[index](data, 3).then(res => {
  345. this.listData = res.data.list
  346. })
  347. // if (index == 0) {} else if (index == 1) {
  348. // this.getRecordOrderList()
  349. // } else {
  350. // this.userSpreadNewList()
  351. // }
  352. },
  353. }
  354. }
  355. </script>
  356. <style scoped lang="scss">
  357. .my-promotion {
  358. .header {
  359. background: #212230 url('../static/fxbg.png') no-repeat;
  360. background-size: 100% 100%;
  361. padding: 48rpx 30rpx;
  362. color: #fff;
  363. position: relative;
  364. height: 328rpx;
  365. .user-msg {
  366. display: flex;
  367. align-items: flex-start;
  368. width: 100%;
  369. .acator {
  370. width: 90rpx;
  371. height: 90rpx;
  372. margin-right: 20rpx;
  373. image {
  374. width: 100%;
  375. height: 100%;
  376. border-radius: 50%;
  377. }
  378. }
  379. .msg {
  380. display: flex;
  381. flex-direction: column;
  382. .name {
  383. font-size: 30rpx;
  384. font-weight: bold;
  385. }
  386. .process {
  387. width: 380rpx;
  388. height: 6rpx;
  389. border-radius: 6rpx;
  390. background: #4D4E59;
  391. margin: 20rpx 0;
  392. .fill {
  393. height: 100%;
  394. border-radius: 6rpx;
  395. background-color: #fff;
  396. }
  397. }
  398. .level-info {
  399. font-size: 20rpx;
  400. .mr20 {
  401. margin-right: 40rpx;
  402. }
  403. }
  404. }
  405. .invite {
  406. display: flex;
  407. align-items: center;
  408. position: absolute;
  409. right: 0rpx;
  410. background: rgba(255, 255, 255, 0.14);
  411. border-radius: 32px 0px 0px 32px;
  412. color: #FFFFFF;
  413. padding: 10rpx 16rpx 10rpx 8rpx;
  414. .poster-in {
  415. width: 20rpx;
  416. height: 20rpx;
  417. display: flex;
  418. align-items: center;
  419. margin-right: 8rpx;
  420. image {
  421. width: 100%;
  422. height: 100%;
  423. }
  424. }
  425. .text {
  426. font-size: 20rpx;
  427. }
  428. }
  429. }
  430. .tesk {
  431. position: absolute;
  432. bottom: 0;
  433. width: 690rpx;
  434. height: 128rpx;
  435. background: linear-gradient(135deg, #FEE8C7 0%, #FFBD6B 100%);
  436. border-radius: 6px 6px 0px 0px;
  437. padding: 24rpx 30rpx;
  438. display: flex;
  439. justify-content: space-between;
  440. align-items: center;
  441. .line {
  442. width: 1px;
  443. height: 74rpx;
  444. background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #9B5900 52%, rgba(255, 255, 255, 0) 100%);
  445. opacity: 0.2;
  446. margin: 0 26rpx;
  447. }
  448. .tesk-l {
  449. display: flex;
  450. align-items: center;
  451. .fx-leavel {
  452. display: flex;
  453. align-items: center;
  454. color: #9B5900;
  455. font-size: 30rpx;
  456. font-weight: bold;
  457. .point {
  458. margin-left: 20rpx;
  459. width: 0;
  460. height: 0;
  461. border-top: 8rpx solid transparent;
  462. border-left: 8rpx solid #9B5900;
  463. border-bottom: 8rpx solid transparent;
  464. }
  465. }
  466. .fx-trip {
  467. color: #9B5900;
  468. font-size: 24rpx;
  469. margin-top: 14rpx;
  470. }
  471. .upgrade {
  472. width: 68rpx;
  473. height: 68rpx;
  474. image {
  475. width: 100%;
  476. height: 100%;
  477. }
  478. }
  479. }
  480. .tesk-r {
  481. padding: 10rpx 20rpx;
  482. color: #9B5900;
  483. font-size: 24rpx;
  484. font-weight: 400;
  485. text-align: center;
  486. background: #FFFFFF;
  487. border-radius: 40rpx;
  488. }
  489. }
  490. }
  491. .price-box.header-height {
  492. position: relative;
  493. margin-top: -150rpx;
  494. }
  495. .price-box {
  496. padding: 48rpx 32rpx;
  497. background-color: #fff;
  498. margin: 24rpx 30rpx;
  499. border-radius: 12px;
  500. .box-top {
  501. display: flex;
  502. justify-content: space-between;
  503. color: #777777;
  504. font-size: 24rpx;
  505. .icon-xiangyou {
  506. font-size: 24rpx;
  507. }
  508. }
  509. .com-count {
  510. color: #EB0000;
  511. font-size: 42rpx;
  512. font-weight: bold;
  513. margin-top: 16rpx;
  514. }
  515. .box-btn {
  516. display: flex;
  517. justify-content: space-between;
  518. margin-top: 44rpx;
  519. .in {
  520. display: flex;
  521. justify-content: center;
  522. align-items: center;
  523. flex-direction: column;
  524. }
  525. .item {
  526. width: 100%;
  527. .item-cn {
  528. display: flex;
  529. justify-content: center;
  530. flex-direction: column;
  531. }
  532. .text {
  533. color: #777777;
  534. font-size: 24rpx;
  535. margin-bottom: 20rpx;
  536. }
  537. .num {
  538. color: #333333;
  539. font-size: 36rpx;
  540. font-weight: bold;
  541. }
  542. }
  543. }
  544. .btn {
  545. display: flex;
  546. color: #9B5900;
  547. background: linear-gradient(135deg, #FEE8C7 0%, #FFBD6B 100%);
  548. border-radius: 46px;
  549. align-items: center;
  550. justify-content: center;
  551. padding: 32rpx 0;
  552. margin-top: 48rpx;
  553. font-size: 30rpx;
  554. line-height: 30rpx;
  555. font-weight: bold;
  556. margin: 48rpx 10rpx 0 10rpx;
  557. }
  558. }
  559. .statistics {
  560. display: flex;
  561. flex-wrap: wrap;
  562. background-color: #fff;
  563. margin: 24rpx 30rpx;
  564. border-radius: 12px;
  565. padding: 40rpx 46rpx 40rpx 0;
  566. .mb {
  567. margin-bottom: 64rpx;
  568. }
  569. .item {
  570. width: 50%;
  571. display: flex;
  572. align-items: center;
  573. padding-left: 50rpx;
  574. .img {
  575. width: 46rpx;
  576. height: 46rpx;
  577. margin-right: 22rpx;
  578. .iconfont {
  579. font-size: 40rpx !important;
  580. font-weight: bold;
  581. }
  582. }
  583. .item-r {
  584. .text {
  585. font-size: 26rpx;
  586. color: #333333;
  587. margin-bottom: 12rpx;
  588. }
  589. .trip {
  590. color: #999999;
  591. font-size: 22rpx;
  592. }
  593. }
  594. }
  595. }
  596. // ---------------------------------------
  597. .data {
  598. margin: 28rpx 30rpx;
  599. background-color: #fff;
  600. width: 690rpx;
  601. border-radius: 12rpx;
  602. .data-num {
  603. height: 168rpx;
  604. background: url('../static/data-num.png') no-repeat;
  605. background-size: 100% 100%;
  606. display: flex;
  607. align-items: center;
  608. justify-content: space-around;
  609. color: #fff;
  610. font-size: 24rpx;
  611. .num {}
  612. .num-color {
  613. margin-top: 20rpx;
  614. font-weight: bold;
  615. font-size: 36rpx;
  616. }
  617. }
  618. .data-money {
  619. display: flex;
  620. justify-content: space-between;
  621. color: #333;
  622. padding: 16rpx 30rpx;
  623. font-size: 24rpx;
  624. .money {
  625. display: flex;
  626. align-items: center;
  627. color: #333333;
  628. }
  629. .money-num {
  630. color: #E93323;
  631. font-size: 28rpx;
  632. font-weight: bold;
  633. padding-left: 20rpx;
  634. }
  635. .btn {
  636. width: 160rpx;
  637. background: linear-gradient(135deg, #FEA21F 0%, #FE7A18 100%);
  638. border-radius: 38rpx;
  639. color: #fff;
  640. text-align: center;
  641. padding: 16rpx 0;
  642. font-size: 26rpx;
  643. }
  644. }
  645. }
  646. .invites {
  647. width: 690rpx;
  648. margin: 28rpx 30rpx;
  649. background-color: #fff;
  650. border-radius: 12rpx;
  651. font-size: 26rpx;
  652. color: #333;
  653. padding: 40rpx 46rpx;
  654. .invite-list {
  655. display: flex;
  656. .item {
  657. margin-right: 48rpx;
  658. display: flex;
  659. flex-direction: column;
  660. align-items: center;
  661. .img {
  662. width: 60rpx;
  663. height: 60rpx;
  664. margin-bottom: 24rpx;
  665. image {
  666. width: 100%;
  667. height: 100%;
  668. border-radius: 50%;
  669. }
  670. }
  671. }
  672. }
  673. }
  674. .list {
  675. width: 690rpx;
  676. margin: 28rpx 30rpx;
  677. background-color: #fff;
  678. border-radius: 12rpx;
  679. font-size: 28rpx;
  680. .tab-list {
  681. display: flex;
  682. justify-content: space-between;
  683. padding: 32rpx 30rpx 0 30rpx;
  684. color: #999999;
  685. .tab {
  686. display: flex;
  687. .item {
  688. margin-right: 48rpx;
  689. transition: all 0.3s;
  690. .item-text {}
  691. .line {
  692. width: 54rpx;
  693. height: 4rpx;
  694. margin: 12rpx auto 0 auto;
  695. border-radius: 4px;
  696. }
  697. .line.on {
  698. background-color: #E93323;
  699. }
  700. }
  701. .item .on {
  702. font-size: 32rpx;
  703. font-weight: bold;
  704. color: #E93323;
  705. }
  706. }
  707. }
  708. .more {
  709. display: flex;
  710. align-items: center;
  711. font-size: 26rpx;
  712. .icon-xiangyou {
  713. font-size: 24rpx;
  714. }
  715. }
  716. }
  717. }
  718. </style>