index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. <template>
  2. <view class="consume-content" :style="{'--status-bar-': statusBarHeight}">
  3. <view class="consume-content-info">
  4. <!-- 头部主要内容 开始 -->
  5. <view class="consume-content-header">
  6. <customNavbar title="提现" bgColor="var(--gd-bgm-color)" :customNavbarInfo="{}" :contentStyle="{}"
  7. :leftStyle="{color: '#fff'}"></customNavbar>
  8. <!-- tab 开始 -->
  9. <u-tabs
  10. :list="list1"
  11. @click="clickTabs"
  12. lineColor="var(--gd-bgm-color)"
  13. :activeStyle="{ color: 'rgba(127, 127, 127, 1)' }"
  14. :inactiveStyle="{ color: 'rgba(127, 127, 127, 1)' }"
  15. :scrollable="false"
  16. ></u-tabs>
  17. <!-- tab 结束 -->
  18. </view>
  19. <!-- 头部主要内容 结束 -->
  20. <!-- 收支列表 开始 -->
  21. <view class="consume-content-list">
  22. <customScrollList
  23. ref="customScrollList"
  24. @load="load"
  25. @paging="paging"
  26. @refresh="refresh"
  27. >
  28. <view v-if="dataList.length>0" style="width: 100%;padding: 10rpx 30rpx 0;box-sizing: border-box;" class="item-list">
  29. <u-checkbox-group placement="column" @change="checkboxChange">
  30. <view v-for="(item,index) in dataList" :key="item.id" class="item u-flex">
  31. <u-checkbox v-if="serialType==0" shape="circle" activeColor="#ED0000" :key="index"
  32. :name="item.name" :checked="item.checked" @change="toggleCheck(index)" class="checkbox" />
  33. <view :class="['item-box',serialType==0 ? 'item-box-shadow':'']">
  34. <view class="text u-flex u-row-between text-order">
  35. <view class="name">订单号:{{item.orderId}}</view>
  36. </view>
  37. <view class="text u-flex u-row-between text-title">
  38. <view class="name">《{{item.performName}}》</view>
  39. </view>
  40. <view class="text u-flex u-row-between text-perform">
  41. <view class="name">{{item.performDate}} {{item.performTimeStart}}~{{item.performTimeEnd}}</view>
  42. <view class="name">{{ item.seatTypeName }}</view>
  43. </view>
  44. <view class="text u-flex u-row-between">
  45. <view class="name">核销数量:{{ item.wipeNum }}</view>
  46. <view class="withdrawTotal">获得佣金:<text class="num"> ¥ {{item.totalPrice}}</text></view>
  47. </view>
  48. <view v-if="serialType!=0" class="text u-flex u-row-between text-perform">
  49. <view class="name">提现时间:{{ item.createTime }}</view>
  50. </view>
  51. <view v-if="serialType==1" class="text u-flex u-row-between text-perform">
  52. <view class="name">到账时间:{{ item.receivedTime }}</view>
  53. </view>
  54. </view>
  55. </view>
  56. </u-checkbox-group>
  57. </view>
  58. </customScrollList>
  59. </view>
  60. <!-- 收支列表 结束 -->
  61. </view>
  62. <view class="cart-bottom" v-if="serialType==0">
  63. <view class="inner u-flex u-row-between">
  64. <view class="left u-flex">
  65. <view class="checkbox" @click="checkboxClick" style="padding: 10px;">
  66. <u-checkbox-group @change="allCheckboxChange">
  67. <u-checkbox shape="circle" :checked="allChecked" activeColor="#ED0000" :name="allCheckbox.name"
  68. label="全选"></u-checkbox>
  69. </u-checkbox-group>
  70. </view>
  71. <view class="total-price-wrap u-flex">
  72. <view class="total">共{{selectGoods.length}}人</view>
  73. <view class="totalPrice u-flex">
  74. 合计: <text class="num"> {{totalPrice}}</text>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="btn active" v-if="selectGoods.length>0&&cansubmit" @click="submitorder">确定</view>
  79. <view class="btn" v-else>确定</view>
  80. </view>
  81. </view>
  82. <view class="cart-bottom" v-else-if="dataList.length>0">
  83. <view class="inner u-flex u-row-between">
  84. <view class="left u-flex">
  85. <view class="checkbox" style="padding: 10px;"></view>
  86. <view class="total-price-wrap u-flex" style="display: flex;flex-direction: column;align-items: flex-start;">
  87. <view class="total">笔数:共{{dataList.length}}笔</view>
  88. <view class="totalPrice u-flex">
  89. 合计佣金: <text class="num"> {{ totalPriceAll }}</text>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. <u-toast ref="uToast"></u-toast>
  96. </view>
  97. </template>
  98. <script>
  99. import {
  100. navigateTo
  101. } from "@/utils/util.js"
  102. import { Decimal } from 'decimal.js';//引入
  103. export default {
  104. data() {
  105. return {
  106. title: '提现',
  107. statusBarHeight: 0, // 状态栏安全距离
  108. monry: 0,
  109. moneyValue: null,
  110. list1: [
  111. {
  112. name: '待提现',
  113. key: 0,
  114. },
  115. {
  116. name: '提现中',
  117. key: 3,
  118. },
  119. {
  120. name: '提现成功',
  121. key: 1,
  122. },
  123. {
  124. name: '提现失败',
  125. key: 2,
  126. },
  127. ],
  128. serialType: 0,
  129. orderId: '',
  130. cansubmit: true,
  131. staticUrl: this.$commonConfig.staticUrl,
  132. allCheckbox: {
  133. name: '全选'
  134. },
  135. options: [{
  136. text: '删除',
  137. style: {
  138. backgroundColor: '#FF3C3F',
  139. 'padding-left': '10px'
  140. }
  141. }],
  142. // 购物车列表
  143. dataList: [],
  144. totalPriceAll: null,
  145. }
  146. },
  147. computed: {
  148. // 是否全选
  149. allChecked() {
  150. return this.dataList.every(item => item.checked)
  151. },
  152. selectGoods() {
  153. let selectGoods = [];
  154. this.dataList.forEach(item => {
  155. if (item.checked) {
  156. selectGoods.push(item)
  157. }
  158. })
  159. return selectGoods
  160. },
  161. // 合计价格
  162. totalPrice() {
  163. let that = this;
  164. return this.dataList.reduce((total, item) => {
  165. if (item.checked) {
  166. let price = null;
  167. total += item.totalPrice;
  168. }
  169. return total;
  170. }, 0).toFixed(2);
  171. }
  172. },
  173. onLoad(page) {
  174. this.orderId = page.id;
  175. },
  176. onShow() {
  177. this.statusBarHeight = getApp().globalData.statusBarHeight
  178. this.$refs.customScrollList.refresh()
  179. },
  180. watch:{
  181. dataList(){
  182. let totalPriceAll = 0
  183. this.dataList.forEach((item,index)=>{
  184. totalPriceAll = new Decimal(totalPriceAll).add(new Decimal(item.totalPrice))
  185. })
  186. this.totalPriceAll = totalPriceAll
  187. }
  188. },
  189. methods: {
  190. /**
  191. * @author ygh
  192. * @data 2023-12-20
  193. */
  194. navigateToFun() {
  195. navigateTo('/pages/cash/index')
  196. },
  197. /**
  198. * 选择tabs
  199. */
  200. clickTabs(item) {
  201. console.log('item', item);
  202. if(this.serialType == item.key) return
  203. this.serialType = item.key
  204. this.dataList = []
  205. this.$refs.customScrollList.refresh()
  206. },
  207. /**
  208. * 获取数据
  209. */
  210. async load(paging) {
  211. try{
  212. this.$refs.customScrollList.showPullUp = true
  213. let res = await this.$u.api.distributorList({
  214. noSign: 1,
  215. userid: this.distribution_user_info.userId,
  216. pageNum: 1,
  217. pageSize: 10,
  218. status: this.serialType
  219. })
  220. if(res && res.code ===200) {
  221. if(res.data.rows){
  222. this.dataList = res.data.rows.map(item => {
  223. item.checked = false;
  224. return {
  225. ...item,
  226. class: {
  227. 0: 'status-0',
  228. 1: 'status-1',
  229. 2: 'status-2',
  230. 3: 'status-3',
  231. 4: 'status-4',
  232. 5: 'status-5',
  233. 6: 'status-6',
  234. 7: 'status-7',
  235. 8: 'status-8'
  236. }[item.status] || ''
  237. }
  238. })
  239. this.totalPriceAll = res.data.realPrice
  240. }else {
  241. this.dataList = []
  242. }
  243. this.$refs.customScrollList.loadSuccess({
  244. list: this.dataList,
  245. total: this.dataList.length
  246. })
  247. } else {
  248. this.$refs.customScrollList.loadSuccess({
  249. list: [],
  250. total: res.data.total || this.dataList.length
  251. })
  252. }
  253. }catch(e){
  254. //TODO handle the exception
  255. console.error("e===",e)
  256. this.$refs.customScrollList.loadSuccess({
  257. list: [],
  258. total: this.dataList.length
  259. })
  260. }
  261. },
  262. paging(paging){
  263. console.log("下拉 加载数据")
  264. },
  265. /**
  266. * 下拉触底
  267. */
  268. async refresh(paging){
  269. console.log("上拉 加载数据")
  270. //this.$refs.customScrollList.showEmpty = true
  271. try{
  272. //this.$refs.customScrollList.showPullUp = true
  273. let res = await this.$u.api.distributorList({
  274. pageNum: paging.page,
  275. pageSize: paging.size,
  276. userid: this.distribution_user_info.userId,
  277. status: this.serialType
  278. })
  279. if(res && res.code ===200) {
  280. if(res.data.rows){
  281. this.dataList = [].concat(res.data.rows.map(item => {
  282. item.checked = false;
  283. return {
  284. ...item,
  285. class: {
  286. 0: 'status-0',
  287. 1: 'status-1',
  288. 2: 'status-2',
  289. 3: 'status-3',
  290. 4: 'status-4',
  291. 5: 'status-5',
  292. 6: 'status-6',
  293. 7: 'status-7',
  294. 8: 'status-8'
  295. }[item.status] || ''
  296. }
  297. }))
  298. }else {
  299. this.dataList = []
  300. }
  301. // this.marketPersonsSerialList = null
  302. this.$refs.customScrollList.refreshSuccess({
  303. list: this.dataList,
  304. total: this.dataList.length
  305. })
  306. } else {
  307. this.$refs.customScrollList.refreshSuccess({
  308. list: [],
  309. total: res.data.total || this.dataList.length
  310. })
  311. }
  312. }catch(e){
  313. //TODO handle the exception
  314. console.error("e===",e)
  315. this.$refs.customScrollList.refreshSuccess({
  316. list: [],
  317. total: this.dataList.length
  318. })
  319. }
  320. },
  321. /** 选择了提现数据 */
  322. // 切换全选状态
  323. allCheckboxChange(n) {
  324. // console.log('allCheckboxChange',n[0]);
  325. console.log('allCheckboxChange', n);
  326. let selectAll = n[0] ? true : false;
  327. this.dataList.forEach(item => {
  328. item.checked = selectAll
  329. })
  330. },
  331. checkboxClick() {
  332. // console.log('checkboxClick',this.allChecked);
  333. this.dataList.forEach(item => {
  334. item.checked = !this.allChecked
  335. })
  336. },
  337. checkboxChange(n) {
  338. // console.log('checkboxChange',n);
  339. },
  340. // 切换商品选中状态
  341. toggleCheck(index) {
  342. // console.log('toggleCheck',index);
  343. // if(this.dataList[index].status !== 3){
  344. // uni.showToast({
  345. // icon:'none',
  346. // title:'该状态不能退款',
  347. // duration:1000
  348. // })
  349. // return
  350. // }
  351. this.dataList[index].checked = !this.dataList[index].checked
  352. },
  353. submitorder() {
  354. let personList = this.selectGoods.map(item=>{
  355. return {personsId:item.id,withdrawTotal:item.withdrawTotal}
  356. });
  357. let params = {
  358. withdrawTotal:this.totalPrice,
  359. personList:JSON.stringify(personList)
  360. };
  361. // console.log('selectGoods', this.selectGoods);
  362. uni.$u.route('/pages/cash/index', params);
  363. },
  364. getViewers() {
  365. this.$u.api.distributorList({
  366. userid: this.distribution_user_info.userId
  367. }).then(res => {
  368. this.dataList = res.data.list.map(item => {
  369. item.checked = false;
  370. return {
  371. ...item,
  372. class: {
  373. 0: 'status-0',
  374. 1: 'status-1',
  375. 2: 'status-2',
  376. 3: 'status-3',
  377. 4: 'status-4',
  378. 5: 'status-5',
  379. 6: 'status-6',
  380. 7: 'status-7',
  381. 8: 'status-8'
  382. }[item.status] || ''
  383. }
  384. })
  385. }).catch(err => {
  386. console.log('getOrderDetails', err.data);
  387. })
  388. },
  389. }
  390. }
  391. </script>
  392. <style lang="scss" scoped>
  393. .consume-content {
  394. width: 100%;
  395. height: 100%;
  396. --header-h: 90rpx;
  397. .consume-content-info {
  398. width: 100%;
  399. height: 100%;
  400. display: flex;
  401. flex-direction: column;
  402. box-sizing: border-box;
  403. }
  404. }
  405. /** 头部主要内容 开始 */
  406. .consume-content-header {
  407. width: 100%;
  408. //height: var(--header-h);
  409. box-sizing: border-box;
  410. position: relative;
  411. ::v-deep .u-search {
  412. padding: 0 30rpx !important;
  413. }
  414. ::v-deep .u-search__action {
  415. color: #fff !important;
  416. }
  417. /** 余额 开始 */
  418. .consume-content-money {
  419. width: 100%;
  420. box-sizing: border-box;
  421. margin-top: 50rpx;
  422. padding-left: 66rpx;
  423. color: #fff;
  424. >text {
  425. font-size: 24rpx;
  426. }
  427. .consume-content-money-num {
  428. display: flex;
  429. justify-content: center;
  430. align-items: flex-start;
  431. flex-direction: column;
  432. margin-top: 24rpx;
  433. >text:nth-child(1) {
  434. .balance-userinfo-util {
  435. font-size: 24rpx;
  436. margin-left: 5rpx;
  437. }
  438. ::v-deep .u-count-num {
  439. font-weight: bold !important;
  440. font-size: 48rpx !important;
  441. }
  442. }
  443. >text:nth-child(2) {
  444. margin-top: 20rpx;
  445. font-size: 24rpx;
  446. }
  447. }
  448. }
  449. /** 余额 结束 */
  450. /** 提现 开始 */
  451. .consume-content-cash {
  452. width: 100%;
  453. box-sizing: border-box;
  454. position: absolute;
  455. top: 100%;
  456. transform: translateY(-50%);
  457. padding: 0 12rpx;
  458. .consume-content-consume-box {
  459. width: 100%;
  460. height: 100%;
  461. background-color: #fff;
  462. box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(221, 221, 221, 0.5);
  463. border-radius: 20rpx;
  464. box-sizing: border-box;
  465. padding: 34rpx 30rpx 38rpx;
  466. >text {
  467. font-size: 28rpx;
  468. color: #363636;
  469. }
  470. .consume-content-consume-money {
  471. width: 100%;
  472. display: flex;
  473. align-items: center;
  474. padding: 40rpx 0 20rpx;
  475. border-bottom: 2rpx solid #EEEEEE;
  476. ::v-deep .u-cell__body {
  477. padding: 20rpx 0 !important;
  478. }
  479. .consume-content-consume-input {
  480. width: 100%;
  481. padding: 0 10rpx;
  482. }
  483. >text {
  484. flex-shrink: 0;
  485. flex-wrap: nowrap;
  486. white-space: nowrap;
  487. }
  488. .consume-content-consume-money-icon {
  489. font-size: 32rpx;
  490. }
  491. .consume-content-consume-money-all {
  492. color: var(--gd-but-color);
  493. font-size: 24rpx;
  494. cursor: pointer;
  495. }
  496. }
  497. .consume-content-consume-card {
  498. width: 100%;
  499. ::v-deep .u-cell__body {
  500. padding: 20rpx 0 !important;
  501. }
  502. }
  503. .consume-content-consume-submit {
  504. width: 100%;
  505. height: 92rpx;
  506. display: flex;
  507. align-items: center;
  508. justify-content: center;
  509. box-sizing: border-box;
  510. padding: 0 80rpx 0;
  511. margin-top: 70rpx;
  512. >view {
  513. width: 100%;
  514. height: 100%;
  515. border-radius: 46rpx;
  516. color: #fff;
  517. background-color: var(--gd-but-color);
  518. font-size: 28rpx;
  519. font-family: SourceHanSansCN, SourceHanSansCN;
  520. display: flex;
  521. align-items: center;
  522. justify-content: center;
  523. }
  524. }
  525. }
  526. }
  527. /** 提现 结束 */
  528. }
  529. /** 头部主要内容 结束 **/
  530. /** 收支列表 开始 */
  531. .consume-content-list {
  532. width: 100%;
  533. height: 100%;
  534. background: #F7F7F9;
  535. // overflow: hidden;
  536. }
  537. /** 收支列表 结束 */
  538. .u-flex {
  539. display: flex;
  540. flex-direction: row;
  541. align-items: center;
  542. }
  543. .u-row-between {
  544. justify-content: space-between;
  545. }
  546. .u-row-around {
  547. justify-content: space-around;
  548. }
  549. .item-list{
  550. .item{
  551. width: 100%;
  552. background: #FFFFFF;
  553. border-radius: 10rpx;
  554. padding-left: 18rpx;
  555. margin-bottom: 24rpx;
  556. box-sizing: border-box;
  557. .item-box {
  558. width: 100%;
  559. padding: 10rpx 10rpx 15rpx;
  560. box-sizing: border-box;
  561. }
  562. .item-box-shadow {
  563. box-shadow: -6rpx 0rpx 20rpx -18rpx rgba(0,0,0,0.5);
  564. }
  565. .text{
  566. flex: 1;
  567. color: #999;
  568. .name{
  569. font-size: 24rpx;
  570. }
  571. .withdrawTotal{
  572. font-size: 24rpx;
  573. color: var(--gd-but-color);
  574. .num{
  575. font-size: 32rpx;
  576. }
  577. }
  578. }
  579. .text-order {
  580. padding: 10rpx 0;
  581. border-bottom: 1px solid rgba(204, 204, 204, 0.5);
  582. }
  583. .text-title {
  584. color: #000;
  585. font-weight: 600;
  586. padding: 10rpx 0;
  587. }
  588. .text-perform {
  589. padding: 10rpx 0 20rpx;
  590. }
  591. }
  592. }
  593. .cart-bottom {
  594. position: fixed;
  595. z-index: 1001;
  596. height: 98rpx;
  597. left: 0;
  598. right: 0;
  599. bottom: 0;
  600. .inner {
  601. background-color: #fff;
  602. height: 100%;
  603. left: 0;
  604. right: 0;
  605. bottom: 0;
  606. padding: 0 20rpx;
  607. padding-left: 0;
  608. .total-price-wrap {
  609. margin-left: 30rpx;
  610. .totalPrice{
  611. font-size: 30rpx;
  612. color: #333;
  613. font-weight: 400;
  614. .num{
  615. font-size: 40rpx;
  616. font-weight: bold;
  617. color: #ED0000;
  618. margin-left: 5px;
  619. }
  620. }
  621. .total{
  622. font-size: 20rpx;
  623. font-weight: 400;
  624. color: #999999;
  625. margin-right: 16rpx;
  626. }
  627. }
  628. .btn {
  629. height: 80rpx;
  630. line-height: 80rpx;
  631. border-radius: 50rpx;
  632. padding: 0 50rpx;
  633. background-color: #eee;
  634. color: #333;
  635. text-align: center;
  636. &.active {
  637. background-color: #FF3C3F;
  638. color: #fff;
  639. }
  640. }
  641. }
  642. }
  643. </style>