index.vue 5.7 KB

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