myincome.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. <template>
  2. <view style="position: relative;">
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view :style="{marginTop:navH}"></view>
  6. <view class="head">
  7. <view class="show-income1">
  8. <view class="show-income1-left">
  9. <view class="show-income1-left-up">
  10. <view style="display: flex;align-items: center;">
  11. <p>我获得的收益总数</p>
  12. <image id="helpicon" :src="picture.icon_help" mode=""
  13. style="width: 35rpx;height: 35rpx;padding-left: 10rpx;"
  14. @click="showIncomeHelp = true" />
  15. </view>
  16. <view class="tip_box" v-if="showIncomeHelp">
  17. <view class="container" :style="{
  18. 'margin-right': cotainerMargin + 'px',
  19. backgroundColor: '#404040', borderRadius: '5px' }">
  20. <!-- 提示文字 -->
  21. <view class="tips">
  22. <p>{{incomeHelpText}}</p>
  23. </view>
  24. <view class="close" @click="showIncomeHelp = false">
  25. <image class="closeImg" src="../../static/delete.png" />
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="show-income1-left-down">
  31. <p @click="toIncome('can')">
  32. {{information.showIncome?information.showIncome:'0.0'}}
  33. </p>
  34. </view>
  35. </view>
  36. <view class="show-income1-right">
  37. <view>
  38. <button class="show-income1-btn" type="default" @click="toIncome('can')">提现</button>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="show-income2">
  43. <view class="show-income2-text" @click="toIncome('can')">
  44. <p style="padding-bottom: 20rpx;">可提现</p>
  45. <p>{{information.showCanwithdraw?information.showCanwithdraw:'0.0'}}</p>
  46. </view>
  47. <view class="show-income2-text" @click="toIncome('ed')">
  48. <p style="padding-bottom: 20rpx;">已提现</p>
  49. <p>{{information.showWithdrawed?information.showWithdrawed:'0.0'}}</p>
  50. </view>
  51. <view class="show-income2-text" @click="toIncome('ing')">
  52. <p style="padding-bottom: 20rpx;">提现中</p>
  53. <p>{{information.showWithdrawing?information.showWithdrawing:'0.0'}}</p>
  54. </view>
  55. </view>
  56. <view class="show-income3">
  57. <p style="font-weight: bold;">收益明细</p>
  58. <view class="menu">
  59. <view class="menu-item" @click="toShow1()">
  60. <p v-bind:class="showList1?'lor':'unlor'">可提现</p>
  61. </view>
  62. <view class="menu-item" @click="toShow2()">
  63. <p v-bind:class="showList2?'lor':'unlor'">已提现</p>
  64. </view>
  65. <view class="menu-item" @click="toShow3()">
  66. <p v-bind:class="showList3?'lor':'unlor'">提现中</p>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="home">
  72. <view class="income-list" v-if="showList1">
  73. <checkbox-group @change="changeCheck">
  74. <view class="income-list-cell" v-for="item in unWithdrawList" :key="item.value">
  75. <view class="income-list-cell-left">
  76. <label>
  77. <view>
  78. <checkbox class="income-list-checkbox" :value="item.task_id"
  79. :checked="item.checked" />
  80. </view>
  81. </label>
  82. <view class="income-info">
  83. <view class="income-info-product">
  84. <image :src="item.photo_url"></image>
  85. </view>
  86. <view class="income-info-tp">
  87. <p>任务ID:{{item.task_id}}</p>
  88. <view class="income-info-project">
  89. <image :src="item.platform_icon_url"></image>
  90. <p>{{item.task_name}}</p>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. <view class="income-list-cell-right">
  96. <p style="color: #f2d22d;font-size: 36rpx;font-weight: 600;">+{{item.showIncome}}
  97. </p>
  98. <p>{{item.showLabel}}</p>
  99. </view>
  100. </view>
  101. </checkbox-group>
  102. </view>
  103. <view class="income-list" v-if="showList2">
  104. <view class="income-list-cell" style="margin-left: 50rpx;" v-for="item in withdrawedList"
  105. :key="item.value">
  106. <view class="income-list-cell-left">
  107. <view class="income-info">
  108. <view class="income-info-product">
  109. <image :src="item.photo_url"></image>
  110. </view>
  111. <view class="income-info-tp">
  112. <p>任务ID:{{item.task_id}}</p>
  113. <view class="income-info-project">
  114. <image :src="item.platform_icon_url"></image>
  115. <p>{{item.task_name}}</p>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. <view class="income-list-cell-right">
  121. <p style="color: #f2d22d;font-size: 36rpx;font-weight: 600;">+{{item.showIncome}}
  122. </p>
  123. <p>{{item.showLabel}}</p>
  124. </view>
  125. </view>
  126. </view>
  127. <view class="income-list" v-if="showList3">
  128. <view class="income-list-cell" style="margin-left: 50rpx;" v-for="item in withdrawingList"
  129. :key="item.value">
  130. <view class="income-list-cell-left">
  131. <view class="income-info">
  132. <view class="income-info-product">
  133. <image :src="item.photo_url"></image>
  134. </view>
  135. <view class="income-info-tp">
  136. <p>任务ID:{{item.task_id}}</p>
  137. <view class="income-info-project">
  138. <image :src="item.platform_icon_url"></image>
  139. <p>{{item.task_name}}</p>
  140. </view>
  141. </view>
  142. </view>
  143. </view>
  144. <view class="income-list-cell-right">
  145. <p style="color: #f2d22d;font-size: 36rpx;font-weight: 600;">+{{item.showIncome}}
  146. </p>
  147. <p>{{item.showLabel}}</p>
  148. </view>
  149. </view>
  150. </view>
  151. <view class="interval2"></view>
  152. <view class="income-workList-buttons" v-if="showList1">
  153. <view>
  154. <label class="all-check-box left-btn">
  155. <view>
  156. <checkbox-group @change="changeAll">
  157. <checkbox class="income-list-checkbox" :value="allCheck.value"
  158. :checked="allCheck.checked" />
  159. </checkbox-group>
  160. </view>
  161. <view style="display: flex;justify-content: center;align-items: center;">
  162. <p>{{allCheck.name}}</p>
  163. </view>
  164. </label>
  165. </view>
  166. <view>
  167. <button class="right-btn" type="primary" @click="submitWithdraw()">提现</button>
  168. </view>
  169. </view>
  170. </view>
  171. </view>
  172. </template>
  173. <script>
  174. import mvBar from "@/components/mys_navBar/mysNavBar";
  175. import {
  176. money,
  177. fansview
  178. } from '@/components/utils.js';
  179. export default {
  180. components: {
  181. mvBar,
  182. },
  183. data() {
  184. return {
  185. navH: getApp().globalData.navHeight,
  186. picture: getApp().globalData.picture,
  187. unWithdrawList: [],
  188. withdrawingList: [],
  189. withdrawedList: [],
  190. allCheck: {
  191. name: '全选',
  192. value: 'all',
  193. checked: false
  194. },
  195. showTab: "",
  196. showList1: true,
  197. showList2: false,
  198. showList3: false,
  199. mysNavConfig: {
  200. /* 开启单页显示首页图标 */
  201. isHome: true,
  202. /* 固定导航 */
  203. navFixed: true,
  204. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  205. navTitle: {
  206. text: "我的收益",
  207. color: "",
  208. fontSize: "32rpx", // px upx rpx
  209. fontWeight: "normal", // 100 - 700
  210. },
  211. btnType: "type2",
  212. onLeftClick: "/pages/mycenter/mycenter",
  213. /* type2 按钮 */
  214. type2Config: {
  215. // 左图标
  216. leftPath: "/static/img/png2.png",
  217. // 右图标
  218. rightPath: "/static/img/png4.png",
  219. // 圆角
  220. radius: "40rpx",
  221. },
  222. },
  223. codeImg: '',
  224. information: {},
  225. incomeHelpText: "在平台产生的总收益【可提现+已提现+提现中】",
  226. showIncomeHelp: false,
  227. labelList: [
  228. "",
  229. "任务收益",
  230. "开团收益",
  231. "样品返现",
  232. "悬赏收益"
  233. ],
  234. };
  235. },
  236. async onShow() {
  237. // 判断登录
  238. uni.showLoading({
  239. title: '加载中'
  240. });
  241. await this.isLogin();
  242. if (this.token === '') {
  243. uni.showModal({
  244. content: '请先登录',
  245. success: function(res) {
  246. if (res.confirm) {
  247. uni.navigateTo({
  248. url: '/pages/login/login'
  249. });
  250. } else if (res.cancel) {
  251. uni.navigateBack();
  252. }
  253. }
  254. });
  255. } else {
  256. await this.getTalentInfo();
  257. // this.toShow1()
  258. // await this.getTaskInfo();
  259. }
  260. uni.hideLoading();
  261. },
  262. onLoad(options) {
  263. console.log(options)
  264. this.showTab = options.showTab
  265. // 传过来的id
  266. console.log(this.showTab)
  267. if (this.showTab == '1') {
  268. this.toShow1();
  269. } else if (this.showTab == '2') {
  270. this.toShow2();
  271. } else if (this.showTab == '3') {
  272. this.toShow3();
  273. } else {
  274. this.toShow1();
  275. }
  276. },
  277. methods: {
  278. toShow1() {
  279. this.showList2 = false;
  280. this.showList3 = false;
  281. this.showList1 = true;
  282. this.getTalentIncome(1);
  283. },
  284. toShow2() {
  285. this.showList1 = false;
  286. this.showList3 = false;
  287. this.showList2 = true;
  288. this.getTalentIncome(3);
  289. },
  290. toShow3() {
  291. this.showList2 = false;
  292. this.showList1 = false;
  293. this.showList3 = true;
  294. this.getTalentIncome(2);
  295. },
  296. // 全选
  297. changeAll: function(e) {
  298. if (e.detail.value.length == 0) {
  299. this.unWithdrawList.map(item => this.$set(item, 'checked', false));
  300. this.$set(this.allCheck, 'checked', false);
  301. } else {
  302. this.unWithdrawList.map(item => this.$set(item, 'checked', true));
  303. this.$set(this.allCheck, 'checked', true);
  304. }
  305. },
  306. // 多选
  307. changeCheck: function(e) {
  308. var items = this.unWithdrawList;
  309. var len = this.unWithdrawList.length;
  310. var values = e.detail.value;
  311. console.log(values)
  312. for (var i = 0; i < len; i++) {
  313. var item = items[i];
  314. if (values.includes(String(item.task_id))) {
  315. this.$set(item, 'checked', true);
  316. } else {
  317. this.$set(item, 'checked', false);
  318. }
  319. }
  320. // 判断选中状态
  321. var isAll = this.list1.every(item => item.checked == true)
  322. isAll ? this.$set(this.allCheck, 'checked', true) : this.$set(this.allCheck, 'checked', false)
  323. },
  324. // 判断登陆是否过期
  325. isLogin() {
  326. return this.$https.get('/youngee/c/t/g/is-login')
  327. .then(res => {
  328. if (res.data.code === 403) {
  329. // 登陆已失效
  330. this.token = ""
  331. } else {
  332. this.token = uni.getStorageSync('token')
  333. }
  334. })
  335. },
  336. getTalentInfo() {
  337. return this.$https.get('/youngee/c/t/g/get-talent-info')
  338. .then(res => {
  339. if (res.data.code === 0) {
  340. this.information = res.data.data
  341. this.information.showWithdrawing = money(this.information.withdrawing)
  342. this.information.showWithdrawed = money(this.information.withdrawed)
  343. this.information.showCanwithdraw = money(this.information.canwithdraw)
  344. this.information.showIncome = money(this.information.income)
  345. }
  346. });
  347. },
  348. getTalentIncome(val) {
  349. return this.$https.post('/youngee/c/t/p/get-talent-income-info', {
  350. type: val
  351. }).then(res => {
  352. if (res.data.code === 0) {
  353. let data = res.data.data
  354. for (let i = 0; i < data.length; ++i) {
  355. data[i].showIncome = money(data[i].income)
  356. data[i].showLabel = this.labelList[data[i].income_type]
  357. }
  358. if (val === 1) {
  359. this.unWithdrawList = data
  360. } else if (val === 2) {
  361. this.withdrawingList = data
  362. } else {
  363. this.withdrawedList = data
  364. }
  365. }
  366. })
  367. },
  368. submitWithdraw() {
  369. let incomeIdList = []
  370. let totalAmount = 0
  371. for (let i = 0; i < this.unWithdrawList.length; ++i) {
  372. if (this.unWithdrawList[i].checked) {
  373. incomeIdList.push(this.unWithdrawList[i].id)
  374. totalAmount += this.unWithdrawList[i].income
  375. }
  376. }
  377. if (incomeIdList.length == 0) {
  378. uni.showToast({
  379. content: '请先选择提现订单',
  380. icon: 'none'
  381. });
  382. return
  383. }
  384. var data = {
  385. incomeIdList: incomeIdList,
  386. totalAmount: totalAmount
  387. };
  388. data = JSON.stringify(data)
  389. uni.navigateTo({
  390. url: '/page_mycenter/myincome/applywithdraw?textObj=' + encodeURIComponent(data)
  391. });
  392. }
  393. // // 获取提现任务
  394. // getTaskInfo() {
  395. // return this.$https.get('/youngee/c/t/g/get-withdraw-task-info')
  396. // .then(res => {
  397. // this.list1 = []
  398. // this.list2 = []
  399. // this.list3 = []
  400. // // console.log(res)
  401. // if (res.data.data.can_withdraw_task_info_list != null) {
  402. // this.list1 = res.data.data.can_withdraw_task_info_list
  403. // for (let i = 0; i < this.list1.length; i++) {
  404. // this.list1[i].show_task_reward = money(this.list1[i].task_reward)
  405. // this.list1[i].show_settle_amount = money(this.list1[i].settle_amount)
  406. // let ProductPhoto = JSON.parse(this.list1[i].product_photo);
  407. // for (let j = 0; j < ProductPhoto.length; ++j) {
  408. // if (ProductPhoto[j].Symbol == 1) {
  409. // this.list1[i].product_photo = ProductPhoto[j]
  410. // }
  411. // }
  412. // }
  413. // }
  414. // if (res.data.data.withdrawed_task_info_list != null) {
  415. // this.list2 = res.data.data.withdrawed_task_info_list
  416. // for (let i = 0; i < this.list2.length; i++) {
  417. // this.list2[i].show_task_reward = money(this.list2[i].task_reward)
  418. // this.list2[i].show_settle_amount = money(this.list2[i].settle_amount)
  419. // let ProductPhoto = JSON.parse(this.list2[i].product_photo);
  420. // for (let j = 0; j < ProductPhoto.length; ++j) {
  421. // if (ProductPhoto[j].Symbol == 1) {
  422. // this.list2[i].product_photo = ProductPhoto[j]
  423. // }
  424. // }
  425. // }
  426. // }
  427. // if (res.data.data.withdrawing_task_info_list != null) {
  428. // this.list3 = res.data.data.withdrawing_task_info_list
  429. // for (let i = 0; i < this.list3.length; i++) {
  430. // this.list3[i].show_task_reward = money(this.list3[i].task_reward)
  431. // this.list3[i].show_settle_amount = money(this.list3[i].settle_amount)
  432. // let ProductPhoto = JSON.parse(this.list3[i].product_photo);
  433. // for (let j = 0; j < ProductPhoto.length; ++j) {
  434. // if (ProductPhoto[j].Symbol == 1) {
  435. // this.list3[i].product_photo = ProductPhoto[j]
  436. // }
  437. // }
  438. // }
  439. // }
  440. // })
  441. // },
  442. },
  443. };
  444. </script>
  445. <style>
  446. /deep/ .share .uni-popup .uni-popup__wrapper {
  447. width: 70% !important;
  448. border-radius: 15rpx !important;
  449. }
  450. </style>
  451. <style lang="scss" scoped>
  452. p {
  453. font-size: 32rpx;
  454. }
  455. .head {
  456. padding: 20rpx 0;
  457. background-color: #fff;
  458. position: fixed;
  459. width: 100%;
  460. z-index: 999;
  461. }
  462. .home {
  463. padding-top: 550rpx;
  464. }
  465. .menu {
  466. display: flex;
  467. align-items: center;
  468. justify-content: space-between;
  469. }
  470. .menu-item p {
  471. font-weight: 600;
  472. &.lor {
  473. border-bottom: 5rpx solid #F0D232;
  474. color: #F0D232;
  475. padding-bottom: 15rpx;
  476. }
  477. &.unlor {
  478. color: #81838f;
  479. padding-bottom: 15rpx;
  480. border-bottom: 5rpx solid #ffffff;
  481. }
  482. }
  483. .show-income1 {
  484. display: flex;
  485. align-items: center;
  486. height: 120rpx;
  487. margin: 0 3%;
  488. }
  489. .show-income1-text {
  490. margin-left: 20rpx;
  491. margin-right: 200rpx;
  492. }
  493. .show-income1-text2 {
  494. flex: 1;
  495. display: flex;
  496. }
  497. .show-income1-btn {
  498. width: 200rpx;
  499. text-align: center;
  500. background-color: #F0D232;
  501. border-radius: 15rpx;
  502. font-size: 35rpx;
  503. line-height: 180%;
  504. }
  505. .show-income2 {
  506. display: flex;
  507. align-items: center;
  508. justify-content: space-around;
  509. height: 150rpx;
  510. margin: 0 3% 3%;
  511. background-color: #F0D232;
  512. border-radius: 10rpx;
  513. }
  514. .show-income2-text {
  515. // padding: 0 50rpx;
  516. text-align: center;
  517. }
  518. .show-income3 {
  519. margin: 0 50rpx;
  520. }
  521. .show-income3 p {
  522. margin-top: 50rpx;
  523. }
  524. .income-list {
  525. margin-bottom: 100rpx;
  526. }
  527. .income-list-cell {
  528. display: flex;
  529. align-items: center;
  530. justify-content: space-between;
  531. }
  532. .income-list-cell-left {
  533. display: flex;
  534. align-items: center;
  535. margin: 20rpx 0;
  536. }
  537. .income-list-cell-right {
  538. display: flex;
  539. flex-direction: column;
  540. align-items: flex-end;
  541. width: 50%;
  542. }
  543. .income-list-cell-right p {
  544. // color: #F0D232;
  545. font-size: 32rpx;
  546. margin-right: 50rpx;
  547. }
  548. // .income-list-cell2 {
  549. // margin-left: 70rpx;
  550. // }
  551. .income-info {
  552. display: flex;
  553. // align-items: center;
  554. }
  555. .income-list-checkbox {
  556. width: 50rpx;
  557. transform: scale(0.7)
  558. }
  559. .income-info-product image {
  560. height: 120rpx;
  561. width: 120rpx;
  562. padding: 10rpx;
  563. }
  564. .income-info-tp {
  565. display: flex;
  566. flex-direction: column;
  567. }
  568. .income-info-project {
  569. display: flex;
  570. align-items: center;
  571. margin: 10rpx 0;
  572. }
  573. .income-info-project image {
  574. height: 40rpx;
  575. width: 70rpx;
  576. padding-right: 20rpx;
  577. }
  578. .interval2 {
  579. width: 100%;
  580. height: 120rpx;
  581. margin-top: 5%;
  582. }
  583. .income-workList-buttons {
  584. display: flex;
  585. justify-content: space-between;
  586. align-items: center;
  587. padding: 2% 50rpx;
  588. position: fixed;
  589. width: 90%;
  590. bottom: 20rpx;
  591. height: 90rpx;
  592. // padding-top: 2%;
  593. background-color: #FFFFFF;
  594. margin-top: 100rpx;
  595. }
  596. .all-check-box {
  597. display: flex;
  598. margin-left: -20rpx;
  599. }
  600. .right-btn {
  601. width: 150rpx;
  602. text-align: center;
  603. color: #000;
  604. background-color: #F0D232;
  605. border-radius: 15rpx;
  606. font-size: 32rpx;
  607. line-height: 180%;
  608. }
  609. .show-income1 {
  610. height: 150rpx;
  611. margin: 0 3% 0 8%;
  612. display: flex;
  613. justify-content: space-between;
  614. align-items: center;
  615. }
  616. .show-income1-btn {
  617. width: 150rpx;
  618. // padding: 0 40rpx;
  619. text-align: center;
  620. background-color: #F0D232;
  621. border-radius: 15rpx;
  622. font-size: 32rpx;
  623. line-height: 250%;
  624. }
  625. .show-income1-left {
  626. display: flex;
  627. flex-direction: column;
  628. justify-content: start;
  629. }
  630. .show-income1-left-up {
  631. margin-bottom: 10rpx;
  632. }
  633. .show-income1-left-down p {
  634. font-size: 40rpx;
  635. font-weight: bold;
  636. color: #F0D232;
  637. }
  638. .show-income1-right {
  639. padding-right: 20rpx;
  640. }
  641. .show-income2 {
  642. display: flex;
  643. align-items: center;
  644. justify-content: space-between;
  645. height: 150rpx;
  646. margin: 0 3% 3%;
  647. background-color: #F0D232;
  648. border-radius: 10rpx;
  649. padding: 0 5%;
  650. }
  651. .show-income2-text {
  652. width: 24%;
  653. text-align: center;
  654. }
  655. .tip_box {
  656. position: absolute;
  657. right: 0;
  658. z-index: 9999;
  659. display: flex;
  660. justify-content: flex-end;
  661. align-items: flex-end;
  662. flex-direction: column;
  663. .arrow {
  664. width: 0;
  665. height: 0;
  666. border: 10rpx solid;
  667. border-color: transparent;
  668. }
  669. .container {
  670. display: flex;
  671. align-items: center;
  672. justify-content: center;
  673. padding: 16rpx 24rpx;
  674. .tips {
  675. flex: 1;
  676. padding-right: 12rpx;
  677. }
  678. .tips p {
  679. font-size: 24rpx;
  680. color: #fff
  681. }
  682. .close {
  683. display: flex;
  684. align-items: center;
  685. height: 30rpx;
  686. width: 30rpx;
  687. .closeImg {
  688. height: 100%;
  689. width: 100%;
  690. }
  691. }
  692. }
  693. }
  694. </style>