Qukatie пре 6 месеци
родитељ
комит
a88b6e553b
1 измењених фајлова са 24 додато и 3 уклоњено
  1. 24 3
      src/views/businessManagement/salesOrder/detailsPageEdit.vue

+ 24 - 3
src/views/businessManagement/salesOrder/detailsPageEdit.vue

@@ -3580,7 +3580,6 @@ export default {
           this.form.billType = 'XS'
           // 如果有id解锁,没有跳过
           // this.form.id && this.unLock({moduleName: 'xs',tableName: 'business_order', billId: this.form.id})
-          this.saveLoading = true
           // this.surplusRouteQuantityOption.forEach((itm)=>{
           //     console.log(itm.storageId);
           //   })
@@ -3590,8 +3589,30 @@ export default {
               item.storageQuantity = item.storageQuantity.surplusRouteQuantity;
               item.storageId = this.contactsForm.storageId
             });*/
-          await this.computedCost()
-
+          // await this.computedCost()
+          if (Number(this.form.thisUsedProfit) > Number(this.form.profit)) {
+            // this.form.thisUsedProfit = 0;
+            return this.$message.error('本次使用的返利不能超过返利余额')
+          }
+          this.saveLoading = true
+          // 销售金额
+          let orderAmount = this.form.orderAmount ? this.form.orderAmount : 0
+          // 已收款
+          let settlmentAmount = this.form.settlmentAmount ? this.form.settlmentAmount : 0
+          // 本次溢付款
+          // let caseOverPayment = this.form.caseOverPayment? this.form.caseOverPayment: 0
+          // 本次试用返利
+          let thisUsedProfit = this.form.thisUsedProfit ? this.form.thisUsedProfit : 0
+          let feeAmountD = 0; //费用明细应收
+          let feeAmountC = 0; //费用明细应付
+          this.$refs.feeInfo.submitData().filter(item => item.feesType == 1).forEach(item => {
+            feeAmountD += Number(item.amount)
+          })
+          this.$refs.feeInfo.submitData().filter(item => item.feesType == 2).forEach(item => {
+            feeAmountC += Number(item.amount)
+          })
+          this.$set(this.form, 'debitAmount', ((Number(orderAmount) - Number(thisUsedProfit) + Number(feeAmountD) - Number(feeAmountC)).toFixed(2)))
+          this.$set(this.form, "balanceAmount", (Number(this.form.debitAmount) - Number(settlmentAmount)).toFixed(2));
           // 把库区拼接的id拆开
           for (let item of this.form.orderItemsList) {
             console.log(item.storageId, item.storageId.indexOf('-'), 3151)