withdrawal.vue 3.68 KB
Newer Older
1
<template>
2 3 4 5 6 7 8 9

  <el-dialog
    :visible.sync="dialogVisible"
    :before-close="()=>{
      $parent.show = false;
    }"
    width="80%">
    <div style="padding: 0 20px">
dcy's avatar
dcy committed
10
      <h1>{{$t('申请退仓')}}-{{orderDetails.orderNo}}</h1>
11 12
      <el-divider></el-divider>
      <el-form label-width="150px">
dcy's avatar
dcy committed
13
        <el-form-item :label="$t('退仓原因')">
14 15
          <el-input v-model="params.reason" style="width:500px" type="textarea"></el-input>
        </el-form-item>
邓春圆's avatar
邓春圆 committed
16 17 18
        <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>
19 20
      </el-form>
      <el-divider></el-divider>
dcy's avatar
dcy committed
21
      <h2>{{$t('审批流程')}}</h2>
22 23 24 25
      <div style="padding: 20px">
        <work-flow xmlkey="retired_warehouse" v-model="params.copyUserId"  />
      </div>
      <div>
dcy's avatar
dcy committed
26
        <el-button v-if="isExamine" @click="submit" type="primary" style="margin-right: 20px;">{{$t('确定退仓')}}</el-button>
27
        <el-button v-if="!isExamine" @click="goBpm" type="primary" style="margin-right: 20px;">{{$t('审核中')}}</el-button>
dcy's avatar
dcy committed
28 29
        <el-button  v-if="!isExamine" type="primary" style="margin-right: 20px;" @click="cancellationOfOrder">{{$t('取消审核')}}</el-button>
        <el-button @click="$parent.show = false;">{{$t('不,再考虑考虑')}}</el-button>
30
      </div>
31
    </div>
32
  </el-dialog>
33 34 35
</template>
<!--退仓-->
<script>
dcy's avatar
dcy committed
36 37 38 39 40 41
import {cancelAdjust, getOrder} from "@/api/ecw/order";
import {
  getRollbackApprovalInfo,
  orderWarehouseInDelete,
  warehouseApprovalCancel
} from "@/api/ecw/batchSingleApplication";
dcy's avatar
dcy committed
42
import workFlow from "@/components/WorkFlow";
邓春圆's avatar
邓春圆 committed
43
import ImageAndVideoUpload from "@/components/ImageAndVideoUpload/index.vue";
44 45 46 47

export default {
  name: "withdrawal",
  props:{
48 49
    orderId:Number,
    dialogVisible:Boolean
50
  },
dcy's avatar
dcy committed
51
  components:{
邓春圆's avatar
邓春圆 committed
52
    ImageAndVideoUpload,
dcy's avatar
dcy committed
53 54
    workFlow
  },
55 56
  data(){
    return {
57 58 59 60 61
      orderDetails:{},
      params:{
        orderId:undefined,
        orderNo:undefined,
        reason:'',
dcy's avatar
dcy committed
62
        copyUserId:[],
邓春圆's avatar
邓春圆 committed
63
        imgUrl:[]
dcy's avatar
dcy committed
64
      },
dcy's avatar
dcy committed
65 66 67 68
      isExamine:true,
      details:{},


69 70 71
    }
  },
  created() {
72
    getOrder(this.orderId).then(r => this.orderDetails = r.data);
dcy's avatar
dcy committed
73 74 75 76 77 78 79 80 81
    getRollbackApprovalInfo({orderId:this.orderId}).then(r => {
      console.log(r)
      if(r.data.status === 1){
          this.details = r.data;
          this.isExamine = false;
          this.params.reason = JSON.parse(this.details.details).reason
      }

    })
82 83
  },
  methods:{
84 85 86 87
    goBpm(){
      this.$parent.show = false
      this.$router.push({query:{id:this.details.formId},path:'/bpm/process-instance/detail'})
    },
88
    submit(){
89 90
      this.params.orderId =  this.orderDetails.orderId;
      this.params.orderNo =this.orderDetails.orderNo;
邓春圆's avatar
邓春圆 committed
91
      this.params.imgUrl =  this.params.imgUrl.join(',')
92 93
      orderWarehouseInDelete(this.params).then(r => {
       if(r.code === 0){
dcy's avatar
dcy committed
94
         this.$message.success(this.$t('退仓成功'));
95 96
         this.params = {}
         this.$parent.show = false
97
       }
98
      })
dcy's avatar
dcy committed
99 100
    },
    cancellationOfOrder(){
dcy's avatar
dcy committed
101 102 103
      this.$prompt(this.$t('请输入取消审核原因'), this.$t('提示'), {
        confirmButtonText: this.$t('确定'),
        cancelButtonText: this.$t('取消'),
dcy's avatar
dcy committed
104 105 106
      }).then(({ value }) => {
        warehouseApprovalCancel(this.details.id,value) .then(r => {
          if(r.data){
dcy's avatar
dcy committed
107
            this.$message.success(this.$t('取消成功'))
dcy's avatar
dcy committed
108 109 110 111 112 113 114 115
            this.params = {}
            this.$parent.show = false

          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
dcy's avatar
dcy committed
116
          message: this.$t('取消成功')
dcy's avatar
dcy committed
117 118
        });
      });
119 120 121 122 123 124 125 126
    }
  }
}
</script>

<style scoped>

</style>