invite.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. <template>
  2. <view class="invite">
  3. <view class="invite_head flex">
  4. <image src="../static/fanhui@2x.png" mode="" @click="retutnTop"></image>
  5. <text class="title">推广中心</text>
  6. <text class="righticon"></text>
  7. </view>
  8. <v-tabs
  9. v-model="current"
  10. :tabs="tabs"
  11. @change="changeTab"
  12. :fixed="false"
  13. :scroll="false"
  14. activeColor="#171A20"
  15. lineColor="#171A20"
  16. bgColor="transparent"
  17. fontSize="30rpx"
  18. lineHeight="6rpx"
  19. lineRadius="6rpx"
  20. :lineScale="0.15"
  21. ></v-tabs>
  22. <swiper class="swiper" circular :current="current" @change="swiperChange">
  23. <swiper-item>
  24. <view class="coin-swiper">
  25. <view class="total-coin-view flex" style="justify-content: flex-start;align-items: flex-end;">
  26. <view class="">
  27. <text class="txt">总收益</text>
  28. <view class="coin-unit">
  29. <text class="coin">{{ totalIn || 0 }}</text>
  30. <text class="unit">&nbsp;元</text>
  31. </view>
  32. </view>
  33. <view class="">
  34. <text class="txt">佣金</text>
  35. <view class="coin-unit">
  36. <text class="coin">{{ info.settled_item || 0 }}</text>
  37. <text class="unit">&nbsp;元</text>
  38. </view>
  39. </view>
  40. <view class="">
  41. <text class="txt">已提现</text>
  42. <view class="coin-unit">
  43. <text class="coin">{{ withd || 0 }}</text>
  44. <text class="unit">&nbsp;元</text>
  45. </view>
  46. </view>
  47. <view class="tixian-btn" @click="toDeposit">提现</view>
  48. </view>
  49. <view class="nodata" v-if="retailList.length == 0 && retailStatus == 'noMore'">暂无数据</view>
  50. <scroll-view class="coin-list-view" scroll-y="true" @scrolltolower="lower('retail')">
  51. <view class="coin-item flex" v-for="(item, index) in retailList" :key="index">
  52. <view class="left flex">
  53. <view class="avatar-view"><image :src="item.avatar || $imgDomain + '/default.png'" mode="aspectFit"></image></view>
  54. <view class="name-time">
  55. <view class="username">{{ item.nickname || '昵称' }}</view>
  56. <view class="time">{{ item.create_time || '时间' }}</view>
  57. </view>
  58. </view>
  59. <view class="right">
  60. <view class="in-coin">+{{ item.coin || '佣金' }}元</view>
  61. <view class="level">{{ item.level }}级</view>
  62. </view>
  63. </view>
  64. </scroll-view>
  65. </view>
  66. </swiper-item>
  67. <swiper-item>
  68. <view class="tixian-swiper">
  69. <view class="nodata" v-if="tixianList.length == 0 && tixianStatus == 'noMore'">暂无数据</view>
  70. <scroll-view class="tixian-list-view" scroll-y="true" @scrolltolower="lower('tixian')">
  71. <template v-for="(item, index) in tixianList">
  72. <view class="tixian-item">
  73. <view class="tixian-title flex">
  74. <view class="title-text">{{ item.create_time }}</view>
  75. <view>
  76. <uni-tag v-if="item.status == 'review'" text="审核中" type="primary"></uni-tag>
  77. <uni-tag v-else-if="item.status == 'success'" text="已通过" type="success"></uni-tag>
  78. <uni-tag v-else-if="item.status == 'reject'" text="已驳回" type="error"></uni-tag>
  79. </view>
  80. </view>
  81. <view class="tixian-info">
  82. <view>提现金额:¥{{ item.amount }}</view>
  83. <view>提现类型:{{ item.type == 'alipay' ? '支付宝' : '微信' }}</view>
  84. <view>账户名:{{ item.username }}</view>
  85. <view>账户:{{ item.account }}</view>
  86. <view v-if="item.status == 'reject'" class="reason">驳回原因:{{ item.reason }}</view>
  87. </view>
  88. </view>
  89. </template>
  90. <view class="lower-tip">
  91. <template v-if="tixianStatus == 'more'">
  92. 下拉加载
  93. </template>
  94. <template v-else-if="tixianStatus == 'loading'">
  95. 加载中...
  96. </template>
  97. <template v-if="tixianStatus == 'noMore'">
  98. 无更多数据
  99. </template>
  100. </view>
  101. </scroll-view>
  102. </view>
  103. </swiper-item>
  104. <swiper-item>
  105. <view class="team-swiper">
  106. <view class="nodata" v-if="teamList.length == 0 && teamStatus == 'noMore'">暂无数据</view>
  107. <view class="team-wrapper" v-if="teamList.length > 0">
  108. <view class="top-view flex">
  109. <text>时间</text>
  110. <text>用户</text>
  111. <text>渠道</text>
  112. </view>
  113. <scroll-view class="team-list-view" scroll-y="true" @scrolltolower="lower('team')">
  114. <view class="team-item flex" v-for="(item, index) in teamList" :key="index">
  115. <text class="time-view">{{ item.create_time || '时间' }}</text>
  116. <text class="name-view">{{ desensitization(item.username) || '昵称' }}</text>
  117. <text>{{ item.level || '渠道' }}</text>
  118. </view>
  119. </scroll-view>
  120. </view>
  121. </view>
  122. </swiper-item>
  123. <swiper-item>
  124. <view class="qrcode-swiper">
  125. <view class="qrcode-wrap">
  126. <!-- <view class="qrcode-view">
  127. <view class="qrcode-box">
  128. <view class="qrcode-img-box">
  129. <image :src="info.qr_code" mode="aspectFill"></image>
  130. </view>
  131. </view>
  132. </view> -->
  133. <canvas class="qrcode-view" canvas-id="firstCanvas" id="firstCanvas" v-if="!canvasImage"></canvas>
  134. <view class="qrcode-view" v-if="canvasImage">
  135. <!-- <image :src="canvasImage" mode="aspectFit"></image> -->
  136. <img class="img1" :src="canvasImage" />
  137. </view>
  138. <!-- #ifndef H5 -->
  139. <view class="btn-view"></view>
  140. <!-- #endif -->
  141. <!-- #ifdef H5 -->
  142. <view class="tip">长按图片保存</view>
  143. <!-- #endif -->
  144. </view>
  145. </view>
  146. </swiper-item>
  147. </swiper>
  148. </view>
  149. </template>
  150. <script>
  151. export default {
  152. data() {
  153. return {
  154. info: {},
  155. current: 0,
  156. tabs: ['佣金', '提现', '团队', '推广'],
  157. totalIn: 0,
  158. withd: 0, //已提现
  159. retailList: [],
  160. retailPage: 1,
  161. retailPageSize: 10,
  162. retailStatus: 'more',
  163. teamList: [],
  164. teamPage: 1,
  165. teamPageSize: 10,
  166. teamStatus: 'more',
  167. tixianList: [],
  168. tixianPage: 1,
  169. tixianPageSize: 10,
  170. tixianStatus: 'more',
  171. canvasImage: ''
  172. };
  173. },
  174. onLoad() {
  175. this.$api.getTotalCoin().then(data => {
  176. this.totalIn = data.data.total;
  177. this.withd = data.data.dw;
  178. });
  179. this.loadRetailList();
  180. this.loadTeamList();
  181. this.loadTixianList();
  182. this.getInfo();
  183. },
  184. methods: {
  185. toDeposit() {
  186. uni.navigateTo({ url: '/pages/me/deposit' });
  187. },
  188. changeTab(index) {
  189. console.log('当前选中的项:' + index);
  190. },
  191. swiperChange({ detail }) {
  192. this.current = detail.current;
  193. },
  194. //返回上一级
  195. retutnTop() {
  196. uni.navigateBack();
  197. },
  198. loadRetailList() {
  199. if (this.retailStatus == 'loading' || this.retailStatus == 'noMore') {
  200. return;
  201. }
  202. this.retailStatus = 'loading';
  203. let query = {
  204. page: this.retailPage,
  205. limit: this.retailPageSize
  206. };
  207. this.$api.getRetailList(query).then(data => {
  208. const list = data.data;
  209. this.retailList = [...this.retailList, ...list];
  210. if (list.length < this.retailPageSize) {
  211. this.retailStatus = 'noMore';
  212. } else {
  213. this.retailStatus = 'more';
  214. }
  215. });
  216. },
  217. loadTeamList() {
  218. if (this.teamStatus == 'loading' || this.teamStatus == 'noMore') {
  219. return;
  220. }
  221. this.teamStatus = 'loading';
  222. let query = {
  223. page: this.teamPage,
  224. limit: this.teamPageSize
  225. };
  226. this.$api.getTeamList(query).then(data => {
  227. const list = data.data;
  228. this.teamList = [...this.teamList, ...list];
  229. if (list.length < this.teamPageSize) {
  230. this.teamStatus = 'noMore';
  231. } else {
  232. this.teamStatus = 'more';
  233. }
  234. });
  235. },
  236. loadTixianList() {
  237. if (this.tixianStatus == 'loading' || this.tixianStatus == 'noMore') {
  238. return;
  239. }
  240. this.tixianStatus = 'loading';
  241. let query = {
  242. page: this.tixianPage,
  243. limit: this.tixianPageSize
  244. };
  245. this.$api.getTixianList(query).then(data => {
  246. const list = data.data;
  247. this.tixianList = [...this.tixianList, ...list];
  248. if (list.length < this.tixianPageSize) {
  249. this.tixianStatus = 'noMore';
  250. } else {
  251. this.tixianStatus = 'more';
  252. }
  253. });
  254. },
  255. lower(type = 'team') {
  256. switch (type) {
  257. case 'team':
  258. if (this.teamStatus == 'more') {
  259. this.teamPage++;
  260. this.loadTeamList();
  261. }
  262. break;
  263. case 'tixian':
  264. if (this.tixianStatus == 'more') {
  265. this.tixianPage++;
  266. this.loadTixianList();
  267. }
  268. break;
  269. case 'retail':
  270. if (this.retailStatus == 'more') {
  271. this.retailPage++;
  272. this.loadRetailList();
  273. }
  274. break;
  275. }
  276. },
  277. getInfo() {
  278. this.$api.userinfo().then(res => {
  279. if (res.code === 1) {
  280. this.info = res.data;
  281. this.makeCanvas();
  282. }
  283. });
  284. },
  285. //手机号脱敏
  286. desensitization(phone) {
  287. if (!phone) return '';
  288. return phone.substr(0, 3) + '****' + phone.substr(7);
  289. },
  290. makeCanvas() {
  291. var _this = this;
  292. var ctx = uni.createCanvasContext('firstCanvas');
  293. const res = uni.getSystemInfoSync();
  294. var canvasW = (560 * res.screenWidth) / 750,
  295. canvasH = (1000 * res.screenWidth) / 750;
  296. uni.getImageInfo({
  297. src: '../static/bj.jpg',
  298. success: function(bg) {
  299. ctx.drawImage(bg.path, 0, 0, canvasW, canvasH);
  300. uni.getImageInfo({
  301. src: '../static/bj.jpg',
  302. success: function(bg2) {
  303. let w = canvasW;
  304. let h = (bg2.height / bg2.width) * w;
  305. let x = 0;
  306. let y = (canvasH - h) / 2;
  307. ctx.drawImage(bg2.path, x, y, w, h);
  308. uni.getImageInfo({
  309. src: _this.info.qr_code,
  310. success: function(qrcode) {
  311. let w = (200 * res.screenWidth) / 750;
  312. let x = (canvasW - w) / 2;
  313. let y = (790 * res.screenWidth) / 750;
  314. ctx.drawImage(qrcode.path, x, y, w, w);
  315. ctx.draw(
  316. false,
  317. setTimeout(() => {
  318. uni.canvasToTempFilePath(
  319. {
  320. x: 0,
  321. y: 0,
  322. width: canvasW,
  323. height: canvasH,
  324. canvasId: 'firstCanvas',
  325. success: function(res) {
  326. // 在H5平台下,tempFilePath 为 base64
  327. // alert('成功')
  328. _this.canvasImage = res.tempFilePath;
  329. // console.log(_this.canvasImage)
  330. }
  331. },
  332. _this
  333. );
  334. }, 1000)
  335. );
  336. }
  337. });
  338. }
  339. });
  340. }
  341. });
  342. }
  343. }
  344. };
  345. </script>
  346. <style lang="scss" scoped>
  347. .lower-tip {
  348. text-align: center;
  349. color: #a3a3a3;
  350. }
  351. .tixian-list-view {
  352. max-height: calc(100vh - 70rpx - 44px - 24rpx);
  353. .tixian-item {
  354. display: flex;
  355. flex-direction: column;
  356. margin: 20rpx;
  357. padding: 0 20rpx;
  358. background-color: #fff;
  359. border-radius: 5px;
  360. .tixian-title {
  361. border-bottom: solid 1px #e3e3e3;
  362. padding: 20rpx 0;
  363. .title-text {
  364. font-size: 14px;
  365. }
  366. }
  367. .tixian-info {
  368. display: flex;
  369. flex-wrap: wrap;
  370. margin: 5rpx 0 20rpx 0px;
  371. view {
  372. width: 50%;
  373. margin-top: 10rpx;
  374. }
  375. .reason {
  376. width: 100%;
  377. color: #e43d33;
  378. font-weight: bold;
  379. }
  380. }
  381. }
  382. }
  383. page {
  384. background-color: #f5f6fa;
  385. }
  386. $swiperH: calc(100vh - 70rpx - 44px);
  387. .invite {
  388. background-image: url(https://www.chaomangdao.com/image/topbg@2x.png);
  389. background-repeat: no-repeat;
  390. background-position: top;
  391. background-size: 100% calc(44px + 70rpx);
  392. padding-top: 95rpx;
  393. .invite_head {
  394. width: 100%;
  395. height: 44px;
  396. padding: 0 20rpx;
  397. image {
  398. width: 44rpx;
  399. height: 44rpx;
  400. }
  401. .title {
  402. font-size: 34rpx;
  403. font-family: PingFangSC-Semibold, PingFang SC;
  404. font-weight: 600;
  405. color: #333333;
  406. line-height: 36rpx;
  407. }
  408. .righticon {
  409. width: 44rpx;
  410. height: 44rpx;
  411. }
  412. }
  413. .swiper {
  414. height: $swiperH;
  415. }
  416. .coin-swiper {
  417. .total-coin-view {
  418. position: relative;
  419. width: 690rpx;
  420. height: 200rpx;
  421. background-image: url(https://www.chaomangdao.com/image/bg@2x.png);
  422. background-repeat: no-repeat;
  423. background-size: 100%;
  424. background-position: center;
  425. margin: 24rpx auto 0;
  426. padding: 48rpx 40rpx;
  427. > view {
  428. flex: 1;
  429. text-align: center;
  430. }
  431. .txt {
  432. font-size: 28rpx;
  433. font-family: PingFangSC-Regular, PingFang SC;
  434. font-weight: 400;
  435. color: #ffffff;
  436. }
  437. .coin-unit {
  438. justify-content: flex-start;
  439. .coin {
  440. font-size: 40rpx;
  441. font-family: PingFangSC-Medium, PingFang SC;
  442. font-weight: 500;
  443. color: #ffffff;
  444. }
  445. .unit {
  446. font-size: 28rpx;
  447. font-family: PingFangSC-Regular, PingFang SC;
  448. font-weight: 400;
  449. color: #ffffff;
  450. }
  451. }
  452. .tixian-btn {
  453. position: absolute;
  454. top: 0;
  455. right: 0;
  456. border-bottom-left-radius: 20rpx;
  457. height: 50rpx;
  458. line-height: 50rpx;
  459. text-align: center;
  460. color: #ffffff;
  461. font-size: 30rpx;
  462. background: #ff4891;
  463. padding: 0 40rpx;
  464. }
  465. }
  466. .coin-list-view {
  467. max-height: calc(100vh - 70rpx - 44px - 24rpx - 200rpx);
  468. .coin-item {
  469. width: 690rpx;
  470. background-color: #fff;
  471. margin: 20rpx auto;
  472. border-radius: 16rpx;
  473. padding: 30rpx;
  474. .left {
  475. .avatar-view {
  476. width: 80rpx;
  477. height: 80rpx;
  478. border-radius: 50%;
  479. overflow: hidden;
  480. margin-right: 20rpx;
  481. border: 1px solid #eee;
  482. }
  483. .name-time {
  484. .username {
  485. font-size: 28rpx;
  486. font-family: PingFangSC-Medium, PingFang SC;
  487. font-weight: 500;
  488. color: #333333;
  489. line-height: 40rpx;
  490. }
  491. .time {
  492. font-size: 24rpx;
  493. font-family: PingFangSC-Regular, PingFang SC;
  494. font-weight: 400;
  495. color: #7a808d;
  496. line-height: 34rpx;
  497. }
  498. }
  499. }
  500. .right {
  501. text-align: right;
  502. .in-coin {
  503. font-size: 32rpx;
  504. font-family: PingFangSC-Medium, PingFang SC;
  505. font-weight: 500;
  506. color: #fa6400;
  507. line-height: 44rpx;
  508. }
  509. .level {
  510. font-size: 24rpx;
  511. font-family: PingFangSC-Regular, PingFang SC;
  512. font-weight: 400;
  513. color: #333333;
  514. line-height: 34rpx;
  515. }
  516. }
  517. }
  518. }
  519. }
  520. .team-swiper {
  521. .team-wrapper {
  522. overflow: hidden;
  523. .top-view {
  524. background: #fff;
  525. border-radius: 24rpx 24rpx 0 0;
  526. width: 690rpx;
  527. margin: 24rpx auto 0;
  528. font-size: 28rpx;
  529. font-family: PingFangSC-Medium, PingFang SC;
  530. font-weight: 500;
  531. color: #2e333f;
  532. padding: 32rpx 30rpx 14rpx;
  533. height: 86rpx;
  534. }
  535. .team-list-view {
  536. max-height: calc(100vh - 70rpx - 44px - 24rpx - 86rpx);
  537. // padding-bottom: 24rpx;
  538. .team-item {
  539. width: 690rpx;
  540. margin: 0 auto;
  541. height: 88rpx;
  542. padding: 0 30rpx;
  543. background-color: #f9f5ff;
  544. font-size: 26rpx;
  545. font-family: PingFangSC-Regular, PingFang SC;
  546. font-weight: 400;
  547. color: #171a20;
  548. line-height: 36rpx;
  549. justify-content: flex-start;
  550. &:nth-child(2n-1) {
  551. background-color: #f6f8ff;
  552. }
  553. &:last-child {
  554. border-radius: 0 0 24rpx 24rpx;
  555. margin-bottom: 24rpx;
  556. }
  557. .time-view {
  558. width: 288rpx;
  559. }
  560. .name-view {
  561. width: 300rpx;
  562. }
  563. }
  564. }
  565. }
  566. }
  567. .qrcode-swiper {
  568. position: relative;
  569. &::before {
  570. // content: '';
  571. width: 54rpx;
  572. height: calc(1000rpx - 100rpx);
  573. background: #cdc7c7;
  574. border-radius: 0 24rpx 24rpx 0;
  575. position: absolute;
  576. left: 0;
  577. top: 50rpx;
  578. }
  579. &::after {
  580. // content: '';
  581. width: 54rpx;
  582. height: calc(1000rpx - 100rpx);
  583. background: #cdc7c7;
  584. border-radius: 24rpx 0 0 24rpx;
  585. position: absolute;
  586. right: 0;
  587. top: 50rpx;
  588. }
  589. .qrcode-wrap {
  590. overflow-y: auto;
  591. height: $swiperH;
  592. }
  593. .qrcode-view {
  594. .img1 {
  595. width: 100%;
  596. height: 100%;
  597. }
  598. width: 560rpx;
  599. height: 1000rpx;
  600. margin: 26rpx auto 0;
  601. background: #ff7674;
  602. border-radius: 24rpx;
  603. background-image: url(https://www.chaomangdao.com/image/abj.jpg);
  604. background-repeat: no-repeat;
  605. background-size: 100% auto;
  606. background-position: center;
  607. position: relative;
  608. display: flex;
  609. overflow: hidden;
  610. .qrcode-box {
  611. width: 100%;
  612. background-image: url(https://www.chaomangdao.com/image/renwu@2x.png);
  613. background-repeat: no-repeat;
  614. background-size: 100% auto;
  615. background-position: center;
  616. }
  617. .qrcode-img-box {
  618. width: 200rpx;
  619. height: 200rpx;
  620. position: absolute;
  621. top: 370rpx;
  622. left: 50%;
  623. transform: translateX(-50%);
  624. }
  625. }
  626. .btn-view {
  627. width: 308rpx;
  628. height: 84rpx;
  629. background-image: url(https://www.chaomangdao.com/image/button@2x.png);
  630. margin: 50rpx auto;
  631. background-size: 100%;
  632. background-position: center;
  633. }
  634. .tip {
  635. margin: 50rpx auto;
  636. text-align: center;
  637. font-size: 33rpx;
  638. }
  639. }
  640. .nodata {
  641. text-align: center;
  642. padding: 40% 0;
  643. font-size: 30rpx;
  644. }
  645. }
  646. </style>