index.vue 16 KB

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