Bläddra i källkod

feat: 强制仓操作

Howie 1 år sedan
förälder
incheckning
8f84bd5ede

+ 14 - 4
src/views/supply/apply/components/apply_form.vue

@@ -210,13 +210,13 @@
                 placeholder="选择存货类别"
                 style="width: 100%"
                 clearable
-                :disabled="goodsList.length > 0"
+                :disabled=" isDealer ? goodsList.length > 0 : false"
               >
                 <el-option
                   v-for="item in categoryList"
-                  :key="item.name"
+                  :key="item.id"
                   :label="item.name"
-                  :value="item.name"
+                  :value="item.id"
                 ></el-option>
               </el-select>
             </el-form-item>
@@ -478,6 +478,9 @@ export default {
         // data.orders.forEach(item => {
         //   item.orderId = item.id;
         // })
+        if (data.orders.length) {
+          this.screenForm.type = data.orders[0].categoryId
+        }
         this.goodsList = data.orders
         // this.screenForm.type = data.mainId;
       })
@@ -542,11 +545,13 @@ export default {
 
     // 获取商品列表
     getGoodsList() {
+      const  categoryName =  this.categoryList.find(k=>k.id == this.screenForm.type )?.name || ''
+
       getGoodsList({
         pageNum: this.currentPage,
         pageSize: 10,
         correspondId: this.screenForm.warehouse,
-        categoryName: this.screenForm.type,
+        categoryName,
         id: this.screenForm.orderNum,
         specification: this.screenForm.model
       }).then(res => {
@@ -686,6 +691,11 @@ export default {
           }
 
           let correspondName = this.warehouseList[findElem(this.warehouseList, 'id', this.screenForm.warehouse)].name
+          this.goodsList.forEach(k=>{
+            k.categoryId =  this.goodsList[0].categoryId
+            k.categoryName =  this.goodsList[0].categoryName
+
+          })
           let params = {
             id: this.listItem ? this.listItem.id : '',
             headerRemark: this.mainForm.headerRemark,

+ 13 - 4
src/views/supply/apply/components/engin_form.vue

@@ -338,9 +338,9 @@
               >
                 <el-option
                   v-for="item in categoryList"
-                  :key="item.name"
+                  :key="item.id"
                   :label="item.name"
-                  :value="item.name"
+                  :value="item.id"
                 ></el-option>
               </el-select>
             </el-form-item>
@@ -682,7 +682,11 @@ export default {
         // data.orders.forEach(item => {
         //   item.orderId = item.id;
         // })
+        if (data.orders.length) {
+          this.screenForm.type = data.orders[0].categoryId
+        }
         this.goodsList = data.orders
+
       })
     },
 
@@ -748,6 +752,7 @@ export default {
 
     // 获取商品列表
     getGoodsList() {
+     const  categoryName =  this.categoryList.find(k=>k.id == this.screenForm.type )?.name || ''
       getEnginGoodsList({
         pageNum: this.currentPage,
         pageSize: 10,
@@ -758,7 +763,7 @@ export default {
         startTime: this.screenForm.date ? this.screenForm.date[0] : '',
         endTime: this.screenForm.date ? this.screenForm.date[1] : '',
         correspondId: this.screenForm.warehouse,
-        categoryName: this.screenForm.type
+        categoryName
       }).then(res => {
         let oldGoodsList = this.goodsList
         let newGoodsList = res.data.records
@@ -931,8 +936,12 @@ export default {
               })
             })
           }
-
           let correspondName = this.warehouseList[findElem(this.warehouseList, 'id', this.screenForm.warehouse)].name
+          this.goodsList.forEach(k=>{
+            k.categoryId =  this.goodsList[0].categoryId
+            k.categoryName =  this.goodsList[0].categoryName
+
+          })
           let params = {
             // orderTime: this.mainForm.orderDate + ' 00:00:00',
             refEnginRecordNo: this.mainForm.loginNum,

+ 5 - 2
src/views/supply/policy/components/retail_form.vue

@@ -96,7 +96,7 @@
         <el-select
           v-model="warehouseValue"
           placeholder="请选择发货仓库"
-          :disabled="!goodsList.length"
+          :disabled=" isDealer ? !goodsList.length : false"
           size="small"
           style="margin-right: 10px"
           @change="handleWarehouseValue"
@@ -863,7 +863,10 @@ export default {
           ((row.price - row.discAmount) * row.qty * ((row.rebateRate || 0) * 100)) / 100
         )
       }
-    }
+    },
+  isDealer() {
+    return JSON.parse(localStorage.getItem('supply_user')).isCustomer
+  }
   },
   watch: {
     goodsList: {

+ 11 - 10
src/views/supply/reserve/components/reserve_form.vue

@@ -76,6 +76,7 @@
     </div>
     <div class="table" style="margin-top: 20px">
       <el-table
+        ref="table"
         :data="goodsList"
         element-loading-text="Loading"
         border
@@ -620,17 +621,17 @@ export default {
 
     // 获取详情
     getDetail() {
-      getDetail({ id: this.listItem.id }).then(res => {
+      getDetail({ id: this.listItem.id }).then(async res => {
+        this.mainForm.orderNum = res.data.id
+        this.mainForm.orderDate = res.data.orderTime
+        this.mainForm.createMan = res.data.createBy
+        this.mainForm.createDate = res.data.createTime
+        this.mainForm.remark = res.data.remark
+        for (let i = 0; i < res.data.reservedOrderItems.length; i++) {
+          res.data.reservedOrderItems[i].warehouseList = await this.getListStock(res.data.reservedOrderItems[i].customerId)
+        }
+
         let data = res.data
-        this.mainForm.orderNum = data.id
-        this.mainForm.orderDate = data.orderTime
-        this.mainForm.createMan = data.createBy
-        this.mainForm.createDate = data.createTime
-        this.mainForm.remark = data.remark
-
-        data.reservedOrderItems.forEach(async item => {
-          item.warehouseList = await this.getListStock(item.customerId)
-        })
 
         this.goodsList = data.reservedOrderItems
       })