index.vue 16 KB

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