index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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" :end="endDate" @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.00'}}</text>
  26. <text>消费:{{tranFlowstatistic.consumeAmount || '0.00' }}</text>
  27. <text>退款:{{tranFlowstatistic.refundAmount || '0.00' }}</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. computed: {
  81. endDate() {
  82. return this.getDate('end');
  83. }
  84. },
  85. methods: {
  86. getDate(type) {
  87. const date = new Date();
  88. let year = date.getFullYear();
  89. let month = date.getMonth() + 1;
  90. let day = date.getDate();
  91. if (type === 'start') {
  92. year = year - 60;
  93. } else if (type === 'end') {
  94. year = year ;
  95. }
  96. month = month > 9 ? month : '0' + month;
  97. day = day > 9 ? day : '0' + day;
  98. return `${year}-${month}-${day}`;
  99. },
  100. clickTab(e){
  101. this.tabIndex = e.index
  102. },
  103. swiperChange(e){
  104. this.tabIndex = e.detail.current
  105. this.transactionFlowstatistic()
  106. // if (this.$refs.MescrollItem[e.detail.current].orderList.length>0){
  107. // this.$refs.MescrollItem[e.detail.current].downCallback()
  108. // }
  109. },
  110. // 确定选择的服务日期
  111. sureChooseDate(e){
  112. this.dataTime = e.detail.value
  113. setTimeout(f=>{
  114. this.$refs.MescrollItem[this.tabIndex].downCallback()
  115. },100)
  116. this.transactionFlowstatistic()
  117. },
  118. // 交易列表
  119. // 查询交易流水统计
  120. transactionFlowstatistic(){
  121. let that = this;
  122. let param = {
  123. dataTime:this.dataTime,
  124. tradeNoType:this.tabIndex
  125. }
  126. if (this.tabIndex === 0){
  127. param={
  128. dataTime:this.dataTime
  129. }
  130. }
  131. this.$api.transactionFlowstatistic(param).then((res)=>{
  132. that.tranFlowstatistic = res.data.data;
  133. })
  134. },
  135. // 详情
  136. orderDetail(item){
  137. uni.$u.route({
  138. url: '/pages/transaction/transaction-detail',
  139. params: {
  140. data: JSON.stringify(item)
  141. }
  142. })
  143. },
  144. showDate(){
  145. this.dataTime = '';
  146. setTimeout(f=>{
  147. this.$refs.MescrollItem[this.tabIndex].downCallback()
  148. },100)
  149. this.transactionFlowstatistic()
  150. },
  151. maxDate(selectedMonth) {
  152. if (!this.$isDataEmpty(selectedMonth)) {
  153. // 将选定的月份转换为Date对象
  154. let selected = new Date(selectedMonth);
  155. // 获取下个月的第一天
  156. let nextMonth = new Date(selected.getFullYear(), selected.getMonth() + 1, 1);
  157. // 获取本月的最后一天
  158. let lastDay = new Date(nextMonth - 1);
  159. // 返回最大日期
  160. return lastDay.toISOString().slice(0, 10);
  161. } else {
  162. // 如果没有选定月份,则返回当前月份的最大日期
  163. let today = new Date();
  164. let nextMonth = new Date(today.getFullYear(), today.getMonth() + 1, 1);
  165. let lastDay = new Date(nextMonth - 1);
  166. return lastDay.toISOString().slice(0, 10);
  167. }
  168. }
  169. },
  170. };
  171. </script>
  172. <style lang="scss" scoped>
  173. @import '/common/css/common.css';
  174. @import './index.rpx.css';
  175. </style>