salary.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view>
  3. <view v-if="null === data || undefined === data" style="text-align: center;padding: 50px 0;">
  4. <view>
  5. 暂无数据
  6. </view>
  7. </view>
  8. <uni-list v-for="item in data">
  9. <uni-list-item :clickable="true" @click="toSlipPage(item.data)" :title="item.date"
  10. :note="'收入:'+item.fsalary+' 元'" />
  11. </uni-list>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. data() {
  17. return {
  18. data: {}
  19. }
  20. },
  21. onLoad() {
  22. this.getSalarySlip()
  23. },
  24. onShow() {
  25. this.getSalarySlip()
  26. },
  27. methods: {
  28. toSlipPage(data) {
  29. uni.setStorageSync("salarySlipData", data)
  30. this.$goto("salarySlip")
  31. },
  32. async getSalarySlip() {
  33. const {
  34. data: res
  35. } = await this.$httpRequest({
  36. url: '/api/ci/sl/?un=' + uni.getStorageSync("setUserName") + "&oc=" + uni
  37. .getStorageSync("orgInfo").organizationCode,
  38. method: 'get',
  39. })
  40. if (res.code == 200) {
  41. this.data = res.data
  42. } else {
  43. }
  44. },
  45. dateResult(time, mode) {
  46. const timeFormat = uni.$u.timeFormat
  47. switch (mode) {
  48. case 'datetime':
  49. return timeFormat(time, 'yyyy-mm-dd hh:MM:ss')
  50. case 'date':
  51. return timeFormat(time, 'yyyy-mm-dd')
  52. case 'year-month':
  53. return timeFormat(time, 'yyyy-mm')
  54. case 'time':
  55. return time
  56. default:
  57. return ''
  58. }
  59. }
  60. }
  61. }
  62. </script>
  63. <style>
  64. page {
  65. padding: 5rpx;
  66. }
  67. .listBody {}
  68. .mylist {
  69. padding: 5px;
  70. border-bottom: 1px solid #ababab;
  71. }
  72. </style>