shish hace 2 años
padre
commit
1f92e482de
Se han modificado 1 ficheros con 40 adiciones y 36 borrados
  1. 40 36
      ghs/src/views/order/add.vue

+ 40 - 36
ghs/src/views/order/add.vue

@@ -28,7 +28,7 @@
         <el-table-column prop="name" label="名称" align="center"></el-table-column>
         <el-table-column prop="name" label="名称" align="center"></el-table-column>
         <el-table-column prop="userPrice" label="单价" width="150" align="center"></el-table-column>
         <el-table-column prop="userPrice" label="单价" width="150" align="center"></el-table-column>
         <el-table-column prop="bigCount" label="数量" width="150" align="center"></el-table-column>
         <el-table-column prop="bigCount" label="数量" width="150" align="center"></el-table-column>
-        <el-table-column prop="totalAmount" label="金额" width="150" align="center"></el-table-column>
+        <el-table-column prop="sumPrice" label="金额" width="150" align="center"></el-table-column>
 
 
         <el-table-column prop="ratioType" label="单位比" align="center" width="150">
         <el-table-column prop="ratioType" label="单位比" align="center" width="150">
           <template slot-scope="scope">
           <template slot-scope="scope">
@@ -243,74 +243,72 @@ export default {
         this.$refs.customref.focus()
         this.$refs.customref.focus()
       })
       })
     }
     }
-    let self = this;
+    let that = this;
     document.onkeydown=function(e) {
     document.onkeydown=function(e) {
       console.log(e)
       console.log(e)
       if(e && e.key == 'Enter' && e.ctrlKey){
       if(e && e.key == 'Enter' && e.ctrlKey){
-        if(self.isAccounts){
-          self.isAccounts = false
-          self.createOrder();
+        if(that.isAccounts){
+          that.isAccounts = false
+          that.createOrder();
         }
         }
       }
       }
       if(e && e.key == 'Enter'){
       if(e && e.key == 'Enter'){
       }
       }
       if(e && e.key && e.key.toLowerCase() =='c' && e.ctrlKey){
       if(e && e.key && e.key.toLowerCase() =='c' && e.ctrlKey){
-        self.$refs['customref'].focus();
+        that.$refs['customref'].focus();
       }
       }
       if(e && e.key && e.key.toLowerCase() =='q' && e.ctrlKey){
       if(e && e.key && e.key.toLowerCase() =='q' && e.ctrlKey){
-        self.$refs['itemSearchRef'].focus();
+        that.$refs['itemSearchRef'].focus();
       }
       }
       if(e && e.key == 'ArrowUp'){
       if(e && e.key == 'ArrowUp'){
-        self.goUp();
+        that.goUp();
       }
       }
       if(e && e.key =='ArrowDown'){
       if(e && e.key =='ArrowDown'){
-        self.goDown();
+        that.goDown();
       }
       }
       if(e && e.key=='='){
       if(e && e.key=='='){
-        self.addBigNum()
+        that.addBigNum()
       }
       }
       if( e && e.key=='-'){
       if( e && e.key=='-'){
-        self.subBigNum()
+        that.subBigNum()
       }
       }
       if(e && e.key=='Delete'){
       if(e && e.key=='Delete'){
-        self.selectList.splice(self.selectIndex, 1);
-        self.$refs.singleTable.setCurrentRow(self.selectList[0]);
+        that.selectList.splice(that.selectIndex, 1);
+        that.$refs.singleTable.setCurrentRow(that.selectList[0]);
       }
       }
       if(e && e.key=='PageDown'){
       if(e && e.key=='PageDown'){
-        self.$confirm('确认删除?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
-          self.selectList = []
-			  })       
+        that.removeFromSave()
       }
       }
       if( e && e.key=='Escape'){
       if( e && e.key=='Escape'){
-        if(self.isAccounts){
-          self.isAccounts = false;
+        if(that.isAccounts){
+          that.isAccounts = false;
           return;
           return;
         }
         }
-        self.escFun();
+        that.escFun();
       }
       }
       if( e && e.key=='F8'){
       if( e && e.key=='F8'){
-        if(self.selectList!=''){
-          self.isAmendPrice = true;
-          self.priceAmend = 0;
-          self.priceAmend = self.selectList[self.selectIndex].price;
-          self.$nextTick(()=>{
-            self.$refs['priceInput'].focus()
-            self.$refs['priceInput'].select()
+        if(that.selectList!=''){
+          that.isAmendPrice = true;
+          that.priceAmend = 0;
+          that.priceAmend = that.selectList[that.selectIndex].price;
+          that.$nextTick(()=>{
+            that.$refs['priceInput'].focus()
+            that.$refs['priceInput'].select()
           })
           })
         }
         }
       }
       }
       if( e && e.key=='F9' ){
       if( e && e.key=='F9' ){
-        self.orderMsg = '';
-        if(self.$util.isEmpty(self.selectList)){
-          self.$message({message: '请选择花材',type: 'warning'});
+        that.orderMsg = '';
+        if(that.$util.isEmpty(that.selectList)){
+          that.$message({message: '请选择花材',type: 'warning'});
           return;
           return;
         }
         }
-        self.isAccounts = true;
-        if(self.$util.isEmpty(self.allShopList)){
-          self.getShopAll();
+        that.isAccounts = true;
+        if(that.$util.isEmpty(that.allShopList)){
+          that.getShopAll();
         }else{
         }else{
-          self.$nextTick(()=>{
-            self.$refs['selectShopListInput'].focus();
+          that.$nextTick(()=>{
+            that.$refs['selectShopListInput'].focus();
           })
           })
         }
         }
       }
       }
@@ -438,15 +436,21 @@ export default {
     confirmNumPrice(){
     confirmNumPrice(){
       let currentItem = this.getItemList[this.getIndex];
       let currentItem = this.getItemList[this.getIndex];
       if(Number(this.customData.bigCount)<=0){
       if(Number(this.customData.bigCount)<=0){
-        this.$message({message: '请先输入数量',type: 'warning'});
+        this.$message({message: '请填写数量',type: 'warning'});
         return;
         return;
       }
       }
+      let has = false
       for (let i=0;i<this.selectList.length;i++){
       for (let i=0;i<this.selectList.length;i++){
         if(this.selectList[i].id == currentItem.id){
         if(this.selectList[i].id == currentItem.id){
+          this.customData.bigCount = Number(this.customData.bigCount)+Number(this.selectList[i].bigCount)
+          this.customData.bigCount = this.customData.bigCount.toFixed(2)
+          this.customData.bigCount = parseFloat(this.customData.bigCount)
           this.selectList.splice(i,1)
           this.selectList.splice(i,1)
         }
         }
       }
       }
-      currentItem = {...currentItem,bigCount:this.customData.bigCount,userPrice:this.customData.userPrice,smallCount:this.customData.smallCount}
+      let sumPrice = Number(this.customData.userPrice)*Number(this.customData.bigCount)
+      sumPrice = parseFloat(sumPrice.toFixed(2))
+      currentItem = {...currentItem,bigCount:this.customData.bigCount,userPrice:this.customData.userPrice,smallCount:this.customData.smallCount,sumPrice:sumPrice}     
       this.replaceItemFn(currentItem,1,'add')
       this.replaceItemFn(currentItem,1,'add')
       this.selectIndex = this.selectList.length-1;
       this.selectIndex = this.selectList.length-1;
       this.$refs.singleTable.setCurrentRow(this.selectList[this.selectList.length-1]);
       this.$refs.singleTable.setCurrentRow(this.selectList[this.selectList.length-1]);