采购结算
This commit is contained in:
@ -79,27 +79,7 @@
|
||||
</a-row>
|
||||
</Card>
|
||||
<Card>
|
||||
<div class="btnBox">
|
||||
<a-button v-if="!isDisable" type="primary" style="margin-bottom: 10px;margin-right: 10px;" @click="handleBtn('add')">新增</a-button>
|
||||
<a-button v-if="!isDisable" @click="handleBtn('del')">删除</a-button>
|
||||
<span>一次结算量吉焦:</span>
|
||||
<span>二次结算量吉焦:</span>
|
||||
<span>结算总量(吉焦):</span>
|
||||
<span>结算总金额:</span>
|
||||
</div>
|
||||
<a-table :columns="columns" :data-source="dataList" :scroll="{x: 1800}" rowKey="salesId" :pagination="false" :row-selection="{ selectedRowKeys: selectedKeys, onChange: onSelectChange }">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a v-if="!isDisable" @click="btnCheck(record, index, 'delete')">删除</a>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'priceDesc'">
|
||||
<a @click="btnCheck(record, index, 'price')">{{record.priceDesc}}</a>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'ksName'">
|
||||
<a @click="btnCheck(record, index, 'ksName')">{{record.ksName}}</a>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
<settleSalesPurList :list="dataList" :disabled="isDisable" pageType="customer" :formState="formState" @change="settleChange"></settleSalesPurList>
|
||||
</Card>
|
||||
<Card title="对账单" :bordered="false" >
|
||||
<UploadList :disabled="isDisable" btnTip="上传对账单" :list="dataFileAccount" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadChange"/>
|
||||
@ -110,8 +90,7 @@
|
||||
</a-form>
|
||||
</div>
|
||||
<customerListModal @register="registerCustomer" @success="handleSuccessCustomer" selectType="radio" />
|
||||
<measureListModal @register="registerMeasure" @success="handleSuccessMeasure"></measureListModal>
|
||||
<priceComposeListModal @register="registerPrice" @success="handleSuccessPrice"></priceComposeListModal>
|
||||
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
@ -133,8 +112,8 @@
|
||||
import { message } from 'ant-design-vue';
|
||||
import UploadList from '/@/components/Form/src/components/UploadList.vue';
|
||||
import customerListModal from '/@/components/common/customerListModal.vue';
|
||||
import measureListModal from '/@/components/common/measureListModal.vue';
|
||||
import priceComposeListModal from '/@/components/common/priceComposeListModal.vue';
|
||||
import settleSalesPurList from '/@/components/common/settleSalesPurList.vue';
|
||||
|
||||
import { getAllCom} from '/@/api/contract/ContractPurInt';
|
||||
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
|
||||
|
||||
@ -172,9 +151,9 @@
|
||||
settleTypeCode: 'I',
|
||||
rpSign: 'Y'
|
||||
});
|
||||
const [registerMeasure, { openModal:openModalMeasure}] = useModal();
|
||||
|
||||
const [registerCustomer, { openModal:openModalCustomer}] = useModal();
|
||||
const [registerPrice, { openModal:openModalPrice}] = useModal();
|
||||
|
||||
const rules= reactive({
|
||||
settleMonth: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
dateFrom: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
@ -195,24 +174,7 @@
|
||||
comIdList: [],
|
||||
signList: []
|
||||
});
|
||||
const selectedKeys = ref([])
|
||||
const columns = ref([
|
||||
{ title: t('序号'), dataIndex: 'index', key: 'index', customRender: (column) => `${column.index + 1}` ,width: 80},
|
||||
{ title: t('计划日期'), dataIndex: 'datePlan', width:120},
|
||||
{ title: t('提气日期'), dataIndex: 'dateMea', width: 120},
|
||||
{ title: t('合同名称'), dataIndex: 'ksName', width: 200},
|
||||
{ title: t('下载点'), dataIndex: 'pointDelyName',width: 150 },
|
||||
{ title: t('完成量(吉焦)'), dataIndex: 'qtyMeaGj', width: 150},
|
||||
{ title: t('完成量(方)'), dataIndex: 'qtyMeaM3', width: 120},
|
||||
{ title: t('结算量(吉焦)'), dataIndex: 'qtySettleGj', width: 140},
|
||||
{ title: t('结算量(方)'), dataIndex: 'qtySettleM3', width: 130},
|
||||
{ title: t('结算价格(元/吉焦)'), dataIndex: 'priceGj', width: 180},
|
||||
{ title: t('结算价格(元/方)'), dataIndex: 'priceM3', width: 170},
|
||||
{ title: t('结算金额(元)'), dataIndex: 'amount', width: 140},
|
||||
{ title: t('价格组成'), dataIndex: 'priceDesc', width: 180},
|
||||
{ title: t('结算次数'), dataIndex: 'settleTimes', width: 100},
|
||||
{ title: t('操作'), dataIndex: 'operation', width: 80},
|
||||
]);
|
||||
|
||||
watch(
|
||||
() => props.id,
|
||||
(val) => {
|
||||
@ -240,9 +202,7 @@
|
||||
}
|
||||
|
||||
});
|
||||
const onSelectChange = (rowKeys) => {
|
||||
selectedKeys.value = rowKeys;
|
||||
}
|
||||
|
||||
const uploadChange = (val) => {
|
||||
dataFileAccount.value = val
|
||||
}
|
||||
@ -291,6 +251,34 @@
|
||||
formState.qtySettleM3 = a.qtySettleM3
|
||||
formState.amount = a.amount
|
||||
}
|
||||
const settleChange = (val) => {
|
||||
dataList.value = val
|
||||
numClear()
|
||||
tableCount()
|
||||
}
|
||||
const numClear = () => {
|
||||
if (!dataList.value.length) {
|
||||
formState.qtySettleGj = ''
|
||||
formState.qtySettleM3 = ''
|
||||
formState.amount = ''
|
||||
}
|
||||
}
|
||||
const tableCount = () => {
|
||||
let qtySettleGj = 0
|
||||
let qtySettleM3 = 0
|
||||
let amount = 0
|
||||
dataList.value.forEach(v => {
|
||||
if (Number(v.settleTimes) == 1){
|
||||
qtySettleGj+=Number(v.qtySettleGj) || 0
|
||||
qtySettleM3+=Number(v.qtySettleM3) || 0
|
||||
}
|
||||
amount+=Number(v.amount) || 0
|
||||
})
|
||||
formState.qtySettleGj = qtySettleGj.toFixed(3)
|
||||
formState.qtySettleM3 = qtySettleM3.toFixed(3)
|
||||
formState.amount = amount.toFixed(2)
|
||||
numFormat()
|
||||
}
|
||||
const comIdChange = (val) => {
|
||||
if (!val)return
|
||||
getDate()
|
||||
@ -328,115 +316,6 @@
|
||||
}
|
||||
return endValue.valueOf() <= startValue.valueOf();
|
||||
}
|
||||
const handleBtn = (type) => {
|
||||
if (type === 'add') {
|
||||
if (!formState.cpCode || !formState.comId) {
|
||||
message.warn('请选择客户和交易主体')
|
||||
return
|
||||
}
|
||||
let obj = {
|
||||
cpCode: formState.cpCode,
|
||||
comId: formState.comId
|
||||
}
|
||||
openModalMeasure(true,{isUpdate: false, searchParams: obj})
|
||||
} else {
|
||||
if (!selectedKeys.value.length) {
|
||||
message.warn('请选择删除数据')
|
||||
return
|
||||
}
|
||||
selectedKeys.value.forEach(i => {
|
||||
let idx = dataList.value.findIndex(v=>v.salesId == i)
|
||||
idx>-1&&dataList.value.splice(idx, 1)
|
||||
});
|
||||
setTimeout(() => {
|
||||
selectedKeys.value = []
|
||||
numClear()
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
const numClear = () => {
|
||||
if (!dataList.value.length) {
|
||||
formState.qtySettleGj = ''
|
||||
formState.qtySettleM3 = ''
|
||||
formState.amount = ''
|
||||
}
|
||||
}
|
||||
const handleSuccessMeasure = (val) => {
|
||||
val.forEach(i =>{
|
||||
delete i.lngFileUploadList
|
||||
})
|
||||
if (!dataList.value.length) {
|
||||
dataList.value = val
|
||||
return
|
||||
}
|
||||
val.forEach(v=> {
|
||||
let idx = dataList.value.findIndex(k=>k.salesId==v.salesId)
|
||||
idx<0&&dataList.value.push(v)
|
||||
})
|
||||
}
|
||||
const btnCheck = (record, index, type) => {
|
||||
if (type == 'delete') {
|
||||
dataList.value.splice(index, 1)
|
||||
numClear()
|
||||
}
|
||||
if (type == 'price'){
|
||||
openModalPrice(true,{isUpdate: false, record,isDisable: isDisable.value})
|
||||
}
|
||||
if (type == 'ksName'){
|
||||
router.push({
|
||||
path: '/contract/ContractSales/viewForm',
|
||||
query: {
|
||||
formPath: 'dayPlan/PngSettleHdr',
|
||||
id: record.ksId,
|
||||
disabled: true
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
const handleSuccessPrice = (arr, curRecord) => {
|
||||
let qtySettleGj = 0
|
||||
let qtySettleM3 = 0
|
||||
let amount = 0
|
||||
let idx = dataList.value.findIndex(v =>v.salesId == curRecord.salesId)
|
||||
arr.forEach(v=> {
|
||||
qtySettleGj+=Number(v.qtySettleGj) || 0
|
||||
qtySettleM3+=Number(v.qtySettleM3) || 0
|
||||
amount+=Number(v.amount) || 0
|
||||
if (idx>-1&&!dataList.value[idx].id) {
|
||||
v.id = ''
|
||||
}
|
||||
})
|
||||
// price_gj=amount/qty_settle_gj,保留4位小数
|
||||
// price_m3=amount/qty_settle_m3,保留4位小数
|
||||
let priceGj = qtySettleGj ? Number(amount) / Number(qtySettleGj) : '0'
|
||||
let priceM3 = qtySettleM3 ? Number(amount) / Number(qtySettleM3) : '0'
|
||||
|
||||
if (idx > -1) {
|
||||
dataList.value[idx].qtySettleGj = qtySettleGj.toFixed(3)
|
||||
dataList.value[idx].qtySettleM3 = qtySettleM3.toFixed(3)
|
||||
dataList.value[idx].amount = amount.toFixed(2)
|
||||
dataList.value[idx].priceGj = priceGj.toFixed(4)
|
||||
dataList.value[idx].priceM3 = priceM3.toFixed(4)
|
||||
dataList.value[idx].lngPngSettleSalesDtlList = arr
|
||||
tableCount()
|
||||
}
|
||||
}
|
||||
const tableCount = () => {
|
||||
let qtySettleGj = 0
|
||||
let qtySettleM3 = 0
|
||||
let amount = 0
|
||||
dataList.value.forEach(v => {
|
||||
if (Number(v.settleTimes) == 1){
|
||||
qtySettleGj+=Number(v.qtySettleGj) || 0
|
||||
qtySettleM3+=Number(v.qtySettleM3) || 0
|
||||
}
|
||||
amount+=Number(v.amount) || 0
|
||||
})
|
||||
formState.qtySettleGj = qtySettleGj.toFixed(3)
|
||||
formState.qtySettleM3 = qtySettleM3.toFixed(3)
|
||||
formState.amount = amount.toFixed(2)
|
||||
numFormat()
|
||||
}
|
||||
const onSearchCustomer = () => {
|
||||
openModalCustomer(true,{isUpdate: false})
|
||||
}
|
||||
@ -517,9 +396,4 @@
|
||||
margin-bottom: 12px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.btnBox {
|
||||
span {
|
||||
margin: 0 30px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user