setStatus.vue 7.79 KB
<template>
  <div>
    <a-modal
      title="设置"
      :width="500"
      :centered="true"
      :visible="visible"
      cancelText="取消"
      @ok="queren"
      @cancel="cancle"
      :maskClosable="false"
    >
      <a-spin :spinning="confirmLoading">
        <a-form :form="form">
          <!-- <a-form-item label="客户主体类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
            <a-input placeholder="请输入参数编号" v-decorator="[ 'username', validatorRules.username]" />
          </a-form-item>-->
          <!-- <a-form-item label="用户额度状态:" :labelCol="labelCol" :wrapperCol="wrapperCol">
            <a-select v-decorator="[ 'creditStatus', {}]" placeholder="请选择状态">
              <a-select-option :value="1">正常</a-select-option>
              <a-select-option :value="3">锁定</a-select-option>
            </a-select>
          </a-form-item> -->
          <a-form-item label="客户名称" :labelCol="{ span: 6 }" :wrapperCol="{ span: 16 }" hasFeedback>
            <a-input
              placeholder="请输入客户名称"
              v-decorator="[
                'customerName',
                {
                  initialValue: records ? records.customerName : '',
                  rules: [{ required: true, message: '请输入客户名称' }],
                },
              ]"
              :readOnly="true"
            />
          </a-form-item>
          <a-form-item label="额度编号" :labelCol="{ span: 6 }" :wrapperCol="{ span: 16 }" hasFeedback>
            <a-input
              placeholder="请输入额度编号"
              v-decorator="[
                'creditNo',
                {
                  initialValue: records ? records.creditNo : '',
                  rules: [{ required: true, message: '请输入额度编号' }],
                },
              ]"
              :readOnly="true"
            />
          </a-form-item>
          <a-form-item label="主体类型:" :labelCol="{ span: 6 }" :wrapperCol="{ span: 16 }">
            <a-select
              v-decorator="[
                'customerType',
                {
                  initialValue: records ? records.customerType : '',
                  rules: [{ required: true, message: '请输入综合可用' }],
                },
              ]"
              placeholder="请选主体类型"
              :disabled="true"
            >
              <a-select-option :value="1">个人</a-select-option>
              <a-select-option :value="2">企业</a-select-option>
              <a-select-option :value="3">未知</a-select-option>
            </a-select>
          </a-form-item>
          <a-form-item label="综合额度(元)" :labelCol="{ span: 6 }" :wrapperCol="{ span: 16 }" hasFeedback>
            <a-input
              placeholder="请输入综合额度"
              v-decorator="[
                'originalComprehensiveAmount',
                {
                  initialValue: records ? records.originalComprehensiveAmount : '',
                  rules: [{ required: true, message: '请输入综合额度' }],
                },
              ]"
              :readOnly="true"
            />
          </a-form-item>
          <a-form-item label="综合已用" :labelCol="{ span: 6 }" :wrapperCol="{ span: 16 }" hasFeedback>
            <a-input
              placeholder="请输入综合已用"
              v-decorator="[
                'creditAmountUsed',
                {
                  initialValue: records ? records.creditAmountUsed : '',
                  rules: [{ required: true, message: '请输入综合已用' }],
                },
              ]"
              :readOnly="true"
            />
          </a-form-item>
          <a-form-item label="在途金额(元)" :labelCol="{ span: 6 }" :wrapperCol="{ span: 16 }" hasFeedback>
            <a-input
              placeholder="请输入在途金额"
              v-decorator="[
                'creditAmountFloat',
                {
                  initialValue: records ? records.creditAmountFloat : '',
                  rules: [{ required: true, message: '请输入在途金额' }],
                },
              ]"
              :readOnly="true"
            />
          </a-form-item>
          <a-form-item label="综合可用" :labelCol="{ span: 6 }" :wrapperCol="{ span: 16 }" hasFeedback>
            <a-input
              placeholder="请输入综合可用"
              v-decorator="[
                'creditAmountUseable',
                {
                  initialValue: records ? records.creditAmountUseable : '',
                  rules: [{ required: true, message: '请输入综合可用' }],
                },
              ]"
              :readOnly="true"
            />
          </a-form-item>
          <a-form-item label="调整额度(元)" :labelCol="{ span: 6 }" :wrapperCol="{ span: 16 }" hasFeedback>
            <a-input
              placeholder="请输入调整额度"
              v-decorator="[
                'adjustComprehensiveAmount',
                {
                  initialValue: records ? records.adjustComprehensiveAmount : '',
                  rules: [{ required: true, message: '请输入调整额度' }],
                },
              ]"
            />
          </a-form-item>
          <a-form-item label="备注" :labelCol="{ span: 6 }" :wrapperCol="{ span: 16 }" hasFeedback>
            <a-input
              placeholder="请输入备注"
              type="textarea"
              v-decorator="[
                'remark',
                {
                  initialValue: records ? records.remark : '',
                },
              ]"
            />
          </a-form-item>
        </a-form>
      </a-spin>
    </a-modal>
  </div>
</template>

<script>
import { changPassword } from '@/api/api'
import { creditAmountModify,updateCreditAdjustAmount } from '@/api/configApi'
export default {
  name: 'setModal',
  props: {},
  data() {
    return {
      visible: false,
      detailFlag: false,
      title: '',
      records: {},
      confirmLoading: false,
      confirmDirty: false,
      validatorRules: {
        creditStatus: {
          rules: [
            {
              required: true,
              message: '请选择状态',
            },
          ],
        },
      },

      model: {},

      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      form: this.$form.createForm(this),
    }
  },
  created() {},

  methods: {
    onChange() {},

    cancle() {
      this.visible = false
    },
    edit(res) {
      console.log(res)
      this.records = res
      if(res.enterpriseName){
        this.records.customerName = res.enterpriseName
        this.records.originalComprehensiveAmount = res.creditAmount
      }else{
        this.records.customerName = res.idCardName
        this.records.originalComprehensiveAmount = res.creditAmount
      }
      this.form.resetFields()
      this.visible = true
      this.$nextTick(() => {
        this.form.setFieldsValue(res)
      })
    },
    queren() {
      this.form.validateFields((err, values) => {
        if (!err) {
          let formData = Object.assign({ id: this.records.id, customerType: this.records.customerType }, values)
          updateCreditAdjustAmount(formData)
            .then((res) => {
              this.confirmLoading = false
              if (res.status.statusCode == 0) {
                this.$message.success(res.status.statusReason)
                this.$emit('queren')
              } else {
                this.$message.warning(res.status.statusReason)
              }
            })
            .finally(() => {
              this.confirmLoading = false
              this.cancle()
            })
        } else {
          this.cancle()
        }
      })
    },
    handleCancel() {
      this.close()
    },
  },
}
</script>