Browse Source

付费申请 销项发票 修改流程 并自动生成

Qukatie 21 hours ago
parent
commit
87f2389f21

+ 151 - 13
src/views/iosBasicData/PaymentApplication/assembly/cashierItem.vue

@@ -51,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%;"
@@ -62,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,10 +89,10 @@
       </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>
@@ -101,7 +101,7 @@
 <script>
 import { MktSlotQuotation, quotationImportBatch } from "@/api/iosBasicData/bills";
 import dicSelect from "@/components/dicSelect/main";
-import { getListAll, submit, remove, applyCashier, revokeCashier } from "@/api/iosBasicData/cashier.js";
+import { getListAll, submit, submitList, remove, applyCashier, revokeCashier } from "@/api/iosBasicData/cashier.js";
 import { bcurrencyGetExrate } from "@/api/iosBasicData/rateManagement";
 export default {
   props: {
@@ -238,7 +238,7 @@ export default {
           {
             label: "备注",
             prop: "remarks",
-            cell:true,
+            cell: true,
             width: 120,
             overHidden: true
           }
@@ -250,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.currentStlCurCode == "CNY") {
+          amountDr += Number(item.currentStlAmountRMB);
+        }
+        if (item.dc == "D" && item.currentStlCurCode == "USD") {
+          amountDrUsd += Number(item.currentStlAmountUSD);
+        }
+        if (item.dc == "C" && item.currentStlCurCode == "CNY") {
+          amountCr += Number(item.currentStlAmountRMB);
+        }
+        if (item.dc == "C" && item.currentStlCurCode == "USD") {
+          amountCrUsd += Number(item.currentStlAmountUSD);
+        }
+      }
+      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) {
@@ -385,17 +500,37 @@ export default {
       if (name == "curCode") {
         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 (el.dc == "D" && el.curCode == "CNY") {
+            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 {
@@ -407,7 +542,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 = {
@@ -416,6 +551,9 @@ export default {
       this.loading = true;
       getListAll(obj)
         .then(res => {
+          if (row.cashierStatus == 0 && type == "auto") {
+            this.oneClickGeneration(row, res.data.data, dataList);
+          }
           this.data = res.data.data;
         })
         .finally(() => {

+ 1 - 1
src/views/iosBasicData/PaymentApplication/finstlbillsDetails.vue

@@ -979,7 +979,7 @@ export default {
     },
     allClick(name) {
       if (name == "指示") {
-        this.$refs.cashier.openDialog(this.form);
+        this.$refs.cashier.openDialog(this.form,this.tableData,'auto');
       }
     },
     updateCashier() {

+ 152 - 22
src/views/iosBasicData/fininvoicesApplyfor/assembly/cashierItem.vue

@@ -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(() => {

+ 1 - 1
src/views/iosBasicData/fininvoicesApplyfor/fininvoicesDetails.vue

@@ -1599,7 +1599,7 @@ export default {
     },
     allClick(name) {
       if (name == "指示") {
-        this.$refs.cashier.openDialog(this.form);
+        this.$refs.cashier.openDialog(this.form,this.tableData,'auto');
       }
     },
     updateCashier() {

+ 151 - 23
src/views/iosBasicData/fininvoicesOutput/assembly/cashierItem.vue

@@ -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,14 @@
           <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" @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 +99,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 +236,7 @@ export default {
           {
             label: "备注",
             prop: "remarks",
-            cell:true,
+            cell: true,
             width: 120,
             overHidden: true
           }
@@ -258,6 +248,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 +500,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 +541,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 +550,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(() => {

+ 1 - 1
src/views/iosBasicData/fininvoicesOutput/fininvoicesDetails.vue

@@ -1112,7 +1112,7 @@ export default {
     },
     allClick(name) {
       if (name == "指示") {
-        this.$refs.cashier.openDialog(this.form);
+        this.$refs.cashier.openDialog(this.form,this.tableData,'auto');
       }
     },
     updateCashier() {

+ 9 - 5
src/views/iosBasicData/finstlbills/assembly/cashierItem.vue

@@ -275,7 +275,7 @@ export default {
         this.processData(row, list, dataList);
       }
     },
-    //处理赋值
+    //生成指示
     async processData(row, list, dataList) {
       let amountDr = 0;
       let amountDrUsd = 0;
@@ -313,7 +313,8 @@ export default {
               amountLoc: Number(Number(amountDr ? amountDr : 0)).toFixed(2),
               taxRate: 0,
               amountTax: Number(Number(amountDr ? amountDr : 0)).toFixed(2),
-              amountNet: 0
+              amountNet: 0,
+              applyCashierAmount:0
             });
           }
           if (amountDrUsd > 0 && item.code == "USD") {
@@ -326,7 +327,8 @@ export default {
               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
+              amountNet: 0,
+              applyCashierAmount:0
             });
           }
         });
@@ -349,7 +351,8 @@ export default {
               amountLoc: Number(Number(amountCr ? amountCr : 0)).toFixed(2),
               taxRate: 0,
               amountTax: Number(Number(amountCr ? amountCr : 0)).toFixed(2),
-              amountNet: 0
+              amountNet: 0,
+              applyCashierAmount:0
             });
           }
           if (amountCrUsd > 0 && item.code == "USD") {
@@ -362,7 +365,8 @@ export default {
               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
+              amountNet: 0,
+              applyCashierAmount:0
             });
           }
         });