<template>
     <a-modal 
      title="放回公池"
      ok-text="确认" 
      cancel-text="取消"
      :visible="invalidShow"
      :confirm-loading="invalidLoading"
      @ok="invalidOk"
      @cancel="invalidCancel">
      <a-row>
      <a-col :md="24" :xs="24" style="display: flex;">
        <div style="color:#000; flex:11;"><span style="color:tomato;">*</span>备注:</div>
        <div style="flex: 89;">
          <a-textarea v-model="remark" rows="5" placeholder="请输入备注" style="max-width: 86%; margin-left: 6px;" />
        </div>
      </a-col>
    </a-row>
  </a-modal>
  </template>
  <script>
  
  import { postAction } from '@/api/manage'
  import store from '@/store'
  export default {
    name: 'CustomerInvalid',
    data () {
      return {
        invalidLoading: false,
        remark: undefined
      }
    },
    props: ['invalidShow','dataPara'],
    watch: {
      immediate: true,
      invalidShow: {
        handler() {

        },
      }
    },
    methods: {
      invalidOk() {
        if(this.remark === undefined || this.remark === null) {
          this.$message.warn('请输入备注。');
          return;
        } else {
          let params = {
            id: this.dataPara.id,
            status: 4,
            followStatus: 9,
            remark: this.remark,
            createBy: store.getters.userInfo.username,
            schoolDistrictId: this.dataPara.schoolDistrictId,
            saleCode_dictText: this.dataPara.saleCode_dictText,
            type: 5
          }
          this.invalidLoading = false;
          postAction("/customer/customerInfo/returnPublic", params).then((res) => {
            if (res.success) {
              this.$message.success(res.message);
            } else {
              this.$message.warn(res.message);
            }
          }).finally(() => {
            this.$emit('invalid-event',false);
            this.remark = undefined;
          });
        }
      },
      invalidCancel() {
        this.$emit('invalid-event','invalid');
        this.remark = undefined;
      },
    }
  }
  </script>
  