timeRule.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. export default {
  23. data() {
  24. return {
  25. globalUser:{},
  26. equipmentList: [],
  27. merchantList:[{equipmentList:[]}],
  28. extraIcon: {
  29. color: '#4cd964',
  30. size: '22',
  31. type: 'spinner'
  32. }
  33. }
  34. },
  35. onShow(state){
  36. this.globalUser = uni.getStorageSync("globalUser");
  37. this.init();
  38. },
  39. onLoad(state){
  40. // this.init();
  41. },
  42. onPullDownRefresh() {
  43. this.init();
  44. },
  45. methods: {
  46. ...mapActions('chart', ['getEquipmentListByUser']),
  47. async init(){
  48. await this.getEquipmentListData();
  49. },
  50. openEquipmentStatisticsByAdmin(merchant){
  51. uni.setStorageSync("timeSet",merchant.id);
  52. uni.setStorageSync("bootTime",merchant.bootTime);
  53. uni.setStorageSync("offTime",merchant.offTime);
  54. uni.navigateTo({
  55. url: 'timeSelect',
  56. });
  57. },
  58. getMerchantTitle(merchant){
  59. return merchant.name?merchant.name:merchant.username;
  60. },
  61. getEquipmentListData(){
  62. this.getEquipmentListByUser(this.globalUser)
  63. .then(data => {
  64. this.merchantList = data;
  65. this.equipmentList = data[0].equipmentList;
  66. uni.stopPullDownRefresh();
  67. }
  68. , _ => void uni.stopPullDownRefresh());
  69. }
  70. }
  71. }
  72. </script>
  73. <style>
  74. </style>