index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <view class="content">
  3. <view class="one">
  4. <picker :range="years" @change="yearChange">
  5. {{ years[yearsIndex] }}
  6. <text v-if="yearsIndex!=0">年</text>
  7. </picker>
  8. </view>
  9. <view class="two">
  10. <scroll-view scroll-y="true" class="scroll-view">
  11. <view class="list-scroll-view">
  12. <view class="list" v-for="(item,index) in list" :key="index" @tap="toInfo(item)">
  13. <view class="list_1">
  14. {{item.year||'暂无'}}
  15. </view>
  16. <view class="list_2">
  17. 总回款金额:
  18. <text>¥{{item.money||'0'}}</text>
  19. </view>
  20. </view>
  21. </view>
  22. </scroll-view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. // 系统设置
  31. config: {},
  32. user: {},
  33. searchInfo: {},
  34. list: [],
  35. years: ["请选择年份", 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036,
  36. 2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2045, 2047, 2048, 2049, 2050
  37. ],
  38. yearsIndex: 0
  39. }
  40. },
  41. onLoad: function(e) {
  42. const that = this;
  43. },
  44. onShow: async function(e) {
  45. const that = this;
  46. that.searchToken();
  47. },
  48. onPullDownRefresh: async function() {
  49. const that = this;
  50. await that.search();
  51. uni.stopPullDownRefresh();
  52. },
  53. methods: {
  54. searchToken() {
  55. const that = this;
  56. try {
  57. const res = uni.getStorageSync('token');
  58. if (res) {
  59. that.$set(that, `user`, res);
  60. }
  61. } catch (e) {
  62. uni.showToast({
  63. title: err.errmsg,
  64. icon: 'error',
  65. duration: 2000
  66. });
  67. }
  68. },
  69. async search() {
  70. const that = this;
  71. let user = that.user;
  72. let info = {
  73. time: that.years[that.yearsIndex],
  74. supplier: user._id,
  75. };
  76. let res;
  77. res = await that.$api(`/Statistics/orderDetail`, 'GET', {
  78. ...info
  79. });
  80. if (res.errcode == '0') {
  81. that.$set(that, `list`, res.data);
  82. } else {
  83. uni.showToast({
  84. title: res.errmsg,
  85. icon: 'none'
  86. })
  87. }
  88. },
  89. yearChange: function(e) {
  90. const that = this;
  91. that.$set(that, `yearsIndex`, e.detail.value);
  92. if (that.yearsIndex != 0) that.search();
  93. },
  94. // 查看详情
  95. toInfo(e) {
  96. console.log(e);
  97. },
  98. }
  99. }
  100. </script>
  101. <style lang="scss">
  102. .content {
  103. display: flex;
  104. flex-direction: column;
  105. width: 100vw;
  106. height: 100vh;
  107. .one {
  108. padding: 2vw;
  109. }
  110. .two {
  111. position: relative;
  112. flex-grow: 1;
  113. background-color: var(--f9Color);
  114. .list {
  115. background-color: #fff;
  116. border: 1px solid var(--f5Color);
  117. padding: 2vw;
  118. margin: 2vw 2vw 0 2vw;
  119. border-radius: 5px;
  120. .list_1 {
  121. padding: 0 1vw;
  122. font-size: var(--font16Size);
  123. font-weight: bold;
  124. }
  125. .list_2:last-child {
  126. padding: 1vw;
  127. font-size: var(--font14Size);
  128. text {
  129. color: var(--fF0Color);
  130. }
  131. }
  132. }
  133. }
  134. }
  135. .scroll-view {
  136. position: absolute;
  137. top: 0;
  138. left: 0;
  139. right: 0;
  140. bottom: 0;
  141. .list-scroll-view {
  142. display: flex;
  143. flex-direction: column;
  144. }
  145. }
  146. </style>