|
|
@@ -16,13 +16,7 @@
|
|
|
@on-load="onLoad"
|
|
|
>
|
|
|
<template slot="indexHeader" slot-scope="{ row }">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- icon="el-icon-plus"
|
|
|
- circle
|
|
|
- @click="addRow"
|
|
|
- ></el-button>
|
|
|
+ <el-button type="primary" size="small" icon="el-icon-plus" circle @click="addRow"></el-button>
|
|
|
</template>
|
|
|
<template slot="index" slot-scope="{ row, index }">
|
|
|
<span>{{ index + 1 }}</span>
|
|
|
@@ -57,7 +51,7 @@
|
|
|
></el-input-number>
|
|
|
<span v-else>{{ row.exrate }}</span>
|
|
|
</template>
|
|
|
- <template slot="amount" slot-scope="{ row }">
|
|
|
+ <!-- <template slot="amount" slot-scope="{ row }">
|
|
|
<el-input-number
|
|
|
v-if="row.$cellEdit"
|
|
|
style="width: 100%;"
|
|
|
@@ -68,7 +62,7 @@
|
|
|
:controls="false"
|
|
|
></el-input-number>
|
|
|
<span v-else>{{ row.amount }}</span>
|
|
|
- </template>
|
|
|
+ </template> -->
|
|
|
<template slot="dc" slot-scope="{ row }">
|
|
|
<el-select v-if="row.$cellEdit" v-model="row.dc" placeholder="请选择" size="small" @change="dcChange(row)">
|
|
|
<el-option v-for="item in dcOptions" :key="item.value" :label="item.label" :value="item.value"> </el-option>
|
|
|
@@ -89,18 +83,16 @@
|
|
|
<span v-else>{{ row.taxRate }}</span>
|
|
|
</template>
|
|
|
<template slot="menu" slot-scope="{ row, index }">
|
|
|
- <el-button type="text" size="small" @click="rowEdit(row)" :disabled="row.status == 1">{{
|
|
|
- row.$cellEdit ? "保存" : "编辑"
|
|
|
- }}</el-button>
|
|
|
+ <el-button type="text" size="small" @click="rowEdit(row)" :disabled="row.status == 1">{{ row.$cellEdit ? "保存" : "编辑" }}</el-button>
|
|
|
<el-button type="text" size="small" @click="rowDel(row, index)" :disabled="row.status == 1">删除</el-button>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="dialogVisible = false" size="mini">取 消</el-button>
|
|
|
- <el-button v-if="form.cashierStatus == 0" size="mini" type="success" :disabled="data.length==0" @click="allClick('申请出纳')">收费申请</el-button>
|
|
|
- <el-button v-if="form.cashierStatus == 1" size="mini" type="danger" @click="allClick('撤销申请出纳')"
|
|
|
- >撤销收费申请</el-button
|
|
|
+ <el-button v-if="form.cashierStatus == 0" size="mini" type="success" :disabled="data.length == 0" @click="allClick('申请出纳')"
|
|
|
+ >收费申请</el-button
|
|
|
>
|
|
|
+ <el-button v-if="form.cashierStatus == 1" size="mini" type="danger" @click="allClick('撤销申请出纳')">撤销收费申请</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
@@ -109,7 +101,7 @@
|
|
|
<script>
|
|
|
import { MktSlotQuotation, quotationImportBatch } from "@/api/iosBasicData/bills";
|
|
|
import dicSelect from "@/components/dicSelect/main";
|
|
|
-import { getListAllDetail, submit, remove, applyCashier2, revokeCashier2 } from "@/api/iosBasicData/cashier.js";
|
|
|
+import { getListAllDetail, submit, submitList, remove, applyCashier2, revokeCashier2 } from "@/api/iosBasicData/cashier.js";
|
|
|
import { bcurrencyGetExrate } from "@/api/iosBasicData/rateManagement";
|
|
|
export default {
|
|
|
props: {
|
|
|
@@ -246,7 +238,7 @@ export default {
|
|
|
{
|
|
|
label: "备注",
|
|
|
prop: "remarks",
|
|
|
- cell:true,
|
|
|
+ cell: true,
|
|
|
width: 120,
|
|
|
overHidden: true
|
|
|
}
|
|
|
@@ -258,6 +250,121 @@ export default {
|
|
|
// this.option = await this.getColumnData(this.getColumnName(309.6), this.optionBack);
|
|
|
},
|
|
|
methods: {
|
|
|
+ async oneClickGeneration(row, list, dataList) {
|
|
|
+ if (list.length == 0) {
|
|
|
+ this.processData(row, list, dataList);
|
|
|
+ }
|
|
|
+ if (list.length) {
|
|
|
+ let ids = [];
|
|
|
+ for (const item of list) {
|
|
|
+ ids.push(item.id);
|
|
|
+ }
|
|
|
+ await remove({ ids: ids.join(",") });
|
|
|
+ this.data = [];
|
|
|
+ this.processData(row, list, dataList);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //生成指示
|
|
|
+ async processData(row, list, dataList) {
|
|
|
+ let amountDr = 0;
|
|
|
+ let amountDrUsd = 0;
|
|
|
+ let amountCr = 0;
|
|
|
+ let amountCrUsd = 0;
|
|
|
+ for (let item of dataList) {
|
|
|
+ if (item.dc == "D" && item.currentCurCode == "CNY") {
|
|
|
+ amountDr += Number(item.currentAmountCNY);
|
|
|
+ }
|
|
|
+ if (item.dc == "D" && item.currentCurCode == "USD") {
|
|
|
+ amountDrUsd += Number(item.currentAmountUSD);
|
|
|
+ }
|
|
|
+ if (item.dc == "C" && item.currentCurCode == "CNY") {
|
|
|
+ amountCr += Number(item.currentAmountCNY);
|
|
|
+ }
|
|
|
+ if (item.dc == "C" && item.currentCurCode == "USD") {
|
|
|
+ amountCrUsd += Number(item.currentAmountUSD);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (amountDr > 0 || amountDrUsd > 0) {
|
|
|
+ let obj = {
|
|
|
+ type: 2,
|
|
|
+ date: row.billDate + " 00:00:00",
|
|
|
+ dc: "D"
|
|
|
+ };
|
|
|
+ const res = await bcurrencyGetExrate(obj);
|
|
|
+ res.data.data.forEach(item => {
|
|
|
+ if (amountDr > 0 && item.code == "CNY") {
|
|
|
+ this.data.push({
|
|
|
+ srcId: row.id,
|
|
|
+ dc: "D",
|
|
|
+ curCode: item.code,
|
|
|
+ exrate: item.exrate,
|
|
|
+ amount: amountDr,
|
|
|
+ amountLoc: Number(Number(amountDr ? amountDr : 0)).toFixed(2),
|
|
|
+ taxRate: 0,
|
|
|
+ amountTax: Number(Number(amountDr ? amountDr : 0)).toFixed(2),
|
|
|
+ amountNet: 0,
|
|
|
+ applyCashierAmount:0
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (amountDrUsd > 0 && item.code == "USD") {
|
|
|
+ this.data.push({
|
|
|
+ srcId: row.id,
|
|
|
+ dc: "D",
|
|
|
+ curCode: item.code,
|
|
|
+ exrate: item.exrate,
|
|
|
+ amount: amountDrUsd,
|
|
|
+ amountLoc: Number(Number(amountDrUsd ? amountDrUsd : 0) * Number(item.exrate ? item.exrate : 0)).toFixed(2),
|
|
|
+ taxRate: 0,
|
|
|
+ amountTax: Number(Number(amountDrUsd ? amountDrUsd : 0) * Number(item.exrate ? item.exrate : 0)).toFixed(2),
|
|
|
+ amountNet: 0,
|
|
|
+ applyCashierAmount:0
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (amountCr > 0 || amountCrUsd > 0) {
|
|
|
+ let obj = {
|
|
|
+ type: 2,
|
|
|
+ date: row.billDate + " 00:00:00",
|
|
|
+ dc: "C"
|
|
|
+ };
|
|
|
+ const res = await bcurrencyGetExrate(obj);
|
|
|
+ res.data.data.forEach(item => {
|
|
|
+ if (amountCr > 0 && item.code == "CNY") {
|
|
|
+ this.data.push({
|
|
|
+ srcId: row.id,
|
|
|
+ dc: "C",
|
|
|
+ curCode: item.code,
|
|
|
+ exrate: item.exrate,
|
|
|
+ amount: amountCr,
|
|
|
+ amountLoc: Number(Number(amountCr ? amountCr : 0)).toFixed(2),
|
|
|
+ taxRate: 0,
|
|
|
+ amountTax: Number(Number(amountCr ? amountCr : 0)).toFixed(2),
|
|
|
+ amountNet: 0,
|
|
|
+ applyCashierAmount:0
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (amountCrUsd > 0 && item.code == "USD") {
|
|
|
+ this.data.push({
|
|
|
+ srcId: row.id,
|
|
|
+ dc: "C",
|
|
|
+ curCode: item.code,
|
|
|
+ exrate: item.exrate,
|
|
|
+ amount: amountCrUsd,
|
|
|
+ amountLoc: Number(Number(amountCrUsd ? amountCrUsd : 0) * Number(item.exrate ? item.exrate : 0)).toFixed(2),
|
|
|
+ taxRate: 0,
|
|
|
+ amountTax: Number(Number(amountCrUsd ? amountCrUsd : 0) * Number(item.exrate ? item.exrate : 0)).toFixed(2),
|
|
|
+ amountNet: 0,
|
|
|
+ applyCashierAmount:0
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this.data.length) {
|
|
|
+ const res = await submitList(this.data);
|
|
|
+ this.data = res.data.data;
|
|
|
+ }
|
|
|
+ },
|
|
|
rowEdit(row) {
|
|
|
if (row.$cellEdit) {
|
|
|
if (!row.curCode) {
|
|
|
@@ -395,16 +502,36 @@ export default {
|
|
|
if (row) {
|
|
|
el.exrate = row.exrate;
|
|
|
if (el.dc == "D" && el.curCode == "CNY") {
|
|
|
- el.amount = Number(this.form.amountDr - this.form.actualAmountDr).toFixed(2);
|
|
|
+ if (this.data.filter(item => el.dc == item.dc && el.curCode == item.curCode).length == 1) {
|
|
|
+ el.amount = Number(this.form.amountDr - this.form.actualAmountDr).toFixed(2);
|
|
|
+ }
|
|
|
+ if (this.data.filter(item => el.dc == item.dc && el.curCode == item.curCode).length == 2) {
|
|
|
+ el.amount = Number(0).toFixed(2);
|
|
|
+ }
|
|
|
}
|
|
|
if (el.dc == "D" && el.curCode == "USD") {
|
|
|
- el.amount = Number(this.form.amountDrUsd - this.form.actualAmountDrUsd).toFixed(2);
|
|
|
+ if (this.data.filter(item => el.dc == item.dc && el.curCode == item.curCode).length == 1) {
|
|
|
+ el.amount = Number(this.form.amountDrUsd - this.form.actualAmountDrUsd).toFixed(2);
|
|
|
+ }
|
|
|
+ if (this.data.filter(item => el.dc == item.dc && el.curCode == item.curCode).length == 2) {
|
|
|
+ el.amount = Number(0).toFixed(2);
|
|
|
+ }
|
|
|
}
|
|
|
if (el.dc == "C" && el.curCode == "CNY") {
|
|
|
- el.amount = Number(this.form.amountCr - this.form.actualAmountCr).toFixed(2);
|
|
|
+ if (this.data.filter(item => el.dc == item.dc && el.curCode == item.curCode).length == 1) {
|
|
|
+ el.amount = Number(this.form.amountCr - this.form.actualAmountCr).toFixed(2);
|
|
|
+ }
|
|
|
+ if (this.data.filter(item => el.dc == item.dc && el.curCode == item.curCode).length == 2) {
|
|
|
+ el.amount = Number(0).toFixed(2);
|
|
|
+ }
|
|
|
}
|
|
|
if (el.dc == "C" && el.curCode == "USD") {
|
|
|
- el.amount = Number(this.form.amountCrUsd - this.form.actualAmountCrUsd).toFixed(2);
|
|
|
+ if (this.data.filter(item => el.dc == item.dc && el.curCode == item.curCode).length == 1) {
|
|
|
+ el.amount = Number(this.form.amountCrUsd - this.form.actualAmountCrUsd).toFixed(2);
|
|
|
+ }
|
|
|
+ if (this.data.filter(item => el.dc == item.dc && el.curCode == item.curCode).length == 2) {
|
|
|
+ el.amount = Number(0).toFixed(2);
|
|
|
+ }
|
|
|
}
|
|
|
this.calculateChange(el);
|
|
|
} else {
|
|
|
@@ -416,7 +543,7 @@ export default {
|
|
|
addRow() {
|
|
|
this.data.push({ $cellEdit: true, srcId: this.form.id, dc: this.form.dc, taxRate: 0 });
|
|
|
},
|
|
|
- openDialog(row) {
|
|
|
+ openDialog(row, dataList, type) {
|
|
|
this.dialogVisible = true;
|
|
|
this.form = row;
|
|
|
let obj = {
|
|
|
@@ -425,6 +552,9 @@ export default {
|
|
|
this.loading = true;
|
|
|
getListAllDetail(obj)
|
|
|
.then(res => {
|
|
|
+ if (row.cashierStatus == 0 && type == "auto") {
|
|
|
+ this.oneClickGeneration(row, res.data.data, dataList);
|
|
|
+ }
|
|
|
this.data = res.data.data;
|
|
|
})
|
|
|
.finally(() => {
|