shish 2 years ago
parent
commit
4e2de7fe52
1 changed files with 7 additions and 2 deletions
  1. 7 2
      ghs/src/views/order/add.vue

+ 7 - 2
ghs/src/views/order/add.vue

@@ -29,8 +29,8 @@
         </el-table-column>
         </el-table-column>
 
 
         <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="110" align="center"></el-table-column>
         <el-table-column prop="bigCount" label="数量" width="110" align="center"></el-table-column>
         <el-table-column prop="bigCount" label="数量" width="110" align="center"></el-table-column>
+        <el-table-column prop="userPrice" label="单价" width="110" align="center"></el-table-column>
         <el-table-column prop="sumPrice" label="金额" width="110" align="center">
         <el-table-column prop="sumPrice" label="金额" width="110" align="center">
           <template slot-scope="scope">
           <template slot-scope="scope">
             ¥{{ parseFloat(Number(scope.row.userPrice)*Number(scope.row.bigCount).toFixed(2)) }}
             ¥{{ parseFloat(Number(scope.row.userPrice)*Number(scope.row.bigCount).toFixed(2)) }}
@@ -109,7 +109,7 @@
         <el-input style="width: 130px;margin-left: 15px" placeholder="价格" @keyup.enter.native="confirmNumPrice()" type="number" v-model="customData.userPrice"></el-input>
         <el-input style="width: 130px;margin-left: 15px" placeholder="价格" @keyup.enter.native="confirmNumPrice()" type="number" v-model="customData.userPrice"></el-input>
         <span>元</span>
         <span>元</span>
       </div>
       </div>
-      <div style="text-align:center;margin:20px 0 5px 0;font-weight:bold;font-size:18px;">剩 {{ currentItem.stock ? parseFloat(currentItem.stock) : 0 }} {{ currentItem.bigUnit}}</div>
+      <div style="margin:15px 0 5px 100px;font-weight:bold;font-size:18px;">剩 {{ currentItem.stock ? parseFloat(currentItem.stock) : 0 }} {{ currentItem.bigUnit}}</div>
       <div class="remark">Enter 确定,Esc 取消</div>
       <div class="remark">Enter 确定,Esc 取消</div>
     </el-dialog>
     </el-dialog>
 
 
@@ -700,10 +700,15 @@ export default {
     },
     },
     confirmNumPrice(){
     confirmNumPrice(){
       let currentItem = this.currentItem;
       let currentItem = this.currentItem;
+      
       if(Number(this.customData.bigCount)<=0){
       if(Number(this.customData.bigCount)<=0){
         this.$message({message: '请填写数量',type: 'warning'});
         this.$message({message: '请填写数量',type: 'warning'});
         return;
         return;
       }
       }
+      if(Number(this.customData.bigCount)>Number(currentItem.stock)){
+        this.$message({message: '库存不足',type: 'warning'});
+        return;
+      }
       currentItem = {...currentItem,bigCount:this.customData.bigCount,userPrice:this.customData.userPrice,smallCount:this.customData.smallCount}
       currentItem = {...currentItem,bigCount:this.customData.bigCount,userPrice:this.customData.userPrice,smallCount:this.customData.smallCount}
       this.replaceItemFn(currentItem,1,'add')
       this.replaceItemFn(currentItem,1,'add')
       this.backToSearchItem();
       this.backToSearchItem();