shish vor 2 Jahren
Ursprung
Commit
4d899e693e
1 geänderte Dateien mit 39 neuen und 10 gelöschten Zeilen
  1. 39 10
      ghs/src/views/item/batch-modify.vue

+ 39 - 10
ghs/src/views/item/batch-modify.vue

@@ -44,22 +44,22 @@
                             </template>
                         </el-table-column>
 
-                        <el-table-column prop="showHjPrice" label="大客价" align="center" width="80">
+                        <el-table-column prop="showHjPrice" label="大客价" align="center" width="70">
                             <template slot-scope="scope">
-                                <el-input v-model="scope.row.showHjPrice" @focus="scope.row.showHjPrice=''" placeholder="大客" size="small"></el-input>
+                                <el-input v-model="scope.row.showHjPrice" @focus="scope.row.showHjPrice=''" placeholder="大客" size="small"></el-input>
                             </template>
                         </el-table-column>
 
-                        <el-table-column prop="showPrice" label="批发价" align="center" width="90">
+                        <el-table-column prop="showPrice" label="批发价" align="center" width="70">
                             <template slot-scope="scope">
-                                <el-input v-model="scope.row.showPrice" @focus="scope.row.showPrice=''" placeholder="批发价" size="small">
+                                <el-input v-model="scope.row.showPrice" @focus="scope.row.showPrice=''" @input="changePrice(scope.row)" placeholder="批发" style="border:1upx solid red;" size="small">
                                 </el-input>
                             </template>
                         </el-table-column>
 
-                        <el-table-column prop="showSkPrice" label="散客价" align="center" width="80">
+                        <el-table-column prop="showSkPrice" label="散客价" align="center" width="70">
                             <template slot-scope="scope">
-                                <el-input v-model="scope.row.showSkPrice" @focus="scope.row.showSkPrice=''" placeholder="散客" size="small"></el-input>
+                                <el-input v-model="scope.row.showSkPrice" @focus="scope.row.showSkPrice=''" placeholder="散客" size="small"></el-input>
                             </template>
                         </el-table-column>
 
@@ -109,6 +109,33 @@
         this.getModifyList()
     },
     methods: {
+        changePrice(info){
+            let addPrice = info.addPrice||0
+            let skMore = info.skMore||0
+            let hjAddPrice = info.hjAddPrice||0
+            let currentPrice = info.showPrice ? parseFloat(info.showPrice) : 0
+
+            let skDiff = 0
+            if(parseFloat(skMore)>parseFloat(addPrice)){
+                skDiff = parseFloat(skMore) - parseFloat(addPrice)
+                skDiff = parseFloat(skDiff).toFixed(2)
+            }
+            let skAmount = currentPrice + skDiff
+            skAmount = parseFloat(skAmount).toFixed(2)
+            info.showSkPrice = skAmount
+
+            let hjDiff = 0
+            if(parseFloat(addPrice)>parseFloat(hjAddPrice)){
+                hjDiff = parseFloat(addPrice) - parseFloat(hjAddPrice)
+                hjDiff = parseFloat(hjDiff).toFixed(2)
+            }
+            let hjAmount = 0
+            if(parseFloat(currentPrice)>parseFloat(hjDiff)){
+                hjAmount = parseFloat(currentPrice) - parseFloat(hjDiff)
+                hjAmount = parseFloat(hjAmount).toFixed(2)
+            }
+            info.showHjPrice = hjAmount
+        },
         getChagnePrice(info){
             this.$service.modify.getModifyItem({id:info.id}).then(res=>{
                 this.historyPriceList = res.list
@@ -202,7 +229,6 @@
                                     }
                                 })
 
-
                                 // 分三组
                                 let segmentsCount = 3;
                                 let length = item.child.length
@@ -228,6 +254,9 @@
     }
   };
   </script>
-  <style lang="scss" scoped>
-  
-  </style>
+<style lang="scss" scoped>
+::v-deep .el-input__inner {
+  padding:0;
+  text-align:center;
+}
+</style>