index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  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" :disabled="item.ifUnionShare === 1" @change="toggleCheck(index)" class="checkbox" />
  36. <view :class="['item-box',serialType==0||serialType==2 ? 'item-box-shadow':'']" @click="showInfo(item)">
  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. // console.log('selectAll', selectAll);
  340. this.dataList.forEach(item => {
  341. if(item.ifUnionShare === 1) {
  342. item.checked = false
  343. } else {
  344. item.checked = selectAll
  345. }
  346. })
  347. },
  348. checkboxClick() {
  349. // console.log('checkboxClick',this.allChecked);
  350. this.dataList.forEach(item => {
  351. item.checked = !this.allChecked
  352. })
  353. },
  354. checkboxChange(n) {
  355. // console.log('checkboxChange',n);
  356. },
  357. // 切换商品选中状态
  358. toggleCheck(index) {
  359. // console.log('toggleCheck',index);
  360. // if(this.dataList[index].status !== 3){
  361. // uni.showToast({
  362. // icon:'none',
  363. // title:'该状态不能退款',
  364. // duration:1000
  365. // })
  366. // return
  367. // }
  368. this.dataList[index].checked = !this.dataList[index].checked
  369. },
  370. //
  371. showInfo(item) {
  372. if(item.ifUnionShare === 1) {
  373. uni.showModal({
  374. title: '提示',
  375. content: '因分销系统内部更新,2025年4月20日之前产生的分销佣金,将会延迟10-15个工作日发放,给您带来不便,我们深感抱歉。',
  376. showCancel: false,
  377. confirmText: '关闭',
  378. success: res => {
  379. // console.log(11,'111');
  380. },
  381. complete() {
  382. }
  383. })
  384. }
  385. },
  386. submitorder() {
  387. let personList = this.selectGoods.map(item=>{
  388. return {personsId:item.id,withdrawTotal:item.withdrawTotal}
  389. });
  390. let params = {
  391. withdrawTotal:this.totalPrice,
  392. personList:JSON.stringify(personList)
  393. };
  394. // console.log('selectGoods', this.selectGoods);
  395. uni.$u.route('/pages/cash/index', params);
  396. },
  397. getViewers() {
  398. this.$u.api.distributorList({
  399. userid: this.distribution_user_info.userId
  400. }).then(res => {
  401. this.dataList = res.data.list.map(item => {
  402. item.checked = false;
  403. return {
  404. ...item,
  405. class: {
  406. 0: 'status-0',
  407. 1: 'status-1',
  408. 2: 'status-2',
  409. 3: 'status-3',
  410. 4: 'status-4',
  411. 5: 'status-5',
  412. 6: 'status-6',
  413. 7: 'status-7',
  414. 8: 'status-8'
  415. }[item.status] || ''
  416. }
  417. })
  418. }).catch(err => {
  419. console.log('getOrderDetails', err.data);
  420. })
  421. },
  422. }
  423. }
  424. </script>
  425. <style lang="scss" scoped>
  426. .consume-content {
  427. width: 100%;
  428. height: 100%;
  429. --header-h: 90rpx;
  430. .consume-content-info {
  431. width: 100%;
  432. height: 100%;
  433. display: flex;
  434. flex-direction: column;
  435. box-sizing: border-box;
  436. }
  437. }
  438. /** 头部主要内容 开始 */
  439. .consume-content-header {
  440. width: 100%;
  441. //height: var(--header-h);
  442. box-sizing: border-box;
  443. position: relative;
  444. ::v-deep .u-search {
  445. padding: 0 30rpx !important;
  446. }
  447. ::v-deep .u-search__action {
  448. color: #fff !important;
  449. }
  450. /** 余额 开始 */
  451. .consume-content-money {
  452. width: 100%;
  453. box-sizing: border-box;
  454. margin-top: 50rpx;
  455. padding-left: 66rpx;
  456. color: #fff;
  457. >text {
  458. font-size: 24rpx;
  459. }
  460. .consume-content-money-num {
  461. display: flex;
  462. justify-content: center;
  463. align-items: flex-start;
  464. flex-direction: column;
  465. margin-top: 24rpx;
  466. >text:nth-child(1) {
  467. .balance-userinfo-util {
  468. font-size: 24rpx;
  469. margin-left: 5rpx;
  470. }
  471. ::v-deep .u-count-num {
  472. font-weight: bold !important;
  473. font-size: 48rpx !important;
  474. }
  475. }
  476. >text:nth-child(2) {
  477. margin-top: 20rpx;
  478. font-size: 24rpx;
  479. }
  480. }
  481. }
  482. /** 余额 结束 */
  483. /** 提现 开始 */
  484. .consume-content-cash {
  485. width: 100%;
  486. box-sizing: border-box;
  487. position: absolute;
  488. top: 100%;
  489. transform: translateY(-50%);
  490. padding: 0 12rpx;
  491. .consume-content-consume-box {
  492. width: 100%;
  493. height: 100%;
  494. background-color: #fff;
  495. box-shadow: 0rpx 2rpx 12rpx 0rpx rgba(221, 221, 221, 0.5);
  496. border-radius: 20rpx;
  497. box-sizing: border-box;
  498. padding: 34rpx 30rpx 38rpx;
  499. >text {
  500. font-size: 28rpx;
  501. color: #363636;
  502. }
  503. .consume-content-consume-money {
  504. width: 100%;
  505. display: flex;
  506. align-items: center;
  507. padding: 40rpx 0 20rpx;
  508. border-bottom: 2rpx solid #EEEEEE;
  509. ::v-deep .u-cell__body {
  510. padding: 20rpx 0 !important;
  511. }
  512. .consume-content-consume-input {
  513. width: 100%;
  514. padding: 0 10rpx;
  515. }
  516. >text {
  517. flex-shrink: 0;
  518. flex-wrap: nowrap;
  519. white-space: nowrap;
  520. }
  521. .consume-content-consume-money-icon {
  522. font-size: 32rpx;
  523. }
  524. .consume-content-consume-money-all {
  525. color: var(--gd-but-color);
  526. font-size: 24rpx;
  527. cursor: pointer;
  528. }
  529. }
  530. .consume-content-consume-card {
  531. width: 100%;
  532. ::v-deep .u-cell__body {
  533. padding: 20rpx 0 !important;
  534. }
  535. }
  536. .consume-content-consume-submit {
  537. width: 100%;
  538. height: 92rpx;
  539. display: flex;
  540. align-items: center;
  541. justify-content: center;
  542. box-sizing: border-box;
  543. padding: 0 80rpx 0;
  544. margin-top: 70rpx;
  545. >view {
  546. width: 100%;
  547. height: 100%;
  548. border-radius: 46rpx;
  549. color: #fff;
  550. background-color: var(--gd-but-color);
  551. font-size: 28rpx;
  552. font-family: SourceHanSansCN, SourceHanSansCN;
  553. display: flex;
  554. align-items: center;
  555. justify-content: center;
  556. }
  557. }
  558. }
  559. }
  560. /** 提现 结束 */
  561. }
  562. /** 头部主要内容 结束 **/
  563. /** 收支列表 开始 */
  564. .consume-content-list {
  565. width: 100%;
  566. height: 100%;
  567. background: #F7F7F9;
  568. // overflow: hidden;
  569. }
  570. /** 收支列表 结束 */
  571. .u-flex {
  572. display: flex;
  573. flex-direction: row;
  574. align-items: center;
  575. }
  576. .u-row-between {
  577. justify-content: space-between;
  578. }
  579. .u-row-around {
  580. justify-content: space-around;
  581. }
  582. .item-list{
  583. .item{
  584. width: 100%;
  585. background: #FFFFFF;
  586. border-radius: 10rpx;
  587. padding-left: 18rpx;
  588. margin-bottom: 24rpx;
  589. box-sizing: border-box;
  590. .item-box {
  591. width: 100%;
  592. padding: 10rpx 10rpx 15rpx;
  593. box-sizing: border-box;
  594. }
  595. .item-box-shadow {
  596. box-shadow: -6rpx 0rpx 20rpx -18rpx rgba(0,0,0,0.5);
  597. }
  598. .text{
  599. flex: 1;
  600. color: #999;
  601. .name{
  602. font-size: 24rpx;
  603. }
  604. .withdrawTotal{
  605. font-size: 24rpx;
  606. color: var(--gd-but-color);
  607. .num{
  608. font-size: 32rpx;
  609. }
  610. }
  611. }
  612. .text-order {
  613. padding: 10rpx 0;
  614. border-bottom: 1px solid rgba(204, 204, 204, 0.5);
  615. }
  616. .text-title {
  617. color: #000;
  618. font-weight: 600;
  619. padding: 10rpx 0;
  620. }
  621. .text-perform {
  622. padding: 10rpx 0 20rpx;
  623. }
  624. }
  625. }
  626. .cart-bottom {
  627. position: fixed;
  628. z-index: 1001;
  629. height: 98rpx;
  630. left: 0;
  631. right: 0;
  632. bottom: 0;
  633. .inner {
  634. background-color: #fff;
  635. height: 100%;
  636. left: 0;
  637. right: 0;
  638. bottom: 0;
  639. padding: 0 20rpx;
  640. padding-left: 0;
  641. .total-price-wrap {
  642. margin-left: 30rpx;
  643. .totalPrice{
  644. font-size: 30rpx;
  645. color: #333;
  646. font-weight: 400;
  647. .num{
  648. font-size: 40rpx;
  649. font-weight: bold;
  650. color: #ED0000;
  651. margin-left: 5px;
  652. }
  653. }
  654. .total{
  655. font-size: 20rpx;
  656. font-weight: 400;
  657. color: #999999;
  658. margin-right: 16rpx;
  659. }
  660. }
  661. .btn {
  662. height: 80rpx;
  663. line-height: 80rpx;
  664. border-radius: 50rpx;
  665. padding: 0 50rpx;
  666. background-color: #eee;
  667. color: #333;
  668. text-align: center;
  669. &.active {
  670. background-color: #FF3C3F;
  671. color: #fff;
  672. }
  673. }
  674. }
  675. }
  676. </style>