<template>
  <div>
  <div style="margin-top:50px;">
    <!-- <span class="title">打印设置</span> -->
    <group title="打印设置">
      <cell title="默认" @click.native="onClick(0)">
        <icon v-if="(type === 0)" type="success_no_circle"></icon>
      </cell>
      <cell title="全部数据" @click.native="onClick(1)">
        <icon v-if="(type === 1)" type="success_no_circle"></icon>
      </cell>
    </group>
    <box gap="20px 10px">
      <x-button type="primary" @click.native="save">保存</x-button>
    </box>
  </div>
  <toast v-model="showInfo" type="text" :time="2000">{{info}}</toast>
</div>
</template>

<script>
import { Group, Cell, Badge, XButton, Box, Icon, Toast, Loading } from 'vux'

export default {
  name: 'setting',
  components: {
    Cell,
    Group,
    Badge,
    XButton,
    Box,
    Icon,
    Toast,
    Loading
  },
  data() {
    return {
      type: 1,
      showInfo: false,
      isLoading: false,
      loadingText: '',
      info: '',
      loaded: false,
      uid: ''
    }
  },
  mounted() {
    this.$services.print.get('printauth', null)
      .then(res => {
        this.type = res.data.printall
      })
  },
  methods: {
    onClick(val) {
      this.type = val;
    },
    save() {
      this.showInfo = true;
      this.info = '保存成功';
    }
  }
}
</script>

<style>
  html, body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
  }
  .title {
    display: block;
    margin-bottom: -20px;
    text-align: left;
    padding: 10px 10px 0px 10px;
    color: #757575;
    font-size: 16px;
  }
</style>
