1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <template>
- <view>
- <view >
- <uni-collapse :accordion="true">
- <uni-list>
- <view v-for="equipment in equipmentList" :key="equipment.id">
- <uni-list-item :title="getMerchantTitle(equipment)" @click="openEquipmentStatisticsByAdmin(equipment)"/>
- </view>
- </uni-list>
- </uni-collapse>
- </view>
- </view>
- </template>
- <script>
- import uniList from '@/components/uni-list/uni-list.vue'
- import uniListItem from '@/components/uni-list-item/uni-list-item.vue'
- import {
- mapState,
- mapActions,
- mapMutations
- } from 'vuex'
- export default {
- data() {
- return {
- globalUser:{},
- equipmentList: [],
- merchantList:[{equipmentList:[]}],
- extraIcon: {
- color: '#4cd964',
- size: '22',
- type: 'spinner'
- }
- }
- },
- onShow(state){
- this.globalUser = uni.getStorageSync("globalUser");
- this.init();
- },
- onLoad(state){
- // this.init();
- },
- onPullDownRefresh() {
- this.init();
- },
- methods: {
- ...mapActions('chart', ['getEquipmentListByUser']),
- async init(){
- await this.getEquipmentListData();
- },
- openEquipmentStatisticsByAdmin(merchant){
- uni.setStorageSync("timeSet",merchant.id);
- uni.setStorageSync("bootTime",merchant.bootTime);
- uni.setStorageSync("offTime",merchant.offTime);
- uni.navigateTo({
- url: 'timeSelect',
- });
- },
- getMerchantTitle(merchant){
- return merchant.name?merchant.name:merchant.username;
- },
- getEquipmentListData(){
- this.getEquipmentListByUser(this.globalUser)
- .then(data => {
- this.merchantList = data;
- this.equipmentList = data[0].equipmentList;
- uni.stopPullDownRefresh();
- }
- , _ => void uni.stopPullDownRefresh());
- }
- }
- }
- </script>
- <style>
- </style>
|