index.vue 16 KB

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