newIntegral.vue 2.5 KB
<template>
  <el-dialog :visible.sync="newIntegral.show" width="800px" center title="积分变更">
    <el-form label-width="150px">
      <el-form-item label="用户ID">
        <el-row :gutter="20">
          <el-col :span="14"><el-input v-model="newIntegral.user_id"/></el-col>
          <el-col :span="6"><el-button @click="showUserList">查询</el-button></el-col>
        </el-row>
      </el-form-item>
      <el-form-item label="积分类型">
        <el-row :gutter="20">
          <el-col :span="20">
            <el-select v-model="newIntegral.is_add">
              <el-option
                v-for="(data,index) in is_addOption"
                :key="index"
                :label="data.value"
                :value="data.id">
              </el-option>
            </el-select>
          </el-col>
        </el-row>
      </el-form-item>
      <el-form-item label="积分值">
        <el-row :gutter="20">
          <el-col :span="20">
        <el-input-number v-model="newIntegral.value"/>
          </el-col>
        </el-row>
      </el-form-item>
      <el-form-item label="描述【用户可见】">
        <el-row :gutter="20">
          <el-col :span="20">
        <el-input v-model="newIntegral.desc"/>
          </el-col>
        </el-row>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
        <el-button @click="newIntegral.show = false">取 消</el-button>
        <el-button type="primary" @click="onAdd">确 定</el-button>
      </span>
  </el-dialog>
</template>

<script>
  import {INTEGRALTYPE} from "../../util/wordbook";
  export default {
    name: "newIntegral",
    props:['newIntegral'],
    data(){
      let is_addOption = [];
      for(let k in INTEGRALTYPE){
        is_addOption.push({id:k,value:INTEGRALTYPE[k]})
      }
      return {
        is_addOption:is_addOption
      }
    },
    methods:{
      onAdd(){
        if(!this.newIntegral.user_id || this.newIntegral.user_id === ''){
          this.$message('请填写用户ID')
        }else if(!this.newIntegral.is_add || this.newIntegral.is_add === ''){
          this.$message('请选择积分类型')
        }else if(!this.newIntegral.value || this.newIntegral.value === ''){
          this.$message('请填写积分值')
        }else if(!this.newIntegral.desc || this.newIntegral.desc === ''){
          this.$message('请填写描述')
        }else{
          this.$emit('subAdd')
        }
      },
      showUserList(){
        this.$emit('showUserList')
      }
    }
  }
</script>

<style scoped>

</style>