myincome.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. <template>
  2. <view style="position: relative;">
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view :style="{marginTop:navH}"></view>
  6. <view>
  7. <view class="show-income3">
  8. <p style="font-weight: bold;">收益明细</p>
  9. <view class="menu">
  10. <view class="menu-item" @click="toShow1()">
  11. <p v-bind:class="showList1?'lor':'unlor'">可提现</p>
  12. </view>
  13. <view class="menu-item" @click="toShow2()">
  14. <p v-bind:class="showList2?'lor':'unlor'">已提现</p>
  15. </view>
  16. <view class="menu-item" @click="toShow3()">
  17. <p v-bind:class="showList3?'lor':'unlor'">提现中</p>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="income-list" v-if="showList1">
  22. <checkbox-group @change="changeCheck">
  23. <view class="income-list-cell" v-for="item in list1" :key="item.value">
  24. <view class="income-list-cell-left">
  25. <label>
  26. <view>
  27. <checkbox class="income-list-checkbox" :value="item.task_id"
  28. :checked="item.checked" />
  29. </view>
  30. </label>
  31. <view>
  32. <p>任务ID:{{item.task_id}}</p>
  33. <p>{{item.project_name}}</p>
  34. <p>商品价值:{{item.product_price}}元</p>
  35. <p>粉丝量:{{item.RecruitStrategy.show_followers_low}}-{{item.RecruitStrategy.show_followers_up}}
  36. </p>
  37. <p>稿费:{{item.RecruitStrategy.show_fee_form}} {{item.show_task_reward}}</p>
  38. <p>提交时间:{{item.complete_date}}</p>
  39. </view>
  40. </view>
  41. <view class="income-list-cell-right">
  42. <p>+{{item.show_settle_amount}}</p>
  43. </view>
  44. </view>
  45. </checkbox-group>
  46. </view>
  47. <view class="income-list" v-if="showList2">
  48. <view class="income-list-cell" style="margin-left: 70rpx;" v-for="item in list2" :key="item.value">
  49. <view class="income-list-cell-left">
  50. <view>
  51. <p>任务ID:{{item.task_id}}</p>
  52. <p>{{item.project_name}}</p>
  53. <p>商品价值:{{item.product_price}}元</p>
  54. <p>粉丝量:{{item.RecruitStrategy.show_followers_low}}-{{item.RecruitStrategy.show_followers_up}}
  55. </p>
  56. <p>稿费:{{item.RecruitStrategy.show_fee_form}} {{item.show_task_reward}}</p>
  57. <p>提交时间:{{item.withdraw_date}}</p>
  58. </view>
  59. </view>
  60. <view class="income-list-cell-right">
  61. <p>+{{item.show_settle_amount}}</p>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="income-list" v-if="showList3">
  66. <view class="income-list-cell" style="margin-left: 70rpx;" v-for="item in list3" :key="item.value">
  67. <view class="income-list-cell-left">
  68. <view>
  69. <p>任务ID:{{item.task_id}}</p>
  70. <p>{{item.project_name}}</p>
  71. <p>商品价值:{{item.product_price}}元</p>
  72. <p>粉丝量:{{item.RecruitStrategy.show_followers_low}}-{{item.RecruitStrategy.show_followers_up}}
  73. </p>
  74. <p>稿费:{{item.RecruitStrategy.show_fee_form}} {{item.show_task_reward}}</p>
  75. <p>提交时间:{{item.withdraw_date}}</p>
  76. </view>
  77. </view>
  78. <view class="income-list-cell-right">
  79. <p>+{{item.show_settle_amount}}</p>
  80. </view>
  81. </view>
  82. </view>
  83. <view class="interval2"></view>
  84. <view class="income-workList-buttons" v-if="showList1">
  85. <view>
  86. <label class="all-check-box left-btn">
  87. <view>
  88. <checkbox-group @change="changeAll">
  89. <checkbox class="income-list-checkbox" :value="allCheck.value"
  90. :checked="allCheck.checked" />
  91. </checkbox-group>
  92. </view>
  93. <view style="display: flex;justify-content: center;align-items: center;">
  94. <p>{{allCheck.name}}</p>
  95. </view>
  96. </label>
  97. </view>
  98. <view>
  99. <button class="right-btn" type="primary" @click="withdraw()">提现</button>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. import mvBar from "@/components/mys_navBar/mysNavBar";
  107. import {
  108. getRouter,
  109. money,
  110. fansview
  111. } from '@/components/utils.js';
  112. export default {
  113. components: {
  114. mvBar,
  115. },
  116. data() {
  117. return {
  118. navH: getApp().globalData.navHeight,
  119. // 测试数据
  120. // list1: [{
  121. // task_id: "001abandon",
  122. // project_name: "PUYU朴郁小树茶冻干茶粉",
  123. // product_price: 78,
  124. // RecruitStrategy: {
  125. // followers_low: "1万",
  126. // followers_up: "3万",
  127. // show_fee_form: "创作者自报价",
  128. // offer: 350,
  129. // },
  130. // settle_amount: 350,
  131. // complete_date: "2022-3-2 14:00",
  132. // checked: false
  133. // }, {
  134. // task_id: "002abash",
  135. // project_name: "Pisco生姜气泡饮料",
  136. // product_price: 68,
  137. // RecruitStrategy: {
  138. // followers_low: "1万",
  139. // followers_up: "3万",
  140. // show_fee_form: "固定稿费",
  141. // offer: 300,
  142. // },
  143. // settle_amount: 150,
  144. // complete_date: "2022-3-2 14:00",
  145. // checked: false
  146. // }],
  147. // list2: [{
  148. // task_id: "003abash",
  149. // project_name: "小鹏海南试驾",
  150. // product_price: 68,
  151. // RecruitStrategy: {
  152. // followers_low: "1万",
  153. // followers_up: "3万",
  154. // show_fee_form: "固定稿费",
  155. // offer: 4000,
  156. // },
  157. // settle_amount: 4000,
  158. // complete_date: "2022-3-2 14:00",
  159. // }, {
  160. // task_id: "004abbreviate",
  161. // project_name: "优衣库三里屯店新店开业",
  162. // product_price: 100,
  163. // RecruitStrategy: {
  164. // followers_low: "5万",
  165. // followers_up: "10万",
  166. // show_fee_form: "固定稿费",
  167. // offer: 1200,
  168. // },
  169. // settle_amount: 1200,
  170. // complete_date: "2022-3-2 14:00",
  171. // }],
  172. // list3: [{
  173. // task_id: "001abandon",
  174. // project_name: "PUYU朴郁小树茶冻干茶粉",
  175. // product_price: 78,
  176. // RecruitStrategy: {
  177. // followers_low: "1万",
  178. // followers_up: "3万",
  179. // show_fee_form: "创作者自报价",
  180. // offer: 350,
  181. // },
  182. // settle_amount: 350,
  183. // complete_date: "2022-3-2 14:00",
  184. // }],
  185. list1: [],
  186. list2: [],
  187. list3: [],
  188. allCheck: {
  189. name: '全选',
  190. value: 'all',
  191. checked: false
  192. },
  193. showTab: "",
  194. showList1: true,
  195. showList2: false,
  196. showList3: false,
  197. picture: {
  198. icon_person: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/youngee/talent_upload/icon-person.png',
  199. icon_location: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/youngee/talent_upload/icon-location.png',
  200. icon_account: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/youngee/talent_upload/icon-account.png',
  201. icon_rmb: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/youngee/talent_upload/icon-rmb.png',
  202. icon_message: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/youngee/talent_upload/icon-message.png',
  203. icon_right: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent_upload/icon-arrow-right.png',
  204. defaultavatarUrl: 'https://horastar.obs.cn-east-3.myhuaweicloud.com/talent/logoxin01.png',
  205. },
  206. mysNavConfig: {
  207. /* 开启单页显示首页图标 */
  208. isHome: true,
  209. /* 固定导航 */
  210. navFixed: true,
  211. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  212. navTitle: {
  213. text: "我的收益",
  214. color: "",
  215. fontSize: "32rpx", // px upx rpx
  216. fontWeight: "normal", // 100 - 700
  217. },
  218. btnType: "type2",
  219. onLeftClick: "/pages/mycenter/mycenter",
  220. /* type2 按钮 */
  221. type2Config: {
  222. // 左图标
  223. leftPath: "/static/img/png2.png",
  224. // 右图标
  225. rightPath: "/static/img/png4.png",
  226. // 圆角
  227. radius: "40rpx",
  228. },
  229. },
  230. codeImg: '',
  231. information: {},
  232. };
  233. },
  234. async onShow() {
  235. // 判断登录
  236. await this.isLogin();
  237. if (this.token === '') {
  238. uni.showModal({
  239. content: '请先登录',
  240. success: function(res) {
  241. if (res.confirm) {
  242. uni.navigateTo({
  243. url: '/pages/login/login'
  244. });
  245. } else if (res.cancel) {
  246. uni.navigateBack();
  247. }
  248. }
  249. });
  250. } else {
  251. this.getTaskInfo()
  252. }
  253. },
  254. onLoad(options) {
  255. getRouter();
  256. console.log(options)
  257. this.showTab = options.showTab
  258. // 传过来的id
  259. if (this.showTab == '1') {
  260. this.toShow1();
  261. } else if (this.showTab == '2') {
  262. this.toShow2();
  263. } else if (this.showTab == '3') {
  264. this.toShow3();
  265. }
  266. },
  267. methods: {
  268. // 判断登陆是否过期
  269. isLogin() {
  270. return this.$https.get('/youngee/c/t/g/is-login')
  271. .then(res => {
  272. if (res.data.code === 403) {
  273. // 登陆已失效
  274. this.token = ""
  275. } else {
  276. this.token = uni.getStorageSync('token')
  277. }
  278. })
  279. },
  280. // 全选
  281. changeAll: function(e) {
  282. if (e.detail.value.length == 0) {
  283. this.list1.map(item => this.$set(item, 'checked', false));
  284. this.$set(this.allCheck, 'checked', false);
  285. } else {
  286. this.list1.map(item => this.$set(item, 'checked', true));
  287. this.$set(this.allCheck, 'checked', true);
  288. }
  289. },
  290. // 多选
  291. changeCheck: function(e) {
  292. var items = this.list1;
  293. var len = this.list1.length;
  294. var values = e.detail.value;
  295. console.log(values)
  296. for (var i = 0; i < len; i++) {
  297. var item = items[i];
  298. if (values.includes(String(item.task_id))) {
  299. this.$set(item, 'checked', true);
  300. } else {
  301. this.$set(item, 'checked', false);
  302. }
  303. }
  304. // 判断选中状态
  305. var isAll = this.list1.every(item => item.checked == true)
  306. isAll ? this.$set(this.allCheck, 'checked', true) : this.$set(this.allCheck, 'checked', false)
  307. },
  308. // 获取提现任务
  309. getTaskInfo() {
  310. return this.$https.get('/youngee/c/t/g/get-withdraw-task-info')
  311. .then(res => {
  312. this.list1 = []
  313. this.list2 = []
  314. this.list3 = []
  315. // console.log(res)
  316. if (res.data.data.can_withdraw_task_info_list != null) {
  317. this.list1 = res.data.data.can_withdraw_task_info_list
  318. for (let i = 0; i < this.list1.length; i++) {
  319. this.list1[i].show_task_reward = money(this.list1[i].task_reward)
  320. this.list1[i].show_settle_amount = money(this.list1[i].settle_amount)
  321. this.list1[i].RecruitStrategy.show_followers_low = fansview(this.list1[i]
  322. .RecruitStrategy.followers_low)
  323. this.list1[i].RecruitStrategy.show_followers_up = fansview(this.list1[i]
  324. .RecruitStrategy.followers_up)
  325. switch (this.list1[i].RecruitStrategy.fee_form) {
  326. case 1:
  327. this.list1[i].RecruitStrategy.show_fee_form = "产品置换"
  328. break
  329. case 2:
  330. this.list1[i].RecruitStrategy.show_fee_form = "固定稿费"
  331. break
  332. case 3:
  333. this.list1[i].RecruitStrategy.show_fee_form = "自报价"
  334. break
  335. }
  336. }
  337. }
  338. if (res.data.data.withdrawed_task_info_list != null) {
  339. this.list2 = res.data.data.withdrawed_task_info_list
  340. for (let i = 0; i < this.list2.length; i++) {
  341. this.list2[i].show_task_reward = money(this.list2[i].task_reward)
  342. this.list2[i].show_settle_amount = money(this.list2[i].settle_amount)
  343. this.list2[i].RecruitStrategy.show_followers_low = fansview(this.list2[i]
  344. .RecruitStrategy.followers_low)
  345. this.list2[i].RecruitStrategy.show_followers_up = fansview(this.list2[i]
  346. .RecruitStrategy.followers_up)
  347. switch (this.list2[i].RecruitStrategy.fee_form) {
  348. case 1:
  349. this.list2[i].RecruitStrategy.show_fee_form = "产品置换"
  350. break
  351. case 2:
  352. this.list2[i].RecruitStrategy.show_fee_form = "固定稿费"
  353. break
  354. case 3:
  355. this.list2[i].RecruitStrategy.show_fee_form = "自报价"
  356. break
  357. }
  358. }
  359. }
  360. if (res.data.data.withdrawing_task_info_list != null) {
  361. this.list3 = res.data.data.withdrawing_task_info_list
  362. for (let i = 0; i < this.list3.length; i++) {
  363. this.list3[i].show_task_reward = money(this.list3[i].task_reward)
  364. this.list3[i].show_settle_amount = money(this.list3[i].settle_amount)
  365. this.list3[i].RecruitStrategy.show_followers_low = fansview(this.list3[i]
  366. .RecruitStrategy.followers_low)
  367. this.list3[i].RecruitStrategy.show_followers_up = fansview(this.list3[i]
  368. .RecruitStrategy.followers_up)
  369. switch (this.list3[i].RecruitStrategy.fee_form) {
  370. case 1:
  371. this.list3[i].RecruitStrategy.show_fee_form = "产品置换"
  372. break
  373. case 2:
  374. this.list3[i].RecruitStrategy.show_fee_form = "固定稿费"
  375. break
  376. case 3:
  377. this.list3[i].RecruitStrategy.show_fee_form = "自报价"
  378. break
  379. }
  380. }
  381. }
  382. })
  383. },
  384. // 进入收益页面
  385. toincome(tab) {
  386. console.log(tab)
  387. },
  388. toShow1() {
  389. this.showList2 = false;
  390. this.showList3 = false;
  391. this.showList1 = true;
  392. },
  393. toShow2() {
  394. this.showList1 = false;
  395. this.showList3 = false;
  396. this.showList2 = true;
  397. },
  398. toShow3() {
  399. this.showList2 = false;
  400. this.showList1 = false;
  401. this.showList3 = true;
  402. },
  403. withdraw() {
  404. if (this.list1.length == 0) {
  405. uni.showModal({
  406. content: '请先选择提现任务',
  407. });
  408. return
  409. }
  410. let taskIdList = []
  411. let totalAmount = 0
  412. for (let i = 0; i < this.list1.length; ++i) {
  413. if (this.list1[i].checked) {
  414. taskIdList.push(this.list1[i].task_id)
  415. totalAmount += this.list1[i].settle_amount
  416. }
  417. }
  418. var data = {
  419. taskIdList: taskIdList,
  420. totalAmount: totalAmount
  421. };
  422. data = JSON.stringify(data)
  423. uni.navigateTo({
  424. url: './myincome/applywithdraw?textObj=' + encodeURIComponent(data)
  425. });
  426. }
  427. },
  428. };
  429. </script>
  430. <style>
  431. /deep/ .share .uni-popup .uni-popup__wrapper {
  432. width: 70% !important;
  433. border-radius: 15rpx !important;
  434. }
  435. </style>
  436. <style lang="scss" scoped>
  437. p {
  438. font-size: 32rpx;
  439. }
  440. .menu {
  441. display: flex;
  442. align-items: center;
  443. justify-content: space-around;
  444. }
  445. .menu-item p {
  446. font-weight: 600;
  447. &.lor {
  448. border-bottom: 5rpx solid #F0D232;
  449. color: #F0D232;
  450. padding-bottom: 15rpx;
  451. }
  452. &.unlor {
  453. color: #81838f;
  454. padding-bottom: 15rpx;
  455. border-bottom: 5rpx solid #ffffff;
  456. }
  457. }
  458. .show-income1 {
  459. display: flex;
  460. align-items: center;
  461. height: 120rpx;
  462. margin: 0 3%;
  463. }
  464. .show-income1-text {
  465. margin-left: 20rpx;
  466. margin-right: 200rpx;
  467. }
  468. .show-income1-text2 {
  469. flex: 1;
  470. display: flex;
  471. }
  472. .show-income1-btn {
  473. width: 200rpx;
  474. text-align: center;
  475. background-color: #F0D232;
  476. border-radius: 15rpx;
  477. font-size: 35rpx;
  478. line-height: 180%;
  479. }
  480. .show-income2 {
  481. display: flex;
  482. align-items: center;
  483. justify-content: space-around;
  484. height: 150rpx;
  485. margin: 0 3% 3%;
  486. background-color: #F0D232;
  487. border-radius: 10rpx;
  488. }
  489. .show-income2-text {
  490. // padding: 0 50rpx;
  491. text-align: center;
  492. }
  493. .show-income3 {
  494. margin: 0 3%;
  495. }
  496. .show-income3 p {
  497. margin-top: 50rpx;
  498. margin-left: 20rpx;
  499. }
  500. .income-list {
  501. margin-bottom: 100rpx;
  502. }
  503. .income-list-cell {
  504. display: flex;
  505. align-items: center;
  506. justify-content: space-between;
  507. margin-right: 20rpx;
  508. }
  509. .income-list-cell-left {
  510. display: flex;
  511. align-items: center;
  512. margin: 20rpx 0;
  513. }
  514. .income-list-cell-right p {
  515. color: #F0D232;
  516. font-size: 35rpx;
  517. }
  518. // .income-list-cell2 {
  519. // margin-left: 70rpx;
  520. // }
  521. .income-list-checkbox {
  522. transform: scale(0.7)
  523. }
  524. .interval2 {
  525. width: 100%;
  526. height: 100rpx;
  527. margin-top: 5%;
  528. }
  529. .income-workList-buttons {
  530. display: flex;
  531. justify-content: space-between;
  532. align-items: center;
  533. padding: 2% 5%;
  534. position: fixed;
  535. width: 90%;
  536. bottom: 0rpx;
  537. height: 90rpx;
  538. // padding-top: 2%;
  539. background-color: #FFFFFF;
  540. margin-top: 100rpx;
  541. }
  542. .all-check-box {
  543. display: flex;
  544. }
  545. .right-btn {
  546. width: 200rpx;
  547. text-align: center;
  548. color: #000;
  549. background-color: #F0D232;
  550. border-radius: 15rpx;
  551. font-size: 32rpx;
  552. line-height: 200%;
  553. }
  554. </style>