潘超林 4 months ago
parent
commit
d46f20a3c3

+ 12 - 5
src/App.vue

@@ -14,13 +14,20 @@ export default {
   metaInfo() {
     return {
       title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
-      titleTemplate: title => {
-        return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
-      }
-    }
-  }
+      titleTemplate: (title) => {
+        return title
+          ? `${title} - ${process.env.VUE_APP_TITLE}`
+          : process.env.VUE_APP_TITLE;
+      },
+    };
+  },
 };
 </script>
+<style>
+.el-input__suffix {
+  top: 5px !important;
+}
+</style>
 <style scoped>
 #app .theme-picker {
   display: none;

+ 9 - 0
src/api/manage/storage.js

@@ -165,4 +165,13 @@ export function storeManageExport(query) {
         method: 'post',
         data: query
     })
+}
+
+
+export function getSkuMsgBySpuId(query) {
+    return request({
+        url: '/system/storeManage/getSkuMsgBySpuId/' + query,
+        method: 'get',
+        data: query
+    })
 }

+ 1 - 1
src/views/outbound/add.vue

@@ -156,7 +156,7 @@
                     show-word-limit
                     @input="passValue"
                   >
-                    <span slot="suffix">{{ scope.row.spuUnit }}</span>
+                    <span slot="suffix">{{ scope.row.storeUnit }}</span>
                   </el-input>
                 </template>
               </el-table-column>

+ 4 - 3
src/views/outbound/edit.vue

@@ -13,6 +13,7 @@
         <el-col :span="12">
           <el-form-item prop="outboundOdd" label="出库单号">
             <el-input
+            disabled
               v-model="form.outboundOdd"
               placeholder="不输入自动生成"
               clearable
@@ -157,7 +158,7 @@
                     @input="passValue"
                     disabled
                   >
-                    <span slot="suffix">{{ scope.row.spuUnit }}</span>
+                  <span slot="suffix">{{ scope.row.storeUnit }}</span>
                   </el-input>
                 </template>
               </el-table-column>
@@ -172,7 +173,7 @@
                     @input="passValue"
                     disabled
                   >
-                    <span slot="suffix">元/{{ scope.row.spuUnit }}</span>
+                    <span slot="suffix">元/{{ scope.row.storeUnit }}</span>
                   </el-input>
                 </template>
               </el-table-column>
@@ -325,7 +326,7 @@ export default {
       form: {
         outboundDate: "",
         outboundOdd: "",
-        outboundType: "",
+        outboundType: undefined,
         storeOutboundList: [],
         outboundUser: "",
         remark: "",

+ 9 - 7
src/views/running/detail.vue

@@ -28,7 +28,7 @@
         <div class="value">
           {{ tj ? tj.canOutboundNum : 0 }}
         </div>
-        <div class="label">当前库存数量()</div>
+        <div class="label">当前库存数量({{info.storeUnit}})</div>
       </div>
       <div class="item">
         <div class="value">
@@ -40,7 +40,7 @@
         <div class="value">
           {{ tj ? tj.storeNum : 0 }}
         </div>
-        <div class="label">入库总数量()</div>
+        <div class="label">入库总数量({{info.storeUnit}})</div>
       </div>
       <div class="item">
         <div class="value">
@@ -52,7 +52,7 @@
         <div class="value">
           {{ tj ? tj.outBoundNum : 0 }}
         </div>
-        <div class="label">出库数量()</div>
+        <div class="label">出库数量({{info.storeUnit}})</div>
       </div>
       <div class="item">
         <div class="value">
@@ -128,13 +128,13 @@
               内容:{{
                 scope.row.skuSpecs ? JSON.parse(scope.row.skuSpecs)[0].specsValue : ""
               }}
-              <br />计量单位:{{ scope.row.spuUnit }}
+              <br />计量单位:{{ scope.row.storeUnit }}
             </template>
           </el-table-column>
           <el-table-column label="单位换算" align="center" prop="storeUnit">
             <template slot-scope="scope">
               <div>
-                1{{ scope.row.spuUnit }} ≈{{ scope.row.unitConversion
+                1{{ scope.row.storeUnit }} ≈{{ scope.row.unitConversion
                 }}{{ scope.row.storeUnit }}
               </div>
             </template>
@@ -246,13 +246,13 @@
               内容:{{
                 scope.row.skuSpecs ? JSON.parse(scope.row.skuSpecs)[0].specsValue : ""
               }}
-              <br />计量单位:{{ scope.row.spuUnit }}
+              <br />计量单位:{{ scope.row.storeUnit }}
             </template>
           </el-table-column>
           <el-table-column label="单位换算" align="center" prop="storeUnit">
             <template slot-scope="scope">
               <div>
-                1{{ scope.row.spuUnit }} ≈{{ scope.row.unitConversion
+                1{{ scope.row.storeUnit }} ≈{{ scope.row.unitConversion
                 }}{{ scope.row.storeUnit }}
               </div>
             </template>
@@ -311,6 +311,8 @@ export default {
   },
   mounted() {
     this.info = this.$route.query;
+    console.log(this.info);
+    
     this.getStorageInfo();
     this.getList();
   },

+ 62 - 23
src/views/storage/add.vue

@@ -84,7 +84,6 @@
         >
           <el-form-item>
             <el-table
-              style="width: 1400px"
               :data="form.storeGoodsList"
               @selection-change="handleSelectionChange"
               row-key="id"
@@ -94,8 +93,24 @@
               <el-table-column label="分类" align="center" prop="categoryName" />
               <el-table-column label="规格计量单位" align="center" prop="spuUnit" />
               <el-table-column label="skuId" align="center" prop="skuId" />
-              <el-table-column label="规格名称" align="center" prop="skuSpecName" />
-              <el-table-column label="规格内容" align="center" prop="skuSpecName" />
+              <el-table-column label="规格名称" align="center" prop="skuSpecName">
+                <template slot-scope="scope">
+                  {{
+                    scope.row.skuSpecName
+                      ? JSON.parse(scope.row.skuSpecName)[0].specsName
+                      : ""
+                  }}
+                </template>
+              </el-table-column>
+              <el-table-column label="规格内容" align="center" prop="skuSpecName">
+                <template slot-scope="scope">
+                  {{
+                    scope.row.skuSpecName
+                      ? JSON.parse(scope.row.skuSpecName)[0].specsValue
+                      : ""
+                  }}
+                </template>
+              </el-table-column>
               <el-table-column label="单位换算" align="center" width="200">
                 <template slot-scope="scope">
                   <div style="display: flex; flex-direction: row; align-items: center">
@@ -110,7 +125,7 @@
                   </div>
                 </template>
               </el-table-column>
-              <el-table-column label="浮动重量" align="center">
+              <el-table-column label="浮动重量" align="center" width="120">
                 <template slot-scope="scope">
                   <el-input
                     v-model="scope.row.floatingWeight"
@@ -121,7 +136,7 @@
                   </el-input>
                 </template>
               </el-table-column>
-              <el-table-column label="入库数量" align="center">
+              <el-table-column label="入库数量" align="center" width="120">
                 <template slot-scope="scope">
                   <el-input
                     v-model="scope.row.storeNum"
@@ -132,7 +147,7 @@
                   </el-input>
                 </template>
               </el-table-column>
-              <el-table-column label="入库单价" align="center">
+              <el-table-column label="入库单价" align="center" width="150">
                 <template slot-scope="scope">
                   <el-input
                     v-model="scope.row.storeUnitPrice"
@@ -143,15 +158,16 @@
                   </el-input>
                 </template>
               </el-table-column>
-              <el-table-column label="销售单价" align="center" width="120">
+              <el-table-column label="销售单价" align="center" width="150">
                 <template slot-scope="scope">
-                  <el-input
+                  {{ scope.row.salePrice }}元/{{ scope.row.spuUnit }}
+                  <!-- <el-input
                     v-model="scope.row.salePrice"
                     clearable
                     oninput="value=value.replace(/[^\d.]/g,'')"
                   >
-                    <span slot="suffix"> 元/{{ scope.row.spuUnit }}</span>
-                  </el-input>
+                    <span slot="suffix"> </span>
+                  </el-input> -->
                 </template>
               </el-table-column>
 
@@ -334,11 +350,11 @@
         <el-table-column label="商品状态" align="center">
           <template slot-scope="scope">
             {{
-              scope.row.skuStatus == 2
+              scope.row.spuStatus == 2
                 ? "售罄"
-                : scope.row.skuStatus == 0
+                : scope.row.spuStatus == 0
                 ? "上架"
-                : scope.row.skuStatus == 1
+                : scope.row.spuStatus == 1
                 ? "下架"
                 : ""
             }}
@@ -367,7 +383,11 @@
 
 <script>
 import { getClassificationListPage } from "@/api/common/index";
-import { getStoreGoodsListByShopId, storeManageSave } from "@/api/manage/storage";
+import {
+  getStoreGoodsListByShopId,
+  storeManageSave,
+  getSkuMsgBySpuId,
+} from "@/api/manage/storage";
 export default {
   data() {
     return {
@@ -454,19 +474,38 @@ export default {
       this.form.storeGoodsList.splice(index, 1);
     },
     dialogOk() {
+      if (this.multipleSelection.length < 1) {
+        this.$message.error("请选择入库商品");
+        return;
+      }
       this.dialogVisible = false;
       console.log("this.", this.multipleSelection);
+      let ids = [];
+
       for (let index = 0; index < this.multipleSelection.length; index++) {
-        let params = {
-          unitConversion: "",
-          floatingWeight: "",
-          storeNum: "",
-          storeUnitPrice: "",
-        };
-        let obj = { ...this.multipleSelection[index], ...params };
-        this.form.storeGoodsList.push(obj);
+        ids.push(this.multipleSelection[index].spuId);
       }
-      console.log(this.form.storeGoodsList);
+
+      getSkuMsgBySpuId(ids).then((res) => {
+        if (res.code == 200) {
+          res.data.forEach((e) => {
+            let params = {
+              unitConversion: "",
+              floatingWeight: "",
+              storeNum: "",
+              storeUnitPrice: "",
+            };
+            let obj = { ...e, ...params };
+            this.form.storeGoodsList.push(obj);
+          });
+          this.form.storeGoodsList = this.unique(this.form.storeGoodsList);
+        }
+      });
+    },
+
+    unique(arr) {
+      const res = new Map();
+      return arr.filter((arr) => !res.has(arr.skuId) && res.set(arr.skuId, 1));
     },
 
     handleSelectionChange(val) {

+ 55 - 16
src/views/storage/edit.vue

@@ -94,8 +94,26 @@
               <el-table-column label="分类" align="center" prop="categoryName" />
               <el-table-column label="规格计量单位" align="center" prop="spuUnit" />
               <el-table-column label="skuId" align="center" prop="skuId" />
-              <el-table-column label="规格名称" align="center" prop="skuSpecName" />
-              <el-table-column label="规格内容" align="center" prop="skuSpecName" />
+              <el-table-column label="规格名称" align="center" prop="skuSpecName">
+                <template slot-scope="scope">
+                  {{ scope.row.skuSpecName?JSON.parse(scope.row.skuSpecName)[0].specsName:'' }}
+                  <!-- {{
+                    scope.row.skuSpecName
+                      ? JSON.parse(scope.row.skuSpecName[0]).specsName
+                      : ""
+                  }} -->
+                </template>
+              </el-table-column>
+              <el-table-column label="规格内容" align="center" prop="skuSpecName">
+                <template slot-scope="scope">
+                  {{ scope.row.skuSpecName?JSON.parse(scope.row.skuSpecName)[0].specsValue:'' }}
+                  <!-- {{
+                    scope.row.skuSpecName
+                      ? JSON.parse(scope.row.skuSpecName[0]).specsName
+                      : ""
+                  }} -->
+                </template>
+              </el-table-column>
               <el-table-column label="单位换算" align="center" width="200">
                 <template slot-scope="scope">
                   <div style="display: flex; flex-direction: row; align-items: center">
@@ -146,13 +164,14 @@
               </el-table-column>
               <el-table-column label="销售单价" align="center" width="120">
                 <template slot-scope="scope">
-                  <el-input
+                  <!-- <el-input
                     v-model="scope.row.salePrice"
                     clearable
                     oninput="value=value.replace(/[^\d.]/g,'')"
                   >
                     <span slot="suffix"> 元/{{ scope.row.spuUnit }}</span>
-                  </el-input>
+                  </el-input> -->
+                  {{scope.row.salePrice}}元/{{ scope.row.spuUnit }}
                 </template>
               </el-table-column>
 
@@ -332,11 +351,11 @@
         <el-table-column label="商品状态" align="center">
           <template slot-scope="scope">
             {{
-              scope.row.skuStatus == 2
+              scope.row.spuStatus == 2
                 ? "售罄"
-                : scope.row.skuStatus == 0
+                : scope.row.spuStatus == 0
                 ? "上架"
-                : scope.row.skuStatus == 1
+                : scope.row.spuStatus == 1
                 ? "下架"
                 : ""
             }}
@@ -365,6 +384,7 @@ import {
   storeManageEdit,
   storeManageInfo,
   storeManageRemoveproduct,
+  getSkuMsgBySpuId,
 } from "@/api/manage/storage";
 export default {
   data() {
@@ -469,17 +489,36 @@ export default {
     },
     dialogOk() {
       this.dialogVisible = false;
-      console.log("this.", this.multipleSelection);
+      console.log("this.", this.multipleelection);
+      let ids = [];
       for (let index = 0; index < this.multipleSelection.length; index++) {
-        let params = {
-          unitConversion: "",
-          floatingWeight: "",
-          storeNum: "",
-          storeUnitPrice: "",
-        };
-        let obj = { ...this.multipleSelection[index], ...params };
-        this.form.storeGoodsList.push(obj);
+        ids.push(this.multipleSelection[index].spuId);
       }
+      getSkuMsgBySpuId(ids).then((res) => {
+        console.log("1231231", res);
+        if (res.code == 200) {
+          res.data.forEach((e) => {
+            let params = {
+              unitConversion: "",
+              floatingWeight: "",
+              storeNum: "",
+              storeUnitPrice: "",
+            };
+            let obj = { ...e, ...params };
+            this.form.storeGoodsList.push(obj);
+          });
+        }
+      });
+      // for (let index = 0; index < this.multipleSelection.length; index++) {
+      //   let params = {
+      //     unitConversion: "",
+      //     floatingWeight: "",
+      //     storeNum: "",
+      //     storeUnitPrice: "",
+      //   };
+      //   let obj = { ...this.multipleSelection[index], ...params };
+      //   this.form.storeGoodsList.push(obj);
+      // }
       console.log(this.form.storeGoodsList);
     },