index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. };
  75. if (user.role == 'cs') info.supplier = user._id;
  76. else if (user.role == 'ld') info.c_leader = user._id;
  77. else info.c_accounting = user._id;
  78. let res;
  79. res = await that.$api(`/Statistics/orderDetail`, 'GET', {
  80. ...info
  81. });
  82. if (res.errcode == '0') {
  83. that.$set(that, `list`, res.data);
  84. } else {
  85. uni.showToast({
  86. title: res.errmsg,
  87. icon: 'none'
  88. })
  89. }
  90. },
  91. yearChange: function(e) {
  92. const that = this;
  93. that.$set(that, `yearsIndex`, e.detail.value);
  94. if (that.yearsIndex != 0) that.search();
  95. },
  96. // 查看详情
  97. toInfo(e) {
  98. console.log(e);
  99. },
  100. }
  101. }
  102. </script>
  103. <style lang="scss">
  104. .content {
  105. display: flex;
  106. flex-direction: column;
  107. width: 100vw;
  108. height: 100vh;
  109. .one {
  110. padding: 2vw;
  111. }
  112. .two {
  113. position: relative;
  114. flex-grow: 1;
  115. background-color: var(--f9Color);
  116. .list {
  117. background-color: #fff;
  118. border: 1px solid var(--f5Color);
  119. padding: 2vw;
  120. margin: 2vw 2vw 0 2vw;
  121. border-radius: 5px;
  122. .list_1 {
  123. padding: 0 1vw;
  124. font-size: var(--font16Size);
  125. font-weight: bold;
  126. }
  127. .list_2:last-child {
  128. padding: 1vw;
  129. font-size: var(--font14Size);
  130. text {
  131. color: var(--fF0Color);
  132. }
  133. }
  134. }
  135. }
  136. }
  137. .scroll-view {
  138. position: absolute;
  139. top: 0;
  140. left: 0;
  141. right: 0;
  142. bottom: 0;
  143. .list-scroll-view {
  144. display: flex;
  145. flex-direction: column;
  146. }
  147. }
  148. </style>