index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <view class="page">
  3. <u-sticky :disabled="isSticky">
  4. <View class=" tabs">
  5. <u-tabs :list="tabList" :scrollable="false"
  6. lineWidth="30"
  7. lineColor="#FFE05C"
  8. :activeStyle="{
  9. color: '#333333',
  10. fontWeight: 'bold',
  11. transform: 'scale(1.05)'
  12. }"
  13. :current="tabIndex" @click="clickTab"></u-tabs>
  14. </View>
  15. <view class="statistics flex-row justify-between ">
  16. <picker class="picker" @change="sureChooseDate" mode='date' fields="month" range-key="label" >
  17. <view class="left flex-row" @click="showDate">
  18. <text>{{dataTime || '全部'}}</text>
  19. <image class="xialaImage" src="/static/transaction/u5.png"></image>
  20. </view>
  21. </picker>
  22. <view class="right flex-row justify-around">
  23. <text>储值¥{{tranFlowstatistic.rechargeAmount || 0}}</text>
  24. <text>消费-¥{{tranFlowstatistic.consumeAmount || 0 }}</text>
  25. <text>退款-¥{{tranFlowstatistic.refundAmount || 0 }}</text>
  26. </view>
  27. </view>
  28. </u-sticky>
  29. <!-- 订单列表 -->
  30. <view :style="{'height':windowHeight}" >
  31. <swiper :style="{'height':windowHeight}" :current="tabIndex" @change="swiperChange">
  32. <swiper-item class="swiperItem" v-for="(item,index) in tabList" :key="index" >
  33. <view>
  34. <mescroll-item ref="MescrollItem" :i="index" :index="tabIndex" :dataTime="dataTime" :tabs="tabList" :height="windowHeight">
  35. </mescroll-item>
  36. </view>
  37. </swiper-item>
  38. </swiper>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import MescrollItem from "./module/mescrollUni-item.vue";
  44. export default {
  45. components: {
  46. MescrollItem
  47. },
  48. data() {
  49. return {
  50. windowHeight:'',
  51. tabIndex:0,
  52. tabList: [{
  53. name: '全部',
  54. }, {
  55. name: '消费'
  56. }, {
  57. name: '储值',
  58. }, {
  59. name: '退款'
  60. }],
  61. serviceTimeShow: false,
  62. show: false,
  63. searchTime: '2023-8-9',
  64. value1: '',
  65. dataTime:'',
  66. tranFlowstatistic: {}
  67. };
  68. },
  69. onLoad() {
  70. let sysInfo = uni.getSystemInfoSync()
  71. this.windowHeight =sysInfo.windowHeight-94+'px'//除标题栏栏外的屏幕可用高度
  72. this.value1 = Date.now();
  73. // 查询交流流水统计
  74. this.transactionFlowstatistic();
  75. },
  76. methods: {
  77. clickTab(e){
  78. this.tabIndex = e.index
  79. },
  80. swiperChange(e){
  81. this.tabIndex = e.detail.current
  82. // if (this.$refs.MescrollItem[e.detail.current].orderList.length>0){
  83. // this.$refs.MescrollItem[e.detail.current].downCallback()
  84. // }
  85. },
  86. // 确定选择的服务日期
  87. sureChooseDate(e){
  88. this.dataTime = e.detail.value
  89. setTimeout(f=>{
  90. this.$refs.MescrollItem[this.tabIndex].downCallback()
  91. },100)
  92. },
  93. // 交易列表
  94. // 查询交易流水统计
  95. transactionFlowstatistic(){
  96. let that = this;
  97. this.$api.transactionFlowstatistic({data:this.reqParm}).then((res)=>{
  98. that.tranFlowstatistic = res.data.data;
  99. }).catch(() =>{
  100. uni.showToast({
  101. title: "操作失败"
  102. })
  103. });
  104. },
  105. // 详情
  106. orderDetail(item){
  107. uni.$u.route({
  108. url: '/pages/transaction/transaction-detail',
  109. params: {
  110. data: JSON.stringify(item)
  111. }
  112. })
  113. },
  114. showDate(){
  115. this.serviceTimeShow = true;
  116. },
  117. maxDate(selectedMonth) {
  118. if (!this.$isDataEmpty(selectedMonth)) {
  119. // 将选定的月份转换为Date对象
  120. let selected = new Date(selectedMonth);
  121. // 获取下个月的第一天
  122. let nextMonth = new Date(selected.getFullYear(), selected.getMonth() + 1, 1);
  123. // 获取本月的最后一天
  124. let lastDay = new Date(nextMonth - 1);
  125. // 返回最大日期
  126. return lastDay.toISOString().slice(0, 10);
  127. } else {
  128. // 如果没有选定月份,则返回当前月份的最大日期
  129. let today = new Date();
  130. let nextMonth = new Date(today.getFullYear(), today.getMonth() + 1, 1);
  131. let lastDay = new Date(nextMonth - 1);
  132. return lastDay.toISOString().slice(0, 10);
  133. }
  134. }
  135. },
  136. };
  137. </script>
  138. <style lang="scss" scoped>
  139. @import '/common/css/common.css';
  140. @import './index.rpx.css';
  141. </style>