consWithdrawal.vue 4.62 KB
<template>

  <el-dialog
    :visible.sync="dialogVisible"
    :before-close="()=>{
      $parent.show = false;
    }"
    width="80%">
    <div style="padding: 0 20px">
      <h1>{{consDetails.expressNo}}-{{consDetails.customerNumber}}-{{$t('申请退仓')}}</h1>
      <h3>{{$t('包裹ID')}}-{{consDetails.consNum}}</h3>
      <el-divider></el-divider>
      <el-form label-width="150px">
        <el-form-item :label="$t('退仓原因')">
          <el-input v-model="params.reason" style="width:500px" type="textarea"></el-input>
        </el-form-item>
        <el-form-item :label="$t('退仓收件人')">
          <el-input v-model="params.name" style="width:500px"></el-input>
        </el-form-item>
        <el-form-item :label="$t('退仓收件电话')">
          <el-input v-model="params.phone" style="width:500px"></el-input>
        </el-form-item>
        <el-form-item :label="$t('退仓收件地址')">
          <el-input v-model="params.address" style="width:500px" type="textarea"></el-input>
        </el-form-item>
        <el-form-item :label="$t('图片')">
          <image-and-video-upload   :file-type="['png' , 'jpg', 'jpeg']" :fileSize="50" :isShowTip="true" v-model="params.imgUrl" ></image-and-video-upload>
        </el-form-item>
      </el-form>
      <el-divider></el-divider>
      <h2>{{$t('审批流程')}}</h2>
      <div style="padding: 20px">
        <work-flow xmlkey="ecw_cons_retired_warehouse" v-model="params.copyUserId"  />
      </div>
      <div>
        <el-button v-if="isExamine" @click="submit" type="primary" style="margin-right: 20px;">{{$t('确定退仓')}}</el-button>
        <el-button v-if="!isExamine" @click="goBpm" type="primary" style="margin-right: 20px;">{{$t('审核中')}}</el-button>
        <el-button  v-if="!isExamine" type="primary" style="margin-right: 20px;" @click="cancellationOfCons">{{$t('取消审核')}}</el-button>
        <el-button @click="$parent.show = false;">{{$t('不,再考虑考虑')}}</el-button>
      </div>
    </div>
  </el-dialog>
</template>
<!--退仓-->
<script>
import workFlow from "@/components/WorkFlow";
import ImageAndVideoUpload from "@/components/ImageAndVideoUpload/index.vue";
import {cancelApplyAndUpdate, createConsRetiredWarehouseApplication, getCons} from "@/api/ecw/cons";
import {getConsApprovalList} from "@/api/ecw/consApproval";

export default {
  name: "withdrawal",
  props:{
    consId:Number,
    dialogVisible:Boolean
  },
  components:{
    ImageAndVideoUpload,
    workFlow
  },
  data(){
    return {
      consDetails:{},
      approvalDetail:{},
      params:{
        consId:undefined,
        expressNo:undefined,
        name:'',
        phone:'',
        address:'',
        reason:'',
        copyUserId:[],
        imgUrl:[]
      },
      isExamine:true,
      details:{},


    }
  },
  created() {
    getCons(this.consId).then(r =>{
      this.consDetails = r.data
    });
    getConsApprovalList({consId:this.consId,approvalType:0,status: 1}).then(r => {
      if(r.data.length!=0){
          this.details = r.data[0];
          this.isExamine = false;
          this.approvalDetail = JSON.parse(r.data[0].approvalDetail)
          this.params.reason = this.approvalDetail.reason
          this.params.imgUrl = this.approvalDetail.imgUrl
          this.params.name = this.approvalDetail.name
          this.params.phone = this.approvalDetail.phone
          this.params.address = this.approvalDetail.address
      }

    })
  },
  methods:{
    goBpm(){
      this.$parent.show = false
      this.$router.push({query:{id:this.details.formId},path:'/bpm/process-instance/detail'})
    },
    submit(){
      this.params.consId =  this.consDetails.id;
      this.params.imgUrl =  this.params.imgUrl.join(',')
      this.params.consNum =  this.consDetails.consNum
      createConsRetiredWarehouseApplication(this.params).then(r => {
       if(r.code === 0){
         this.$message.success(this.$t('退仓成功'));
         this.params = {}
         this.$parent.show = false
       }
      })
    },
    cancellationOfCons(){
      //仅确认取消
      this.$confirm(this.$t('是否确认取消审核?'), this.$t('提示'), {
        confirmButtonText: this.$t('确定'),
        cancelButtonText: this.$t('取消'),
        type: 'warning'
      }).then(() => {
        cancelApplyAndUpdate(this.details.id) .then(r => {
          if(r.data){
            this.$message.success(this.$t('取消成功'))
            this.params = {}
            this.$parent.show = false
          }
        })
      }).catch(() => {
          this.$message({
            type: 'info',
            message: this.$t('取消成功')
          })
      });

    }
  }
}
</script>

<style scoped>

</style>