index.vue 14 KB

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