Browse Source

feat:子商品选择

snow 1 year ago
parent
commit
76c213d9c9

+ 9 - 3
src/views/goodStore/goodsCost/columns.js

@@ -79,8 +79,8 @@ const listCol = [
   },
   {
     prop:'is_combind',
-    label:'是否组合商品',
-    width: '105px',
+    label:'组合类型',
+    width: '95px',
     _slot_:'is_combind',
   },
   {
@@ -631,7 +631,13 @@ const basicColumns = [
     prop: 'is_stock',
     label: '是否库存品',
     _slot_: 'is_stock',
-    span: 8
+    span: 4
+  },
+  {
+    prop: 'is_combind',
+    label: '组合类型',
+    _slot_: 'is_combind',
+    span: 4
   },
   {
     prop: 'noble',

+ 109 - 18
src/views/goodStore/goodsCost/components/baseForm.vue

@@ -457,7 +457,30 @@
         <el-table :data="childTableData" size="mini" border max-height="350px">
           <el-table-column label="子商品成本编号" prop="childCode" min-width="160px" />
           <el-table-column label="子商品名称" prop="child_name" min-width="180px" show-overflow-tooltip />
-          <el-table-column label="组合比例" prop="child_num" width="100px" />
+
+          <el-table-column label="组合比例" prop="child_num" width="140px">
+            <template slot-scope="scope">
+              <span v-if="scope.$index !== editIndex">
+                {{
+                childTableData[scope.$index].child_num
+                }}
+              </span>
+
+              <digital-input
+                v-else
+                :values="childTableData[scope.$index].child_num"
+                :placeholder="'组合比例'"
+                :min="0"
+                :max="100000000000"
+                :position="'right'"
+                :precision="0"
+                :size="'mini'"
+                :controls="false"
+                @reschange="num_change($event,scope.$index)"
+              />
+            </template>
+          </el-table-column>
+
           <el-table-column label="操作" width="120px">
             <template #header>
               <div>
@@ -477,12 +500,26 @@
                 <i class="el-icon-view tb-icon" @click="onChildProdChange(scope.$index, 'view')"></i>
               </el-tooltip>
 
-              <el-tooltip effect="dark" content="修改" placement="top">
+              <el-tooltip
+                effect="dark"
+                content="修改"
+                placement="top"
+                v-if="editIndex !== scope.$index"
+              >
                 <i class="el-icon-edit tb-icon" @click="onChildProdChange(scope.$index,'edit')"></i>
               </el-tooltip>
 
-              <el-tooltip effect="dark" content="删除" placement="top">
-                <i class="el-icon-delete tb-icon" @click="childTableData.splice(scope.$index, 1 )"></i>
+              <el-tooltip effect="dark" content="保存" placement="top" v-else>
+                <i class="el-icon-circle-check tb-icon" @click="onSaveLine(scope.$index)"></i>
+              </el-tooltip>
+
+              <el-tooltip
+                effect="dark"
+                content="删除"
+                placement="top"
+                v-if="editIndex !== scope.$index"
+              >
+                <i class="el-icon-delete tb-icon" @click="onDeleteItem(scope.$index)"></i>
               </el-tooltip>
             </template>
           </el-table-column>
@@ -783,7 +820,7 @@
           </el-col>
           <el-col :span="9">
             <el-form-item label="商品主图" prop="good_img">
-              <div class="good_info_img_div">
+              <div class="good_info_img_div" style="display:flex">
                 <ul v-if="ruleForm.good_img" class="clear">
                   <li
                     class="img-show-li"
@@ -828,7 +865,7 @@
           </el-col>
           <el-col :span="9">
             <el-form-item label="详情介绍" prop="good_info_img">
-              <div class="good_info_img_div">
+              <div class="good_info_img_div" style="display:flex">
                 <ul v-if="ruleForm.good_info_img" class="clear">
                   <li
                     class="img-show-li"
@@ -1067,9 +1104,10 @@
           :type="modalType"
           :editIndex="editIndex"
           :editItem="editItem"
-          :visible.sync="visible"
-          @save="(p,i) => handleChildProductChange(p, i)"
+          :visible.sync="mVisible"
         />
+
+        <product-list-modal :visible.sync="visible" @selected="handleProductSelected" />
       </el-col>
 
       <el-col
@@ -1095,6 +1133,7 @@ import { add_sum, accMul } from "@/utils/validate";
 import CompanySort from "@/components/globalComponents/company-sort/index.vue";
 import { replaceTextWrapAndSpace } from "@/utils";
 import ProductModal from "./productModal.vue";
+import ProductListModal from "./productListModal.vue";
 import { isStockOptions } from "@/assets/js/statusList";
 
 import {
@@ -1109,7 +1148,6 @@ import {
   options9,
   rules
 } from "../columns";
-import source from "../../../../apis/service/orderEntry/source";
 
 export default {
   name: "goodsCostAdd",
@@ -1119,7 +1157,8 @@ export default {
     CompanySort,
     baseFormAddEdit,
     costFormAddEdit,
-    ProductModal
+    ProductModal,
+    ProductListModal
   },
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
@@ -1150,6 +1189,7 @@ export default {
           label: []
         }
       },
+      mVisible: false,
       modalType: "",
       editItem: null,
       editIndex: -1,
@@ -1198,22 +1238,58 @@ export default {
     this.initForm();
   },
   methods: {
+    num_change(evt, index) {
+      this.$set(this.childTableData, index, {
+        ...this.childTableData[index],
+        child_num: evt
+      });
+    },
+    onSaveLine(index) {
+      const { child_num } = this.childTableData[index];
+
+      if (Number(child_num) === 0) {
+        this.$message.warning("组合比例不能为零!");
+        return;
+      }
+
+      this.editIndex = -1;
+    },
     onCompanyChange() {
       this.supplierNosearchChange({ code: this.currentCompany });
     },
     onChildProdChange(index = null, type = "view") {
       this.modalType = type;
-      this.editItem = index === null ? null : { ...this.childTableData[index] };
-      this.editIndex = index === null ? -1 : index;
-      this.visible = true;
-    },
-    handleChildProductChange(product, index) {
-      if (index === -1) {
-        this.childTableData.push(product);
+
+      if (type === "view" && index !== null) {
+        this.editItem = { ...this.childTableData[index] };
+      } else {
+        this.editItem = null;
+      }
+
+      if (type === "edit") {
+        if (this.editIndex !== -1) {
+          this.$message.warning("当前有正在编辑的子商品,请先保存");
+          return;
+        }
+
+        this.editIndex = index !== null ? index : -1;
         return;
       }
-      this.$set(this.childTableData, index, product);
+
+      this[type === "view" ? "mVisible" : "visible"] = true;
+    },
+    handleProductSelected(evt) {
+      const { childCode, child_name } = evt;
+      const item = { childCode, child_name, child_num: 1 };
+      this.childTableData.push(item);
     },
+    // handleChildProductChange(product, index) {
+    // if (index === -1) {
+    // this.childTableData.push(product);
+    // return;
+    // }
+    // this.$set(this.childTableData, index, product);
+    // },
     onCompanyChange() {
       if (this.type === "add") {
         this.ruleForm.company_id = this.currentCompany;
@@ -1248,6 +1324,17 @@ export default {
 
       this.rulesThis.stock_moq[0].required = this.ruleForm.is_stock === "1";
     },
+    onDeleteItem(index) {
+      if (this.editIndex !== -1) {
+        this.$message.warning("当前有正在编辑的子商品,请先保存");
+        return;
+      }
+
+      this.childTableData.splice(index, 1);
+      // if (index === this.editIndex) {
+      //   this.editIndex = -1;
+      // }
+    },
     openCostEdit(index, sitem) {
       // const { is_step } = this.ruleForm;
       // if (index === -1 && is_step === "0" && this.ladder_tableData.length > 0) {
@@ -1279,6 +1366,10 @@ export default {
     //   }
     // },
     async submitForm() {
+      if (this.editIndex !== -1) {
+        this.$message.warning("当前有正在编辑的子商品,请先保存");
+        return;
+      }
       this.sch_is_noble();
       this.good_type_change();
       this.ruleForm.good_remark = replaceTextWrapAndSpace(

+ 5 - 2
src/views/goodStore/goodsCost/components/productListModal.vue

@@ -435,8 +435,11 @@ export default {
         return;
       }
 
-      const { spuCode } = this.selected[0];
-      this.$emit("selected", spuCode);
+      const { spuCode, good_name } = this.selected[0];
+      this.$emit("selected", {
+        childCode: spuCode,
+        child_name: good_name
+      });
       this._visible = false;
     },
     async searchList() {

+ 22 - 5
src/views/goodStore/goodsCost/components/productModal.vue

@@ -22,7 +22,7 @@
             <template slot="packing_spec">
               <el-tag
                 size="mini"
-              >{{ ( options6.find(({id}) => id === sitem && sitem.supply_area) || {}).name || '--' }}</el-tag>
+              >{{ ( options6.find(({id}) => id === sitem.supply_area) || {}).name || '--' }}</el-tag>
             </template>
 
             <template slot="is_auth">
@@ -108,8 +108,8 @@
             <template slot="delivery_day">{{ sitem.delivery_day }}天</template>
             <template slot="lead_time">{{ sitem.lead_time }}天</template>
             <template slot="sample_day">{{ sitem.sample_day }}天</template>
-            <template slot="delivery_place">{{ delivery_place }}</template>
-            <template slot="origin_place">{{ origin_place }}</template>
+            <template slot="delivery_place">{{ delivery_place || '--'}}</template>
+            <template slot="origin_place">{{ origin_place || '--'}}</template>
           </show-data-table>
 
           <el-tooltip content="重新选择子商品" placement="top" v-if="type !== 'view'">
@@ -122,7 +122,7 @@
         </div>
       </el-form-item>
 
-      <el-form-item label="组合比例" prop="child_num">
+      <!-- <el-form-item label="组合比例" prop="child_num">
         <digital-input
           :disabled="this.type === 'view'"
           :values="ruleForm.child_num"
@@ -136,7 +136,7 @@
           :append="''"
           @reschange="child_numChange"
         />
-      </el-form-item>
+      </el-form-item>-->
 
       <el-form-item v-if="type !== 'view'">
         <div style="display:flex;justify-content:flex-end">
@@ -222,6 +222,8 @@ export default {
         child_name: "",
         child_num: ""
       },
+      origin_place: "",
+      delivery_place: "",
       sitem: null,
       rules: {
         childCode: [
@@ -273,6 +275,18 @@ export default {
         console.log(e);
       }
     },
+    async getArea(prop = "delivery_place") {
+      const chunks = this.sitem[prop].split(",");
+      let { data: province } = await asyncRequest.province();
+      province = province.find(
+        ({ province_code }) => province_code === chunks[0]
+      );
+      let { data: city } = await asyncRequest.city({ code: chunks[0] });
+      city = city.find(({ city_code }) => city_code === chunks[1]);
+      let { data: area } = await asyncRequest.area({ code: chunks[1] });
+      area = area.find(({ area_code }) => area_code === chunks[2]);
+      this[prop] = [province, city, area].map(({ name }) => name).join("_");
+    },
     async handleProductChange(spuCode) {
       this.loading = true;
 
@@ -289,6 +303,9 @@ export default {
         this.ruleForm.goodType = good_type;
         this.ruleForm.child_name = good_name;
 
+        await this.getArea("delivery_place");
+        await this.getArea("origin_place");
+
         this.getNewTime();
 
         this.$nextTick(() => this.$refs.formRef.validateField("childCode"));

+ 3 - 3
src/views/goodStore/goodsCost/index.vue

@@ -220,7 +220,7 @@
             <el-col :span="4" style="margin-right:10px">
               <el-select
                 v-model="parmValue.is_combind"
-                placeholder="是否组合商品"
+                placeholder="组合类型"
                 style="width:100%"
                 size="mini"
                 @change="
@@ -230,7 +230,7 @@
                 "
               >
                 <el-option label="是组合商品" value="1" />
-                <el-option label="不是组合商品" value="0" />
+                <el-option label="组合商品" value="0" />
               </el-select>
             </el-col>
 
@@ -321,7 +321,7 @@
         <el-tag
           size="mini"
           :type="scope.row.is_combind === '1' ? '' : 'warning'"
-        >{{scope.row.is_combind === '1' ? '是组合商品' : '不是组合商品'}}</el-tag>
+        >{{scope.row.is_combind === '1' ? '是组合商品' : '组合商品'}}</el-tag>
       </template>
       <template #isonline="{ scope }">
         <el-tag

+ 14 - 1
src/views/goodStore/supplierGoodsCost/columns.js

@@ -205,6 +205,13 @@ const rules = {
       trigger: 'change'
     }
   ],
+  is_combind:[
+    {
+      required: true,
+      message: '请选择组合类型',
+      trigger: 'change'
+    }
+  ],
   brandid: [
     {
       type: 'array',
@@ -611,7 +618,13 @@ const basicColumns = [
     prop: 'is_stock',
     label: '是否库存品',
     _slot_: 'is_stock',
-    span: 8
+    span: 4
+  },
+  {
+    prop: 'is_combind',
+    label: '组合类型',
+    _slot_: 'is_combind',
+    span: 4
   },
   {
     prop: 'noble',

+ 124 - 32
src/views/goodStore/supplierGoodsCost/components/baseForm.vue

@@ -75,8 +75,8 @@
                 <search-supplier
                   :value="ruleForm.supplierNo"
                   :placeholder="'供应商'"
-                  :size="'mini'"
                   disabled
+                  :size="'mini'"
                   :names="supplierName"
                   :isDetail="true"
                   :isp="this.type !== 'view'"
@@ -96,8 +96,8 @@
               </el-form-item>
             </el-col>
           </el-row>
+
           <el-row>
-            <!-- !!  -->
             <el-col :span="8">
               <el-form-item label="商品分类" prop="cat_id">
                 <company-sort
@@ -442,7 +442,7 @@
       </el-col>
     </el-row>
 
-    <el-row class="ddiv" v-if="ruleForm. is_combind === '1'">
+    <el-row class="ddiv" v-if="ruleForm.is_combind === '1'">
       <el-col
         :span="1"
         tag="div"
@@ -461,7 +461,30 @@
         <el-table :data="childTableData" size="mini" border max-height="350px">
           <el-table-column label="子商品成本编号" prop="childCode" min-width="160px" />
           <el-table-column label="子商品名称" prop="child_name" min-width="180px" show-overflow-tooltip />
-          <el-table-column label="组合比例" prop="child_num" width="100px" />
+
+          <el-table-column label="组合比例" prop="child_num" width="140px">
+            <template slot-scope="scope">
+              <span v-if="scope.$index !== editIndex">
+                {{
+                childTableData[scope.$index].child_num
+                }}
+              </span>
+
+              <digital-input
+                v-else
+                :values="childTableData[scope.$index].child_num"
+                :placeholder="'组合比例'"
+                :min="0"
+                :max="100000000000"
+                :position="'right'"
+                :precision="0"
+                :size="'mini'"
+                :controls="false"
+                @reschange="num_change($event,scope.$index)"
+              />
+            </template>
+          </el-table-column>
+
           <el-table-column label="操作" width="120px">
             <template #header>
               <div>
@@ -481,12 +504,26 @@
                 <i class="el-icon-view tb-icon" @click="onChildProdChange(scope.$index, 'view')"></i>
               </el-tooltip>
 
-              <el-tooltip effect="dark" content="修改" placement="top">
+              <el-tooltip
+                effect="dark"
+                content="修改"
+                placement="top"
+                v-if="editIndex !== scope.$index"
+              >
                 <i class="el-icon-edit tb-icon" @click="onChildProdChange(scope.$index,'edit')"></i>
               </el-tooltip>
 
-              <el-tooltip effect="dark" content="删除" placement="top">
-                <i class="el-icon-delete tb-icon" @click="childTableData.splice(scope.$index, 1 )"></i>
+              <el-tooltip effect="dark" content="保存" placement="top" v-else>
+                <i class="el-icon-circle-check tb-icon" @click="onSaveLine(scope.$index)"></i>
+              </el-tooltip>
+
+              <el-tooltip
+                effect="dark"
+                content="删除"
+                placement="top"
+                v-if="editIndex !== scope.$index"
+              >
+                <i class="el-icon-delete tb-icon" @click="onDeleteItem(scope.$index)"></i>
               </el-tooltip>
             </template>
           </el-table-column>
@@ -787,7 +824,7 @@
           </el-col>
           <el-col :span="9">
             <el-form-item label="商品主图" prop="good_img">
-              <div class="good_info_img_div">
+              <div class="good_info_img_div" style="display:flex">
                 <ul v-if="ruleForm.good_img" class="clear">
                   <li
                     class="img-show-li"
@@ -832,7 +869,7 @@
           </el-col>
           <el-col :span="9">
             <el-form-item label="详情介绍" prop="good_info_img">
-              <div class="good_info_img_div">
+              <div class="good_info_img_div" style="display:flex">
                 <ul v-if="ruleForm.good_info_img" class="clear">
                   <li
                     class="img-show-li"
@@ -1071,9 +1108,10 @@
           :type="modalType"
           :editIndex="editIndex"
           :editItem="editItem"
-          :visible.sync="visible"
-          @save="(p,i) => handleChildProductChange(p, i)"
+          :visible.sync="mVisible"
         />
+
+        <product-list-modal :visible.sync="visible" @selected="handleProductSelected" />
       </el-col>
 
       <el-col
@@ -1099,6 +1137,7 @@ import { add_sum, accMul } from "@/utils/validate";
 import CompanySort from "@/components/globalComponents/company-sort/index.vue";
 import { replaceTextWrapAndSpace } from "@/utils";
 import ProductModal from "./productModal.vue";
+import ProductListModal from "./productListModal.vue";
 import { isStockOptions } from "@/assets/js/statusList";
 
 import {
@@ -1113,7 +1152,6 @@ import {
   options9,
   rules
 } from "../columns";
-import source from "../../../../apis/service/orderEntry/source";
 
 export default {
   name: "goodsCostAdd",
@@ -1123,7 +1161,8 @@ export default {
     CompanySort,
     baseFormAddEdit,
     costFormAddEdit,
-    ProductModal
+    ProductModal,
+    ProductListModal
   },
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
@@ -1154,6 +1193,7 @@ export default {
           label: []
         }
       },
+      mVisible: false,
       modalType: "",
       editItem: null,
       editIndex: -1,
@@ -1202,19 +1242,58 @@ export default {
     this.initForm();
   },
   methods: {
+    num_change(evt, index) {
+      this.$set(this.childTableData, index, {
+        ...this.childTableData[index],
+        child_num: evt
+      });
+    },
+    onSaveLine(index) {
+      const { child_num } = this.childTableData[index];
+
+      if (Number(child_num) === 0) {
+        this.$message.warning("组合比例不能为零!");
+        return;
+      }
+
+      this.editIndex = -1;
+    },
+    onCompanyChange() {
+      this.supplierNosearchChange({ code: this.currentCompany });
+    },
     onChildProdChange(index = null, type = "view") {
       this.modalType = type;
-      this.editItem = index === null ? null : { ...this.childTableData[index] };
-      this.editIndex = index === null ? -1 : index;
-      this.visible = true;
-    },
-    handleChildProductChange(product, index) {
-      if (index === -1) {
-        this.childTableData.push(product);
+
+      if (type === "view" && index !== null) {
+        this.editItem = { ...this.childTableData[index] };
+      } else {
+        this.editItem = null;
+      }
+
+      if (type === "edit") {
+        if (this.editIndex !== -1) {
+          this.$message.warning("当前有正在编辑的子商品,请先保存");
+          return;
+        }
+
+        this.editIndex = index !== null ? index : -1;
         return;
       }
-      this.$set(this.childTableData, index, product);
+
+      this[type === "view" ? "mVisible" : "visible"] = true;
+    },
+    handleProductSelected(evt) {
+      const { childCode, child_name } = evt;
+      const item = { childCode, child_name, child_num: 1 };
+      this.childTableData.push(item);
     },
+    // handleChildProductChange(product, index) {
+    // if (index === -1) {
+    // this.childTableData.push(product);
+    // return;
+    // }
+    // this.$set(this.childTableData, index, product);
+    // },
     onCompanyChange() {
       if (this.type === "add") {
         this.ruleForm.company_id = this.currentCompany;
@@ -1232,6 +1311,11 @@ export default {
 
       this.loading = false;
     },
+    company_idsearchChange(e) {
+      const { code } = e;
+      this.ruleForm.company_id = code || "";
+      this.$refs.ruleForm && this.$refs.ruleForm.validateField("company_id");
+    },
     async number_change(e, key) {
       this.ruleForm[key] = e + "" || "0";
       this.$refs.ruleForm.validateField(key);
@@ -1249,6 +1333,17 @@ export default {
 
       this.rulesThis.stock_moq[0].required = this.ruleForm.is_stock === "1";
     },
+    onDeleteItem(index) {
+      if (this.editIndex !== -1) {
+        this.$message.warning("当前有正在编辑的子商品,请先保存");
+        return;
+      }
+
+      this.childTableData.splice(index, 1);
+      // if (index === this.editIndex) {
+      //   this.editIndex = -1;
+      // }
+    },
     openCostEdit(index, sitem) {
       // const { is_step } = this.ruleForm;
       // if (index === -1 && is_step === "0" && this.ladder_tableData.length > 0) {
@@ -1280,6 +1375,10 @@ export default {
     //   }
     // },
     async submitForm() {
+      if (this.editIndex !== -1) {
+        this.$message.warning("当前有正在编辑的子商品,请先保存");
+        return;
+      }
       this.sch_is_noble();
       this.good_type_change();
       this.ruleForm.good_remark = replaceTextWrapAndSpace(
@@ -1935,7 +2034,7 @@ export default {
             this.areaInfo.origin_place.code = [_area_code];
           }
 
-          // this.companyName = companyName;
+          this.companyName = companyName;
 
           if (this.type !== "add") {
             this.childTableData = combind_list.map(
@@ -2007,6 +2106,8 @@ export default {
           this.status = status;
           this.brand_name = brand_name;
           this.unit_name = unit;
+          // this.supplierName = supplierName || "";
+
           if (this.type === "add") {
             this.supplierName = this.getCompanyWithCode(
               this.currentCompany
@@ -2026,7 +2127,7 @@ export default {
             good_type: good_type || "0",
             is_stock: is_stock || "0",
             supplierNo: supplierNo ? [supplierNo] : [],
-            company_id: companyNo,
+            company_id: "",
             is_auth: is_auth || "",
             tax: tax ? tax + "%" : "",
             good_name: good_name || "",
@@ -2088,8 +2189,6 @@ export default {
           this.ruleForm.supplierNo = [this.currentCompany];
           this.$refs.ruleForm.validateField("supplierNo");
         }
-
-        // if (this.type === "add") this.ruleForm.company_id = this.currentCompany;
         await this.set_must_spec();
       });
     },
@@ -2282,7 +2381,6 @@ export default {
     supplierNosearchChange(e) {
       const { id, code, label } = e;
       this.ruleForm.supplierNo = code ? [code] : [];
-
       this.$refs.ruleForm && this.$refs.ruleForm.validateField("supplierNo");
     },
     //业务企业选择
@@ -2361,12 +2459,6 @@ export default {
         this.$refs.ruleForm && this.$refs.ruleForm.validateField(key);
       }
     },
-    company_idsearchChange(e) {
-      const { code } = e;
-      this.ruleForm.company_id = code || "";
-      this.$refs.ruleForm.validateField("company_id");
-    },
-
     //判断图片规格
     beforeAvatarUpload(file) {
       let isJPG = false;

+ 193 - 159
src/views/goodStore/supplierGoodsCost/detail.vue

@@ -14,119 +14,132 @@
         </el-tab-pane>
         <el-tab-pane label="商品成本详情" name="1" v-if="queryType !== 'add'">
           <el-collapse v-model="activeNames" style="margin: -18px 0 0 0">
-            <tempalte v-if="queryType === 'editCoin' || queryType === 'editBase' || queryType === 'edit'">
+            <tempalte
+              v-if="queryType === 'editCoin' || queryType === 'editBase' || queryType === 'edit'"
+            >
               <el-collapse-item title="商品成本详情" name="0">
-              <base-form
-                v-if="newTime !== ''"
-                :type="queryType"
-                :id="queryId"
-                :newTime="newTime"
-                :sitem="sitem"
-                @refresh="refresh"
-              />
-            </el-collapse-item>
+                <base-form
+                  v-if="newTime !== ''"
+                  :type="queryType"
+                  :id="queryId"
+                  :newTime="newTime"
+                  :sitem="sitem"
+                  @refresh="refresh"
+                />
+              </el-collapse-item>
             </tempalte>
-       
 
             <template v-else>
               <el-collapse-item title="基础信息" name="1">
-              <show-data-table :columns="basicColumns" :sitem="sitem">
-                <template slot="noble">
-                   <span
-                     v-if="sitem.noble_metal"
-                   >{{ sitem.noble_weight ? sitem.noble_weight : "0" }}g-{{
-                     sitem.noble_name
-                   }}-{{ sitem.gold_price ? sitem.gold_price : "0" }}元/g-{{
-                     sitem.is_gold_price + '' === "0" ? "不" : ""
-                   }}启用实时金价-{{ sitem.is_diff + '' === "1" ? "有" : "无" }}工差-{{
-                     sitem.config
-                   }}-{{ sitem.other_config }}</span>
+                <show-data-table :columns="basicColumns" :sitem="sitem">
+                  <template slot="noble">
+                    <span v-if="sitem.noble_metal">
+                      {{ sitem.noble_weight ? sitem.noble_weight : "0" }}g-{{
+                      sitem.noble_name
+                      }}-{{ sitem.gold_price ? sitem.gold_price : "0" }}元/g-{{
+                      sitem.is_gold_price + '' === "0" ? "不" : ""
+                      }}启用实时金价-{{ sitem.is_diff + '' === "1" ? "有" : "无" }}工差-{{
+                      sitem.config
+                      }}-{{ sitem.other_config }}
+                    </span>
                   </template>
 
                   <template slot="packing_spec">
-                    <el-tag size="mini">{{ ( options6.find(({id}) => id === sitem.supply_area) || {}).name || '--' }}</el-tag>
+                    <el-tag
+                      size="mini"
+                    >{{ ( options6.find(({id}) => id === sitem.supply_area) || {}).name || '--' }}</el-tag>
                   </template>
 
                   <template slot="is_auth">
-                    <el-tag size="mini">{{ ( options3.find(({id}) => id === sitem.is_auth) || {}).name || '--' }}</el-tag>
+                    <el-tag
+                      size="mini"
+                    >{{ ( options3.find(({id}) => id === sitem.is_auth) || {}).name || '--' }}</el-tag>
                   </template>
 
-                <template slot="cat_info">
-                  {{sitem.cat_info ? sitem.cat_info.map(({name}) => name).join('_') : '--' }}
-                </template>
-                <template slot="weight">
-                  {{sitem.weight}}g
-                </template>
-                <template slot="tax">
-                  {{sitem.tax}}%
-                </template>
-                <template slot="is_stock">
-                  {{String(sitem.is_stock) === '0' ? '非库存品' : '库存品'}}
-                </template>
-                <template slot="is_exclusive">
-                  {{String(sitem.is_exclusive) === '0' ? '非泰康' : '泰康'}}
-                </template>
+                  <template
+                    slot="cat_info"
+                  >{{sitem.cat_info ? sitem.cat_info.map(({name}) => name).join('_') : '--' }}</template>
+                  <template slot="weight">{{sitem.weight}}g</template>
+                  <template slot="tax">{{sitem.tax}}%</template>
+                  <template slot="is_stock">{{String(sitem.is_stock) === '0' ? '非库存品' : '库存品'}}</template>
 
-                <template slot="good_img">
-                  <template v-if="sitem.good_img">
-                    <el-image style="height: 20px;width: 20px;margin-right: 10px" v-for="(img,index) in sitem.good_img.split(',')" :src="img" :preview-src-list="sitem.good_img.split(',')" :key="index" />
+                  <template slot="is_combind">
+                    {{
+                    String(sitem.is_combind) === '1' ? '是组合商品' : '非组合商品'
+                    }}
                   </template>
-                </template>
 
-                <template slot="good_info_img">
-                    <el-image style="height: 20px;width: 20px" :src="sitem.good_info_img" :preview-src-list="[sitem.good_info_img]" />
-                </template>
-                
-                <template slot="good_name">
-                  <img
-                    v-if="sitem.good_thumb_img"
-                    v-viewer
-                    style="width: 23px; height: 23px; margin: 0 5px 0 0"
-                    class="fl"
-                    :src="sitem.good_thumb_img"
-                    alt=""
-                  >
-                  <span>{{ sitem.good_name }}</span>
-                  <span v-for="(si, i) in sitem.speclist" :key="si.spec_id + i">
-                    <span v-if="i !== 0">-</span>
-                    <span v-else>_</span>
-                    <span>{{ si.spec_name }}[{{ si.spec_value }}]</span>
-                  </span>
-                  <el-popover placement="top" width="300" trigger="hover">
-                    <ul>
-                      <li
-                        v-if=" newTime !== '' && isDisplayPrivateField('1')"
-                      >
-                        <span>商品成本编号:</span><span>{{ sitem.spuCode }}</span>
-                      </li>
-                    </ul>
-                    <i slot="reference" class="el-icon-warning-outline fr" />
-                  </el-popover>
-                </template>
+                  <template
+                    slot="is_exclusive"
+                  >{{String(sitem.is_exclusive) === '0' ? '非泰康' : '泰康'}}</template>
 
-                <template slot="noble_weight">{{sitem.noble_weight}}g</template>
-                <template slot="is_gold_price">{{String(sitem.is_gold_price) === '1' ? '是' : '否'}}</template>
-                <template slot="is_diff">{{String(sitem.is_diff) === '1' ? '有公差' : '无工差'}}</template>
+                  <template slot="good_img">
+                    <template v-if="sitem.good_img">
+                      <el-image
+                        style="height: 20px;width: 20px;margin-right: 10px"
+                        v-for="(img,index) in sitem.good_img.split(',')"
+                        :src="img"
+                        :preview-src-list="sitem.good_img.split(',')"
+                        :key="index"
+                      />
+                    </template>
+                  </template>
 
-                <template slot="delivery_day">{{sitem.delivery_day}}天</template>
-              <template slot="lead_time">{{sitem.lead_time}}天</template>
-              <template slot="sample_day">{{sitem.sample_day}}天</template>
-              <template slot="delivery_place">{{delivery_place}}</template>
-              <template slot="origin_place">{{origin_place}}</template>
-              <template slot="packing_weight">
-                {{sitem.packing_weight}}g
-              </template>
-              </show-data-table>
-            </el-collapse-item>
+                  <template slot="good_info_img">
+                    <el-image
+                      style="height: 20px;width: 20px"
+                      :src="sitem.good_info_img"
+                      :preview-src-list="[sitem.good_info_img]"
+                    />
+                  </template>
 
-            <!-- <el-collapse-item title="规格信息" name="2">
+                  <template slot="good_name">
+                    <img
+                      v-if="sitem.good_thumb_img"
+                      v-viewer
+                      style="width: 23px; height: 23px; margin: 0 5px 0 0"
+                      class="fl"
+                      :src="sitem.good_thumb_img"
+                      alt
+                    />
+                    <span>{{ sitem.good_name }}</span>
+                    <span v-for="(si, i) in sitem.speclist" :key="si.spec_id + i">
+                      <span v-if="i !== 0">-</span>
+                      <span v-else>_</span>
+                      <span>{{ si.spec_name }}[{{ si.spec_value }}]</span>
+                    </span>
+                    <el-popover placement="top" width="300" trigger="hover">
+                      <ul>
+                        <li v-if=" newTime !== '' && isDisplayPrivateField('1')">
+                          <span>商品成本编号:</span>
+                          <span>{{ sitem.spuCode }}</span>
+                        </li>
+                      </ul>
+                      <i slot="reference" class="el-icon-warning-outline fr" />
+                    </el-popover>
+                  </template>
+
+                  <template slot="noble_weight">{{sitem.noble_weight}}g</template>
+                  <template slot="is_gold_price">{{String(sitem.is_gold_price) === '1' ? '是' : '否'}}</template>
+                  <template slot="is_diff">{{String(sitem.is_diff) === '1' ? '有公差' : '无工差'}}</template>
+
+                  <template slot="delivery_day">{{sitem.delivery_day}}天</template>
+                  <template slot="lead_time">{{sitem.lead_time}}天</template>
+                  <template slot="sample_day">{{sitem.sample_day}}天</template>
+                  <template slot="delivery_place">{{delivery_place}}</template>
+                  <template slot="origin_place">{{origin_place}}</template>
+                  <template slot="packing_weight">{{sitem.packing_weight}}g</template>
+                </show-data-table>
+              </el-collapse-item>
+
+              <!-- <el-collapse-item title="规格信息" name="2">
               <el-table :data="sitem.speclist" :size="'mini'" border style="width: 100%">
                 <el-table-column prop="spec_name" label="规格类型" />
                 <el-table-column prop="spec_value" label="规格值" />
               </el-table>
-            </el-collapse-item> -->
+              </el-collapse-item>-->
 
-            <!-- <el-collapse-item title="包装信息" name="3">
+              <!-- <el-collapse-item title="包装信息" name="3">
               <show-data-table :columns="packingColumns" :sitem="sitem">
                 <template slot="packing_weight">
                   {{sitem.packing_weight}}g
@@ -142,9 +155,9 @@
                 <template slot="delivery_place">{{delivery_place}}</template>
                 <template slot="origin_place">{{origin_place}}</template>
               </show-data-table>
-            </el-collapse-item> -->
+              </el-collapse-item>-->
 
-            <!-- <el-collapse-item title="图片信息" name="5">
+              <!-- <el-collapse-item title="图片信息" name="5">
               <show-data-table :columns="imageColumns" :sitem="sitem">
                 <template slot="good_thumb_img">
                   <el-image style="height: 40px;width: 40px" :src="sitem.good_thumb_img" :preview-src-list="[sitem.good_thumb_img]" />
@@ -160,47 +173,47 @@
                     <el-image style="height: 40px;width: 40px" :src="sitem.good_info_img" :preview-src-list="[sitem.good_info_img]" />
                 </template>
               </show-data-table>
-            </el-collapse-item> -->
+              </el-collapse-item>-->
 
-            <el-collapse-item title="固定与阶梯成本" name="6" v-if="displayCostField">
-              <show-data-table :columns="ladderColumns" :sitem="sitem">
-                <template slot="demo_fee">{{sitem.demo_fee}}元</template>
-                <template slot="open_fee">{{sitem.open_fee}}元</template>
-                <template slot="sample_fee">{{sitem.sample_fee}}元</template>
-                <template slot="market_price">{{sitem.market_price}}元</template>
-                <template slot="data_table">
-                  <el-table size="mini" :data="sitem.nakelist">
-                    <el-table-column prop="min_num" label="起订量(>=)" />
-                    <el-table-column prop="nake_fee" label="成本单价" />
-                    <el-table-column prop="cost_fee" label="工艺费" />
-                    <el-table-column prop="delivery_fee" label="物流费" />
-                    <el-table-column prop="cert_fee" label="证书费" />
-                    <el-table-column prop="mark_fee" label="加标费" />
-                    <el-table-column prop="package_fee" label="包装费" />
-                    <el-table-column prop="other_fee" label="其他费用" />
-                    <el-table-column prop="nake_total" label="成本合计" />
-                  </el-table>
-                </template>
-              </show-data-table>
-            </el-collapse-item>
+              <el-collapse-item title="固定与阶梯成本" name="6" v-if="displayCostField">
+                <show-data-table :columns="ladderColumns" :sitem="sitem">
+                  <template slot="demo_fee">{{sitem.demo_fee}}元</template>
+                  <template slot="open_fee">{{sitem.open_fee}}元</template>
+                  <template slot="sample_fee">{{sitem.sample_fee}}元</template>
+                  <template slot="market_price">{{sitem.market_price}}元</template>
+                  <template slot="data_table">
+                    <el-table size="mini" :data="sitem.nakelist">
+                      <el-table-column prop="min_num" label="起订量(>=)" />
+                      <el-table-column prop="nake_fee" label="成本单价" />
+                      <el-table-column prop="cost_fee" label="工艺费" />
+                      <el-table-column prop="delivery_fee" label="物流费" />
+                      <el-table-column prop="cert_fee" label="证书费" />
+                      <el-table-column prop="mark_fee" label="加标费" />
+                      <el-table-column prop="package_fee" label="包装费" />
+                      <el-table-column prop="other_fee" label="其他费用" />
+                      <el-table-column prop="nake_total" label="成本合计" />
+                    </el-table>
+                  </template>
+                </show-data-table>
+              </el-collapse-item>
 
-            <el-collapse-item
-              title="采购部门审批"
-              v-if="
+              <el-collapse-item
+                title="采购部门审批"
+                v-if="
                 ((status + '' === '0' && ppowers.some((i) => i == '0')) ||
                   (status + '' === '2' && ppowers.some((i) => i == '2')) ||
                   (status + '' === '3' && ppowers.some((i) => i == '3'))) &&
                 queryType === 'view'
               "
-            >
-              <exam-form
-                :statusList="statusList"
-                :newTime="newTime"
-                :disabled="false"
-                :isMust="false"
-                @searchChange="examForm"
-              />
-            </el-collapse-item>
+              >
+                <exam-form
+                  :statusList="statusList"
+                  :newTime="newTime"
+                  :disabled="false"
+                  :isMust="false"
+                  @searchChange="examForm"
+                />
+              </el-collapse-item>
             </template>
           </el-collapse>
         </el-tab-pane>
@@ -213,10 +226,9 @@
           />
         </el-tab-pane>
 
-
         <el-tab-pane label="流程图" name="3" v-if="queryType !== 'add'">
           <flow-chart process_id="15" type="SPCB" :orderCode="queryId" />
-       </el-tab-pane>
+        </el-tab-pane>
       </el-tabs>
     </div>
     <div v-else>
@@ -229,9 +241,17 @@ import asyncRequest from "@/apis/service/goodStore/goodsCost";
 import resToken from "@/mixins/resToken";
 import { mapGetters } from "vuex";
 import baseForm from "./components/baseForm";
-import costForm from './components/costDetail'
-import ShowDataTable from '@/views/standingBook/components/detail-data-table.vue'
-import { basicColumns, packingColumns, sendColumns, imageColumns, ladderColumns, options6 , options3} from './columns'
+import costForm from "./components/costDetail";
+import ShowDataTable from "@/views/standingBook/components/detail-data-table.vue";
+import {
+  basicColumns,
+  packingColumns,
+  sendColumns,
+  imageColumns,
+  ladderColumns,
+  options6,
+  options3
+} from "./columns";
 import privateField from "@/mixins/privateField";
 
 export default {
@@ -243,22 +263,34 @@ export default {
     costForm
   },
   computed: {
-    ...mapGetters(["tablebtnSize", "searchSize", "size", "private_field", "originLevel"]),
-    displayCostField(){
-      return (["1", '3']).includes(this.originLevel) || this.private_field.includes('1')
+    ...mapGetters([
+      "tablebtnSize",
+      "searchSize",
+      "size",
+      "private_field",
+      "originLevel"
+    ]),
+    displayCostField() {
+      return (
+        ["1", "3"].includes(this.originLevel) ||
+        this.private_field.includes("1")
+      );
     },
     powers() {
-      const { btnList } = this.$store.getters
-      const tran = btnList.find((item) => item.menu_route == "supplierGoodsCostDetail") || {};
+      const { btnList } = this.$store.getters;
+      const tran =
+        btnList.find(item => item.menu_route == "supplierGoodsCostDetail") ||
+        {};
       const { action } = tran ?? {};
       return action ?? [];
     },
     ppowers() {
       const tran =
-        this.$store.getters.roleProcess.find((i) => i.process_type === "SPCB") || {};
+        this.$store.getters.roleProcess.find(i => i.process_type === "SPCB") ||
+        {};
       const { action } = tran ?? {};
       return action ?? [];
-    },
+    }
   },
 
   data() {
@@ -280,8 +312,8 @@ export default {
       queryId: "",
       status: "",
       sitem: null,
-      delivery_place: '',
-      origin_place: ''
+      delivery_place: "",
+      origin_place: ""
     };
   },
   mounted() {
@@ -299,8 +331,8 @@ export default {
         this.getNewTime();
       } else {
         await this.initData();
-        await this.getArea('delivery_place');
-        await this.getArea('origin_place');
+        await this.getArea("delivery_place");
+        await this.getArea("origin_place");
       }
 
       this.loading = false;
@@ -311,48 +343,50 @@ export default {
       console.log(e);
       if (!this.loading) {
         let type = "";
-        if (e.state + '' === "1") {
+        if (e.state + "" === "1") {
           type = "1";
         } else {
           type =
-            this.status + '' === "0"
+            this.status + "" === "0"
               ? "6"
-              : this.status + '' === "2"
+              : this.status + "" === "2"
               ? "4"
-              : this.status + '' === "3"
+              : this.status + "" === "3"
               ? "5"
               : "";
         }
         await this.setstatus(type, "提交采购部门审核", e.remark);
       }
     },
-    async getArea(prop = 'delivery_place'){
-      const chunks = this.sitem[prop].split(',');
+    async getArea(prop = "delivery_place") {
+      const chunks = this.sitem[prop].split(",");
       let { data: province } = await asyncRequest.province();
-      province = province.find(({province_code}) => province_code === chunks[0])
-      let { data: city } = await  asyncRequest.city({code: chunks[0]})
-      city = city.find(({city_code}) => city_code === chunks[1])
-      let { data: area } = await asyncRequest.area({code: chunks[1]})
-      area = area.find(({area_code}) => area_code === chunks[2])
-      this[prop] = [province,city,area].map(({name}) => name).join("_")
+      province = province.find(
+        ({ province_code }) => province_code === chunks[0]
+      );
+      let { data: city } = await asyncRequest.city({ code: chunks[0] });
+      city = city.find(({ city_code }) => city_code === chunks[1]);
+      let { data: area } = await asyncRequest.area({ code: chunks[1] });
+      area = area.find(({ area_code }) => area_code === chunks[2]);
+      this[prop] = [province, city, area].map(({ name }) => name).join("_");
     },
     async setstatus(type, detail, remark) {
       await this.$confirm(`确定要${detail}?`, {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(async () => {
           let _model = {
             spuCode: this.queryId,
             status: type,
-            remark: remark,
+            remark: remark
           };
           let res = await asyncRequest.status(_model);
           if (res && res.code === 0) {
             this.$notify.success({
               title: "提交成功!",
-              message: "",
+              message: ""
             });
             await this.initForm();
           } else if (res && res.code >= 100 && res.code <= 104) {
@@ -374,7 +408,7 @@ export default {
     async initData() {
       this.loading = true;
       const { code, message, data } = await asyncRequest.detail({
-        spuCode: this.queryId,
+        spuCode: this.queryId
       });
       this.loading = false;
       if (code === 0) {
@@ -390,8 +424,8 @@ export default {
     },
     getNewTime() {
       this.newTime = new Date().valueOf();
-    },
-  },
+    }
+  }
 };
 </script>
 <style lang="scss" scoped>

+ 12 - 12
src/views/sellOut/combinedAdd/components/columnsForm.js

@@ -80,29 +80,29 @@ export const stockColumns = [
         prop:'type_name',
         span:6
     },
+    {
+      label:'收发货省市区',
+      prop:'target',
+      span:12
+    },
+    {
+        label:'收发货详细地址',
+        prop:'wsm_addr',
+        span:12
+    },
     {
         label:'收发货联系人',
         prop:'wsm_name',
-        span:8
+        span:6
     },
     {
         label:'联系人职位',
         prop:'position',
-        span:8
+        span:6
     },
     {
         label:'联系人电话',
         prop:'wsm_mobile',
-        span:8
-    },
-    {
-        label:'收发货省市区',
-        prop:'target',
-        span:12
-    },
-    {
-        label:'收发货详细地址',
-        prop:'wsm_addr',
         span:12
     },
 ]