index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. showDataLoading: false,
  67. serviceTimeShow: false,
  68. show: false,
  69. mode: 'single',
  70. searchTime: '2023-8-9',
  71. value1: '',
  72. dataTime:'',
  73. tranRecordsList: [],
  74. tranFlowstatistic: {}
  75. };
  76. },
  77. onLoad() {
  78. let sysInfo = uni.getSystemInfoSync()
  79. this.windowHeight =sysInfo.windowHeight-94+'px'//除标题栏栏外的屏幕可用高度
  80. this.value1 = Date.now();
  81. // 查询交流流水统计
  82. this.transactionFlowstatistic();
  83. },
  84. methods: {
  85. clickTab(e){
  86. this.tabIndex = e.index
  87. },
  88. swiperChange(e){
  89. this.tabIndex = e.detail.current
  90. // if (this.$refs.MescrollItem[e.detail.current].orderList.length>0){
  91. // this.$refs.MescrollItem[e.detail.current].downCallback()
  92. // }
  93. },
  94. // 确定选择的服务日期
  95. sureChooseDate(e){
  96. this.serviceTimeShow = false;
  97. this.dataTime = uni.$u.timeFormat(e.value, 'yyyy-mm');
  98. this.$refs.MescrollItem[this.tabIndex].downCallback()
  99. },
  100. // 交易列表
  101. // 查询交易流水统计
  102. transactionFlowstatistic(){
  103. let that = this;
  104. that.showDataLoading = true;
  105. this.$api.transactionFlowstatistic({data:this.reqParm}).then((res)=>{
  106. that.tranFlowstatistic = res.data.data;
  107. that.showDataLoading = false;
  108. }).catch(() =>{
  109. uni.showToast({
  110. title: "操作失败"
  111. })
  112. });
  113. },
  114. // 详情
  115. orderDetail(item){
  116. uni.$u.route({
  117. url: '/pages/transaction/transaction-detail',
  118. params: {
  119. data: JSON.stringify(item)
  120. }
  121. })
  122. },
  123. showDate(){
  124. // this.show = true;
  125. this.serviceTimeShow = true;
  126. },
  127. confirm(e) {
  128. this.searchTime = e[0];
  129. this.show = false;
  130. },
  131. close() {
  132. this.show = false;
  133. },
  134. maxDate(selectedMonth) {
  135. if (!this.$isDataEmpty(selectedMonth)) {
  136. // 将选定的月份转换为Date对象
  137. let selected = new Date(selectedMonth);
  138. // 获取下个月的第一天
  139. let nextMonth = new Date(selected.getFullYear(), selected.getMonth() + 1, 1);
  140. // 获取本月的最后一天
  141. let lastDay = new Date(nextMonth - 1);
  142. // 返回最大日期
  143. return lastDay.toISOString().slice(0, 10);
  144. } else {
  145. // 如果没有选定月份,则返回当前月份的最大日期
  146. let today = new Date();
  147. let nextMonth = new Date(today.getFullYear(), today.getMonth() + 1, 1);
  148. let lastDay = new Date(nextMonth - 1);
  149. return lastDay.toISOString().slice(0, 10);
  150. }
  151. }
  152. },
  153. };
  154. </script>
  155. <style lang="scss" scoped>
  156. @import '/common/css/common.css';
  157. @import './index.rpx.css';
  158. </style>