ccjgmwz 3 lat temu
rodzic
commit
bdf8b61714

+ 17 - 7
src/views/purchasingManagement/purchaseOrderList.vue

@@ -565,7 +565,6 @@
             v-model="closePositionList1.transactionPrice"
             placeholder
             class="deal"
-            placeholder="请输入成交价"
             @change='transaction'
           >
             <ws-option
@@ -585,6 +584,7 @@
         </el-form-item>
         <el-form-item label="平仓数量(吨)" prop="closingQuantity">
           <el-input
+            @input="closingPositionPayable"
             v-model="closePositionList1.closingQuantity"
             autocomplete="off"
             placeholder="请输入平仓数量"
@@ -593,6 +593,7 @@
         </el-form-item>
         <el-form-item label="平仓价格(元/吨)" prop="closeRate">
           <el-input
+            @input="closingPositionPayable"
             v-model="closePositionList1.closeRate"
             autocomplete="off"
             placeholder="请输入平仓价格"
@@ -1012,6 +1013,7 @@ export default {
       transactionRecordList: {},
       closePositionList: [],
       historyList: [],
+      openPositionTmp:0,
       pickerBeginDateBefore: {
         disabledDate: (time) => {
           return time.getTime() > Date.now()
@@ -1039,9 +1041,12 @@ export default {
     transaction(e){
       for (let i = 0; i < this.transactionRecordList1.length; i++) {
         if(this.transactionRecordList1[i].key==e){
-          if(this.closePositionList1.openPosition>this.transactionRecordList1[i].value){
+          if(this.openPositionTmp>this.transactionRecordList1[i].value){
             this.closePositionList1.openPosition=this.transactionRecordList1[i].value
           }
+          else{
+            this.closePositionList1.openPosition = this.openPositionTmp
+          }
         }
       }
     },
@@ -1299,14 +1304,19 @@ export default {
     },
     //计算平仓应付
     closingPositionPayable() {
-      this.closePositionList1.closingPositionPayable =
-        (this.closePositionList1.closeRate -
-          this.closePositionList1.transactionPrice -
-          this.closePositionList1.closingBasis) *
-        this.closePositionList1.closingQuantity
+      if(this.closePositionList1.transactionPrice
+      && this.closePositionList1.closeRate && this.closePositionList1.closingBasis && this.closePositionList1.closingQuantity)
+      {
+        this.closePositionList1.closingPositionPayable =
+          (this.closePositionList1.transactionPrice -
+            this.closePositionList1.closeRate-
+            Math.abs(this.closePositionList1.closingBasis)) *
+          this.closePositionList1.closingQuantity
+      }
     },
     cloaeposition1(item) {
       this.dialogFormVisible2 = true
+      this.openPositionTmp = item.openPosition
       this.$set(this.closePositionList1, 'id', item.id)
       this.$set(this.closePositionList1, 'openPosition', item.openPosition)
       this.$set(