Commit 8fa33029 authored by dragondean@qq.com's avatar dragondean@qq.com

批量费用申请和审核

parent 1806ef98
......@@ -96,6 +96,44 @@ export function feeApplicationListByOrderId(query){
data:data,
})
}
// 批量申请费用
export function feeApplicationCreateBatch(data){
return request({
url:'order/fee-application/create/batch',
method:'post',
data:data,
})
}
// 根据订单ID获取是否有正在申请的费用申请
export function getFeeApplicationApproveByOrderId(orderId){
return request({
url:'/order/fee-application/get/isApprove',
method:'get',
params: {id: orderId}
})
}
// 根据流程主键ID得到批量申请费用
export function getBatchFeeByBusinessId(businessId){
return request({
url:'/order/fee-application/getBatchFeeByBusinessId',
method:'get',
params: {businessId}
})
}
// 查询批量申请费用
export function feeApplicationGetBatch(params){
return request({
url:'/order/fee-application/get/batch',
method:'get',
params
})
}
//费用申请修改
export function applicationUpdate(data){
return request({
......
......@@ -181,11 +181,18 @@ export default {
id: this.processInstance.businessKey,
type: 2
},
// 原来的费用申请
free_apply: {
component: "warehouseDetails",
processId: this.processInstance.businessKey,
type: 2
},
// 2.0空运加的批量申请
batch_free_apply: {
component: () => import('@/views/ecw/order/components/BatchFeeApplication'),
businessId: this.processInstance.businessKey,
processInstanceId: this.$route.query.id
},
retired_warehouse: {
component: "warehouseDetails",
processId: this.processInstance.businessKey,
......
<template>
<div>
<h1>{{ $t('申请信息【订单信息】') }}</h1>
<el-descriptions :column="4" border>
<el-descriptions-item :label="$t('订单号')">{{ order.orderNo }}</el-descriptions-item>
<el-descriptions-item :label="$t('运输方式')">
<dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="order.transportId"></dict-tag>
</el-descriptions-item>
<el-descriptions-item :label="$t('出货方式')">
{{ order.channelName }}
</el-descriptions-item>
<el-descriptions-item :label="$t('订单状态')">
{{ order.statusMsg }}
</el-descriptions-item>
<el-descriptions-item :label="$t('唛头')">
{{ order.marks }}
</el-descriptions-item>
<el-descriptions-item :label="$t('始发仓')">{{ order.logisticsInfoDto.startTitleZh }}</el-descriptions-item>
<el-descriptions-item :label="$t('目的仓')">{{ order.logisticsInfoDto.destTitleZh }}</el-descriptions-item>
</el-descriptions>
<div style="font-size: 14px">
<p>{{ $t('申请理由') }}</p>
<div v-for="(item, index) in feeList" :key="item.id">
{{index + 1}}、【<dict-tag :type="DICT_TYPE.FEE_TYPE" :value="item.feeType" />】,
<dict-tag :value="item.payType" :type="DICT_TYPE.PAYMENT_TYPE" ></dict-tag>
{{ item.applicationFee }}{{ currencyName(item.applicationFeeCurrency) }}
{{$t('备注')}}{{ item.remarks || $t('')}}
</div>
</div>
</div>
</template>
<script>
import {
warehouseApprovalGetByFormId,
warehouseApprovalGetById,
warehouseAreaPositionList
} from "@/api/ecw/batchSingleApplication";
import {
applicationGetOrderByProcessId,
feeApplicationGet, feeApplicationGetBatch, getBatchFeeByBusinessId, getBatchFeeByProcessId,
getOrder,
getOrderPage,
getWarehouseUpdateApprovalInfo, qetBatchFeeByBusinessId
} from '@/api/ecw/order'
import { getChannelList } from '@/api/ecw/channel';
import Template from "@/views/cms/template";
import {getSupplierPage} from "@/api/ecw/supplier";
import { DICT_TYPE } from "@/utils/dict";
import { getCurrencyList } from "@/api/ecw/currency";
import {arrryToKeyedObjectBy} from '@/utils/index'
export default {
components: {Template},
props:{
businessId: [Number, String],
processInstanceId: String
},
name: "BatchFeeApplicationDetail",
data(){
return{
order: null,
feeList: [],
currencyList:[]
}
},
computed:{
currencyMap(){
return arrryToKeyedObjectBy(this.currencyList, 'id')
},
currencyName(){
return id => {
let obj = this.currencyMap[id]
if(obj) return this.$l(obj, 'title')
return this.$t('未知')
}
}
},
created() {
getCurrencyList().then(res => {
this.currencyList = res.data
})
getBatchFeeByBusinessId(this.businessId).then(res => {
console.log({res})
this.feeList = res.data
return getOrder(res.data[0].orderId)
}).then(res => {
this.order = res.data
})
},
methods:{
}
}
</script>
......@@ -12,35 +12,35 @@
</div></el-form-item>
<el-form-item :label="$t('发货人')+':'"><div class="content">{{orderDetails.consignorVO ? orderDetails.consignorVO.name :''}}</div></el-form-item>
<el-form-item :label="$t('唛头')"><div class="content">{{orderDetails.marks}}</div></el-form-item>
<el-form-item> <el-button @click="addCost">{{$t('添加申请')}}</el-button></el-form-item>
<el-form-item> <el-button :disabled="!!processInstanceId" @click="addCost">{{$t('添加申请')}}</el-button></el-form-item>
</el-form>
<el-table :data="list">
<el-table-column :label="$t('序号')" type="index"></el-table-column>
<el-table-column :label="$t('费用类型')">
<template v-slot:default = "scope">
<dict-selector :disabled="isModify[forbidden(scope.row)]" :type="DICT_TYPE.FEE_TYPE" v-model="scope.row.feeType" />
<dict-selector :disabled="!!processInstanceId" :type="DICT_TYPE.FEE_TYPE" v-model="scope.row.feeType" />
</template>
</el-table-column>
<el-table-column :label="$t('金额')">
<template v-slot:default = 'scope'>
<el-input :disabled="isModify[forbidden(scope.row)]" v-model.number="scope.row.applicationFee" ></el-input>
<el-input :disabled="!!processInstanceId" v-model.number="scope.row.applicationFee" ></el-input>
</template>
</el-table-column>
<el-table-column :label="$t('货币类型')">
<template v-slot:default = 'scope'>
<el-select :disabled="isModify[forbidden(scope.row)]" v-model="scope.row.applicationFeeCurrency">
<el-select :disabled="!!processInstanceId" v-model="scope.row.applicationFeeCurrency">
<el-option v-for="item in JSON.parse(currencys)" :key="item.id" :label="item.titleZh" :value="item.id" />
</el-select>
</template>
</el-table-column>
<el-table-column :label="$t('付款类型')">
<template v-slot = {row}>
<dict-selector :disabled="isModify[forbidden(row)]" :type="DICT_TYPE.PAYMENT_TYPE" v-model="row.payType" />
<dict-selector :disabled="!!processInstanceId" :type="DICT_TYPE.PAYMENT_TYPE" v-model="row.payType" />
</template>
</el-table-column>
<el-table-column :label="$t('备注')">
<template v-slot:default="scope">
<el-input :disabled="isModify[forbidden(scope.row)]" v-model="scope.row.remarks" type="textarea"></el-input>
<el-input :disabled="!!processInstanceId" v-model="scope.row.remarks" type="textarea"></el-input>
</template>
</el-table-column>
<el-table-column :label="$t('确认收款')">
......@@ -55,9 +55,10 @@
</el-table-column>
<el-table-column :label="$t('操作')">
<template v-slot:default = 'scope'>
<el-button type="text" v-if="scope.row.status !== 0&&scope.row.status !== 1">{{STATUS[scope.row.status]}}</el-button>
<!--<el-button type="text" v-if="scope.row.status !== 0&&scope.row.status !== 1">{{STATUS[scope.row.status]}}</el-button>
<el-button type="text" v-if="scope.row.status == 1" @click="examineFn">{{$t('审核中')}}</el-button>
<el-button type="text" v-if="scope.row.status === 2" @click="modify(scope.row)">{{$t('修改')}}</el-button>
<el-button type="text" v-if="scope.row.status === 2" @click="modify(scope.row)">{{$t('修改')}}</el-button>-->
<el-button type="text" :disabled="!!processInstanceId" @click="del(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
......@@ -65,9 +66,9 @@
<work-flow xmlkey="free_apply" v-model="selectedUsers" />
</div>
<div style="text-align: center;margin-top: 20px;">
<el-button v-if="!IsExamine" style="margin-right: 30px;" @click="submit">{{$t('提交')}}</el-button>
<el-button v-if="IsExamine" style="margin-right: 30px;" @click="examineFn">{{$t('审核中')}}</el-button>
<el-button v-if="IsExamine" style="margin-right: 30px;" @click="cancel">{{$t('取消审核')}}</el-button>
<el-button type="primary" v-if="!processInstanceId" style="margin-right: 30px;" @click="submit">{{$t('提交')}}</el-button>
<el-button type="primary" v-if="processInstanceId" style="margin-right: 30px;" @click="goProcessDetail">{{$t('审核中')}}</el-button>
<el-button type="primary" v-if="processInstanceId" style="margin-right: 30px;" @click="cancel">{{$t('取消审核')}}</el-button>
<el-button @click="$emit('update:dialogVisible',false)">{{$t('返回')}}</el-button>
</div>
</div>
......@@ -78,10 +79,14 @@
<script>
import {
getOrder,
feeApplicationCreate,
feeApplicationCreateBatch,
ApplicationListByOrderId,
applicationUpdate,
feeApplicationListByOrderId, feeApplicationCancel
feeApplicationListByOrderId,
feeApplicationCancel,
getFeeApplicationApproveByOrderId,
getBatchFeeByProcessId,
qetBatchFeeByBusinessId, getBatchFeeByBusinessId
} from "@/api/ecw/order";
import { getDictDatas, DICT_TYPE } from '@/utils/dict';
import Template from "@/views/cms/template";
......@@ -100,7 +105,11 @@ export default {
data(){
return {
orderDetails:{},
// 费用列表
list:[],
// 审核ID,没有则表示不在审核中
processInstanceId: null,
DICT_TYPE,
getDictDatas,
STATUS:{},
......@@ -114,24 +123,28 @@ export default {
this.STATUS[e.value] = e.label
})
},
computed:{
forbidden(){
return (row)=>{
return this.list.findIndex(e => e.id === row.id)
getOrder(this.orderId).then(res => {
this.orderDetails = res.data
})
// 查询是否有审核中的费用申请
getFeeApplicationApproveByOrderId(this.orderId).then(res => {
if(res.data.formId){
this.processInstanceId = res.data.formId
getBatchFeeByBusinessId(res.data.orderApprovalId).then(res => {
this.list = res.data
})
}
},
IsExamine(){
return this.list.some(e => e.status === 1)
}
})
},
methods:{
del(index){
this.$confirm(this.$t("确定要删除此条费用申请么?")).then(() => {
this.list.splice(index, 1)
})
},
addCost(){
if(this.list.some(e => e.status === 0 || e.status === 1)){
return this.$message.success(this.$t('当前有申请费用为审核中或未提交,请审核后在申请'));
}
this.list.push(
{
this.list.push({
orderId:this.orderId,
feeType:undefined,//费用申请类型
applicationFee:undefined,//金额
......@@ -140,54 +153,24 @@ export default {
receiveFlag:0,
applicationAuthor:undefined,
status:0,
}
)
this.isModify.push(false)
this.isModifyIf = false;
},
submit(){
if(this.isModifyIf){
applicationUpdate({...this.list[this.isModify.findIndex(e => e === false)],status:1}).then(r => {
if(r.code === 0){
this.$emit('update:dialogVisible',false)
this.$message.success(this.$t('修改成功'));
}
})
}else {
if(this.list[this.list.length - 1].status === 0){
feeApplicationCreate( {...this.list[this.list.length - 1],status:1,copyUserId:this.selectedUsers}).then(r=>{
if(r.code === 0){
this.$emit('update:dialogVisible',false)
this.$message.success(this.$t('添加成功'));
this.selectedUsers = [];
}
})
}else {
this.$message.success(this.$t('当前有申请费用为审核中或未提交,请审核后在申请'));
}
}
},
getOrderList(){
ApplicationListByOrderId({orderId: this.orderId}).then(r => {
submit(){
feeApplicationCreateBatch( {
orderFeeApplicationCreateReqVOList: this.list,
copyUserId:this.selectedUsers,
orderId: this.orderId
}).then(r=>{
if(r.code === 0){
this.list = r.data;
this.list.forEach(()=>this.isModify.push(true))
let p = this.list.find(e => e.status === 1)
this.$emit('update:dialogVisible',false)
this.$message.success(this.$t('添加成功'));
this.selectedUsers = [];
}
})
},
modify(row){
if(this.list.some(i => i.status === 0 || i.status === 1))return this.$message.warning(this.$t('当前有未提交的数据或审核中的数据不能修改'))
this.isModifyIf = true;
this.isModify.forEach((item,index)=>{
this.$set(this.isModify, index, true )
})
this.$set(this.isModify, this.list.findIndex(e => e.id === row.id), false )
},
examineFn(){
let item = this.list.find(e => e.status === 1);
console.log(item)
this.$router.push({path:'/bpm/process-instance/detail',query:{id:item.bpmProcessId}})
goProcessDetail(){
this.$emit('update:dialogVisible',false)
this.$router.push('/bpm/process-instance/detail?id=' + this.processInstanceId)
},
cancel(){
this.$prompt(this.$t('请输入取消原因'), this.$t('提示'), {
......@@ -195,7 +178,7 @@ export default {
cancelButtonText: this.$t('取消'),
}).then(({ value }) => {
let item = this.list.find(e => e.status === 1);
feeApplicationCancel({huifu:value,bpmProcessId:item.bpmProcessId}).then(r => {
feeApplicationCancel({huifu:value,bpmProcessId: this.processInstanceId}).then(r => {
this.$message({
type: 'success',
message:this.$t('取消成功')
......
......@@ -497,7 +497,7 @@
<batch-pickup v-if="showBatchPickup" @close="onBatchClose" @success="onBatchClose"/>
<withdrawal v-if="show" :dialog-visible="show" :orderId="orderId" ></withdrawal>
<batch-single-application @getList="getList" :order-list="orderId" :dialog-visible.sync="warehouseBol"></batch-single-application>
<fee-application :order-id="orderId" :currencys="JSON.stringify(currencyList)" :dialog-visible.sync="feeApplicationBol"></fee-application>
<fee-application v-if="feeApplicationBol" :order-id="orderId" :currencys="JSON.stringify(currencyList)" :dialog-visible.sync="feeApplicationBol"></fee-application>
<merge-log :order-no="showMergedLogOrderNo" v-if="showMergedLogOrderNo !== null" @close="showMergedLogOrderNo=null" />
<pickup-log v-if="showPickupLogOrderNo" :order-no="showPickupLogOrderNo" @close="showPickupLogOrderNo=null" @delete="getList" />
<SplitRevoke v-if="splitRevokeOrderId" :order-id="splitRevokeOrderId" @close="splitRevokeOrderId=null;getList()"></SplitRevoke>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment