|
@@ -115,7 +115,8 @@
|
|
|
</trade-card>
|
|
|
<trade-card title="货物明细">
|
|
|
<avue-crud :option="option" :data="form.agentItemsList" id="out-table" ref="crud"
|
|
|
- @selection-change="selectionChange" @resetColumn="resetColumn('crud', 'option', 'optionBack', 376)"
|
|
|
+ @selection-change="selectionChange" @select="selectHandle"
|
|
|
+ @resetColumn="resetColumn('crud', 'option', 'optionBack', 376)"
|
|
|
@saveColumn="saveColumn('crud', 'option', 'optionBack', 376)">
|
|
|
<template slot="menuLeft">
|
|
|
<el-button type="primary" size="small" icon="el-icon-plus" :disabled="editDisabled"
|
|
@@ -163,6 +164,12 @@
|
|
|
<!-- <el-input v-if="row.$cellEdit" v-model="row.billNo" placeholder="请输入 提单号"></el-input> -->
|
|
|
<span v-if="!row.$cellEdit" style="color: #1e9fff" @click="rowJump(row)">{{ row.billNo }}</span>
|
|
|
</template>
|
|
|
+ <template slot="boxType" slot-scope="{ row }">
|
|
|
+ <dic-select v-if="row.$cellEdit" v-model="row.boxType" placeholder="箱型" key="id" res="records"
|
|
|
+ label="cnName" url="/blade-los/bcntrtypes/list" :filterable="true" :remote="true"
|
|
|
+ dataName="cnName"></dic-select>
|
|
|
+ <span v-else>{{ row.boxType }}</span>
|
|
|
+ </template>
|
|
|
<tempalte slot="orderReleaseMethod" slot-scope="{ row }">
|
|
|
<dic-select v-if="row.$cellEdit" v-model="row.orderReleaseMethod" placeholder="放单方式" key="dictKey"
|
|
|
label="dictValue" url="/blade-system/dict-biz/dictionary?code=release_method"
|
|
@@ -231,14 +238,19 @@
|
|
|
<check-schedule :checkId="checkId" :batchNo="batchNo" @choceScheduleFun="choceScheduleFun"></check-schedule>
|
|
|
</el-dialog>
|
|
|
<el-dialog append-to-body title="尾款账单" class="el-dialogDeep" :visible.sync="wkDialog" width="50%" top="30vh"
|
|
|
- :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
|
|
|
+ :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" @closed="wkClosed"
|
|
|
+ v-dialog-drag>
|
|
|
<avue-form v-model="wkForm" :option="wkOption"></avue-form>
|
|
|
- <avue-crud :data="wkData" :option="wkOptionList"></avue-crud>
|
|
|
+ <avue-crud :data="wkForm.agentItemsRList" :option="wkOptionList">
|
|
|
+ <tempalte slot="thisSettlementAmount" slot-scope="{ row }">
|
|
|
+ <el-input-number v-if="row.$cellEdit" v-model="row.thisSettlementAmount" @change="wkChange(row)"
|
|
|
+ :controls="false" placeholder="请输入 本次金额" size="small" style="width: 100%;"></el-input-number>
|
|
|
+ </tempalte>
|
|
|
+ </avue-crud>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button size="mini" @click="wkDialog = false">取 消</el-button>
|
|
|
- <el-button size="mini" type="primary" @click="wkDialog = false">提 交</el-button>
|
|
|
+ <el-button size="mini" type="primary" @click="wkSubmit">提 交</el-button>
|
|
|
</span>
|
|
|
-
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -257,8 +269,9 @@ export default {
|
|
|
|
|
|
data() {
|
|
|
return {
|
|
|
- wkData: [],
|
|
|
- wkForm: {},
|
|
|
+ wkForm: {
|
|
|
+ agentItemsRList: []
|
|
|
+ },
|
|
|
wkOption: {
|
|
|
menuBtn: false,
|
|
|
span: 8,
|
|
@@ -266,22 +279,22 @@ export default {
|
|
|
column: [
|
|
|
{
|
|
|
label: '总货值',
|
|
|
- prop: '',
|
|
|
+ prop: 'goodsValue',
|
|
|
disabled: true,
|
|
|
},
|
|
|
{
|
|
|
label: '预付金额',
|
|
|
- prop: '',
|
|
|
+ prop: 'prepaidAmount',
|
|
|
disabled: true,
|
|
|
},
|
|
|
{
|
|
|
label: '应收金额',
|
|
|
- prop: '',
|
|
|
+ prop: 'amountD',
|
|
|
disabled: true,
|
|
|
},
|
|
|
{
|
|
|
label: '汇率',
|
|
|
- prop: ''
|
|
|
+ prop: 'exchangeRate'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
@@ -294,7 +307,7 @@ export default {
|
|
|
column: [
|
|
|
{
|
|
|
label: '提单号',
|
|
|
- prop: 'invoiceHeader',
|
|
|
+ prop: 'billNo',
|
|
|
overHidden: true
|
|
|
},
|
|
|
{
|
|
@@ -304,10 +317,7 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
label: '本次金额',
|
|
|
- prop: 'taxRate',
|
|
|
- cell: true,
|
|
|
- type: 'number',
|
|
|
- controls: false
|
|
|
+ prop: 'thisSettlementAmount',
|
|
|
}
|
|
|
]
|
|
|
},
|
|
@@ -946,13 +956,23 @@ export default {
|
|
|
countChange(row) {
|
|
|
row.amount = _.multiply(Number(row.quantity ? row.quantity : 0), Number(row.price ? row.price : 0))
|
|
|
},
|
|
|
+ wkChange(row) {
|
|
|
+ let sum = 0
|
|
|
+ this.wkForm.agentItemsRList.forEach(e => {
|
|
|
+ sum = _.add(sum, e.thisSettlementAmount)
|
|
|
+ })
|
|
|
+ if (sum > this.wkForm.unresolvedAmount) {
|
|
|
+ setTimeout(() => {
|
|
|
+ row.thisSettlementAmount = 0
|
|
|
+ this.$message.error("本次金额总数不能超过未结算金额");
|
|
|
+ }, 200);
|
|
|
+ }
|
|
|
+ },
|
|
|
addRow() {
|
|
|
if (!this.form.corpId) {
|
|
|
return this.$message.error("请选择客户名称");
|
|
|
}
|
|
|
this.form.agentItemsList.push({ $cellEdit: true })
|
|
|
- // this.$refs.crud.rowAdd()
|
|
|
-
|
|
|
},
|
|
|
rowCell(row, index) {
|
|
|
if (row.$cellEdit == true) {
|
|
@@ -979,7 +999,37 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
selectionChange(list) {
|
|
|
- this.selectionList = list
|
|
|
+ this.selectionList = list;
|
|
|
+ },
|
|
|
+ selectHandle(selection, row) {
|
|
|
+ // 取消其中一个选中的时候 默认取消同单号的选中
|
|
|
+ if (!selection.includes(row)) {
|
|
|
+ this.pickUp(false,row.billNo);
|
|
|
+ } else {
|
|
|
+ this.pickUp(true,row.billNo);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 需要默认勾选/取消的数据
|
|
|
+ pickUp(bool,billNo) {
|
|
|
+ let arr = [];
|
|
|
+ this.form.agentItemsList.forEach(e=>{
|
|
|
+ if(billNo==e.billNo){
|
|
|
+ arr.push(e)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.toggleSelection(arr, bool);
|
|
|
+ },
|
|
|
+ // 默认选择/取消中的行
|
|
|
+ toggleSelection(rows, bool) {
|
|
|
+ if (rows) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ rows.forEach(row => {
|
|
|
+ this.$refs.crud.toggleRowSelection(row, bool);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$refs.crud.clearSelection();
|
|
|
+ }
|
|
|
},
|
|
|
getDetails(id) {
|
|
|
const loading = this.$loading({
|
|
@@ -1054,34 +1104,49 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
if (name == '尾款账单') {
|
|
|
+
|
|
|
if (!this.form.domesticConsigneeCname) return this.$message.error("请选择国内收货人");
|
|
|
- this.wkDialog = true
|
|
|
+
|
|
|
+ for (let index in this.selectionList) {
|
|
|
+ if (this.selectionList[index].whetherBalancePayment == 1) {
|
|
|
+ return this.$message.error("第" + Number(this.selectionList[index].$index + 1) + "行已生成尾款");
|
|
|
+ }
|
|
|
+ // if (this.selectionList.filter(row => this.selectionList[index].billNo == row.billNo).length != this.form.agentItemsList.filter(row => this.selectionList[index].billNo == row.billNo).length) {
|
|
|
+ // this.$confirm("是否收取所选择相同提单号所有明细尾款?", {
|
|
|
+ // confirmButtonText: "确定",
|
|
|
+ // cancelButtonText: "取消",
|
|
|
+ // type: "warning"
|
|
|
+ // }).then(() => {
|
|
|
+ // console.log(index)
|
|
|
+ // this.form.agentItemsList.forEach(row=>{
|
|
|
+ // if(row.billNo==this.selectionList[index].billNo){
|
|
|
+ // this.$refs.crud.toggleRowSelection(row, true);
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ }
|
|
|
let obj = {}
|
|
|
obj = {
|
|
|
...this.form,
|
|
|
agentItemsList: this.selectionList
|
|
|
}
|
|
|
balancePayment(obj).then(res => {
|
|
|
- // res.data.data.forEach(e => {
|
|
|
- // if (this.form.currency == e.code) {
|
|
|
- // this.$prompt('请输入汇率', '尾款账单', {
|
|
|
- // confirmButtonText: '确定',
|
|
|
- // cancelButtonText: '取消',
|
|
|
- // inputValue: e.exrate
|
|
|
- // }).then(({ value }) => {
|
|
|
- // let obj = {}
|
|
|
- // obj = {
|
|
|
- // ...this.form,
|
|
|
- // exchangeRate: value
|
|
|
- // }
|
|
|
- // generateBalancePaymentBill(obj).then(res => {
|
|
|
- // this.$message.success("成功生成首款账单");
|
|
|
- // this.getDetails(this.form.id)
|
|
|
- // })
|
|
|
- // })
|
|
|
- // }
|
|
|
- // })
|
|
|
+ this.wkForm = res.data.data
|
|
|
+ this.wkForm.amountD = _.subtract(res.data.data.goodsValue, res.data.data.prepaidAmount)
|
|
|
+ res.data.data.agentItemsRList.forEach(e => {
|
|
|
+ e.$cellEdit = true
|
|
|
+ })
|
|
|
+ this.wkForm.agentItemsRList = res.data.data.agentItemsRList
|
|
|
+ bcurrencyGetExrate({ date: this.form.contractDate, dc: 'D' }).then(res => {
|
|
|
+ res.data.data.forEach(e => {
|
|
|
+ if (this.form.currency == e.code) {
|
|
|
+ this.wkForm.exchangeRate = e.exrate
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
})
|
|
|
+ this.wkDialog = true
|
|
|
}
|
|
|
if (name == '生成首款应付') {
|
|
|
if (this.form.applyForPayment == 1) return this.$message.error("请勿重复生成");
|
|
@@ -1232,6 +1297,16 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ wkSubmit() {
|
|
|
+ generateBalancePaymentBill(this.wkForm).then(res => {
|
|
|
+ this.$message.success("成功生成尾款账单");
|
|
|
+ this.getDetails(this.form.id)
|
|
|
+ this.wkDialog = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ wkClosed() {
|
|
|
+ this.wkForm = this.$options.data().wkForm
|
|
|
+ },
|
|
|
application() {
|
|
|
if (this.form.downPayment != 1) return this.$message.error("未申请首款账单");
|
|
|
if (this.form.balancePayment != 1) return this.$message.error("未申请尾款账单");
|