Browse Source

feat备库

snow 1 year ago
parent
commit
e36217fb02

+ 7 - 2
src/components/globalComponents/show-goods-data-table/ShowDataTableColumns.js

@@ -6,6 +6,12 @@ const reColumns = [
     _slot_: 'good_name',
     span: 18
   },
+  {
+    prop:'is_combind',
+    label:'组合类型',
+    _slot_:"is_combind",
+    span: 6
+  },
   {
     prop: 'cat',
     label: '分类',
@@ -674,8 +680,7 @@ const costColumns = [
     prop: 'craft_desc',
     label: '工艺说明',
     span: 24
-  }
-
+  },
 ]
 // 是否定制
 const options1 = [

+ 70 - 0
src/components/globalComponents/show-goods-data-table/main.vue

@@ -15,6 +15,21 @@
         <el-tag size="mini">{{String(sitem.is_combind) === "1" ? '组合商品' : '非组合商品'}}</el-tag>
       </template>
 
+      <template slot="combind_list">
+        <el-table :data="sitem.combind_list" size="mini">
+          <el-table-column prop="childCode" label="子商品成本编号" />
+          <el-table-column prop="child_name" label="子商品名称" />
+          <el-table-column prop="child_num" label="组合比例" />
+          <el-table-column label="操作" width="80px">
+            <template slot-scope="{ row }">
+              <el-tooltip content="查看详情">
+                <el-button size="mini" type="text" icon="el-icon-view" @click="openDetail(row)" />
+              </el-tooltip>
+            </template>
+          </el-table-column>
+        </el-table>
+      </template>
+
       <template slot="good_name">
         <img
           v-if="sitem.good_thumb_img"
@@ -148,6 +163,24 @@
       :columns="costColumns"
       :border="border"
     >
+      <template slot="is_combind">
+        <el-tag size="mini">{{String(sitem.is_combind) === "1" ? '组合商品' : '非组合商品'}}</el-tag>
+      </template>
+      <template slot="combind_list">
+        <el-table :data="sitem.combind_list" size="mini">
+          <el-table-column prop="childCode" label="子商品成本编号" />
+          <el-table-column prop="child_name" label="子商品名称" />
+          <el-table-column prop="child_num" label="组合比例" />
+          <el-table-column label="操作" width="80px">
+            <template slot-scope="{ row }">
+              <el-tooltip content="查看详情">
+                <el-button size="mini" type="text" icon="el-icon-view" @click="openDetail(row)" />
+              </el-tooltip>
+            </template>
+          </el-table-column>
+        </el-table>
+      </template>
+
       <template slot="good_name">
         <img
           v-if="sitem.good_thumb_img"
@@ -287,6 +320,9 @@
       :columns="reColumns"
       :border="border"
     >
+      <template slot="is_combind">
+        <el-tag size="mini">{{String(sitem.is_combind) === "1" ? '组合商品' : '非组合商品'}}</el-tag>
+      </template>
       <template slot="good_name">
         <!-- <img
           v-viewer
@@ -488,6 +524,7 @@ import {
   options11,
   options12
 } from "./ShowDataTableColumns";
+
 export default {
   name: "ShowGoodsDataTable",
 
@@ -515,6 +552,14 @@ export default {
     border: {
       type: Boolean,
       default: false
+    },
+    isStockInfo: {
+      type: Boolean,
+      default: false
+    },
+    isRemoveStock: {
+      type: Boolean,
+      default: false
     }
   },
   data() {
@@ -543,6 +588,28 @@ export default {
     ...mapGetters(["isSupertube"])
   },
   watch: {
+    sitem: {
+      handler() {
+        const { is_combind } = this.sitem;
+        if (!is_combind !== "1" || this.isStockInfo) return;
+
+        ["onlineColumns", "reColumns", "costColumns", "coveColumns"].forEach(
+          prop => {
+            this[prop] = [
+              ...this[prop],
+              ...[
+                {
+                  label: "子商品信息",
+                  _slot_: "combind_list",
+                  span: 24
+                }
+              ]
+            ];
+          }
+        );
+        // console.log(this.sitem);
+      }
+    },
     newTime: function(val) {
       if (val) {
         this.initForm();
@@ -554,6 +621,9 @@ export default {
   },
 
   methods: {
+    openDetail({ childCode }) {
+      this.$router.push("/goodStore/goodsCostDetail?id=" + childCode);
+    },
     async initForm() {
       console.log(
         `${this.type}---${this.skucode}---${this.spucode}---${this.iscgd}`

+ 175 - 148
src/components/search-good-modal/main.vue

@@ -82,14 +82,10 @@
                 </el-select>
               </el-col>
               <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
-                <el-button type="primary" :size="searchSize" @click="searchList">
-                  刷新
-                </el-button>
+                <el-button type="primary" :size="searchSize" @click="searchList">刷新</el-button>
               </el-col>
               <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
-                <el-button type="warning" :size="searchSize" @click="restSearch">
-                  重置
-                </el-button>
+                <el-button type="warning" :size="searchSize" @click="restSearch">重置</el-button>
               </el-col>
             </el-row>
             <el-row style="padding: 0 0 0 0">
@@ -105,25 +101,22 @@
                     parmValue.page = 1;
                     searchList();
                   "
-                ><el-select
-                  slot="prepend"
-                  v-model="select"
-                  style="width: 135px"
-                  placeholder="关键字类型"
                 >
-                  <el-option label="商品编号" value="1" />
-                  <el-option label="商品名称" value="2" />
-                  <el-option label="业务公司名称" value="3" />
-                  <el-option label="供应商名称" value="4" /> </el-select></el-input>
+                  <el-select
+                    slot="prepend"
+                    v-model="select"
+                    style="width: 135px"
+                    placeholder="关键字类型"
+                  >
+                    <el-option label="商品编号" value="1" />
+                    <el-option label="商品名称" value="2" />
+                    <el-option label="业务公司名称" value="3" />
+                    <el-option label="供应商名称" value="4" />
+                  </el-select>
+                </el-input>
               </el-col>
               <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
-                <el-button
-                  type="success"
-                  :size="searchSize"
-                  @click="resultList(selection)"
-                >
-                  保存
-                </el-button>
+                <el-button type="success" :size="searchSize" @click="resultList(selection)">保存</el-button>
               </el-col>
             </el-row>
           </div>
@@ -138,8 +131,8 @@
             <img
               :src="scope.row.good_thumb_img"
               style="display: inline-block; width: 100%; height: 100%"
-              alt=""
-            >
+              alt
+            />
           </div>
         </template>
         <template #good_type="{ scope }">
@@ -157,18 +150,26 @@
 </template>
 
 <script>
-import asyncRequest from '@/apis/components/search-good-modal'
-import resToken from '@/mixins/resToken'
-import mixinPage from '@/mixins/elPaginationHandle'
-import { mapGetters } from 'vuex'
-import columns from './columns'
+import asyncRequest from "@/apis/components/search-good-modal";
+import resToken from "@/mixins/resToken";
+import mixinPage from "@/mixins/elPaginationHandle";
+import { mapGetters } from "vuex";
+import columns from "./columns";
 export default {
-  name: 'SearchGoodModal',
+  name: "SearchGoodModal",
   mixins: [resToken, mixinPage],
   computed: {
-    ...mapGetters(['tablebtnSize', 'searchSize', 'size'])
+    ...mapGetters(["tablebtnSize", "searchSize", "size"])
   },
-  props: ['showModel', 'once', 'isonline', 'is_stock', 'isNoble', 'checkType'],
+  props: [
+    "showModel",
+    "once",
+    "isonline",
+    "is_stock",
+    "isNoble",
+    "checkType",
+    "is_combind"
+  ],
 
   /**
    * 属性集合
@@ -182,29 +183,29 @@ export default {
   data() {
     return {
       options1: [
-        { id: '0', name: '否' },
-        { id: '1', name: '是' }
+        { id: "0", name: "否" },
+        { id: "1", name: "是" }
       ],
-      sinput: '',
-      select: '1',
+      sinput: "",
+      select: "1",
       options: [],
       selectLoading: false,
-      searchName: '',
+      searchName: "",
       supplierCode: [],
       loading: true,
       showModelThis: false,
       parmValue: {
-        type_code: '', // 是否定制
-        supplierNo: '', // 供应商code
+        type_code: "", // 是否定制
+        supplierNo: "", // 供应商code
         cat_id: [],
         brandid: [],
-        spucode: '', // 商品编码
-        good_name: '', // 商品名称
-        status: '1', //
-        company: '',
-        supplier: '',
-        isonline: '',
-        is_stock: '',
+        spucode: "", // 商品编码
+        good_name: "", // 商品名称
+        status: "1", //
+        company: "",
+        supplier: "",
+        isonline: "",
+        is_stock: "",
         page: 1, // 页码
         size: 15 // 每页显示条数
       },
@@ -228,19 +229,19 @@ export default {
       },
       // 表格 - 列参数
       columns: columns
-    }
+    };
   },
   watch: {
     showModel: function(val) {
-      this.showModelThis = val
+      this.showModelThis = val;
       if (val) {
         // this.supplierCode = [];
-        this.restSearch()
+        this.restSearch();
       }
     },
     showModelThis(val) {
       if (!val) {
-        this.$emit('cancel')
+        this.$emit("cancel");
       }
     }
   },
@@ -256,174 +257,200 @@ export default {
     //   this.searchList();
     // },
     restSearch() {
-      this.sinput = ''
-      this.select = '1'
+      this.sinput = "";
+      this.select = "1";
       // this.supplierCode = [];
       this.parmValue = {
-        type_code: '', // 是否定制
-        supplierNo: '', // 供应商code
-        spucode: '', // 商品编码
+        type_code: "", // 是否定制
+        supplierNo: "", // 供应商code
+        spucode: "", // 商品编码
         cat_id: [],
         brandid: [],
-        good_name: '', // 商品名称
-        status: '1', //
-        is_stock: '',
-        company: '',
-        supplier: '',
-        isonline: '',
+        good_name: "", // 商品名称
+        status: "1", //
+        is_stock: "",
+        company: "",
+        supplier: "",
+        isonline: "",
         page: 1, // 页码
         size: 15 // 每页显示条数
-      }
+      };
       // 表格 - 分页
       this.pageInfo = {
         size: 15,
         curr: 1,
         total: 0
-      }
-      this.searchList()
+      };
+      this.searchList();
     },
     async goods_class_change(e) {
-      this.parmValue.cat_id = e
-      this.pageInfo.curr = 1
-      this.parmValue.page = 1
-      await this.searchList()
+      this.parmValue.cat_id = e;
+      this.pageInfo.curr = 1;
+      this.parmValue.page = 1;
+      await this.searchList();
     },
     async brandidsearchChange(e) {
-      const { id } = e
-      this.parmValue.brandid = id ? [id] : []
-      this.pageInfo.curr = 1
-      this.parmValue.page = 1
-      await this.searchList()
+      const { id } = e;
+      this.parmValue.brandid = id ? [id] : [];
+      this.pageInfo.curr = 1;
+      this.parmValue.page = 1;
+      await this.searchList();
     },
     async searchList() {
-      this.loading = true
-      this.parmValue.spucode = this.select === '1' ? this.sinput : ''
-      this.parmValue.good_name = this.select === '2' ? this.sinput : ''
-      this.parmValue.company = this.select === '3' ? this.sinput : ''
-      this.parmValue.supplier = this.select === '4' ? this.sinput : ''
-      this.parmValue.isonline = this.isonline || ''
-      this.parmValue.is_stock = this.is_stock || ''
-      const model = JSON.parse(JSON.stringify(this.parmValue))
-      model.cat_id = model.cat_id.length > 0 ? model.cat_id[model.cat_id.length - 1] : ''
+      this.loading = true;
+      this.parmValue.spucode = this.select === "1" ? this.sinput : "";
+      this.parmValue.good_name = this.select === "2" ? this.sinput : "";
+      this.parmValue.company = this.select === "3" ? this.sinput : "";
+      this.parmValue.supplier = this.select === "4" ? this.sinput : "";
+      this.parmValue.isonline = this.isonline || "";
+      this.parmValue.is_stock = this.is_stock || "";
+
+      console.log(this.is_combind, "---");
+
+      if (this.is_combind) {
+        this.parmValue.is_combind = this.is_combind;
+      }
+
+      const model = JSON.parse(JSON.stringify(this.parmValue));
+      model.cat_id =
+        model.cat_id.length > 0 ? model.cat_id[model.cat_id.length - 1] : "";
       model.brandid =
-        model.brandid.length > 0 ? model.brandid[model.brandid.length - 1] : ''
+        model.brandid.length > 0 ? model.brandid[model.brandid.length - 1] : "";
 
-      const res = await asyncRequest.list(model)
+      const res = await asyncRequest.list(model);
       if (res && res.code === 0 && res.data) {
-        this.tableData = res.data.list
-        this.tableData.forEach((a) => {
-          a.cat_name = ''
-          const list = a.cat_info || []
+        this.tableData = res.data.list;
+        this.tableData.forEach(a => {
+          a.cat_name = "";
+          const list = a.cat_info || [];
           list.forEach((b, i) => {
-            a.cat_name += i == 0 ? b.name : '/' + b.name
-          })
-        })
-        this.pageInfo.total = Number(res.data.count)
+            a.cat_name += i == 0 ? b.name : "/" + b.name;
+          });
+        });
+        this.pageInfo.total = Number(res.data.count);
       } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout()
+        await this.logout();
       } else {
-        this.tableData = []
-        this.pageInfo.total = 0
+        this.tableData = [];
+        this.pageInfo.total = 0;
       }
-      this.loading = false
+      this.loading = false;
     },
     async remoteMethod(query) {
-      this.selectLoading = true
-      if (query !== '') {
-        this.options = []
+      this.selectLoading = true;
+      if (query !== "") {
+        this.options = [];
         const formValue = {
           page: 1,
           size: 100,
           name: query,
-          code: ''
-        }
+          code: ""
+        };
 
-        const res = await asyncRequest.supplierList(formValue)
+        const res = await asyncRequest.supplierList(formValue);
         if (res && res.code === 0 && res.data) {
-          const { list } = res.data
-          this.options = list
+          const { list } = res.data;
+          this.options = list;
         } else if (res && res.code >= 100 && res.code <= 104) {
-          await this.logout()
+          await this.logout();
         } else {
-          this.$message.warning(res.message)
+          this.$message.warning(res.message);
         }
       } else {
-        this.options = []
+        this.options = [];
       }
-      this.selectLoading = false
+      this.selectLoading = false;
     },
     async resultList(selection) {
       if (selection && selection.length > 1 && this.once) {
-        this.$message.warning('只能选择一条商品信息!')
-        return
+        this.$message.warning("只能选择一条商品信息!");
+        return;
       }
 
       if (this.checkType) {
-        const h = this.$createElement
+        const h = this.$createElement;
         const categoryIds = selection.map(({ cat_info, is_gold_price }) => ({
           id: String(cat_info[0].id),
           isGoldPrice: String(is_gold_price)
-        }))
+        }));
 
-        console.log(categoryIds)
-        const nobleMetalIds = categoryIds.filter(({ id, isGoldPrice }
-        ) => id === '6' && isGoldPrice === '1')
+        console.log(categoryIds);
+        const nobleMetalIds = categoryIds.filter(
+          ({ id, isGoldPrice }) => id === "6" && isGoldPrice === "1"
+        );
 
-        if (nobleMetalIds.length > 0 && categoryIds.length !== nobleMetalIds.length) {
+        if (
+          nobleMetalIds.length > 0 &&
+          categoryIds.length !== nobleMetalIds.length
+        ) {
           // this.$message.warning('勾选商品的分类必须全部为"贵金属"或全部为"非贵金属"')
 
           this.$message({
-            message: h('p', null, [
-              h('span', null, '勾选商品必须全部为'),
-              h('i', { style: 'color: red' }, '开启实时金价的贵金属商品'),
-              h('span', null, '或者全部为'),
-              h('i', { style: 'color: red' }, '未开启实时金价的贵金属商品和非贵金属商品')
+            message: h("p", null, [
+              h("span", null, "勾选商品必须全部为"),
+              h("i", { style: "color: red" }, "开启实时金价的贵金属商品"),
+              h("span", null, "或者全部为"),
+              h(
+                "i",
+                { style: "color: red" },
+                "未开启实时金价的贵金属商品和非贵金属商品"
+              )
             ]),
-            type: 'warning',
+            type: "warning",
             dangerouslyUseHTMLString: true
-          })
-          return
+          });
+          return;
         }
 
-        const isNoble = nobleMetalIds.length > 0 && categoryIds.length === nobleMetalIds.length
-        if ((isNoble && !this.isNoble) && this.isNoble !== null) {
+        const isNoble =
+          nobleMetalIds.length > 0 &&
+          categoryIds.length === nobleMetalIds.length;
+        if (isNoble && !this.isNoble && this.isNoble !== null) {
           // this.$message.warning('如需添加 "贵金属商品",请将已添加的所有 "非贵金属商品" 删除!')
 
           this.$message({
-            message: h('p', null, [
-              h('span', null, '如需添加'),
-              h('i', { style: 'color: red' }, '开启实时金价的贵金属商品'),
-              h('span', null, '请将已添加的所有'),
-              h('i', { style: 'color: red' }, '未开启实时金价的贵金属商品和非贵金属商品'),
-              h('span', null, '删除!')
+            message: h("p", null, [
+              h("span", null, "如需添加"),
+              h("i", { style: "color: red" }, "开启实时金价的贵金属商品"),
+              h("span", null, "请将已添加的所有"),
+              h(
+                "i",
+                { style: "color: red" },
+                "未开启实时金价的贵金属商品和非贵金属商品"
+              ),
+              h("span", null, "删除!")
             ]),
-            type: 'warning',
+            type: "warning",
             dangerouslyUseHTMLString: true
-          })
-          return
+          });
+          return;
         }
 
-        if ((!isNoble && this.isNoble) && this.isNoble !== null) {
+        if (!isNoble && this.isNoble && this.isNoble !== null) {
           this.$message({
-            message: h('p', null, [
-              h('span', null, '如需添加'),
-              h('i', { style: 'color: red' }, '未开启实时金价的贵金属商品和非贵金属商品'),
-              h('span', null, '请将已添加的所有'),
-              h('i', { style: 'color: red' }, '开启实时金价的贵金属商品'),
-              h('span', null, '删除!')
+            message: h("p", null, [
+              h("span", null, "如需添加"),
+              h(
+                "i",
+                { style: "color: red" },
+                "未开启实时金价的贵金属商品和非贵金属商品"
+              ),
+              h("span", null, "请将已添加的所有"),
+              h("i", { style: "color: red" }, "开启实时金价的贵金属商品"),
+              h("span", null, "删除!")
             ]),
-            type: 'warning',
+            type: "warning",
             dangerouslyUseHTMLString: true
-          })
-          return
+          });
+          return;
         }
       }
 
-      this.showModelThis = false
-      this.$emit('resultList', selection)
+      this.showModelThis = false;
+      this.$emit("resultList", selection);
     }
   }
-}
+};
 </script>
 
 <style></style>

+ 26 - 31
src/components/search-stock-good-modal/index.vue

@@ -31,21 +31,14 @@
           >
             <template slot-scope="scope">
               <span>{{ scope.row.good_name }}</span>
-              <span
-                v-for="(si, sii) in scope.row.specinfo"
-                :key="si.spec_value_id + sii"
-                >{{ sii === 0 ? "_" : "-" }}{{ si.spec_name }}[{{
-                  si.spec_value
-                }}]</span
-              >
+              <span v-for="(si, sii) in scope.row.specinfo" :key="si.spec_value_id + sii">
+                {{ sii === 0 ? "_" : "-" }}{{ si.spec_name }}[{{
+                si.spec_value
+                }}]
+              </span>
             </template>
           </el-table-column>
-          <el-table-column
-            v-else
-            :key="column + index"
-            show-overflow-tooltip
-            v-bind="column"
-          />
+          <el-table-column v-else :key="column + index" show-overflow-tooltip v-bind="column" />
         </template>
       </el-table>
       <div
@@ -73,9 +66,7 @@
           />
         </div>
         <div class="fr">
-          <el-button type="primary" :size="'mini'" @click="resultList()"
-            >保 存</el-button
-          >
+          <el-button type="primary" :size="'mini'" @click="resultList()">保 存</el-button>
         </div>
       </div>
     </el-card>
@@ -93,9 +84,9 @@ export default {
 
   mixins: [resToken, mixinPage],
   computed: {
-    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+    ...mapGetters(["tablebtnSize", "searchSize", "size"])
   },
-  props: ["showModel", "once", "code", "good_code", "cat_id"],
+  props: ["showModel", "once", "code", "good_code", "cat_id", "is_combind"],
 
   /**
    * 属性集合
@@ -118,7 +109,7 @@ export default {
         wsm_code: "", //仓库code
         cat_id: "",
         page: 1, // 页码
-        size: 10, // 每页显示条数
+        size: 10 // 每页显示条数
       },
       tableData: [],
       passwordModel: false,
@@ -129,21 +120,21 @@ export default {
       // 表格 - 参数
       table: {
         stripe: true,
-        border: true,
+        border: true
         // _defaultHeader_: ["setcol"],
       },
       // 表格 - 分页
       pageInfo: {
         size: 10,
         curr: 1,
-        total: 0,
+        total: 0
       },
       // 表格 - 列参数
-      columns: columns,
+      columns: columns
     };
   },
   watch: {
-    showModel: function (val) {
+    showModel: function(val) {
       this.showModelThis = val;
       if (val) {
         this.supplierCode = [];
@@ -154,7 +145,7 @@ export default {
       if (!val) {
         this.$emit("cancel");
       }
-    },
+    }
   },
 
   methods: {
@@ -163,13 +154,13 @@ export default {
         wsm_code: "", //仓库code
         cat_id: "",
         page: 1, // 页码
-        size: 10, // 每页显示条数
+        size: 10 // 每页显示条数
       };
       // 表格 - 分页
       this.pageInfo = {
         size: 10,
         curr: 1,
-        total: 0,
+        total: 0
       };
       this.searchList();
     },
@@ -180,10 +171,14 @@ export default {
       this.parmValue.stock_max = "1";
       this.parmValue.cat_id = this.cat_id;
 
+      if (this.is_combind) {
+        this.parmValue.is_combind = this.is_combind;
+      }
+
       const res = await asyncRequest.list(this.parmValue);
       if (res && res.code === 0 && res.data) {
         this.tableData = res.data.list;
-        this.tableData.forEach((v) => {
+        this.tableData.forEach(v => {
           v.class_cat = "";
           if (v.can && v.can.length > 0) {
             v.can.forEach((x, i) => {
@@ -214,16 +209,16 @@ export default {
         return;
       }
       let list = JSON.parse(JSON.stringify(this.multipleSelection));
-      list.map((v) => {
+      list.map(v => {
         delete v["id"];
         return v;
       });
       this.showModelThis = false;
       this.$emit("searchChange", list);
-    },
-  },
+    }
+  }
 };
 </script>
 
 <style>
-</style>
+</style>

+ 16 - 22
src/views/sellOut/combinedAdd/components/baseForm.vue

@@ -139,7 +139,7 @@
     </el-form-item>
 
     <el-row>
-      <el-col :span="12">
+      <el-col :span="24">
         <el-form-item label="添加库存数" prop="stock_num" label-width="110px">
           <digital-input
             :values="ruleForm.stock_num"
@@ -156,7 +156,7 @@
         </el-form-item>
       </el-col>
 
-      <el-col :span="12">
+      <!-- <el-col :span="12">
         <el-form-item label="可用库存数">
           <digital-input
             :values="ruleForm.usable_stock"
@@ -172,7 +172,7 @@
             @reschange="number_change($event, 'usable_stock')"
           />
         </el-form-item>
-      </el-col>
+      </el-col>-->
     </el-row>
 
     <el-form-item label="子商品库存情况" label-width="110px">
@@ -181,16 +181,14 @@
         <el-table-column label="子商品名称" prop="child_name" min-width="180px" show-overflow-tooltip />
         <el-table-column label="组合比例" prop="child_num" />
         <el-table-column label="本次添加库存数">
-          <template
-            slot-scope="{ row }"
-          >{{ ((row.child_num || 0) * ( ruleForm.stock_num || 0)) || 0}}</template>
+          <template slot-scope="{ row }">{{ calcStockNum(row) }}</template>
         </el-table-column>
 
-        <el-table-column label="锁定库存总数">
+        <!-- <el-table-column label="锁定库存总数">
           <template slot-scope="{ row }">{{ row.stock || 0 }}</template>
-        </el-table-column>
-        <el-table-column label="锁定库存可用库存数">
-          <template slot-scope="{ row }">{{ row.usable_stock || 0 }}</template>
+        </el-table-column>-->
+        <el-table-column label="剩余可用可用库存数">
+          <template slot-scope="{ row }">{{ row.usable_stock || 0}}</template>
         </el-table-column>
       </el-table>
     </el-form-item>
@@ -212,7 +210,7 @@ import ProductModal from "./productModal.vue";
 import asyncRequest from "@/apis/service/sellOut/combindAdd";
 import { stockColumns, productColumns } from "./columnsForm";
 import privateField from "@/mixins/privateField";
-import { add_sum, isnumber } from "@/utils/validate";
+import { add_sum, isnumber, accMul } from "@/utils/validate";
 
 const validateNum = (rule, value, callback) => {
   if (value === "") {
@@ -282,20 +280,12 @@ export default {
         await this.$refs.ruleForm.validate();
         const { usable_stock, ...params } = this.ruleForm;
 
-        // const total = this.productinfo.combind_list.reduce(
-        //   (prev, { child_num }) => add_sum(prev, child_num * params.stock_num),
-        //   0
-        // );
-
-        // if (total > usable_stock) {
-        //   this.$message.warning("添加库存数不能超过可用库存数");
-        //   return;
-        // }
-
         // (row.child_num || 0) * ( ruleForm.stock_num || 0
         for (let item of this.productinfo.combind_list) {
           const { child_num, usable_stock, child_name } = item;
-          if (child_num * params.stock_num > usable_stock) {
+          if (
+            parseInt(accMul(this.ruleForm.stock_num, child_num)) > usable_stock
+          ) {
             this.$message.warning(
               `子商品   ${child_name}   添加库存数不能超过可用库存数`
             );
@@ -333,6 +323,10 @@ export default {
       this.productinfo = null;
       this.ruleForm.spuCode = "";
     },
+    calcStockNum(row) {
+      const { child_num } = row;
+      return parseInt(accMul(this.ruleForm.stock_num, child_num));
+    },
     async handleStockSelected(evt) {
       const { id } = evt;
       this.loading.stock = true;

+ 1 - 0
src/views/sellOut/combinedAdd/detail.vue

@@ -37,6 +37,7 @@
                   :iscgd="true"
                   :newTime="newTime"
                   :spucode="sitem.spuCode"
+                  :isStockInfo="true"
                 />
               </el-collapse-item>
 

+ 6 - 6
src/views/sellOut/combinedRemove/components/baseForm.vue

@@ -31,7 +31,7 @@
     </el-form-item>
 
     <el-row>
-      <el-col :span="12">
+      <el-col :span="24">
         <el-form-item label="解除库存数" prop="stock_num" label-width="110px">
           <digital-input
             :values="ruleForm.stock_num"
@@ -48,7 +48,7 @@
         </el-form-item>
       </el-col>
 
-      <el-col :span="12">
+      <!-- <el-col :span="12">
         <el-form-item label="可解除库存总数" label-width="110px">
           <digital-input
             :values="ruleForm.usable_stock"
@@ -64,7 +64,7 @@
             @reschange="number_change($event, 'usable_stock')"
           />
         </el-form-item>
-      </el-col>
+      </el-col>-->
     </el-row>
 
     <el-form-item label="子商品库存情况" label-width="110px">
@@ -78,10 +78,10 @@
           >{{ ((row.child_num || 0) * ( ruleForm.stock_num || 0)) || 0}}</template>
         </el-table-column>
 
-        <el-table-column label="锁定库存总数">
+        <!-- <el-table-column label="锁定库存总数">
           <template slot-scope="{ row }">{{ row.stock || 0 }}</template>
-        </el-table-column>
-        <el-table-column label="锁定库存可用库存数">
+        </el-table-column>-->
+        <el-table-column label="剩余可解除库存数">
           <template slot-scope="{ row }">{{ row.usable_stock || 0 }}</template>
         </el-table-column>
       </el-table>

+ 10 - 2
src/views/sellOut/combinedRemove/detail.vue

@@ -26,8 +26,16 @@
                 </show-data-table>
               </el-collapse-item>
 
-              <el-collapse-item title="组合商品详情" name="5" v-if="sitem">
-                <ProductDetail :spuCode="sitem.spuCode" />
+              <el-collapse-item title="组合商品详情" name="5" v-if="sitem && sitem.spuCode">
+                <show-goods-data-table
+                  v-if="newTime !== ''"
+                  type="1"
+                  :iscgd="true"
+                  :newTime="newTime"
+                  :spucode="sitem.spuCode"
+                  :isStockInfo="true"
+                  :isRemoveStock="true"
+                />
               </el-collapse-item>
 
               <el-collapse-item title="子商品信息" name="4">

+ 123 - 126
src/views/sellOut/stockApply/components/addEdit.vue

@@ -27,78 +27,80 @@
             />
 
             <show-data-table
-                  v-if="activeGoodDetail"
-                  border
-                  style="margin-top: 10px; padding: 0"
-                  :sitem="activeGoodDetail"
-                  :columns="ShowDataTableColumns"
-                >
-                  <template slot="good_name">
-                    <img
-                      v-viewer
-                      style="width: 23px; height: 23px; margin: 0 5px 0 0"
-                      class="fl"
-                      v-if="activeGoodDetail.good_thumb_img"
-                      :src="activeGoodDetail.good_thumb_img"
-                      alt=""
-                    />
-                    <span>{{ activeGoodDetail.good_name }}</span>
-                    <span v-for="(si, i) in activeGoodDetail.specinfo" :key="si.spec_id + i">
-                      <span>{{ i === 0 ? "--" : "__" }}</span
-                      ><span>{{ si.spec_name }}[{{ si.spec_value }}]</span>
-                    </span>
-                  </template>
-                  <template slot="good_info_img">
-                    <img
-                      class="fl"
-                      style="width: 23px; height: 23px; margin: 0 5px 0 0"
-                      v-viewer
-                      v-for="(si, i) in activeGoodDetail.good_info_img"
-                      :src="si"
-                      :key="si + i"
-                    />
-                  </template>
-                  <template slot="cat">
-                    <span v-for="(si, sii) in activeGoodDetail.cat_info" :key="si.id"
-                      ><span v-if="sii !== 0">_</span><span>{{ si.name }}</span>
-                    </span>
-                  </template>
-                  <template slot="exclusive">
-                    <span v-for="(si, sii) in activeGoodDetail.exclusive" :key="si.id"
-                      ><span v-if="sii !== 0">/</span><span>{{ si.name }}</span>
-                    </span>
-                  </template>
-                  <template slot="is_stock">
-                    <el-tag :size="'mini'">{{
-                      activeGoodDetail.is_stock + '' === "1" ? "是" : "否"
-                    }}</el-tag>
-                  </template>
-                  <template slot="weight">
-                    <span
-                      >商品总重:{{ activeGoodDetail.new_weight }}/{{
-                        activeGoodDetail.weight_unit
-                      }}</span
-                    >
-                    <span v-if="activeGoodDetail.metal_id"
-                      >--{{
-                        activeGoodDetail.noble_weight ? activeGoodDetail.noble_weight : "0"
-                      }}g--{{ activeGoodDetail.metal_name }}---{{
-                        activeGoodDetail.gold_price ? activeGoodDetail.gold_price : "0"
-                      }}元/g--{{
-                        activeGoodDetail.is_gold_price + '' === "0" ? "不" : ""
-                      }}启用实时金价--{{
-                        activeGoodDetail.is_diff + '' === "1" ? "有" : "无"
-                      }}工差--{{ activeGoodDetail.config }}---{{
-                        activeGoodDetail.other_config
-                      }}</span
-                    >
-                  </template>
-                </show-data-table>
+              v-if="activeGoodDetail"
+              border
+              style="margin-top: 10px; padding: 0"
+              :sitem="activeGoodDetail"
+              :columns="ShowDataTableColumns"
+            >
+              <template slot="good_name">
+                <img
+                  v-viewer
+                  style="width: 23px; height: 23px; margin: 0 5px 0 0"
+                  class="fl"
+                  v-if="activeGoodDetail.good_thumb_img"
+                  :src="activeGoodDetail.good_thumb_img"
+                  alt
+                />
+                <span>{{ activeGoodDetail.good_name }}</span>
+                <span v-for="(si, i) in activeGoodDetail.specinfo" :key="si.spec_id + i">
+                  <span>{{ i === 0 ? "--" : "__" }}</span>
+                  <span>{{ si.spec_name }}[{{ si.spec_value }}]</span>
+                </span>
+              </template>
+              <template slot="good_info_img">
+                <img
+                  class="fl"
+                  style="width: 23px; height: 23px; margin: 0 5px 0 0"
+                  v-viewer
+                  v-for="(si, i) in activeGoodDetail.good_info_img"
+                  :src="si"
+                  :key="si + i"
+                />
+              </template>
+              <template slot="cat">
+                <span v-for="(si, sii) in activeGoodDetail.cat_info" :key="si.id">
+                  <span v-if="sii !== 0">_</span>
+                  <span>{{ si.name }}</span>
+                </span>
+              </template>
+              <template slot="exclusive">
+                <span v-for="(si, sii) in activeGoodDetail.exclusive" :key="si.id">
+                  <span v-if="sii !== 0">/</span>
+                  <span>{{ si.name }}</span>
+                </span>
+              </template>
+              <template slot="is_stock">
+                <el-tag :size="'mini'">
+                  {{
+                  activeGoodDetail.is_stock + '' === "1" ? "是" : "否"
+                  }}
+                </el-tag>
+              </template>
+              <template slot="weight">
+                <span>
+                  商品总重:{{ activeGoodDetail.new_weight }}/{{
+                  activeGoodDetail.weight_unit
+                  }}
+                </span>
+                <span v-if="activeGoodDetail.metal_id">
+                  --{{
+                  activeGoodDetail.noble_weight ? activeGoodDetail.noble_weight : "0"
+                  }}g--{{ activeGoodDetail.metal_name }}---{{
+                  activeGoodDetail.gold_price ? activeGoodDetail.gold_price : "0"
+                  }}元/g--{{
+                  activeGoodDetail.is_gold_price + '' === "0" ? "不" : ""
+                  }}启用实时金价--{{
+                  activeGoodDetail.is_diff + '' === "1" ? "有" : "无"
+                  }}工差--{{ activeGoodDetail.config }}---{{
+                  activeGoodDetail.other_config
+                  }}
+                </span>
+              </template>
+            </show-data-table>
           </el-form-item>
         </el-col>
 
-        
-
         <!-- 采购数量 -->
         <el-col :span="5">
           <el-form-item label="采购数量" prop="goods_num">
@@ -125,11 +127,7 @@
         </el-col>
         <!-- 最晚入库时间 -->
         <el-col :span="7">
-          <el-form-item
-            label="最晚入库时间"
-            prop="lasttime"
-            label-width="120px"
-          >
+          <el-form-item label="最晚入库时间" prop="lasttime" label-width="120px">
             <el-date-picker
               v-model="ruleForm.lasttime"
               type="date"
@@ -143,8 +141,7 @@
                   (status + '' === '0' && powers.some((i) => i == '005'))
                 )
               "
-            >
-            </el-date-picker>
+            ></el-date-picker>
           </el-form-item>
         </el-col>
         <el-col :span="12">
@@ -163,8 +160,7 @@
                   :underline="false"
                   :href="ruleForm.file_url"
                   target="_blank"
-                  >{{ ruleForm.file_url_name }}</el-link
-                >
+                >{{ ruleForm.file_url_name }}</el-link>
                 <el-link
                   class="fr"
                   type="info"
@@ -173,12 +169,9 @@
                     id === 'add' ||
                     (status + '' === '0' && powers.some((i) => i == '005'))
                   "
-                  ><i
-                    class="el-icon-circle-close"
-                    @click="close_url"
-                    :size="'mini'"
-                  ></i
-                ></el-link>
+                >
+                  <i class="el-icon-circle-close" @click="close_url" :size="'mini'"></i>
+                </el-link>
               </p>
               <p v-else class="no">附件</p>
               <div v-if="ruleForm.file_url === ''">
@@ -214,8 +207,7 @@
                 )
               "
               v-model="ruleForm.remark"
-            >
-            </el-input>
+            ></el-input>
           </el-form-item>
         </el-col>
 
@@ -228,8 +220,7 @@
               id === 'add' ||
               (status == '0' && powers.some((i) => i == '005'))
             "
-            >保 存
-          </el-button>
+          >保 存</el-button>
         </el-col>
       </el-row>
     </el-form>
@@ -237,6 +228,7 @@
       :once="true"
       :cat_id="cat_id"
       :is_stock="'1'"
+      is_combind="0"
       :show-model="showGoodsModel"
       :isonline="''"
       @cancel="showGoodsModel = false"
@@ -244,7 +236,8 @@
     />
   </div>
 </template>
-   <script>
+
+<script>
 import resToken from "@/mixins/resToken";
 import asyncRequest from "@/apis/service/sellOut/stockApply";
 import searchGoodModal from "@/components/search-good-modal";
@@ -254,24 +247,24 @@ export default {
   props: ["id", "sitem", "newTime", "type"],
   mixins: [resToken],
   components: {
-    searchGoodModal,
+    searchGoodModal
   },
   computed: {
     powers() {
+      const { btnList } = this.$store.getters;
       const tran =
-        this.$store.getters.btnList.find(
-          (item) => item.menu_route == "stockApplyDetail"
-        ) || {};
+        btnList.find(item => item.menu_route == "stockApplyDetail") || {};
+
       const { action } = tran ?? {};
       return action ?? [];
-    },
+    }
   },
   watch: {
-    newTime: function (val) {
+    newTime: function(val) {
       if (val) {
         this.initForm();
       }
-    },
+    }
   },
   data() {
     const validate_num_0 = (rule, value, callback) => {
@@ -295,7 +288,7 @@ export default {
       pickerOptions: {
         disabledDate(time) {
           return time.getTime() < Date.now();
-        },
+        }
       },
       status: "",
       cat_id: "",
@@ -304,7 +297,7 @@ export default {
       activeGoodDetail: null,
       showGoodsModel: "",
       loading: false,
-      ShowDataTableColumns:addColumns,
+      ShowDataTableColumns: addColumns,
       ruleForm: {
         id: "",
         good_code: "",
@@ -313,7 +306,7 @@ export default {
         file_url: "",
         file_url_name: "",
         lasttime: "",
-        remark: "",
+        remark: ""
         // supplier_code: [],
         // supplier_name: "",
         // stock_code: [],
@@ -324,38 +317,38 @@ export default {
           {
             required: true,
             message: "商品名称不能为空!",
-            trigger: "blur",
-          },
+            trigger: "blur"
+          }
         ],
         goods_num: [
           {
             required: true,
             validator: validate_num_0,
-            trigger: "blur",
-          },
+            trigger: "blur"
+          }
         ],
         lasttime: [
           {
             required: true,
             message: "请输入最晚入库时间!",
-            trigger: "change",
-          },
+            trigger: "change"
+          }
         ],
         file_url: [
           {
             required: true,
             message: "请选择附件!",
-            trigger: "change",
-          },
+            trigger: "change"
+          }
         ],
         remark: [
           {
             required: true,
             message: "备注不能为空!",
-            trigger: "blur",
-          },
-        ],
-      },
+            trigger: "blur"
+          }
+        ]
+      }
     };
   },
   mounted() {
@@ -374,9 +367,9 @@ export default {
 
     // 执行点击商品名称的抛出事件
     async addGoodsRes(e) {
-      console.log(e)
-      if(!e || e.length === 0) return
-      let { spuCode ,good_name } = e[0];
+      console.log(e);
+      if (!e || e.length === 0) return;
+      let { spuCode, good_name } = e[0];
       this.ruleForm.good_name = good_name;
       this.ruleForm.good_code = spuCode;
       await this.requseGoodDetail(spuCode);
@@ -384,13 +377,17 @@ export default {
     },
 
     async requseGoodDetail(spuCode) {
-      this.dtaLoading = true
-      let { code, data, message } = await asyncRequest.goods_detail({spuCode});
-      this.dtaLoading = false
+      this.dtaLoading = true;
+      let { code, data, message } = await asyncRequest.goods_detail({
+        spuCode
+      });
+      this.dtaLoading = false;
 
       if (code === 0) {
         this.activeGoodDetail = data;
-        this.activeGoodDetail.good_info_img = this.activeGoodDetail.good_info_img.split(",");
+        this.activeGoodDetail.good_info_img = this.activeGoodDetail.good_info_img.split(
+          ","
+        );
         const { weight } = this.activeGoodDetail;
         let kgnum = parseInt((weight * 1) / 1000);
         let gnum = (weight * 1) % 1000;
@@ -442,7 +439,7 @@ export default {
               file_url,
               file_name,
               status,
-              remark,
+              remark
             } = this.sitem;
 
             this.ruleForm = {
@@ -454,7 +451,7 @@ export default {
               file_url: file_url || "",
               file_url_name: file_name || "",
               status: status || "",
-              remark: remark || "",
+              remark: remark || ""
             };
           }
         }
@@ -462,7 +459,7 @@ export default {
     },
     // 保存更改
     async submitForm() {
-      await this.$refs.ruleForm.validate(async (valid) => {
+      await this.$refs.ruleForm.validate(async valid => {
         if (valid) {
           if (this.loading) {
             return;
@@ -477,7 +474,7 @@ export default {
             // file_name,
             // stock_code,
             lasttime,
-            remark,
+            remark
           } = this.ruleForm;
           let model = {
             id: id,
@@ -487,7 +484,7 @@ export default {
             file_url: file_url || "",
             // file_url_name: file_name || "",
             lastime: lasttime || "",
-            remark: remark || "",
+            remark: remark || ""
           };
           let res = {};
           if (this.id === "add") {
@@ -500,7 +497,7 @@ export default {
             const title = this.id === "add" ? "添加成功" : "修改成功";
             this.$notify.success({
               title,
-              message: "",
+              message: ""
             });
             this.$emit("refresh");
           } else if (res && res.code >= 100 && res.code <= 104) {
@@ -552,8 +549,8 @@ export default {
       }
 
       return isJPG && isLt2M;
-    },
-  },
+    }
+  }
 };
 </script>
 <style lang="scss" scoped>