shish 2 лет назад
Родитель
Сommit
14ce8df603
1 измененных файлов с 32 добавлено и 64 удалено
  1. 32 64
      ghs/src/views/order/add.vue

+ 32 - 64
ghs/src/views/order/add.vue

@@ -27,22 +27,24 @@
       </el-table>
       </el-table>
     </div>
     </div>
     <div class="seek-list-box" v-if="seekList!=''">
     <div class="seek-list-box" v-if="seekList!=''">
-      <el-table ref="seekList" :data="seekList" highlight-current-row style="width: 100%" border :header-cell-style="{background:'#fdfdfd', color: '#666'}" class="tableBox active">
-        <el-table-column prop="itemName" label="图片" align="center"></el-table-column>
-        <el-table-column prop="itemName" label="名称" align="center"></el-table-column>
+      <el-table ref="showItemRef" :data="seekList" highlight-current-row style="width:100%" border :header-cell-style="{background:'#fdfdfd', color: '#666'}" class="tableBox active">
+        <el-table-column prop="cover" label="图片" align="center" width="180">
+          <template slot-scope="scope">
+            <img :src="scope.row.cover" style="width:40px;margin:0 auto;" />
+          </template>
+        </el-table-column>
+        <el-table-column prop="name" label="名称" align="center"></el-table-column>
         <el-table-column prop="price" label="价格" width="180" align="center"></el-table-column>
         <el-table-column prop="price" label="价格" width="180" align="center"></el-table-column>
         <el-table-column prop="stock" label="库存" width="180" align="center"></el-table-column>
         <el-table-column prop="stock" label="库存" width="180" align="center"></el-table-column>
         <el-table-column prop="bigUnit" label="单位" width="180" align="center"></el-table-column>
         <el-table-column prop="bigUnit" label="单位" width="180" align="center"></el-table-column>
-        <el-table-column prop="price" label="单价" width="180" align="center"></el-table-column>
       </el-table>
       </el-table>
     </div>
     </div>
     <div class="bottom_input">
     <div class="bottom_input">
-      <span style="margin-right:10px;font-weight: 700;">花材</span>
-      <el-input style="width: 280px;font-size:13px" @keyup.enter.native="enterSeekFun()" placeholder="这里搜索,光标插入 Ctrl + Q" type="text" ref="itemSearchRef" v-model="seekVal"></el-input>
-      <div style="display: inline-block;" class="allPrice">总金额: {{ totalMoney.toFixed(2) }}</div>
-      <div style="display: inline-block;" class="allPrice">总数量: {{tableData.length}}</div>
-      <div style="display: inline-block;" class="allPrice active">
-      </div>
+        <span style="margin-right:10px;font-weight: 700;">花材</span>
+        <el-input style="width: 280px;font-size:13px" @keyup.enter.native="searchItemFn()" placeholder="这里搜索,光标插入 Ctrl + Q" type="text" ref="itemSearchRef" v-model="seekVal"></el-input>
+        <div style="display: inline-block;" class="allPrice">总金额: {{ totalMoney.toFixed(2) }}</div>
+        <div style="display: inline-block;" class="allPrice">总数量: {{tableData.length}}</div>
+        <div style="display: inline-block;" class="allPrice active"></div>
     </div>
     </div>
     <el-dialog title="选择花材" v-if="isSelectNumber" :visible.sync="isSelectNumber" width="30%" center>
     <el-dialog title="选择花材" v-if="isSelectNumber" :visible.sync="isSelectNumber" width="30%" center>
       <div class="el-dialog-center">
       <div class="el-dialog-center">
@@ -200,7 +202,6 @@ export default {
       small:null,//小单位(支)
       small:null,//小单位(支)
       totalMoney:0,//总价
       totalMoney:0,//总价
       modifyPrice:0,//实际收款
       modifyPrice:0,//实际收款
-      allList:'',
       seekVal:'',//搜索值
       seekVal:'',//搜索值
       seekOldVal:'',//上一次搜索值
       seekOldVal:'',//上一次搜索值
       seekListIndex:0,
       seekListIndex:0,
@@ -214,7 +215,7 @@ export default {
       printSelectList:'',
       printSelectList:'',
       orderMsg:'',
       orderMsg:'',
       number: 0,
       number: 0,
-      customId:0,
+      customId:1,
       customInfoList:[],
       customInfoList:[],
       loading: false,
       loading: false,
       selectCustomName:''
       selectCustomName:''
@@ -224,12 +225,11 @@ export default {
 
 
   },
   },
   mounted() {
   mounted() {
-
-    this.$nextTick(() => {
-      this.$refs.customref.focus()
-    })
-
-    this.getAllList()
+    if(this.customId == 0){
+      this.$nextTick(() => {
+        this.$refs.customref.focus()
+      })
+    }
     let self = this;
     let self = this;
     document.onkeydown=function(e) {
     document.onkeydown=function(e) {
       console.log(e)
       console.log(e)
@@ -289,7 +289,6 @@ export default {
           return;
           return;
         }
         }
         self.isAccounts = true;
         self.isAccounts = true;
-
         if(self.$util.isEmpty(self.allShopList)){
         if(self.$util.isEmpty(self.allShopList)){
           self.getShopAll();
           self.getShopAll();
         }else{
         }else{
@@ -337,11 +336,6 @@ export default {
       }
       }
       return todaty
       return todaty
     },
     },
-    getAllList(){
-      this.$service.product.list().then(res => {
-        this.allList = res.list;
-      });
-    },
     getShopAll(){
     getShopAll(){
       this.$service.custom.shopListAll().then(res => {
       this.$service.custom.shopListAll().then(res => {
         this.allShopList = res.list;
         this.allShopList = res.list;
@@ -375,38 +369,21 @@ export default {
     printOrder() {
     printOrder() {
 
 
     },
     },
-    async enterSeekFun(){
+    async searchItemFn(){
       if(this.seekVal==''){
       if(this.seekVal==''){
         this.isSeek = false
         this.isSeek = false
         return
         return
       }
       }
-      if(this.seekVal == this.seekOldVal && this.seekList != ''){
-        // if(Number(this.seekList[this.seekListIndex].stock)==0){
-        //   this.$message({message: '库存不足',type: 'warning'});
-        //   return;
-        // }
-        this.isSeek = false;
-        this.isSelectNumber = true;
-        this.$nextTick(()=>{
-          this.$refs['bigInput'].focus();
-        })
-      }else{
-        this.seekList = [];
-        this.seekListIndex = 0;
-        this.seekOldVal = this.seekVal;
-        this.isSeek = true;
-        let list = this.$util.copyObject(this.allList);
-        let commonList = list;
-        await commonList.forEach(ele => {
-          let hasName = ele.itemName && ele.itemName.indexOf(this.seekVal) >= 0;
-          let elePy = (ele.py && ele.py.toLocaleUpperCase()) || "";
-          let hasPy = elePy.indexOf(this.seekVal.toLocaleUpperCase()) >= 0;
-          if (hasName || hasPy) {
-            this.seekList.push(ele);
-          }
-        });
-        this.$refs.seekList.setCurrentRow(this.seekList[0]);
-      }
+      let that = this
+      this.seekList = [];
+      this.seekListIndex = 0;
+      this.seekOldVal = this.seekVal;
+      this.isSeek = true;
+      await this.$service.item.getItemList({search:this.seekVal,requestType:'kd',pageSize:6}).then(res=>{
+        let list = this.$util.copyObject(res.list)
+        that.seekList = list
+      })
+      that.$refs.showItemRef.setCurrentRow(that.seekList[0])
     },
     },
     enterFun(){
     enterFun(){
       let selectList = this.seekList[this.seekListIndex];
       let selectList = this.seekList[this.seekListIndex];
@@ -544,7 +521,7 @@ export default {
         }else{
         }else{
           this.seekListIndex++;
           this.seekListIndex++;
         }
         }
-        this.$refs.seekList.setCurrentRow(this.seekList[this.seekListIndex]);
+        this.$ref.showItemRef.setCurrentRow(this.seekList[this.seekListIndex]);
       }else{
       }else{
         let tableDataLength = this.tableData.length-1;
         let tableDataLength = this.tableData.length-1;
         if(tableDataLength==this.tableDataIndex){
         if(tableDataLength==this.tableDataIndex){
@@ -563,7 +540,7 @@ export default {
         }else{
         }else{
           this.seekListIndex--;
           this.seekListIndex--;
         }
         }
-        this.$refs.seekList.setCurrentRow(this.seekList[this.seekListIndex]);
+        this.$ref.showItemRef.setCurrentRow(this.seekList[this.seekListIndex]);
       }else{
       }else{
         if(this.tableDataIndex==0){
         if(this.tableDataIndex==0){
           this.tableDataIndex = 0
           this.tableDataIndex = 0
@@ -572,7 +549,6 @@ export default {
         }
         }
         this.$refs.singleTable.setCurrentRow(this.tableData[this.tableDataIndex]);
         this.$refs.singleTable.setCurrentRow(this.tableData[this.tableDataIndex]);
       }
       }
-
     },
     },
     freightInput(){
     freightInput(){
        this.totalMoney = Number(this.freight) +  this.number
        this.totalMoney = Number(this.freight) +  this.number
@@ -596,15 +572,6 @@ export default {
     line-height: 45px;
     line-height: 45px;
   }
   }
 }
 }
-
-.bottom_input {
-  text-align: center;
-  .el-form-item {
-    margin-bottom: 0;
-  }
-}
-</style>
-<style lang="scss" scoped>
 .app-list-content {
 .app-list-content {
   position: relative;
   position: relative;
 
 
@@ -646,6 +613,7 @@ export default {
   .bottom_input {
   .bottom_input {
     position: absolute;
     position: absolute;
     bottom: 18px;
     bottom: 18px;
+    width:100%;
     text-align: center;
     text-align: center;
     .allPrice {
     .allPrice {
       margin-left:50px;
       margin-left:50px;