Procházet zdrojové kódy

货代正负数校验规则

Qukatie před 4 měsíci
rodič
revize
3e74f54382

+ 79 - 15
src/views/iosBasicData/PaymentApplication/assembly/finstlbillsitems.vue

@@ -16,13 +16,13 @@
             </el-table-column>
             <el-table-column prop="isCleared" label="核销" width="70px">
                 <template slot-scope="{ row }">
-                    <span v-if="row.isCleared==0 ">
+                    <span v-if="row.isCleared == 0">
                         未销账
                     </span>
-                    <span v-if="row.isCleared==3 ">
+                    <span v-if="row.isCleared == 3">
                         部分销账
                     </span>
-                    <span v-if="row.isCleared==9 ">
+                    <span v-if="row.isCleared == 9">
                         销账
                     </span>
                 </template>
@@ -220,29 +220,93 @@ export default {
     methods: {
         armbChange(row) {
             if (row.dc == 'C') {
-                if (Number(row.currentStlAmountRMB) > Number(row.amount - row.appliedAmount - row.appliedAmountStl - row.stlTtlAmount)) {
-                    row.currentStlAmountRMB = 0
-                    return this.$message.error("本次对账金额不能大于未对账金额");
+                if (Number(row.amount - row.appliedAmount - row.appliedAmountStl - row.stlTtlAmount) > 0) {
+                    if (Number(row.currentStlAmountRMB) < 0) {
+                        row.currentStlAmountRMB = 0
+                        return this.$message.error("本次对账金额不能输入负数");
+                    }
+                    if (Number(row.currentStlAmountRMB) > Number(row.amount - row.appliedAmount - row.appliedAmountStl - row.stlTtlAmount)) {
+                        row.currentStlAmountRMB = 0
+                        return this.$message.error("本次对账金额不能超过未对账金额");
+                    }
+                }
+                if (Number(row.amount - row.appliedAmount - row.appliedAmountStl - row.stlTtlAmount) < 0) {
+                    if (Number(row.currentStlAmountRMB) >= 0) {
+                        row.currentStlAmountRMB = Number(row.amount - row.appliedAmount - row.appliedAmountStl - row.stlTtlAmount)
+                        return this.$message.error("本次对账金额不能输入非负数");
+                    }
+                    if (Number(row.currentStlAmountRMB) < Number(row.amount - row.appliedAmount - row.appliedAmountStl - row.stlTtlAmount)) {
+                        row.currentStlAmountRMB = Number(row.amount - row.appliedAmount - row.appliedAmountStl - row.stlTtlAmount)
+                        return this.$message.error("本次对账金额不能超过未对账金额");
+                    }
                 }
             }
             if (row.dc == 'D') {
-                if (Number(row.currentStlAmountRMB) > Number(row.amount - row.stlTtlAmount)) {
-                    row.currentStlAmountRMB = 0
-                    return this.$message.error("本次对账金额不能大于未对账金额");
+                if (Number(row.amount - row.stlTtlAmount) > 0) {
+                    if (Number(row.currentStlAmountRMB) < 0) {
+                        row.currentStlAmountRMB = 0
+                        return this.$message.error("本次对账金额不能输入负数");
+                    }
+                    if (Number(row.currentStlAmountRMB) > Number(row.amount - row.stlTtlAmount)) {
+                        row.currentStlAmountRMB = 0
+                        return this.$message.error("本次对账金额不能超过未对账金额");
+                    }
+                }
+                if (Number(row.amount - row.stlTtlAmount) < 0) {
+                    if (Number(row.currentStlAmountRMB) >= 0) {
+                        row.currentStlAmountRMB = Number(row.amount - row.stlTtlAmount)
+                        return this.$message.error("本次对账金额不能输入非负数");
+                    }
+                    if (Number(row.currentStlAmountRMB) < Number(row.amount - row.stlTtlAmount)) {
+                        row.currentStlAmountRMB = Number(row.amount - row.stlTtlAmount)
+                        return this.$message.error("本次对账金额不能超过未对账金额");
+                    }
                 }
             }
         },
         ausdChange(row) {
             if (row.dc == 'C') {
-                if (Number(row.currentStlAmountUSD) > Number(row.amount - row.appliedAmount - row.appliedAmountStl - row.stlTtlAmount)) {
-                    row.currentStlAmountUSD = 0
-                    return this.$message.error("本次对账金额不能大于未对账金额");
+                if (Number(row.amount - row.appliedAmount - row.appliedAmountStl - row.stlTtlAmount) > 0) {
+                    if (Number(row.currentStlAmountUSD) < 0) {
+                        row.currentStlAmountUSD = 0
+                        return this.$message.error("本次对账金额不能输入负数");
+                    }
+                    if (Number(row.currentStlAmountUSD) > Number(row.amount - row.appliedAmount - row.appliedAmountStl - row.stlTtlAmount)) {
+                        row.currentStlAmountUSD = 0
+                        return this.$message.error("本次对账金额不能超过未对账金额");
+                    }
+                }
+                if (Number(row.amount - row.appliedAmount - row.appliedAmountStl - row.stlTtlAmount) < 0) {
+                    if (Number(row.currentStlAmountUSD) >= 0) {
+                        row.currentStlAmountUSD = Number(row.amount - row.appliedAmount - row.appliedAmountStl - row.stlTtlAmount)
+                        return this.$message.error("本次对账金额不能输入非负数");
+                    }
+                    if (Number(row.currentStlAmountUSD) < Number(row.amount - row.appliedAmount - row.appliedAmountStl - row.stlTtlAmount)) {
+                        row.currentStlAmountUSD = Number(row.amount - row.appliedAmount - row.appliedAmountStl - row.stlTtlAmount)
+                        return this.$message.error("本次对账金额不能超过未对账金额");
+                    }
                 }
             }
             if (row.dc == 'D') {
-                if (Number(row.currentStlAmountUSD) > Number(row.amount - row.stlTtlAmount)) {
-                    row.currentStlAmountUSD = 0
-                    return this.$message.error("本次对账金额不能大于未对账金额");
+                if (Number(row.amount - row.stlTtlAmount) > 0) {
+                    if (Number(row.currentStlAmountUSD) < 0) {
+                        row.currentStlAmountUSD = 0
+                        return this.$message.error("本次对账金额不能输入负数");
+                    }
+                    if (Number(row.currentStlAmountUSD) > Number(row.amount - row.stlTtlAmount)) {
+                        row.currentStlAmountUSD = 0
+                        return this.$message.error("本次对账金额不能超过未对账金额");
+                    }
+                }
+                if (Number(row.amount - row.stlTtlAmount) < 0) {
+                    if (Number(row.currentStlAmountUSD) >= 0) {
+                        row.currentStlAmountUSD = Number(row.amount - row.stlTtlAmount)
+                        return this.$message.error("本次对账金额不能输入非负数");
+                    }
+                    if (Number(row.currentStlAmountUSD) < Number(row.amount - row.stlTtlAmount)) {
+                        row.currentStlAmountUSD = Number(row.amount - row.stlTtlAmount)
+                        return this.$message.error("本次对账金额不能超过未对账金额");
+                    }
                 }
             }
         },

+ 43 - 9
src/views/iosBasicData/fininvoicesApplyfor/assembly/fininvoicesitems.vue

@@ -36,11 +36,11 @@
             <!--</el-table-column>-->
             <el-table-column prop="currentAmountCNY" label="本次CNY" width="120px">
                 <template slot-scope="scope">
-                    <el-input-number style="width: 100%;" v-model="scope.row.currentAmountCNY" v-if="!editSave" min="0"
+                    <el-input style="width: 100%;" v-model="scope.row.currentAmountCNY" v-if="!editSave"
                         size="mini" autocomplete="off" :controls="false"
-                        :disabled="scope.row.curCode != 'CNY' || settlementdistar || !(form.status == '0' || form.status == '4'|| form.status == null)"
+                        :disabled="scope.row.curCode != 'CNY' || settlementdistar || !(form.status == '0' || form.status == '4' || form.status == null)"
                         clearable placeholder="请输入本次发票金额" @change="armbChange(scope.row)">
-                    </el-input-number>
+                    </el-input>
                     <span v-else>{{ scope.row.currentAmountCNY }}</span>
                 </template>
             </el-table-column>
@@ -147,16 +147,50 @@ export default {
     },
     methods: {
         armbChange(row) {
-            if (Number(row.currentAmountCNY) > Number(row.amount - row.appliedInvoiceAmount - row.appliedInvoiceAmountStl - row.uninvoicedAmount)) {
-                row.currentAmountCNY = 0
-                return this.$message.error("本次对账金额不能大于未对账金额");
+            if (Number(row.amount - row.appliedInvoiceAmount - row.appliedInvoiceAmountStl - row.uninvoicedAmount) > 0) {
+                if (Number(row.currentAmountCNY) < 0) {
+                    row.currentAmountCNY = 0
+                    return this.$message.error("本次对账金额不能为负数");
+                }
+                if (Number(row.currentAmountCNY) > Number(row.amount - row.appliedInvoiceAmount - row.appliedInvoiceAmountStl - row.uninvoicedAmount)) {
+                    row.currentAmountCNY = 0
+                    return this.$message.error("本次对账金额不能大于未对账金额");
+                }
             }
+            if (Number(row.amount - row.appliedInvoiceAmount - row.appliedInvoiceAmountStl - row.uninvoicedAmount) < 0) {
+                if (Number(row.currentAmountCNY) > 0) {
+                    row.currentAmountCNY = Number(row.amount - row.appliedInvoiceAmount - row.appliedInvoiceAmountStl - row.uninvoicedAmount)
+                    return this.$message.error("本次对账金额不能为非负数");
+                }
+                if (Number(row.currentAmountCNY) < Number(row.amount - row.appliedInvoiceAmount - row.appliedInvoiceAmountStl - row.uninvoicedAmount)) {
+                    row.currentAmountCNY = Number(row.amount - row.appliedInvoiceAmount - row.appliedInvoiceAmountStl - row.uninvoicedAmount)
+                    return this.$message.error("本次对账金额不能大于未对账金额");
+                }
+            }
+
         },
         ausdChange(row) {
-            if (Number(row.currentAmountUSD) > Number(row.amount - row.appliedInvoiceAmount - row.appliedInvoiceAmountStl - row.uninvoicedAmount)) {
-                row.currentAmountUSD = 0
-                return this.$message.error("本次对账金额不能大于未对账金额");
+            if (Number(row.amount - row.appliedInvoiceAmount - row.appliedInvoiceAmountStl - row.uninvoicedAmount) > 0) {
+                if (Number(row.currentAmountUSD) < 0) {
+                    row.currentAmountUSD = 0
+                    return this.$message.error("本次对账金额不能为负数");
+                }
+                if (Number(row.currentAmountUSD) > Number(row.amount - row.appliedInvoiceAmount - row.appliedInvoiceAmountStl - row.uninvoicedAmount)) {
+                    row.currentAmountUSD = 0
+                    return this.$message.error("本次对账金额不能大于未对账金额");
+                }
+            }
+            if (Number(row.amount - row.appliedInvoiceAmount - row.appliedInvoiceAmountStl - row.uninvoicedAmount) < 0) {
+                if (Number(row.currentAmountUSD) > 0) {
+                    row.currentAmountUSD = Number(row.amount - row.appliedInvoiceAmount - row.appliedInvoiceAmountStl - row.uninvoicedAmount)
+                    return this.$message.error("本次对账金额不能为非负数");
+                }
+                if (Number(row.currentAmountUSD) < Number(row.amount - row.appliedInvoiceAmount - row.appliedInvoiceAmountStl - row.uninvoicedAmount)) {
+                    row.currentAmountUSD = Number(row.amount - row.appliedInvoiceAmount - row.appliedInvoiceAmountStl - row.uninvoicedAmount)
+                    return this.$message.error("本次对账金额不能大于未对账金额");
+                }
             }
+
         },
         // 明细删除
         deletefun(row, index) {

+ 46 - 13
src/views/iosBasicData/finstlbills/assembly/finstlbillsitems.vue

@@ -21,8 +21,8 @@
             </el-table-column>
             <el-table-column prop="dc" label="收付" width="50px">
                 <template slot-scope="{row}">
-                    <span v-if="row.dc=='D'">收</span>
-                    <span v-if="row.dc=='C'">付</span>
+                    <span v-if="row.dc == 'D'">收</span>
+                    <span v-if="row.dc == 'C'">付</span>
                 </template>
             </el-table-column>
             <el-table-column prop="isInvoice" label="开票状态" width="80px">
@@ -57,8 +57,8 @@
             <el-table-column prop="currentStlAmountRMB" label="本次对账CNY" width="100">
                 <template slot-scope="scope">
                     <el-input style="width: 100%;" v-model="scope.row.currentStlAmountRMB" v-if="brfalse" size="mini"
-                        autocomplete="off" :disabled="scope.row.currentStlCurCode != 'CNY'" clearable placeholder="请输入USD"
-                        @change="armbChange(scope.row)">
+                        autocomplete="off" :disabled="scope.row.currentStlCurCode != 'CNY'" clearable
+                        placeholder="请输入USD" @change="armbChange(scope.row)">
                     </el-input>
                     <span v-else>{{ scope.row.currentStlAmountRMB }}</span>
                     <!--<span>{{scope.row.currentStlAmountRMB}}</span>-->
@@ -67,9 +67,8 @@
             <el-table-column prop="currentStlAmountUSD" label="本次对账USD" width="100">
                 <template slot-scope="scope">
                     <el-input style="width: 100%;" v-model="scope.row.currentStlAmountUSD" v-if="brfalse" size="mini"
-                        autocomplete="off" :disabled="scope.row.currentStlCurCode != 'USD'" clearable placeholder="请输入USD"
-                         @change="ausdChange(scope.row)"
-                        >
+                        autocomplete="off" :disabled="scope.row.currentStlCurCode != 'USD'" clearable
+                        placeholder="请输入USD" @change="ausdChange(scope.row)">
                     </el-input>
                     <span v-else>{{ scope.row.currentStlAmountUSD }}</span>
                     <!--<span>{{scope.row.currentStlAmountUSD}}</span>-->
@@ -284,16 +283,50 @@ export default {
     },
     methods: {
         armbChange(row) {
-            if (Number(row.currentStlAmountRMB) > Number(row.amount - row.reconciliationAmount)) {
-                row.currentStlAmountRMB = 0
-                return this.$message.error("本次对账金额不能大于未对账金额");
+            if (Number(row.amount - row.reconciliationAmount) > 0) {
+                if (Number(row.currentStlAmountRMB)<0) {
+                    row.currentStlAmountRMB = 0
+                    return this.$message.error("本次对账金额不能输入负数");
+                }
+                if (Number(row.currentStlAmountRMB) > Number(row.amount - row.reconciliationAmount)) {
+                    row.currentStlAmountRMB = 0
+                    return this.$message.error("本次对账金额不能超过未对账金额");
+                }
+            }
+            if (Number(row.amount - row.reconciliationAmount) < 0) {
+                if(row.currentStlAmountRMB>=0){
+                    row.currentStlAmountRMB = Number(row.amount - row.reconciliationAmount)
+                    return this.$message.error("本次对账金额不能输入非负数");
+                }
+                if (Number(row.currentStlAmountRMB) < Number(row.amount - row.reconciliationAmount)) {
+                    row.currentStlAmountRMB = Number(row.amount - row.reconciliationAmount)
+                    return this.$message.error("本次对账金额不能超过未对账金额");
+                }
             }
+
         },
         ausdChange(row) {
-            if (Number(row.currentStlAmountUSD) > Number(row.amount - row.reconciliationAmount)) {
-                row.currentStlAmountUSD = 0
-                return this.$message.error("本次对账金额不能大于未对账金额");
+            if (Number(row.amount - row.reconciliationAmount) > 0) {
+                if (Number(row.currentStlAmountUSD)<0) {
+                    row.currentStlAmountUSD = 0
+                    return this.$message.error("本次对账金额不能输入负数");
+                }
+                if (Number(row.currentStlAmountUSD) > Number(row.amount - row.reconciliationAmount)) {
+                    row.currentStlAmountUSD = 0
+                    return this.$message.error("本次对账金额不能超过未对账金额");
+                }
+            }
+            if (Number(row.amount - row.reconciliationAmount) < 0) {
+                if(row.currentStlAmountUSD>=0){
+                    row.currentStlAmountUSD =  Number(row.amount - row.reconciliationAmount)
+                    return this.$message.error("本次对账金额不能输入非负数");
+                }
+                if (Number(row.currentStlAmountUSD) < Number(row.amount - row.reconciliationAmount)) {
+                    row.currentStlAmountUSD =  Number(row.amount - row.reconciliationAmount)
+                    return this.$message.error("本次对账金额不能超过未对账金额");
+                }
             }
+
         },
         // 币别选择监听
         corpChange(value, row) {