invite.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  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 v-if="canTi == 1">
  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. canTi: '',
  157. tabs: ['佣金', '提现', '团队', '推广'],
  158. totalIn: 0,
  159. withd: 0, //已提现
  160. retailList: [],
  161. retailPage: 1,
  162. retailPageSize: 10,
  163. retailStatus: 'more',
  164. teamList: [],
  165. teamPage: 1,
  166. teamPageSize: 10,
  167. teamStatus: 'more',
  168. tixianList: [],
  169. tixianPage: 1,
  170. tixianPageSize: 10,
  171. tixianStatus: 'more',
  172. canvasImage: ''
  173. };
  174. },
  175. onLoad() {
  176. this.$api.getTotalCoin().then(data => {
  177. this.totalIn = data.data.total;
  178. this.withd = data.data.dw;
  179. });
  180. this.isti();
  181. this.loadRetailList();
  182. this.loadTeamList();
  183. this.loadTixianList();
  184. this.getInfo();
  185. },
  186. methods: {
  187. isti() {
  188. this.$api.checkSwitch().then(({ data }) => {
  189. this.canTi = data;
  190. if (data == 0) {
  191. this.tabs = ['提现', '团队', '推广'];
  192. }
  193. });
  194. },
  195. toDeposit() {
  196. uni.navigateTo({ url: '/pages/me/deposit' });
  197. },
  198. changeTab(index) {
  199. console.log('当前选中的项:' + index);
  200. },
  201. swiperChange({ detail }) {
  202. this.current = detail.current;
  203. },
  204. //返回上一级
  205. retutnTop() {
  206. uni.navigateBack();
  207. },
  208. loadRetailList() {
  209. if (this.retailStatus == 'loading' || this.retailStatus == 'noMore') {
  210. return;
  211. }
  212. this.retailStatus = 'loading';
  213. let query = {
  214. page: this.retailPage,
  215. limit: this.retailPageSize
  216. };
  217. this.$api.getRetailList(query).then(data => {
  218. const list = data.data;
  219. this.retailList = [...this.retailList, ...list];
  220. if (list.length < this.retailPageSize) {
  221. this.retailStatus = 'noMore';
  222. } else {
  223. this.retailStatus = 'more';
  224. }
  225. });
  226. },
  227. loadTeamList() {
  228. if (this.teamStatus == 'loading' || this.teamStatus == 'noMore') {
  229. return;
  230. }
  231. this.teamStatus = 'loading';
  232. let query = {
  233. page: this.teamPage,
  234. limit: this.teamPageSize
  235. };
  236. this.$api.getTeamList(query).then(data => {
  237. const list = data.data;
  238. this.teamList = [...this.teamList, ...list];
  239. if (list.length < this.teamPageSize) {
  240. this.teamStatus = 'noMore';
  241. } else {
  242. this.teamStatus = 'more';
  243. }
  244. });
  245. },
  246. loadTixianList() {
  247. if (this.tixianStatus == 'loading' || this.tixianStatus == 'noMore') {
  248. return;
  249. }
  250. this.tixianStatus = 'loading';
  251. let query = {
  252. page: this.tixianPage,
  253. limit: this.tixianPageSize
  254. };
  255. this.$api.getTixianList(query).then(data => {
  256. const list = data.data;
  257. this.tixianList = [...this.tixianList, ...list];
  258. if (list.length < this.tixianPageSize) {
  259. this.tixianStatus = 'noMore';
  260. } else {
  261. this.tixianStatus = 'more';
  262. }
  263. });
  264. },
  265. lower(type = 'team') {
  266. switch (type) {
  267. case 'team':
  268. if (this.teamStatus == 'more') {
  269. this.teamPage++;
  270. this.loadTeamList();
  271. }
  272. break;
  273. case 'tixian':
  274. if (this.tixianStatus == 'more') {
  275. this.tixianPage++;
  276. this.loadTixianList();
  277. }
  278. break;
  279. case 'retail':
  280. if (this.retailStatus == 'more') {
  281. this.retailPage++;
  282. this.loadRetailList();
  283. }
  284. break;
  285. }
  286. },
  287. getInfo() {
  288. this.$api.userinfo().then(res => {
  289. if (res.code === 1) {
  290. this.info = res.data;
  291. this.makeCanvas();
  292. }
  293. });
  294. },
  295. //手机号脱敏
  296. desensitization(phone) {
  297. if (!phone) return '';
  298. return phone.substr(0, 3) + '****' + phone.substr(7);
  299. },
  300. makeCanvas() {
  301. var _this = this;
  302. var ctx = uni.createCanvasContext('firstCanvas');
  303. const res = uni.getSystemInfoSync();
  304. var canvasW = (560 * res.screenWidth) / 750,
  305. canvasH = (1000 * res.screenWidth) / 750;
  306. uni.getImageInfo({
  307. src: '../static/bg.png',
  308. success: function(bg) {
  309. ctx.drawImage(bg.path, 0, 0, canvasW, canvasH);
  310. uni.getImageInfo({
  311. src: '../static/bg.png',
  312. success: function(bg2) {
  313. let w = canvasW;
  314. let h = (bg2.height / bg2.width) * w;
  315. let x = 0;
  316. let y = (canvasH - h) / 2;
  317. ctx.drawImage(bg2.path, x, y, w, h);
  318. // #ifdef H5
  319. let erwema = _this.info.qr_code;
  320. // #endif
  321. // #ifndef H5
  322. let erwema = _this.info.qr_code;
  323. // #endif
  324. uni.getImageInfo({
  325. src: erwema,
  326. success: function(qrcode) {
  327. console.log(qrcode, 'erweima');
  328. let w = (100 * res.screenWidth) / 750;
  329. let x = (24 * res.screenWidth) / 750;
  330. // let x = (canvasW - w) / 2;
  331. let y = (670 * res.screenWidth) / 750;
  332. ctx.drawImage(qrcode.path, x, y, w, w);
  333. ctx.draw(
  334. false,
  335. setTimeout(() => {
  336. uni.canvasToTempFilePath(
  337. {
  338. x: 0,
  339. y: 0,
  340. width: canvasW,
  341. height: canvasH,
  342. canvasId: 'firstCanvas',
  343. success: function(res) {
  344. console.log(res, '123456');
  345. // 在H5平台下,tempFilePath 为 base64
  346. // alert('成功')
  347. _this.canvasImage = res.tempFilePath;
  348. },
  349. fail(err) {
  350. console.log(err, 'err');
  351. }
  352. },
  353. _this
  354. );
  355. }, 1000)
  356. );
  357. },
  358. fail(err) {
  359. console.log(err, 'erwemasb');
  360. }
  361. });
  362. },
  363. fail(err) {
  364. console.log(err, '987654');
  365. }
  366. });
  367. },
  368. fail(err) {
  369. console.log(err, '789456135');
  370. }
  371. });
  372. }
  373. }
  374. };
  375. </script>
  376. <style lang="scss" scoped>
  377. .lower-tip {
  378. text-align: center;
  379. color: #a3a3a3;
  380. }
  381. .tixian-list-view {
  382. max-height: calc(100vh - 70rpx - 44px - 24rpx);
  383. .tixian-item {
  384. display: flex;
  385. flex-direction: column;
  386. margin: 20rpx;
  387. padding: 0 20rpx;
  388. background-color: #fff;
  389. border-radius: 5px;
  390. .tixian-title {
  391. border-bottom: solid 1px #e3e3e3;
  392. padding: 20rpx 0;
  393. .title-text {
  394. font-size: 14px;
  395. }
  396. }
  397. .tixian-info {
  398. display: flex;
  399. flex-wrap: wrap;
  400. margin: 5rpx 0 20rpx 0px;
  401. view {
  402. width: 50%;
  403. margin-top: 10rpx;
  404. }
  405. .reason {
  406. width: 100%;
  407. color: #e43d33;
  408. font-weight: bold;
  409. }
  410. }
  411. }
  412. }
  413. page {
  414. background-color: #f5f6fa;
  415. }
  416. $swiperH: calc(100vh - 70rpx - 44px);
  417. .invite {
  418. background-image: url(https://www.chaomangdao.com/image/topbg@2x.png);
  419. background-repeat: no-repeat;
  420. background-position: top;
  421. background-size: 100% calc(44px + 70rpx);
  422. padding-top: 95rpx;
  423. .invite_head {
  424. width: 100%;
  425. height: 44px;
  426. padding: 0 20rpx;
  427. image {
  428. width: 44rpx;
  429. height: 44rpx;
  430. }
  431. .title {
  432. font-size: 34rpx;
  433. font-family: PingFangSC-Semibold, PingFang SC;
  434. font-weight: 600;
  435. color: #333333;
  436. line-height: 36rpx;
  437. }
  438. .righticon {
  439. width: 44rpx;
  440. height: 44rpx;
  441. }
  442. }
  443. .swiper {
  444. height: $swiperH;
  445. }
  446. .coin-swiper {
  447. .total-coin-view {
  448. position: relative;
  449. width: 690rpx;
  450. height: 200rpx;
  451. background-image: url(https://www.chaomangdao.com/image/bg@2x.png);
  452. background-repeat: no-repeat;
  453. background-size: 100%;
  454. background-position: center;
  455. margin: 24rpx auto 0;
  456. padding: 48rpx 40rpx;
  457. > view {
  458. flex: 1;
  459. text-align: center;
  460. }
  461. .txt {
  462. font-size: 28rpx;
  463. font-family: PingFangSC-Regular, PingFang SC;
  464. font-weight: 400;
  465. color: #ffffff;
  466. }
  467. .coin-unit {
  468. justify-content: flex-start;
  469. .coin {
  470. font-size: 40rpx;
  471. font-family: PingFangSC-Medium, PingFang SC;
  472. font-weight: 500;
  473. color: #ffffff;
  474. }
  475. .unit {
  476. font-size: 28rpx;
  477. font-family: PingFangSC-Regular, PingFang SC;
  478. font-weight: 400;
  479. color: #ffffff;
  480. }
  481. }
  482. .tixian-btn {
  483. position: absolute;
  484. top: 0;
  485. right: 0;
  486. border-bottom-left-radius: 20rpx;
  487. height: 50rpx;
  488. line-height: 50rpx;
  489. text-align: center;
  490. color: #ffffff;
  491. font-size: 30rpx;
  492. background: #ff4891;
  493. padding: 0 40rpx;
  494. }
  495. }
  496. .coin-list-view {
  497. max-height: calc(100vh - 70rpx - 44px - 24rpx - 200rpx);
  498. .coin-item {
  499. width: 690rpx;
  500. background-color: #fff;
  501. margin: 20rpx auto;
  502. border-radius: 16rpx;
  503. padding: 30rpx;
  504. .left {
  505. .avatar-view {
  506. width: 80rpx;
  507. height: 80rpx;
  508. border-radius: 50%;
  509. overflow: hidden;
  510. margin-right: 20rpx;
  511. border: 1px solid #eee;
  512. }
  513. .name-time {
  514. .username {
  515. font-size: 28rpx;
  516. font-family: PingFangSC-Medium, PingFang SC;
  517. font-weight: 500;
  518. color: #333333;
  519. line-height: 40rpx;
  520. }
  521. .time {
  522. font-size: 24rpx;
  523. font-family: PingFangSC-Regular, PingFang SC;
  524. font-weight: 400;
  525. color: #7a808d;
  526. line-height: 34rpx;
  527. }
  528. }
  529. }
  530. .right {
  531. text-align: right;
  532. .in-coin {
  533. font-size: 32rpx;
  534. font-family: PingFangSC-Medium, PingFang SC;
  535. font-weight: 500;
  536. color: #fa6400;
  537. line-height: 44rpx;
  538. }
  539. .level {
  540. font-size: 24rpx;
  541. font-family: PingFangSC-Regular, PingFang SC;
  542. font-weight: 400;
  543. color: #333333;
  544. line-height: 34rpx;
  545. }
  546. }
  547. }
  548. }
  549. }
  550. .team-swiper {
  551. .team-wrapper {
  552. overflow: hidden;
  553. .top-view {
  554. background: #fff;
  555. border-radius: 24rpx 24rpx 0 0;
  556. width: 690rpx;
  557. margin: 24rpx auto 0;
  558. font-size: 28rpx;
  559. font-family: PingFangSC-Medium, PingFang SC;
  560. font-weight: 500;
  561. color: #2e333f;
  562. padding: 32rpx 30rpx 14rpx;
  563. height: 86rpx;
  564. }
  565. .team-list-view {
  566. max-height: calc(100vh - 70rpx - 44px - 24rpx - 86rpx);
  567. // padding-bottom: 24rpx;
  568. .team-item {
  569. width: 690rpx;
  570. margin: 0 auto;
  571. height: 88rpx;
  572. padding: 0 30rpx;
  573. background-color: #f9f5ff;
  574. font-size: 26rpx;
  575. font-family: PingFangSC-Regular, PingFang SC;
  576. font-weight: 400;
  577. color: #171a20;
  578. line-height: 36rpx;
  579. justify-content: flex-start;
  580. &:nth-child(2n-1) {
  581. background-color: #f6f8ff;
  582. }
  583. &:last-child {
  584. border-radius: 0 0 24rpx 24rpx;
  585. margin-bottom: 24rpx;
  586. }
  587. .time-view {
  588. width: 288rpx;
  589. }
  590. .name-view {
  591. width: 300rpx;
  592. }
  593. }
  594. }
  595. }
  596. }
  597. .qrcode-swiper {
  598. position: relative;
  599. &::before {
  600. // content: '';
  601. width: 54rpx;
  602. height: calc(1000rpx - 100rpx);
  603. background: #cdc7c7;
  604. border-radius: 0 24rpx 24rpx 0;
  605. position: absolute;
  606. left: 0;
  607. top: 50rpx;
  608. }
  609. &::after {
  610. // content: '';
  611. width: 54rpx;
  612. height: calc(1000rpx - 100rpx);
  613. background: #cdc7c7;
  614. border-radius: 24rpx 0 0 24rpx;
  615. position: absolute;
  616. right: 0;
  617. top: 50rpx;
  618. }
  619. .qrcode-wrap {
  620. overflow-y: auto;
  621. height: $swiperH;
  622. }
  623. .qrcode-view {
  624. .img1 {
  625. width: 100%;
  626. height: 100%;
  627. }
  628. width: 560rpx;
  629. height: 1000rpx;
  630. margin: 26rpx auto 0;
  631. background: #ff7674;
  632. border-radius: 24rpx;
  633. background-image: url(https://www.chaomangdao.com/image/abj.jpg);
  634. background-repeat: no-repeat;
  635. background-size: 100% auto;
  636. background-position: center;
  637. position: relative;
  638. display: flex;
  639. overflow: hidden;
  640. .qrcode-box {
  641. width: 100%;
  642. background-image: url(https://www.chaomangdao.com/image/renwu@2x.png);
  643. background-repeat: no-repeat;
  644. background-size: 100% auto;
  645. background-position: center;
  646. }
  647. .qrcode-img-box {
  648. width: 200rpx;
  649. height: 200rpx;
  650. position: absolute;
  651. top: 370rpx;
  652. left: 50%;
  653. transform: translateX(-50%);
  654. }
  655. }
  656. .btn-view {
  657. width: 308rpx;
  658. height: 84rpx;
  659. background-image: url(https://www.chaomangdao.com/image/button@2x.png);
  660. margin: 50rpx auto;
  661. background-size: 100%;
  662. background-position: center;
  663. }
  664. .tip {
  665. margin: 50rpx auto;
  666. text-align: center;
  667. font-size: 33rpx;
  668. }
  669. }
  670. .nodata {
  671. text-align: center;
  672. padding: 40% 0;
  673. font-size: 30rpx;
  674. }
  675. }
  676. </style>