index.vue 5.6 KB

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