<template> <el-dialog visible :close-on-click-modal="false" :before-close="closeDialog" :title="title"> <el-form ref="form" :model="form" label-width="120px" :rules="rules"> <!-- 海运是重货,空运是泡货 --> <template v-if="applyType == 4"> <el-form-item :label="$t('原重货标准')"> {{form.orgWVolume}} kg/cbm </el-form-item> <el-form-item :label="$t('现重货标准')" style="width: 400px" prop="clearanceFreight"> <el-input v-model="form.wvolume" type="number" class="w-100" /> kg/cbm </el-form-item> </template> <template v-else-if="applyType == 5"> <el-form-item :label="$t('原泡货标准')"> {{form.orgVWeight}} kg </el-form-item> <el-form-item :label="$t('现泡货标准')" style="width: 400px" prop="clearanceFreight"> <el-input v-model="form.vweight" type="number" class="w-100" /> kg </el-form-item> </template> <template v-else-if="applyType == 29"> <el-form-item :label="$t('现订单泡重')"> {{form.orgVWeight}} kg </el-form-item> <el-form-item :label="$t('新订单泡重')" style="width: 400px" prop="clearanceFreight"> <el-input v-model="form.vweight" type="number" class="w-100" /> kg </el-form-item> </template> </el-form> <div class="page-title">{{ $t('审批流程') }}</div> <work-flow :xmlkey="workFlowKey" v-model="ccIdArr" /> <div v-if="form.applyStatus != 1"> <el-button type="primary" @click="handleSubmit">{{ $t('提交') }}</el-button> </div> <div v-else> <el-button type="primary" @click="$router.push('/bpm/process-instance/detail?id=' + form.formId)"> <dict-tag :type="DICT_TYPE.APPLY_STATUS" :value="form.applyStatus" /> </el-button> <el-button type="primary" @click="cancelAudit">{{ $t('取消审核') }}</el-button> <el-button type="default" @click="closeDialog">{{ $t('返回') }}</el-button> </div> </el-dialog> </template> <script> import {createOrderSpecial, getOrderSpecial} from "@/api/ecw/order" import {getUnitList} from "@/api/ecw/unit" import {getChannel, getChannelList} from "@/api/ecw/channel" import { getCurrencyList } from '@/api/ecw/currency' import { getProductType } from '@/api/ecw/productType' import WorkFlow from '@/components/WorkFlow' import {cancelProcessInstance} from '@/api/bpm/processInstance' export default { name: "OrderSpecialDiscount", props: { order: Object, orderItem: Object, applyType: Number // 4是重货标准优惠5是泡货标准优惠,29泡货优惠 }, components: { WorkFlow }, created() { // 查看详情,列表进来的 this.getOrderSpecial() }, data() { return { // applyType: 2, //1是优惠申请2是管理折扣3是佣金设置4是重货优惠5是泡货优惠 ccIdArr: [], form: { }, rules:{ }, } }, watch:{ ccIdArr(){ this.$set(this.form, 'ccIds', this.ccIdArr.join(',')) } }, computed:{ title(){ return { 4: this.$t('重货标准优惠申请'), 5: this.$t('泡货标准优惠申请'), 29: this.$t('申请泡重优惠') }[this.applyType] // return this.applyType == 4 ? this.$t('重货优惠申请') : this.$t('泡货优惠申请') }, // 流程key workFlowKey(){ // 泡货优惠申请审核 if(this.applyType == 29){ return 'shipment_bulky_cargo' } // 订单特价审核 return 'special_apply' } }, methods: { handleSubmit(){ this.$refs.form.validate().then(res => { createOrderSpecial(Object.assign({}, this.form, {applyType: this.applyType})).then(res => { this.$message.success(this.$t('提交成功')) this.$emit('success') }) }) }, getOrderSpecial(){ getOrderSpecial(this.order.orderId, this.applyType, {}).then(r => { this.form = r.data }) }, closeDialog(){ this.$emit('close') }, cancelAudit(){ this.$prompt(this.$t('请输入取消原因?'), this.$t("取消审批"), { type: 'warning', confirmButtonText: this.$t("确定"), cancelButtonText: this.$t("取消"), inputPattern: /^[\s\S]*.*[^\s][\s\S]*$/, // 判断非空,且非空格 inputErrorMessage: this.$t("取消原因不能为空"), }).then(({ value }) => { return cancelProcessInstance(this.form.formId, value); }).then(() => { this.$modal.msgSuccess(this.$t("取消成功")); this.closeDialog() }) }, } } </script>