index.vue 16 KB

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