timeRule.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <view>
  3. <view >
  4. <uni-collapse :accordion="true">
  5. <uni-list>
  6. <view v-for="equipment in equipmentList" :key="equipment.id">
  7. <uni-list-item :title="getMerchantTitle(equipment)" @click="openEquipmentStatisticsByAdmin(equipment)"/>
  8. </view>
  9. </uni-list>
  10. </uni-collapse>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. import uniList from '@/components/uni-list/uni-list.vue'
  16. import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
  17. import {
  18. mapState,
  19. mapActions,
  20. mapMutations
  21. } from 'vuex'
  22. import {
  23. dateUtils
  24. } from '@/common/util.js';
  25. export default {
  26. data() {
  27. return {
  28. globalUser:{},
  29. equipmentList: [],
  30. merchantList:[{equipmentList:[]}],
  31. extraIcon: {
  32. color: '#4cd964',
  33. size: '22',
  34. type: 'spinner'
  35. }
  36. }
  37. },
  38. onShow(state){
  39. this.globalUser = uni.getStorageSync("globalUser");
  40. this.globalUser.todayDate = dateUtils.getCurrentDate();
  41. this.init();
  42. },
  43. onLoad(state){
  44. // this.init();
  45. },
  46. onPullDownRefresh() {
  47. this.init();
  48. },
  49. methods: {
  50. ...mapActions('chart', ['getEquipmentListByUser']),
  51. async init(){
  52. await this.getEquipmentListData();
  53. },
  54. openEquipmentStatisticsByAdmin(merchant){
  55. uni.setStorageSync("timeSet",merchant.id);
  56. uni.setStorageSync("bootTime",merchant.bootTime);
  57. uni.setStorageSync("offTime",merchant.offTime);
  58. uni.navigateTo({
  59. url: 'timeSelect',
  60. });
  61. },
  62. getMerchantTitle(merchant){
  63. return merchant.name?merchant.name:merchant.username;
  64. },
  65. getEquipmentListData(){
  66. this.getEquipmentListByUser(this.globalUser)
  67. .then(data => {
  68. this.merchantList = data;
  69. this.equipmentList = data[0].equipmentList;
  70. uni.stopPullDownRefresh();
  71. }
  72. , _ => void uni.stopPullDownRefresh());
  73. }
  74. }
  75. }
  76. </script>
  77. <style>
  78. </style>