shish преди 2 години
родител
ревизия
13f18bf78a
променени са 1 файла, в които са добавени 41 реда и са изтрити 41 реда
  1. 41 41
      ghs/src/views/order/add.vue

+ 41 - 41
ghs/src/views/order/add.vue

@@ -55,7 +55,7 @@
     <div class="bottom_input">
         <span style="margin-right:10px;font-weight: 700;">花材</span>
         <el-input style="width: 280px;font-size:13px" @input="beginSearchItem" @keyup.enter.native="selectCurrentItem" @focus="clearSeachVal" placeholder="这里搜索,光标插入 Ctrl + Q" type="text" ref="itemSearchRef" v-model="searchVal"></el-input>
-        <div style="display: inline-block;" class="allPrice">{{tableData.length}}种</div>
+        <div style="display: inline-block;" class="allPrice">{{selectList.length}}种</div>
         <div style="display: inline-block;" class="allPrice">¥{{ totalMoney }}</div>
         <div style="display: inline-block;" class="allPrice active"></div>
     </div>
@@ -222,7 +222,7 @@ export default {
       getIndex:0,
       getItemList:[],//搜索展示的列表
       selectIndex:0,
-      tableData: [],// {index:'001',name:'测试1',lv:'2',unit:'支',count:'100',price:'50',money:'100'},
+      selectList: [],// {index:'001',name:'测试1',lv:'2',unit:'支',count:'100',price:'50',money:'100'},
       allShopList:[],
       selectShopListVal:'',
       freight:'',//运费
@@ -277,12 +277,12 @@ export default {
         self.subBigNum()
       }
       if(e && e.key=='Delete'){
-        self.tableData.splice(self.selectIndex, 1);
-        self.$refs.singleTable.setCurrentRow(self.tableData[0]);
+        self.selectList.splice(self.selectIndex, 1);
+        self.$refs.singleTable.setCurrentRow(self.selectList[0]);
       }
       if(e && e.key=='PageDown'){
         self.$confirm('确认删除?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => {
-          self.tableData = []
+          self.selectList = []
 			  })       
       }
       if( e && e.key=='Escape'){
@@ -293,10 +293,10 @@ export default {
         self.escFun();
       }
       if( e && e.key=='F8'){
-        if(self.tableData!=''){
+        if(self.selectList!=''){
           self.isAmendPrice = true;
           self.priceAmend = 0;
-          self.priceAmend = self.tableData[self.selectIndex].price;
+          self.priceAmend = self.selectList[self.selectIndex].price;
           self.$nextTick(()=>{
             self.$refs['priceInput'].focus()
             self.$refs['priceInput'].select()
@@ -305,7 +305,7 @@ export default {
       }
       if( e && e.key=='F9' ){
         self.orderMsg = '';
-        if(self.$util.isEmpty(self.tableData)){
+        if(self.$util.isEmpty(self.selectList)){
           self.$message({message: '请选择花材',type: 'warning'});
           return;
         }
@@ -365,7 +365,7 @@ export default {
       });
     },
     createOrder(){
-      const product = this.tableData.map(ele => {
+      const product = this.selectList.map(ele => {
         return { productId: ele.id, bigNum: ele.big, smallNum: ele.small };
       });
       let parameter = {
@@ -379,9 +379,9 @@ export default {
       }
       this.$service.order.orderCreate(parameter).then(res => {
         this.orderMsg = res;
-        this.printSelectList = this.tableData;
+        this.printSelectList = this.selectList;
         this.$nextTick(()=>{
-          this.tableData = [];
+          this.selectList = [];
           this.isAccounts = false;
           this.escFun();
         })
@@ -444,16 +444,16 @@ export default {
         return;
       }
       let money = Number(currentItem.price) * Number(big)
-      for (let i=0;i<this.tableData.length;i++){
-        if(this.tableData[i].id == currentItem.id){
-          this.tableData.splice(i,1)
+      for (let i=0;i<this.selectList.length;i++){
+        if(this.selectList[i].id == currentItem.id){
+          this.selectList.splice(i,1)
         }
       }
       currentItem = {...currentItem,bigCount:parseFloat(Number(big)),totalAmount:money.toFixed(2),smallCount:0}
       this.replaceItemFn(currentItem,1,'add')
-      //this.tableData.push(newItem)
-      this.selectIndex = this.tableData.length-1;
-      this.$refs.singleTable.setCurrentRow(this.tableData[this.tableData.length-1]);
+      //this.selectList.push(newItem)
+      this.selectIndex = this.selectList.length-1;
+      this.$refs.singleTable.setCurrentRow(this.selectList[this.selectList.length-1]);
       this.$nextTick(()=>{
         this.big = null;
         this.small = null;
@@ -462,7 +462,7 @@ export default {
     },
     getAllTableDataMoney(){
       let totalMoney = 0;
-      this.tableData.forEach(ele => {
+      this.selectList.forEach(ele => {
         totalMoney= totalMoney + ele.totalAmount
       })
       totalMoney = Number(totalMoney)
@@ -495,33 +495,33 @@ export default {
         this.$message({message: '请输入大于0的值',type: 'warning'});
         return;
       }
-      let currentItem = this.tableData[this.selectIndex];
-      this.tableData[this.selectIndex].price = this.priceAmend;
+      let currentItem = this.selectList[this.selectIndex];
+      this.selectList[this.selectIndex].price = this.priceAmend;
       let money = Number(currentItem.price) * (Number(currentItem.big) + Number(currentItem.small) / Number(currentItem.ratio));
-      this.tableData[this.selectIndex].money = money;
-      this.tableData[this.selectIndex].totalMoney = money.toFixed(2);
+      this.selectList[this.selectIndex].money = money;
+      this.selectList[this.selectIndex].totalMoney = money.toFixed(2);
       this.priceAmend = 0;
       this.escFun();
     },
     addBigNum(){
-      let currentItem = this.tableData[this.selectIndex];
+      let currentItem = this.selectList[this.selectIndex];
       // if(Number(currentItem.stock)<Number(currentItem.big+1) + Number(currentItem.small) / Number(currentItem.ratio)){
       //   this.$message({message: '库存不足',type: 'warning'});
       //   return;
       // }
-      this.tableData[this.selectIndex].big++
+      this.selectList[this.selectIndex].big++
       let money = Number(currentItem.price) * (Number(currentItem.big) + Number(currentItem.small) / Number(currentItem.ratio));
-      this.tableData[this.selectIndex].count = this.tableData[this.selectIndex].big+'/'+Number(this.tableData[this.selectIndex].small);
-      this.tableData[this.selectIndex].money = money;
-      this.tableData[this.selectIndex].totalMoney = money.toFixed(2),
+      this.selectList[this.selectIndex].count = this.selectList[this.selectIndex].big+'/'+Number(this.selectList[this.selectIndex].small);
+      this.selectList[this.selectIndex].money = money;
+      this.selectList[this.selectIndex].totalMoney = money.toFixed(2),
           this.getAllTableDataMoney();
       setTimeout(()=>{
         this.searchVal = '';
       },100)
     },
     subBigNum(){
-      let currentItem = this.tableData[this.selectIndex];
-      if(this.tableData[this.selectIndex].big==1){
+      let currentItem = this.selectList[this.selectIndex];
+      if(this.selectList[this.selectIndex].big==1){
         setTimeout(()=>{
           this.searchVal = '';
         },100)
@@ -531,11 +531,11 @@ export default {
       //   this.$message({message: '库存不足',type: 'warning'});
       //   return;
       // }
-      this.tableData[this.selectIndex].big--
+      this.selectList[this.selectIndex].big--
       let money = Number(currentItem.price) * (Number(currentItem.big) + Number(currentItem.small) / Number(currentItem.ratio));
-      this.tableData[this.selectIndex].count = this.tableData[this.selectIndex].big+'/'+Number(this.tableData[this.selectIndex].small);
-      this.tableData[this.selectIndex].money = money;
-      this.tableData[this.selectIndex].totalMoney = money.toFixed(2),
+      this.selectList[this.selectIndex].count = this.selectList[this.selectIndex].big+'/'+Number(this.selectList[this.selectIndex].small);
+      this.selectList[this.selectIndex].money = money;
+      this.selectList[this.selectIndex].totalMoney = money.toFixed(2),
       this.getAllTableDataMoney();
       setTimeout(()=>{
         this.searchVal = '';
@@ -543,22 +543,22 @@ export default {
     },
     goDown(){
       if(this.isSeek){
-        let tableDataLength = this.getItemList.length-1;
+        let selectListLength = this.getItemList.length-1;
         if(this.getIndex==5) return
-        if(tableDataLength==this.getIndex){
-          this.getIndex = tableDataLength
+        if(selectListLength==this.getIndex){
+          this.getIndex = selectListLength
         }else{
           this.getIndex++;
         }
         this.$refs.showItemRef.setCurrentRow(this.getItemList[this.getIndex]);
       }else{
-        let tableDataLength = this.tableData.length-1;
-        if(tableDataLength==this.selectIndex){
-          this.selectIndex = tableDataLength
+        let selectListLength = this.selectList.length-1;
+        if(selectListLength==this.selectIndex){
+          this.selectIndex = selectListLength
         }else{
           this.selectIndex++;
         }
-        this.$refs.singleTable.setCurrentRow(this.tableData[this.selectIndex]);
+        this.$refs.singleTable.setCurrentRow(this.selectList[this.selectIndex]);
       }
 
     },
@@ -576,7 +576,7 @@ export default {
         }else{
           this.selectIndex--;
         }
-        this.$refs.singleTable.setCurrentRow(this.tableData[this.selectIndex]);
+        this.$refs.singleTable.setCurrentRow(this.selectList[this.selectIndex]);
       }
     },
     freightInput(){