Browse Source

修复对账单

dev
qb 2 months ago
parent
commit
beb9b239b1
  1. 120
      src/views/finance/ReconciliationDepositSlip.vue

120
src/views/finance/ReconciliationDepositSlip.vue

@ -94,7 +94,23 @@
<!-- 头部左侧按钮模块 -->
<div class="avue-crud__left">
<!-- 审核 -->
<el-button v-if="item.name === 2" type="primary" icon="Stamp" @click="handleConfirm">生成对账单</el-button>
<el-button
v-if="permissionObj.ReconciliationDepositSlip_handleConfirm"
type="primary"
icon="Stamp"
@click="handleConfirm"
>
生成对账单
</el-button>
<el-button
v-if="permissionObj.ReconciliationDepositSlip_handleBatchSettle"
type="primary"
icon="Stamp"
@click="handleBatchSettle"
>
批量结算
</el-button>
<!-- 导出 -->
<el-button type="primary" icon="Download" @click="handleExport"> </el-button>
@ -119,8 +135,12 @@
@selection="selectionChange"
>
<template #default="slotProps">
<template v-if="item.name !== 1 && slotProps.scope.column.label === '操作'">
<el-text @click="() => handleComputedPrice(slotProps.scope)">计算费用</el-text>
<template v-if="slotProps.scope.column.label === '操作'">
<el-text
v-if="permissionObj.ReconciliationDepositSlip_handleComputedPrice"
@click="() => handleComputedPrice(slotProps.scope)"
>计算费用</el-text
>
</template>
</template>
</tablecmt>
@ -215,7 +235,7 @@
import { ref, reactive, toRefs, computed, onMounted, nextTick } from 'vue';
import functions from '@/utils/functions.js';
import dayjs from 'dayjs';
import { mapGetters } from 'vuex';
import { mapGetters, useStore } from 'vuex';
/** 获取字典 */
import { getDictionaryBiz } from '@/api/system/dict';
import {
@ -226,7 +246,7 @@ import {
postCreateReconciliationOrder,
postCreateFinishWaybillId,
postCreateReconciliationwWaybillId,
postCalculateRealCostByWaybillId
postCalculateRealCostByWaybillId,
} from '@/api/finance/ReconciliationDepositSlip';
import {
downloadXls,
@ -339,8 +359,32 @@ const tableNodeRef = ref();
const { search, shortcuts, selectionList, drawerShow, page, defaultTime2 } = toRefs(details);
/** vuex */
const permission = computed(() => mapGetters(['permission', 'tagWel', 'tagList']));
console.log('permission :>> ', permission);
const $store = useStore();
const { permission } = $store.getters;
const permissionObj = reactive({
//
ReconciliationDepositSlip_handleConfirm: computed(() => {
return details.pageStatus === 1
? permission.ReconciliationDepositSlip_handleConfirm_toB
: permission.ReconciliationDepositSlip_handleConfirm_toC;
}),
//
ReconciliationDepositSlip_handleBatchSettle: computed(() => {
return details.pageStatus === 1
? permission.ReconciliationDepositSlip_handleBatchSettle_toB
: //
permission.ReconciliationDepositSlip_handleBatchSettle_toC;
}),
//
ReconciliationDepositSlip_handleComputedPrice: computed(() => {
return details.pageStatus === 1
? //
permission.ReconciliationDepositSlip_handleComputedPrice_toB
: permission.ReconciliationDepositSlip_handleComputedPrice_toC;
}),
});
onMounted(async () => {
await nextTick();
@ -568,6 +612,42 @@ const handleFullScrean = (_type: 'open' | 'close', _name: string) => {
}
};
/** 批量结算 */
const handleBatchSettle = () => {
try {
if (details.selectionList.length === 0) return ElMessage.warning('请选择需要结算的数据');
ElMessageBox.confirm('是否批量结算?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(async () => {
details.popUpShow.confirmVisited = false;
try {
details.loadingObj.pageLoading = true;
const submitData = {
waybillIds: details.selectionList.map(val => val.waybillId),
};
const res = await postCreateFinishWaybillId(submitData);
const { code, msg } = res.data;
if (code !== 200) return msg && ElMessage.warning(msg);
if (msg) ElMessage.success(msg);
} catch (error) {
console.log('error :>> ', error);
} finally {
onLoad();
details.loadingObj.pageLoading = false;
}
});
} catch (error) {
console.log('error :>> ', error);
} finally {
}
};
/** 生成对账单 */
const handleConfirm = async () => {
await nextTick();
@ -611,11 +691,25 @@ const handleSubmitConfrim = () => {
try {
details.loadingObj.pageLoading = true;
const submitData = {
orderInfoIds: details.selectionList.map(val => val.orderInfoId),
};
let res: any = {};
// toB
if (details.pageStatus === 1) {
const submitData = {
waybillIds: details.selectionList.map(val => val.waybillId),
};
res = await postCreateReconciliationwWaybillId(submitData);
}
// toC
else {
const submitData = {
orderInfoIds: details.selectionList.map(val => val.orderInfoId),
};
res = await postCreateReconciliationOrder(submitData);
}
const res = await postCreateReconciliationOrder(submitData);
const { code, msg } = res.data;
if (code !== 200) return msg && ElMessage.warning(msg);
@ -639,8 +733,8 @@ const handleComputedPrice = ({ row }) => {
try {
details.loadingObj.pageLoading = true;
// const res = await postReal(row.orderInfoId);
const res = await postCalculateRealCostByWaybillId(row.waybillId);
const res = await postReal(row.orderInfoId);
// const res = await postCalculateRealCostByWaybillId(row.waybillId);
const { code, msg } = res.data;
if (code !== 200) return msg && ElMessage.warning(msg);

Loading…
Cancel
Save