<template>
  <div style="background: #fff;">
    <van-nav-bar title="工龄分设置" left-text="返回" @click-left="$route_back" left-arrow></van-nav-bar>
    <van-row style="margin-top: 0.8rem; margin-bottom: 0.3rem;">
      <van-col span="22" offset="2" style="font-size: 0.28rem; color: #909399;">工龄分是为了更好地认可老员工</van-col>
    </van-row>
    <van-row  style="margin: 0 0 0.5rem 0;" type="flex" justify="center">
      <van-col span="6">
        <span class="base_point_label">工龄分</span>
      </van-col>
      <van-col span="8"> 
        <van-field style="background: #F5F7FA" v-model="parameter.service_point"  placeholder="输入分值" type="digit" />
      </van-col>
      <van-col span="6" class="base_point_right" style="background: #F5F7FA;line-height: 0.92rem;">B分</van-col>
    </van-row>
    <van-row style="margin-bottom: 0.3rem;">
      <van-col span="22" offset="2" style="font-size: 0.28rem; color: #909399;">· 首次加分=员工已在职的月份数*工龄分</van-col>
      <!-- <van-col span="22" offset="2" style="font-size: 0.28rem; color: #909399;">· 未满一个月的不加分</van-col> -->
      <van-col span="22" offset="2" style="font-size: 0.28rem; color: #909399;">· 后续加分按已设置的工龄分值每月自动累加</van-col>
    </van-row>
    <!-- <p class="tips">· 首次加分=员工已在职的月份数*工龄分</p>
    <p class="tips">· 未满一个月的不加分</p>
    <p class="tips">· 后续加分按已设置的工龄分值每月自动累加</p> -->
    <!-- <p class="tips">
      ·计算方式
    </p>
    <p class="tips"> 工龄分=入职月份数*分值 </p>
    <p class="tips"> 入职月份数=当前时间-入职时间</p>
    <p style="font-size: 14px;margin: 12px 50px 0 50px;color: #909399;">
        ·入职满一个月起算，每个月叠加。
    </p> -->
    <van-row>
      <van-col span="20" offset="2">
        <van-button size="large" type="info" @click="saveBase" :loading="send_loading" >保存设置</van-button>
      </van-col>
    </van-row>

  </div>
</template>

<script>
import request from '@/utils/request'
import Vue from 'vue'
import { Field, Button, Checkbox, CheckboxGroup  } from 'vant';
Vue.use(Field).use(Button).use(Checkbox).use(CheckboxGroup);
export default {
  name: 'point_base',
  data() {
    return {
	    parameter:{service_point:''},
     send_loading: false
    }
  },
  components: {},
  methods: {
      saveBase() {
        if(this.parameter.service_point == '') {
            this.$toast('请输入工龄分')
            return;
        }
        request('post','/api/integral/site/config',this.parameter,'v2').then((res) => {
          if(res.data.code == 1) {
            this.$toast("设置成功")
          }else {
            this.$toast(res.data.msg)
          }
        })
      },
      getPoint() {
          request( 'get','/api/integral/site/config').then(res => {
              if(res.data.code == 1) {
			          this.parameter=res.data.data;
              }
          })
      }
  },
  mounted() {

  },
  created() {
    this.getPoint();
  }
}
</script>

<style scoped lang="less">
  .tips{
    font-size: 14px;
    margin-left: 0.8rem;
    margin-right: 0.8rem;
    color: #909399;
  }
  .base_point_right{
    font-size: 14px;
    color: #909399;
    line-height: 0.92rem;
    text-align: center;
    background: #F5F7FA;
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  .base_point_label{
    font-size: 0.32rem;
    display: inline-block;
    background: #26a2ff;
    color: #fff;
    text-align: center;
    width: 100%;
    vertical-align: middle;
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
    padding: 0.24rem 0;
  }
</style>

