index.vue 16 KB

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