index.vue 3.1 KB

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