Commit afaff852 authored by 我在何方's avatar 我在何方

收款单货币bug

parent 35b9e1e1
......@@ -5,17 +5,18 @@
:model="form"
label-width="120px"
label-position="left"
:inline="true"
>
<el-card>
<div v-if="id" slot="header" class="card-title">{{ $t('修改收款单') }}</div>
<div v-else slot="header" class="card-title">{{ $t('新增收款单') }}</div>
<el-descriptions :column="3" border>
<el-descriptions-item :label="$t('客户')">
<!-- <el-descriptions :column="3" border> -->
<!-- <el-descriptions-item > -->
<el-form-item
label=""
label-width="0"
:label="$t('客户')"
style="margin-bottom: 0"
prop="customerId"
:span="4"
:rules="{ required: true, trigger: ['blur', 'change'], message: $t('客户不能为空') }"
>
<customer-selector
......@@ -23,13 +24,13 @@
@change="customerChange"
/>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item :label="$t('部门')">
<!-- </el-descriptions-item>
<el-descriptions-item > -->
<el-form-item
label=""
label-width="0"
:label="$t('部门')"
style="margin-bottom: 0"
prop="departmentId"
:span="4"
:rules="{ required: true, trigger: ['blur', 'change'], message: $t('部门不能为空') }"
>
<el-select
......@@ -45,13 +46,11 @@
/>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item :label="$t('业务员')">
<el-form-item
label=""
label-width="0"
:label="$t('业务员')"
style="margin-bottom: 0"
prop="salesmanId"
:span="4"
:rules="{ required: true, trigger: ['blur', 'change'], message: $t('业务员不能为空') }"
>
<el-select v-model="form.salesmanId" :placeholder="$t('请选择业务员')" @change="v => form.salesmanName = creatorData.find(t => t.id === v).nickname">
......@@ -63,12 +62,11 @@
/>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item :label="$t('手续费(RMB)')">
<el-form-item
label=""
label-width="0"
style="margin-bottom: 0"
<!-- </el-descriptions-item> -->
<!-- <el-descriptions-item > -->
<!-- <el-form-item
:label="$t('手续费(RMB)')"
style="margin-bottom: 0;margin-top: 20px;"
prop="feeRate"
:rules="{ required: true, trigger: ['blur', 'change'], message: $t('手续费不能为空') }"
>
......@@ -76,19 +74,18 @@
v-model="form.feeRate"
:placeholder="$t('请输入手续费')"
></el-input>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item :label="$t('备注')">
</el-form-item> -->
<!-- </el-descriptions-item>
<el-descriptions-item > -->
<el-form-item
label=""
label-width="0"
style="margin-bottom: 0"
:label="$t('备注')"
style="margin-bottom: 0;margin-top: 20px;"
prop="remark"
>
<el-input v-model="form.remark" :placeholder="$t('备注')"></el-input>
</el-form-item>
</el-descriptions-item>
</el-descriptions>
<!-- </el-descriptions-item> -->
<!-- </el-descriptions> -->
</el-card>
<el-card class="card amountCard">
<div slot="header" class="card-title">{{ $t('订单信息') }}</div>
......@@ -151,13 +148,13 @@
</template>
</el-table-column>
</el-table>
<el-descriptions :column="2" border class="card">
<el-descriptions-item :label="$t('是否需要开票')">
<!-- <el-descriptions :column="2" border class="card">
<el-descriptions-item > -->
<el-form-item
label=""
label-width="0"
style="margin-bottom: 0"
:label="$t('是否需要开票')+':'"
style="margin-bottom: 0;margin-top: 20px;"
prop="openInvoice"
required
:rules="{ required: true, trigger: ['blur', 'change'], message: $t('请选择是否需要开票') }"
>
<el-select
......@@ -168,11 +165,17 @@
<el-option :value="0" :label="$t('否')"></el-option>
</el-select>
</el-form-item>
</el-descriptions-item>
<el-descriptions-item :label="$t('核销基准币种')">
<el-form-item
:label="$t('核销基准币种')+':'"
style="margin-bottom: 0;margin-top: 20px;"
>
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="showCurrencyId" />
</el-form-item>
<!-- </el-descriptions-item>
<el-descriptions-item :label="$t('核销基准币种')">
</el-descriptions-item>
</el-descriptions>
</el-descriptions> -->
</el-card>
<el-card v-if="showInvoice" class="card">
<div slot="header" class="card-title">{{ $t('开票资料') }}</div>
......@@ -328,11 +331,23 @@
style="margin-bottom: 0"
:prop="`receiptAccountList.${scope.$index}.collectionCurrencyId`"
>
<dict-selector
:type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT"
<el-select
v-model="scope.row.collectionCurrencyId"
:placeholder="$t('请选择')"
@change="val => currencyIdChange(val, scope.row, scope.$index)"
>
<el-option
v-for="item in currencyList"
:key="item.id"
:label="item.titleZh"
:value="item.id"
/>
</el-select>
<!-- <dict-selector
:type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT"
v-model="scope.row.collectionCurrencyId"
@change="val => currencyIdChange(val, scope.row, scope.$index)"
/> -->
</el-form-item>
</template>
</el-table-column>
......@@ -648,6 +663,7 @@ import { getTradeCityList } from "@/api/ecw/region";
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 {getOrder} from '@/api/ecw/order'
import { getCurrencyPage } from "@/api/ecw/currency";
import ret from "bluebird/js/release/util";
import dayjs from "dayjs";
......@@ -702,7 +718,8 @@ export default {
discountForm: {},
selectListRow: {},
selectListIndex: 0,
flag: false
flag: false,
orderData:{}
};
},
async created() {
......@@ -762,6 +779,11 @@ export default {
getReceivableInfoByIds({ id: this.receiptId }).then(res => {
this.list = [{...res.data}]
this.calculation()
getOrder(res.data.orderId).then(response => {
// console.log(response.data)
this.$set(this.form,'customerId',response.data.userId)
})
})
}
......@@ -828,7 +850,6 @@ export default {
},
methods: {
checkDiscount(e){
console.log(e)
if(e>this.selectListRow.totalAmount){
this.discountForm.discountTotal = this.selectListRow.totalAmount
}
......@@ -837,12 +858,12 @@ export default {
row.collectionCurrencyId = val
if (val == row.currencyId) row.collectionRate = 1
else {
if (row.currencyId == 1 && val == 2) row.collectionRate = this.UStoRMB()
if (row.currencyId == 1 && val == 3) row.collectionRate = this.UStoNAN()
if (row.currencyId == 2 && val == 1) row.collectionRate = this.RMBtoUS()
if (row.currencyId == 2 && val == 3) row.collectionRate = this.RMBtoNAN()
if (row.currencyId == 3 && val == 1) row.collectionRate = this.NANtoUS()
if (row.currencyId == 3 && val == 2) row.collectionRate = this.NANtoRMB()
if (row.currencyId == 1 && val == 3) row.collectionRate = this.UStoRMB()
if (row.currencyId == 1 && val == 2) row.collectionRate = this.UStoNAN()
if (row.currencyId == 3 && val == 1) row.collectionRate = this.RMBtoUS()
if (row.currencyId == 3 && val == 2) row.collectionRate = this.RMBtoNAN()
if (row.currencyId == 2 && val == 1) row.collectionRate = this.NANtoUS()
if (row.currencyId == 2 && val == 3) row.collectionRate = this.NANtoRMB()
}
this.rateChange(row, index)
......@@ -1023,9 +1044,6 @@ export default {
addressPhone: `${res.data.billingAddress || ''}/${res.data.billingTell || ''}`,
}
})
},
getReceivableListByIds() {
},
cancelDiscount() {
this.discountVisible = false
......@@ -1109,20 +1127,22 @@ export default {
submitForm(addType) {
const params = {...this.form}
params.addType = 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) {
params.receivableVOList = this.list
}else{
this.$modal.msgError(this.$t('请添加未收客户款项'));
return
}
params.receiptAccountList.length = params.receiptAccountList.length - 1
params.receiptAccountList.map(v => {
delete v.discountTotal
v.writeOffRate = Number(v.writeOffRate)
return v
})
delete params.receivableDetail
if (addType === 1) {
let fieldsToValidate = ['customerId', 'departmentId', 'salesmanId']; // 部分字段校验 保存草稿用
Promise.all(
......@@ -1139,7 +1159,9 @@ export default {
});
if (valid) {
this.saveBtnLoading = true
if (this.id && this.id !== '0') {
console.log(this.id)
return
if (this.id && this.id != 0) {
updateReceipt(params).then(res => {
this.$modal.msgSuccess(this.$t('修改成功'));
this.$router.back();
......@@ -1162,7 +1184,7 @@ export default {
this.$refs.form.validate ((valid)=>{
if (valid) {
this.saveBtnLoading = true
if (this.id && this.id !== '0') {
if (this.id && this.id != 0) {
if(params.state==0) params.state = 1
updateReceipt(params).then(res => {
this.$modal.msgSuccess(this.$t('修改成功'));
......
......@@ -64,7 +64,7 @@
<p style="margin: 0;word-break: break-all;">A/C NO{{bankTiem.platformAccountNo}}</p>
</div>
<div style="padding:6px 0;width: 87.5%;text-align: center;">
<p style="margin: 0;">应收<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="bankTiem.currencyId" />¥{{bankTiem.receivableAmount}}</p>
<p style="margin: 0;">应收<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="bankTiem.currencyId" />{{bankTiem.receivableAmount}}¥</p>
<!-- <p style="margin: 0;">未收:¥{{bankTiem.noReceipt}}</p> -->
</div>
</div>
......
......@@ -192,7 +192,8 @@
</el-table-column>
<el-table-column :label="$t('期望收款币种')" align="center">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.collectionCurrencyId" />
<!-- <dict-tag :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="scope.row.collectionCurrencyId" /> -->
{{getCurrencyLabel(scope.row.collectionCurrencyId)}}
</template>
</el-table-column>
<el-table-column :label="$t('期望收款汇率')" align="center">
......@@ -324,9 +325,22 @@
prop="currencyId"
:rules="{ required: true, trigger: ['blur', 'change'], message: $t('币种不能为空') }"
>
<dict-selector v-if="!isView" :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" v-model="addForm.currencyId" @change="val => currencyIdChange(val)"/>
<el-select
v-model="addForm.currencyId"
:placeholder="$t('请选择')"
:disabled="isView"
@change="val => currencyIdChange(val)"
>
<el-option
v-for="item in currencyList"
:key="item.id"
:label="item.titleZh"
:value="item.id"
/>
</el-select>
<!-- <dict-selector v-if="!isView" :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" v-model="addForm.currencyId" @change="val => currencyIdChange(val)"/> -->
<!-- <span v-else>{{ addForm.currencyId }}</span> -->
<dict-tag v-else :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="addForm.currencyId" />
<!-- <dict-tag v-else :type="DICT_TYPE.BOX_SHIPPING_PRICE_UNIT" :value="addForm.currencyId" /> -->
</el-form-item>
</div>
<el-form-item
......@@ -533,10 +547,10 @@ export default {
const dollarList = res.data.filter(v => v.collectionCurrencyId == 1)
const dollar = dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount || 0), 0)
const rmbList = res.data.filter(v => v.collectionCurrencyId == 2)
const rmbList = res.data.filter(v => v.collectionCurrencyId == 3)
const rmb = rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount || 0), 0)
const nairaList = res.data.filter(v => v.collectionCurrencyId == 3)
const nairaList = res.data.filter(v => v.collectionCurrencyId == 2)
const naira = nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.collectionAmount || 0), 0)
res.data[res.data.length -1].collectionAmount = [dollar, rmb, naira]
......@@ -547,14 +561,14 @@ export default {
const d = res.data.find(v => v.currencyId == 1)
d && (d.discountTotal = discountDollar)
const rmbListByList = this.list.filter(v => v.currencyId === 2)
const rmbListByList = this.list.filter(v => v.currencyId === 3)
const discountRmb = rmbListByList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const r = res.data.find(v => v.currencyId == 2)
const r = res.data.find(v => v.currencyId == 3)
r && (r.discountTotal = discountRmb)
const nairaListByList = this.list.filter(v => v.currencyId === 3)
const nairaListByList = this.list.filter(v => v.currencyId === 2)
const discountNaira = nairaListByList.reduce((total, currentValue) => NP.plus(total, currentValue.discountTotal || 0), 0)
const n = res.data.find(v => v.currencyId == 3)
const n = res.data.find(v => v.currencyId == 2)
n && (n.discountTotal = discountNaira)
......@@ -573,13 +587,18 @@ export default {
setWriteOffAmount() {
this.$set(this.addForm, 'writeOffAmount', NP.times(this.addForm.rate || 0, this.addForm.amount || 0))
},
getCurrencyLabel(id){
var label = this.currencyList.filter(item=>item.id == id)
if(label.length>0) return label[0].titleZh
return ''
},
calculation() {
const verificationList = this.detailed.filter(v => v.status === 1)
const dollarList = verificationList.filter(v => v.currencyId === 1)
const dollar = dollarList.length > 0 ? dollarList.reduce((total, currentValue) => NP.plus(total, currentValue.amount || 0), 0) : 0
const rmbList = verificationList.filter(v => v.currencyId === 2)
const rmbList = verificationList.filter(v => v.currencyId === 3)
const rmb = rmbList.length > 0 ? rmbList.reduce((total, currentValue) => NP.plus(total, currentValue.amount || 0), 0) : 0
const nairaList = verificationList.filter(v => v.currencyId === 3)
const nairaList = verificationList.filter(v => v.currencyId === 2)
const naira = nairaList.length > 0 ? nairaList.reduce((total, currentValue) => NP.plus(total, currentValue.amount || 0), 0) : 0
// const usCount = NP.plus(dollar, NP.times(this.RMBtoUS(), rmb), NP.times(this.NANtoUS(), naira))
......@@ -653,12 +672,12 @@ export default {
if(val === this.showCurrencyId) {
rate = 1
} else {
if (this.showCurrencyId === 1 && val === 2) rate = this.RMBtoUS()
else if (this.showCurrencyId === 1 && val === 3) rate = this.NANtoUS()
else if (this.showCurrencyId === 2 && val === 1) rate = this.UStoRMB()
else if (this.showCurrencyId === 2 && val === 3) rate = this.NANtoRMB()
else if (this.showCurrencyId === 3 && val === 1) rate = this.UStoNAN()
else if (this.showCurrencyId === 3 && val === 2) rate = this.RMBtoNAN()
if (this.showCurrencyId === 1 && val === 3) rate = this.RMBtoUS()
else if (this.showCurrencyId === 1 && val === 2) rate = this.NANtoUS()
else if (this.showCurrencyId === 3 && val === 1) rate = this.UStoRMB()
else if (this.showCurrencyId === 3 && val === 2) rate = this.NANtoRMB()
else if (this.showCurrencyId === 2 && val === 1) rate = this.UStoNAN()
else if (this.showCurrencyId === 2 && val === 3) rate = this.RMBtoNAN()
}
this.$set(this.addForm, 'rate', rate)
},
......
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