<template> 
 | 
  <GlobalAlertWindow :title="title" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm"> 
 | 
    <div class="tips-style">调整有效期后,客户的有效期会发生改变,请谨慎操作</div> 
 | 
    <el-form :model="form" ref="form" label-width="100px" label-suffix=":" :rules="rules" inline> 
 | 
      <div class="short-line"> 
 | 
        <el-form-item label="企业名称" prop="name"> 
 | 
          <el-input v-model="form.name" disabled v-trim /> 
 | 
        </el-form-item> 
 | 
      </div> 
 | 
      <!-- <div class="item-line"> 
 | 
        <el-form-item label="客户类型"  prop="oepnType"> 
 | 
          <el-radio-group v-model="form.oepnType" @change="typeChange"> 
 | 
            <el-radio :label="1">正式账号</el-radio> 
 | 
            <el-radio :label="0">试用账号</el-radio> 
 | 
          </el-radio-group> 
 | 
        </el-form-item> 
 | 
      </div> --> 
 | 
  
 | 
      <div class="item-line"> 
 | 
        <el-form-item label="有效期" prop="oepnValidDate"> 
 | 
          <!-- <el-date-picker v-model="form.oepnValidDate" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd hh:mm:ss" 
 | 
            placeholder="选择日期"> --> 
 | 
          <el-date-picker type="date" v-model="form.oepnValidDate" value-format="yyyy-MM-dd" placeholder="选择有效日期"> 
 | 
          </el-date-picker> 
 | 
          有效期包含选择日期 
 | 
        </el-form-item> 
 | 
      </div> 
 | 
      <div class="short-line"> 
 | 
        <el-form-item label="主播数限制" prop="userNum"> 
 | 
          <el-input v-model="form.userNum" placeholder="请输入主播数" v-trim /> 
 | 
          <span style="display:inline;font-size:10px;color:red">注:为0不限制人数</span> 
 | 
        </el-form-item> 
 | 
      </div> 
 | 
    </el-form> 
 | 
    <!-- <div slot="footer"></div> --> 
 | 
  </GlobalAlertWindow> 
 | 
</template> 
 | 
  
 | 
<script> 
 | 
import BaseOpera from '@/components/base/BaseOpera' 
 | 
import GlobalAlertWindow from '@/components/common/GlobalAlertWindow' 
 | 
import { update } from '@/api/business/company' 
 | 
// import { create } from '@/api/business/companyChange' 
 | 
export default { 
 | 
  name: 'OperaCompanyValidDateWindow', 
 | 
  extends: BaseOpera, 
 | 
  components: { GlobalAlertWindow }, 
 | 
  data() { 
 | 
  
 | 
    return { 
 | 
      isUploading: false, 
 | 
      // 表单数据 
 | 
      form: { 
 | 
        id: null, 
 | 
        name: '', 
 | 
        oepnValidDate: '', 
 | 
        userNum: 0 
 | 
      }, 
 | 
      types: [], 
 | 
      // 验证规则 
 | 
      rules: { 
 | 
        openUserNum: [ 
 | 
          { pattern: /^[0-9]+$/, message: '只可以输入数字', trigger: 'change' } 
 | 
        ] 
 | 
      } 
 | 
    } 
 | 
  }, 
 | 
  created() { 
 | 
    this.config({ 
 | 
      api: '/business/company', 
 | 
      'field.id': 'id' 
 | 
    }) 
 | 
  }, 
 | 
  methods: { 
 | 
    open(title, target) { 
 | 
      this.title = title 
 | 
      this.visible = true 
 | 
      // 编辑 
 | 
      this.$nextTick(() => { 
 | 
        this.$refs.form.clearValidate() 
 | 
        this.$refs.form.resetFields() 
 | 
        for (const key in this.form) { 
 | 
          this.form[key] = target[key] 
 | 
        } 
 | 
      }) 
 | 
    }, 
 | 
    typeChange() { 
 | 
      let tempDate = new Date(); 
 | 
      tempDate.setDate(tempDate.getDate() + (this.form.oepnType ? 30 : 15)) 
 | 
      this.form.oepnValidDate = `${tempDate.getFullYear()}-${tempDate.getMonth() + 1}-${tempDate.getDate()} 00:00:00` 
 | 
    }, 
 | 
    confirm() { 
 | 
      this.$refs.form.validate((valid) => { 
 | 
        if (!valid) { 
 | 
          return 
 | 
        } 
 | 
        this.isWorking = true 
 | 
        update(this.form) 
 | 
          .then(() => { 
 | 
            this.visible = false 
 | 
            this.$refs.form.resetFields() 
 | 
            this.$tip.apiSuccess('修改有效期成功') 
 | 
            this.$emit('success') 
 | 
          }) 
 | 
          .catch(e => { 
 | 
            this.$tip.apiFailed(e) 
 | 
          }) 
 | 
          .finally(() => { 
 | 
            this.isWorking = false 
 | 
          }) 
 | 
      }) 
 | 
    } 
 | 
  }, 
 | 
} 
 | 
</script> 
 | 
  
 | 
<style lang="scss" scoped> 
 | 
.tips-style { 
 | 
  background-color: #f7f7f7; 
 | 
  height: 30px; 
 | 
  line-height: 30px; 
 | 
  
 | 
  a { 
 | 
    text-decoration: none 
 | 
  } 
 | 
  
 | 
  padding-left: 10px; 
 | 
  margin-bottom: 20px; 
 | 
} 
 | 
  
 | 
.item-line { 
 | 
  ::v-deep .el-form-item__content { 
 | 
    width: 480px; 
 | 
  } 
 | 
} 
 | 
  
 | 
.short-line { 
 | 
  ::v-deep .el-form-item__content { 
 | 
    width: 286px; 
 | 
  } 
 | 
} 
 | 
  
 | 
.pic-line { 
 | 
  ::v-deep .el-form-item__content { 
 | 
    width: 500px; 
 | 
  } 
 | 
} 
 | 
  
 | 
.address { 
 | 
  display: flex; 
 | 
  
 | 
  .line { 
 | 
    width: 10px; 
 | 
  } 
 | 
} 
 | 
  
 | 
.sub-title { 
 | 
  font-size: 20px; 
 | 
  font-weight: 600; 
 | 
  margin-top: 10px; 
 | 
  margin-bottom: 10px; 
 | 
} 
 | 
</style> 
 |