Commit 1330ab72 authored by 吴滔's avatar 吴滔

订单增加优惠功能

parent a05bc4f6
......@@ -18,6 +18,15 @@ export function updateReceipt(data) {
})
}
// 获取收款单列表
export function getReceiptList(query) {
return request({
url: '/ecw/receipt/page',
method: 'get',
params: query
})
}
// 获取应收款列表
export function getReceivableList(query) {
return request({
......@@ -36,10 +45,19 @@ export function getReceivableInfoByIds(query) {
})
}
// 获取收款单列表
export function getReceiptList(query) {
// 修改优惠信息
export function updateReceivableDiscountById(query) {
return request({
url: '/ecw/receipt/page',
url: '/ecw/receivable/updateReceivableDiscountById',
method: 'post',
data: query
})
}
// 得到应收优惠的最后操作人
export function getReceivableDiscountLogById(query) {
return request({
url: '/ecw/receivable/getReceivableDiscountLogById',
method: 'get',
params: query
})
......
......@@ -134,46 +134,19 @@
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" />
</template>
</el-table-column>
<el-table-column label="优惠金额" align="center">
<template slot-scope="scope">
{{ scope.row.discountTotal ? `${scope.row.discountTotal}(${scope.row.discountRemark})` : 0 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button v-if="scope.row.type !== 'total'" type="text" @click="addDiscount(scope.row, scope.$index)">{{ scope.row.discountTotal ? '修改优惠' : '新增优惠' }}</el-button>
<el-button v-if="scope.row.type !== 'total'" type="text" @click="deleteListRow(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-descriptions :column="2" border class="card">
<!-- <el-descriptions-item v-for="(v, index) in form.receiptAccountList" :label="`收款账户${index + 1}`" :key="index">
<div style="display: flex">
<el-form-item
label=""
label-width="0"
style="margin-bottom: 0; margin-right: 12px"
:prop="`receiptAccountList[${index}].platformAccountId`"
:rules="{ required: true, trigger: ['blur', 'change'], message: '请选择收款账户' }"
>
<el-select
v-model="v.platformAccountId"
placeholder="请选择收款账户"
>
<el-option
v-for="item in bankData"
:key="item.id"
:label="item.baAccountName + '(' + item.baAccountNum + ')'"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item
label=""
label-width="0"
style="margin-bottom: 0; margin-right: 12px"
:prop="`receiptAccountList[${index}].currencyId`"
:rules="{ required: true, trigger: ['blur', 'change'], message: '请选择币种' }"
>
<dict-selector
:type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT"
v-model="v.currencyId"
/>
</el-form-item>
<el-button type="text" v-if="index === 0" @click="form.receiptAccountList = [...form.receiptAccountList, {}]">添加收款账户</el-button>
<el-button type="text" v-if="index > 0" @click="subtractItem(index)"><span style="color: red">删除</span></el-button>
</div>
</el-descriptions-item> -->
<el-descriptions-item label="是否需要开票">
<el-form-item
label=""
......@@ -286,7 +259,11 @@
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" />
</template>
</el-table-column>
<el-table-column label="应收金额" align="center" prop="receivableAmount" />
<el-table-column label="应收金额" align="center" prop="receivableAmount">
<template slot-scope="scope" v-if="scope.row.type !== 'total'">
{{ `${scope.row.receivableAmount - scope.row.discountTotal}(${scope.row.receivableAmount} - ${scope.row.discountTotal})` }}
</template>
</el-table-column>
<el-table-column align="center" width="220">
<template #header>
核销基准币种(<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="showCurrencyId" />)汇率
......@@ -301,7 +278,7 @@
style="margin-bottom: 0"
:prop="`receiptAccountList.${scope.$index}.writeOffRate`"
>
<el-input v-model="scope.row.writeOffRate"></el-input>
<el-input v-model="scope.row.writeOffRate" @input="() => writeOffRateChange(scope.row, scope.$index)"></el-input>
</el-form-item>
</template>
<template v-else>
......@@ -391,47 +368,17 @@
<el-date-picker
v-model="form.rateValidateDate"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
</el-descriptions-item>
</el-descriptions>
</el-card>
<!-- <el-card class="card amountCard">
<el-descriptions :column="2" border>
<template v-for="(item, index) in form.receivableDetailList">
<el-descriptions-item :label="index === 0 ? '应收总金额' : ''" :key="index+3">
{{ item.amount }}
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="index + 1" />
</el-descriptions-item>
<el-descriptions-item :key="index">
<template v-if="showCurrencyId !== item.currencyId" slot="label">
汇率(<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="showCurrencyId" />)
</template>
<el-form-item
v-if="showCurrencyId !== item.currencyId"
label=""
label-width="0"
style="margin-bottom: 0"
:prop="`receivableDetailList[${index}].rate`"
:rules="{ required: true, trigger: ['blur', 'change'], message: '请输入汇率' }"
>
<el-input v-model="item.rate" style="width: 220px" @input="calculationCount(form.receivableTotalAmount)"></el-input>
</el-form-item>
</el-descriptions-item>
</template>
<el-descriptions-item>
<template slot="label">
应收总金额(<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="showCurrencyId" />)
</template>
{{ form.receivableTotalAmount }}
</el-descriptions-item>
</el-descriptions>
</el-card> -->
</el-form>
<div slot="footer" style="margin: 20px 0">
<el-button type="primary" :loading="saveBtnLoading" @click="submitForm(1)"> </el-button>
<el-button type="primary" @click="submitForm(0)">{{ id ? '修 改' : '新 增' }}</el-button>
<el-button type="primary" :loading="saveBtnLoading" @click="submitForm(0)">{{ id ? '修 改' : '新 增' }}</el-button>
</div>
<el-dialog
:visible.sync="open"
......@@ -550,6 +497,7 @@
@selection-change="handleSelectionChange"
row-key="id"
height="calc(100vh - 480px)"
:key="dialogTableKey"
>
<el-table-column type="selection" width="55" :reserve-selection="true"> </el-table-column>
<el-table-column label="订单号" align="center" prop="orderNo" />
......@@ -607,6 +555,70 @@
</div>
</div>
</el-dialog>
<el-dialog v-if="discountVisible" :visible.sync="discountVisible" title="优惠信息确认" width="60%" append-to-body>
<el-form label-width="120px">
<el-form-item v-if="form.receiptNo" label="收款单号">
{{ form.receiptNo }}
</el-form-item>
<el-table :data="[selectListRow]" border style="margin-bottom: 22px">
<el-table-column label="订单号" align="center" prop="orderNo" />
<el-table-column label="唛头" align="center" prop="marks" />
<el-table-column label="品名" align="center" prop="title">
<template slot-scope="scope">
{{ scope.row.titleZh + "(" + scope.row.titleEn + ")" }}
</template>
</el-table-column>
<el-table-column label="箱数" align="center" prop="num" />
<el-table-column label="体积/重量" align="center" prop="weight" />
<el-table-column label="收入类型" align="center" prop="feeType">
<template slot-scope="scope">
<dict-tag
:type="DICT_TYPE.FEE_TYPE"
:value="scope.row.feeType"
></dict-tag>
</template>
</el-table-column>
<el-table-column label="单价金额" align="center" prop="unitPrice">
<template slot-scope="scope">
<span>{{ scope.row.unitPrice }}</span>
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" />
</template>
</el-table-column>
<el-table-column label="总金额" align="center" prop="totalAmount">
<template slot-scope="scope">
<span>{{ scope.row.totalAmount }}</span>
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" />
</template>
</el-table-column>
</el-table>
<el-form-item label="总金额">
{{ selectListRow.totalAmount }}
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="selectListRow.currencyId" />
</el-form-item>
<el-form-item label="优惠金额">
<el-input v-model="discountForm.discountTotal" style="width: 300px"></el-input>
&nbsp;&nbsp;
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="selectListRow.currencyId" />
</el-form-item>
<el-form-item label="优惠原因">
<el-input v-model="discountForm.discountRemark" type="textarea" style="width: 300px"></el-input>
</el-form-item>
<el-form-item label="优惠后">
{{ selectListRow.totalAmount - (discountForm.discountTotal || 0) }}
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="selectListRow.currencyId" />
</el-form-item>
<el-form-item label="操作人">
{{ discountForm.author }}
</el-form-item>
<el-form-item label="操作时间">
{{ discountForm.time }}
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveDiscount"> </el-button>
<el-button @click="cancelDiscount"> </el-button>
</div>
</el-dialog>
</div>
</template>
......@@ -619,11 +631,13 @@ import { getBankAccountPage } from "@/api/ecw/bankAccount";
import { listSimpleDepts } from "@/api/system/dept";
import { getChannelList } from "@/api/ecw/channel";
import { getTradeCityList } from "@/api/ecw/region";
import { createReceipt, getReceivableList, getReceivableInfoByIds, getReceiptInfoByIds, getReceiptAccountList, getInvoicingItem, updateReceipt } from "@/api/ecw/financial";
import { createReceipt, getReceivableList, getReceivableInfoByIds, getReceiptInfoByIds, getReceiptAccountList, getInvoicingItem, updateReceipt, updateReceivableDiscountById, getReceivableDiscountLogById } from "@/api/ecw/financial";
import {getCustomer} from '@/api/ecw/customer'
import NP from 'number-precision'
import { getCurrencyPage } from "@/api/ecw/currency";
import ret from "bluebird/js/release/util";
import dayjs from "dayjs";
import { getUserProfile } from "@/api/system/user";
export default {
name: "CreatCollection",
......@@ -636,22 +650,13 @@ export default {
loading1: false,
uploadFileUrl: process.env.VUE_APP_BASE_API + "/app-api/file/upload", // 上传的图片服务器地址
form: {
// receiptAccountList: [{}],
// receivableDetailList: [
// { amount: 0, currencyId: 1, rate: 0 },
// { amount: 0, currencyId: 2, rate: 0 },
// { amount: 0, currencyId: 3, rate: 0 }
// ],
receiptAccountList: [
// { currencyId: 1, receivableAmount: 0, writeOffRate: 1, writeOffAmount: 999, platformAccountId: '', currencyId: '', rate: 1, collectionAmount: 0 },
// { currencyId: 2, receivableAmount: 0, writeOffRate: 1, writeOffAmount: 999, platformAccountId: '', currencyId: '', rate: 1, collectionAmount: 0 },
// { currencyId: 3, receivableAmount: 0, writeOffRate: 1, writeOffAmount: 999, platformAccountId: '', currencyId: '', rate: 1, collectionAmount: 0 },
]
receiptAccountList: []
},
creatorData: [],
list: [],
// fileList: [],
orderData: [],
dialogTableKey: 0,
total: 0,
headers: {
Authorization: "Bearer " + getToken(),
......@@ -676,10 +681,17 @@ export default {
id: 0,
receiptId: 0,
currencyList: [],
saveBtnLoading: false
saveBtnLoading: false,
discountVisible: false,
discountForm: {},
selectListRow: {},
selectListIndex: 0
};
},
async created() {
getUserProfile().then(res => {
this.discountForm.author = res.data.username
})
// 获取汇率
await getCurrencyPage(this.params).then(res => this.currencyList = res.data.list)
......@@ -687,9 +699,10 @@ export default {
if (that.$route.query.id) {
this.id = this.$route.query.id;
getReceiptInfoByIds({ id: this.id }).then(res => {
res.data.rateValidateDate = dayjs(res.data.rateValidateDate).format('YYYY-MM-DD HH:mm:ss')
this.form = Object.assign({}, this.form, res.data)
})
getInvoicingItem({ id: this.id }).then(res => {
await getInvoicingItem({ id: this.id }).then(res => {
this.list = [...res.data]
})
getReceiptAccountList({ id: this.id }).then(res => {
......@@ -703,8 +716,24 @@ export default {
}
this.$set(this.form, 'receiptAccountList', [...res.data])
this.$nextTick(() => {
const dollarList = this.list.filter(v => v.currencyId === 1)
const discountDollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const d = this.form.receiptAccountList.find(v => v.currencyId == 1)
d && (d.discountTotal = discountDollar)
const rmbList = this.list.filter(v => v.currencyId === 2)
const discountRmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const r = this.form.receiptAccountList.find(v => v.currencyId == 2)
r && (r.discountTotal = discountRmb)
const nairaList = this.list.filter(v => v.currencyId === 3)
const discountNaira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const n = this.form.receiptAccountList.find(v => v.currencyId == 3)
n && (n.discountTotal = discountNaira)
this.form.receiptAccountList.forEach((item, index) => {
this.rateChange(item, index)
// this.calculation()
});
})
})
......@@ -713,12 +742,6 @@ export default {
this.receiptId = this.$route.query.receiptId;
getReceivableInfoByIds({ id: this.receiptId }).then(res => {
this.list = [{...res.data}]
// this.list = [
// { collectionAmount: 100, currencyId: 2 },
// { collectionAmount: 100, currencyId: 3 },
// { collectionAmount: 100, currencyId: 3 },
// ]
// this.$set(this.form, 'supplierId', res.data.supplierId)
this.calculation()
})
}
......@@ -799,20 +822,26 @@ export default {
this.rateChange(row, index)
},
writeOffRateChange(row, index) {
row.writeOffAmount = NP.times(row.writeOffRate || 0, NP.minus(row.receivableAmount, row.discountTotal))
const writeOffAmountTotal = this.form.receiptAccountList.filter(v => v.type !== 'total').reduce((total, currentValue) => NP.plus(total, currentValue.writeOffAmount || 0), 0)
this.form.receiptAccountList[this.form.receiptAccountList.length -1].writeOffAmount = writeOffAmountTotal
},
rateChange(row, index) {
row.receivableAmount && (row.collectionAmount = NP.times(row.collectionRate || 0, row.receivableAmount))
row.receivableAmount && (row.collectionAmount = NP.times(row.collectionRate || 0, NP.minus(row.receivableAmount, row.discountTotal)))
this.form.receiptAccountList[index] = {...row}
setTimeout(() => {
// 收款总计
const dollarList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == 1)
const dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount || 0), 0)
const dollar = dollarList.reduce((total, currentValue) => NP.plus(total, NP.minus(currentValue.receivableAmount, currentValue.discountTotal || 0) || 0), 0)
const rmbList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == 2)
const rmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount || 0), 0)
const rmb = rmbList.reduce((total, currentValue) => NP.plus(total, NP.minus(currentValue.receivableAmount, currentValue.discountTotal || 0) || 0), 0)
const nairaList = this.form.receiptAccountList.filter(v => v.collectionCurrencyId == 3)
const naira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount || 0), 0)
const naira = nairaList.reduce((total, currentValue) => NP.plus(total, NP.minus(currentValue.receivableAmount, currentValue.discountTotal || 0) || 0), 0)
this.form.receiptAccountList[this.form.receiptAccountList.length -1].collectionAmount = [dollar, rmb, naira]
this.$set(this.form, 'receiptAccountList', [...this.form.receiptAccountList])
......@@ -822,12 +851,14 @@ export default {
const copyList = this.form.receiptAccountList
this.form.receiptAccountList = []
const dollarList = this.list.filter(v => v.currencyId === 1)
let dollar
let dollar,discountDollar
if (dollarList.length > 0) {
dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.totalAmount || 0), 0)
discountDollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const t = copyList.find(v => v.currencyId == 1)
this.form.receiptAccountList = [
{
discountTotal: discountDollar,
currencyId: 1,
receivableAmount: dollar,
writeOffRate: t?.writeOffRate || (this.showCurrencyId === 1 ? 1 : this.showCurrencyId === 2 ? this.UStoRMB() : this.UStoNAN()),
......@@ -836,16 +867,18 @@ export default {
collectionRate: t?.collectionRate || ''
}
]
this.calculationCount(dollar, 1)
this.calculationCount(NP.minus(dollar, discountDollar), 1)
}
const rmbList = this.list.filter(v => v.currencyId === 2)
let rmb
let rmb,discountRmb
if (rmbList.length > 0) {
rmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.totalAmount || 0), 0)
discountRmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const t = copyList.find(v => v.currencyId == 2)
this.form.receiptAccountList = [
...this.form.receiptAccountList,
{
discountTotal: discountRmb,
currencyId: 2,
receivableAmount: rmb,
writeOffRate: t?.writeOffRate || (this.showCurrencyId === 1 ? this.RMBtoUS() : this.showCurrencyId === 2 ? 1 : this.RMBtoNAN()),
......@@ -854,16 +887,18 @@ export default {
collectionRate: t?.collectionRate || ''
}
]
this.calculationCount(rmb, 2)
this.calculationCount(NP.minus(rmb, discountRmb), 2)
}
const nairaList = this.list.filter(v => v.currencyId === 3)
let naira
let naira,discountNaira
if (nairaList.length > 0) {
naira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.totalAmount || 0), 0)
discountNaira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const t = copyList.find(v => v.currencyId == 3)
this.form.receiptAccountList = [
...this.form.receiptAccountList,
{
discountTotal: discountNaira,
currencyId: 3,
receivableAmount: naira,
writeOffRate: t?.writeOffRate || (this.showCurrencyId === 1 ? this.NANtoUS() : this.showCurrencyId === 2 ? this.NANtoRMB() : 1),
......@@ -872,7 +907,7 @@ export default {
collectionRate: t?.collectionRate || ''
}
]
this.calculationCount(naira, 3)
this.calculationCount(NP.minus(naira, discountNaira), 3)
}
if (this.form.receiptAccountList.length > 0) {
// totalAmount
......@@ -960,12 +995,50 @@ export default {
}
})
},
// subtractItem(index) {
// this.form.receiptAccountList.splice(index, 1)
// this.$set(this.form, 'receiptAccountList', [...this.form.receiptAccountList])
// },
getReceivableListByIds() {
},
cancelDiscount() {
this.discountVisible = false
this.discountForm = {}
this.selectListRow = {}
},
addDiscount(row, index) {
this.discountVisible = true
this.selectListRow = { ...row }
this.selectListIndex = index
this.$set(this.discountForm, 'time', dayjs().format('YYYY-MM-DD HH:mm:ss'))
getReceivableDiscountLogById({ id: row.id }).then(res => {
if (res.data?.creatorName) {
this.$set(this.discountForm, 'time', dayjs(res.data.createTime).format('YYYY-MM-DD HH:mm:ss'))
this.$set(this.discountForm, 'discountTotal', res.data.discountTotal)
this.$set(this.discountForm, 'discountRemark', res.data.discountRemark)
this.$set(this.discountForm, 'author', res.data.creatorName)
}
})
},
saveDiscount() {
console.log(this.discountForm)
// this.selectListRow.id
const params = {
id: this.selectListRow.id,
discountTotal: this.discountForm.discountTotal,
discountRemark: this.discountForm.discountRemark,
orderNo: this.selectListRow.orderNo,
orderId: this.selectListRow.orderId,
}
updateReceivableDiscountById(params).then(res => {
if (this.selectListRow.discountTotal) {
this.$modal.msgSuccess("修改成功");
} else {
this.$modal.msgSuccess("新增成功");
}
getReceivableInfoByIds({ id: this.selectListRow.id }).then(res => {
this.$set(this.list, this.selectListIndex, {...res.data})
this.cancelDiscount()
this.calculation()
})
})
},
getList() {
this.loading1 = true;
......@@ -975,6 +1048,7 @@ export default {
// 执行查询
getReceivableList(params).then((response) => {
this.orderData = response.data.list;
this.dialogTableKey ++
this.total = response.data.total;
this.loading1 = false;
this.$nextTick(() => {
......@@ -985,35 +1059,6 @@ export default {
})
});
},
// beforeRemove(file, fileList) {
// return this.$confirm(`确定移除?`).then(res => {
// setTimeout(() => {
// this.fileList = fileList.map(v => v.response.data)
// }, 300)
// });
// },
// handleUploadSuccess(res, file, fileList) {
// var arr = [];
// fileList.forEach((item) => {
// arr.push(item.response.data);
// });
// this.fileList = arr;
// this.loading.close();
// },
// handleBeforeUpload() {
// this.loading = this.$loading({
// lock: true,
// text: "上传中",
// background: "rgba(0, 0, 0, 0.7)",
// });
// },
// handleUploadError() {
// this.$message({
// type: "error",
// message: "上传失败",
// });
// this.loading.close();
// },
/** 新增按钮操作 */
handleAdd() {
this.open = true;
......@@ -1022,9 +1067,13 @@ export default {
this.open = false;
},
submitForm(addType) {
this.saveBtnLoading = true
const params = {...this.form, addType}
params.receiptAccountList.length = params.receiptAccountList.length - 1
params.receiptAccountList.map(v => {
delete v.discountTotal
v.writeOffRate = Number(v.writeOffRate)
return v
})
// params.receiptAccountList = params.receiptAccountList.map(v => Object.assign(v, { }))
delete params.receivableDetail
if (this.list && this.list.length > 0) {
......@@ -1032,7 +1081,6 @@ export default {
}
if (params.receivableVOList.length === 0) {
this.$modal.msgError("请添加未收客户款项");
this.saveBtnLoading = false
return
}
if (addType === 1) {
......@@ -1050,17 +1098,20 @@ export default {
return errorMessage == '';
});
if (valid) {
this.saveBtnLoading = true
if (this.id && this.id !== '0') {
updateReceipt(params).then(res => {
this.$modal.msgSuccess("修改成功");
this.saveBtnLoading = false
this.$router.back();
}).finally(() => {
this.saveBtnLoading = false
})
} else {
createReceipt(params).then(res => {
this.$modal.msgSuccess("保存成功");
this.saveBtnLoading = false
this.$router.back();
}).finally(() => {
this.saveBtnLoading = false
})
}
}
......@@ -1069,28 +1120,20 @@ export default {
}
this.$refs.form.validate ((valid)=>{
if (valid) {
// const params = {...this.form, addType}
// params.receiptAccountList = params.receiptAccountList
// delete params.receivableDetail
// if (this.list && this.list.length > 0) {
// params.receivableVOList = this.list
// }
// // params.fileList = this.fileList.join(',')
// if (params.receivableVOList.length === 0) {
// this.$modal.msgError("请添加未收客户款项");
// return
// }
this.saveBtnLoading = true
if (this.id && this.id !== '0') {
updateReceipt(params).then(res => {
this.$modal.msgSuccess("修改成功");
this.saveBtnLoading = false
this.$router.back();
}).finally(() => {
this.saveBtnLoading = false
})
} else {
createReceipt(params).then(res => {
this.$modal.msgSuccess("新增成功");
this.saveBtnLoading = false
this.$router.back();
}).finally(() => {
this.saveBtnLoading = false
})
}
}
......@@ -1104,6 +1147,11 @@ export default {
this.open = false;
this.calculation()
},
deleteListRow(index) {
const list = [...this.list]
delete list[index]
this.list = list.filter(v => v)
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.page = 1;
......@@ -1117,7 +1165,8 @@ export default {
margin-top: 20px;
}
.dialog-footer {
padding: 40px;
// padding: 40px;
text-align: left;
}
.card-title {
font-size: 18px;
......
......@@ -46,6 +46,11 @@
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" />
</template>
</el-table-column>
<el-table-column label="优惠金额" align="center">
<template slot-scope="scope">
{{ scope.row.discountTotal ? `${scope.row.discountTotal}(${scope.row.discountRemark})` : 0 }}
</template>
</el-table-column>
</el-table>
<el-descriptions :column="2" border class="card">
<!-- <el-descriptions-item v-for="(v, index) in form.platformAccountIdList" :label="`收款账户${index + 1}`" :key="index">
......@@ -156,7 +161,12 @@
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.currencyId" />
</template>
</el-table-column>
<el-table-column label="应收金额" align="center" prop="receivableAmount" />
<!-- <el-table-column label="应收金额" align="center" prop="receivableAmount" /> -->
<el-table-column label="应收金额" align="center" prop="receivableAmount">
<template slot-scope="scope" v-if="scope.row.type !== 'total'">
{{ `${scope.row.receivableAmount - scope.row.discountTotal}(${scope.row.receivableAmount} - ${scope.row.discountTotal})` }}
</template>
</el-table-column>
<el-table-column align="center" width="220">
<template #header>
核销基准币种(<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="showCurrencyId" />)汇率
......@@ -509,6 +519,22 @@ export default {
res.data[res.data.length -1].collectionAmount = [dollar, rmb, naira]
// this.$set(this.form, 'receiptAccountList', [...this.form.receiptAccountList])
const dollarListByList = this.list.filter(v => v.currencyId === 1)
const discountDollar = dollarListByList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const d = res.data.find(v => v.currencyId == 1)
d && (d.discountTotal = discountDollar)
const rmbListByList = this.list.filter(v => v.currencyId === 2)
const discountRmb = rmbListByList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const r = res.data.find(v => v.currencyId == 2)
r && (r.discountTotal = discountRmb)
const nairaListByList = this.list.filter(v => v.currencyId === 3)
const discountNaira = nairaListByList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const n = res.data.find(v => v.currencyId == 3)
n && (n.discountTotal = discountNaira)
this.$set(this.form, 'receiptAccountList', [...res.data])
this.$nextTick(() => {
// this.form.receiptAccountList.forEach((item, index) => {
......
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