rejectDialog.vue 3.09 KB
<!-- 驳回 -->
<template>
  <baseDialog :dialog-config="dialogConfig"
              :is-show.sync="visible"
              class="accountDailog"
              @handleClick="handleAddConfirm">
    <div class="reject-dialog">
      <el-form ref="refundForm"
               label-width="150px"
               :model="infoForm"
               :rules="formRules">
        <el-form-item label="驳回原因:"
                      prop="rejectCause">
          <el-input type="textarea"
                    :row="4"
                    placeholder="请输入驳回原因"
                    maxlength="50"
                    show-word-limit
                    v-model="infoForm.rejectCause"
                    class=" reject-input" />
        </el-form-item>
      </el-form>
    </div>
  </baseDialog>
</template>

<script>
import { purchaseOrderReject, operatorreviewOperatorReject, businessreviewBusinessReject } from '@/api/purchaseShopping.js'
import { deepClone } from '@/common/util'
export default {
  name: 'RejectDialog',
  data() {
    return {
      userInfo: this.$store.state.d2admin.user.info,
      infoForm: {
        rejectCause: ''
      },
      dialogConfig: {
        title: '驳回',
        width: '750px'
      },
      formRules: {
        rejectCause: [{ required: true, message: '请输入驳回原因', trigger: 'change' }]
      }
    }
  },

  props: {
    rejectVisible: {
      type: Boolean,
      default: false
    },
    paramsObj: {
      type: Object,
      default: {}
    }
  },
  computed: {
    visible: {
      get() {
        // if (this.visible) {
        //   // 注册全局监听事件 [ 目前只考虑鼠标解除触发 ]
        //   window.addEventListener('mousedown', this.watchContextmenu)
        // }
        return this.rejectVisible
      },
      set(newVal) {
        this.$emit('dialogClose', { flag: newVal, attrName: 'rejectVisible' })
        // this.$emit('update:visible', newVal)
      }
    }
  },

  watch: {
  },

  created() {
  },
  components: {},

  mounted() {

  },

  methods: {

    handleAddConfirm() {
      // return
      this.$refs.refundForm.validate(valid => {
        if (valid) {
          // console.log(valid)
          // return
          var infoForm = deepClone(this.infoForm)
          var params = {}
          params.rejectCause = infoForm.rejectCause
          params.orderCode = this.paramsObj.orderCode
          const _api = this.paramsObj.type == 'operator' ? operatorreviewOperatorReject : businessreviewBusinessReject

          // purchaseOrderReject(params).then(res => {
          _api(params).then(res => {
            this.notice.okTips('操作成功')
            // this.handleClose(true)
            this.visible = true
          })
        }
      })
    },

    handleClose(flag) {
      this.$emit('dialogClose', flag)
    }
  }
}
</script>
<style lang="scss" scoped>
.reject-dialog {
  margin: 65px 0;

  .reject-input {
    ::v-deep .el-textarea__inner {
      height: 70px;
    }
  }

  .el-textarea .el-input__count {
    right: 90px;
    bottom: -10px;
    font-size: 12px;
    color: #999999;
  }

  .tips {
    color: #999999;
  }
}
</style>