戴艳蓉 пре 3 година
родитељ
комит
0f5ab4b839

+ 1 - 1
src/apis/components/search-good-online-modal.js

@@ -2,7 +2,7 @@ import http from "@/apis/axios";
 const api = "admin/";
 export default {
   // 列表
-  list: (data, params) => http(api + "gooduplist", data, "post", params),
+  list: (data, params) => http(api + "goodlist", data, "post", params),
   // 供应商列表
   supplierList: (data, params) => http(api + "supplierlist", data, "post", params),
 

+ 10 - 19
src/apis/service/goodStore/goodsCost/index.js

@@ -3,9 +3,8 @@ import http from "@/apis/axios";
 const api = "admin/";
 export default {
   // 添加
-  add: (data, params) => http(api + "goodadd", data, "post", params),
-  // 删除
-  delete: (data, params) => http(api + "gooddel", data, "post", params),
+  add: (data, params) => http(api + "goodupcreate", data, "post", params),
+
   // 分页查询
   list: (data, params) => http(api + "gooduplist", data, "post", params),
   // 获取全部规格值
@@ -13,22 +12,14 @@ export default {
   // 规格值添加
   valueadd: (data, params) => http(api + "valuecreate", data, "post", params),
   // 详情
-  detail: (data, params) => http(api + "goodinfo", data, "post", params),
-  // 更改
-  update: (data, params) => http(api + "goodsave", data, "post", params),
+  detail: (data, params) => http(api + "goodupinfo", data, "post", params),
+  // 基础信息更改
+  update: (data, params) => http(api + "goodupeditinfo", data, "post", params),
+  // 成本更改
+  updateP: (data, params) => http(api + "goodupeditfee", data, "post", params),
+
+  // 删除
+  delete: (data, params) => http(api + "gooddel", data, "post", params),
   // 更新状态
   status: (data, params) => http(api + "goodstatus", data, "post", params),
-  // 复制
-  copy: (data, params) => http(api + "goodcopy", data, "post", params),
-  // 获取全部分类
-  catAll: (data, params) => http(api + "catAll", data, "post", params),
-  // 获取全部品牌
-  brandAll: (data, params) => http(api + "brandall", data, "post", params),
-  // 获取全部供应商账号
-  supplierAll: (data, params) => http(api + "supplierall", data, "post", params),
-  // 商品种类ID换取规格值
-  specByCat: (data, params) => http(api + "SpecByCat", data, "post", params),
-  // 规格属性值新建
-  specinfoadd: (data, params) => http(api + "specinfoadd", data, "post", params),
-
 };

+ 13 - 27
src/views/goodStore/goodsCost/add.vue

@@ -1,15 +1,10 @@
 <template>
-  <div class="goodsCostAdd pagePadding">
+  <div class="goodsCostAdd">
     <div
+      class="goodsCostAdd"
       v-if="powers && powers.length > 0 && powers.some((item) => item == '007')"
     >
-      <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
-        <el-tab-pane label="基础/规格" name="1"> <base-form /></el-tab-pane>
-        <el-tab-pane label="包装/发货/图片" name="2">
-          <pack-form
-        /></el-tab-pane>
-        <el-tab-pane label="固定/阶梯成本" name="3"> <cost-form /></el-tab-pane>
-      </el-tabs>
+      <base-form />
     </div>
     <div v-else>
       <no-auth></no-auth>
@@ -21,15 +16,11 @@ 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/costForm";
-import packForm from "./components/packForm";
 export default {
   name: "goodsCostAdd",
   mixins: [resToken],
   components: {
     baseForm,
-    costForm,
-    packForm,
   },
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
@@ -50,12 +41,6 @@ export default {
       size: "small",
       activeName: "1",
       loading: false,
-   
-     
-
-    
-
-   
     };
   },
   mounted() {
@@ -64,7 +49,7 @@ export default {
   methods: {
     async initForm() {
       this.loading = true;
-    
+
       this.loading = false;
     },
     handleClick(row) {
@@ -78,15 +63,17 @@ export default {
         await this.resetForm(res.data);
       }
     },
-  
-
-  
-   
   },
 };
 </script>
    <style lang="scss" scoped>
 .goodsCostAdd {
+  position: relative;
+  height: 100%;
+  .goodsCostAdd {
+    overflow-y: scroll;
+    padding: 10px;
+  }
   .goodsCostAdd-title {
     border-top: 1px solid #ebeef5;
     span {
@@ -101,19 +88,18 @@ export default {
   }
   /deep/ .ddiv {
     border-top: 1px solid #dcdfe6;
-   
   }
   /deep/ .dtitle {
     width: 40px;
     text-align: center;
     height: 100%;
     min-height: 100%;
-    ul{
-      padding:20px 0 0 0;
+    ul {
+      padding: 20px 0 0 0;
     }
   }
   /deep/ .dmain {
-     padding: 20px 0 0 0;
+    padding: 20px 0 0 0;
     width: calc(100% - 40px);
     border-left: 1px solid #dcdfe6;
   }

+ 313 - 1
src/views/goodStore/goodsCost/columns.js

@@ -92,5 +92,317 @@ const listCol = [
     _slot_: "operation",
   },
 ]
+const rules= {
+  cat_id: [
+    {
+      type: "array",
+      required: true,
+      message: "商品分类",
+      trigger: "change",
+    },
+  ],
+  brandid: [
+    {
+      type: "array",
+      required: false,
+      message: "商品品牌",
+      trigger: "change",
+    },
+  ],
+  noble_weight: [
+    {
+      required: true,
+      message: "贵金属重量为合法数字",
+      trigger: "blur",
+    },
+  ],
+  weight: [
+    {
+      required: true,
+      message: "商品总重量为合法数字",
+      trigger: "blur",
+    },
+  ],
+  good_type: [
+    {
+      required: true,
+      message: "请选择是否定制",
+      trigger: "change",
+    },
+  ],
+  is_stock: [
+    {
+      required: true,
+      message: "请选择是否库存品",
+      trigger: "change",
+    },
+  ],
+  company_id: [
+    {
+      required: true,
+      message: "请选择业务公司",
+      trigger: "change",
+    },
+  ],
+  supplierNo: [
+    {
+      type: "array",
+      required: true,
+      message: "请选择供应商",
+      trigger: "change",
+    },
+  ],
+  is_auth: [
+    {
+      required: true,
+      message: "商品主图",
+      trigger: "change",
+    },
+  ],
+  tax: [
+    {
+      required: true,
+      message: "请选择税率",
+      trigger: "change",
+    },
+  ],
+  good_name: [
+    {
+      required: true,
+      message: "请输入商品名称",
+      trigger: "blur",
+    },
+  ],
+  unit: [
+    {
+      type: "array",
+      required: true,
+      message: "请输入商品单位",
+      trigger: "blur",
+    },
+  ],
+  is_exclusive: [
+    {
+      required: true,
+      message: "请选择专属类型",
+      trigger: "change",
+    },
+  ],
+  noble_metal: [
+    {
+      required: true,
+      message: "请选择贵金属种类",
+      trigger: "change",
+    },
+  ],
+  is_gold_price: [
+    {
+      required: true,
+      message: "请选择是否启用实时金价",
+      trigger: "change",
+    },
+  ],
+  moq: [
+    {
+      required: true,
+      message: "定制起订量应为合法数字",
+      trigger: "blur",
+    },
+  ],
+  customized: [
+    {
+      required: true,
+      message: "定制工期为合法数字",
+      trigger: "blur",
+    },
+  ],
+  after_sales: [
+    {
+      required: true,
+      message: "售后说明不能为空",
+      trigger: "blur",
+    },
+  ],
+  good_remark: [
+    {
+      required: true,
+      message: "商品备注不能为空",
+      trigger: "blur",
+    },
+  ],
+  //包装/发货/图片
+  packing_list: [
+    {
+      required: true,
+      message: "请输入包装清单",
+      trigger: "blur",
+    },
+  ],
+  packing_way: [
+    {
+      required: true,
+      message: "请输入包装方式",
+      trigger: "blur",
+    },
+  ],
 
-export { options1, options2, options3, options4, options5, options6, options7, listCol }
+  packing_spec: [
+    {
+      required: true,
+      message: "请输入装箱规格",
+      trigger: "blur",
+    },
+  ],
+  packing_weight: [
+    {
+      required: true,
+      message: "请输入装箱重量",
+      trigger: "blur",
+    },
+  ],
+  packing_szie: [
+    {
+      required: true,
+      message: "请输入装箱尺寸",
+      trigger: "blur",
+    },
+  ],
+  supply_area: [
+    {
+      required: true,
+      message: "请选择供货区域",
+      trigger: "change",
+    },
+  ],
+  delivery_place: [
+    {
+      type: "array",
+      required: true,
+      message: "请选择发货地",
+      trigger: "change",
+    },
+  ],
+  origin_place: [
+    {
+      type: "array",
+      required: true,
+      message: "请选择产地",
+      trigger: "change",
+    },
+  ],
+  delivery_day: [
+    {
+      required: true,
+      message: "请输入物流时间",
+      trigger: "blur",
+    },
+  ],
+  lead_time: [
+    {
+      required: true,
+      message: "请输入供货周期",
+      trigger: "blur",
+    },
+  ],
+  sample_day: [
+    {
+      required: true,
+      message: "请输入调样周期",
+      trigger: "blur",
+    },
+  ],
+  good_thumb_img: [
+    {
+      required: true,
+      message: "商品缩略图",
+      trigger: "change",
+    },
+  ],
+  // good_img: [
+  //   {
+  //     required: true,
+  //     message: "商品详情主图",
+  //     trigger: "change",
+  //   },
+  // ],
+  good_info_img: [
+    {
+      type: "array",
+      required: true,
+      message: "商品详情介绍图",
+      trigger: "change",
+    },
+  ],
+
+  //固定成本
+  cert_fee: [
+    {
+      required: true,
+      message: "证书费应为合法数字",
+      trigger: "blur",
+    },
+  ],
+  packing_fee: [
+    {
+      required: true,
+      message: "包装费应为合法数字",
+      trigger: "blur",
+    },
+  ],
+  cost_fee: [
+    {
+      required: true,
+      message: "成本工艺费应为合法数字",
+      trigger: "blur",
+    },
+  ],
+  mark_fee: [
+    {
+      required: true,
+      message: "加标费应为合法数字",
+      trigger: "blur",
+    },
+  ],
+  demo_fee: [
+    {
+      required: true,
+      message: "打样应为合法数字",
+      trigger: "blur",
+    },
+  ],
+  open_fee: [
+    {
+      required: true,
+      message: "开模费应为合法数字",
+      trigger: "blur",
+    },
+  ],
+  sample_fee: [
+    {
+      required: true,
+      message: "调样费应为合法数字",
+      trigger: "blur",
+    },
+  ],
+  market_price: [
+    {
+      required: true,
+      message: "市场价应为合法数字",
+      trigger: "blur",
+    },
+  ],
+  nake_price: [
+    {
+      required: true,
+      message: "含税成本合计应为合法数字",
+      trigger: "blur",
+    },
+  ],
+  is_step: {
+    required: true,
+    message: "请选择是否启用阶梯",
+    trigger: "change",
+  },
+}
+
+export { options1, options2, options3, options4, options5, options6, options7, listCol,rules }

+ 735 - 264
src/views/goodStore/goodsCost/components/baseForm.vue

@@ -305,9 +305,8 @@
           <li>息</li>
         </ul>
       </el-col>
-      <el-col :span="23" class="dmain" style="padding-left: 18px">
+      <el-col :span="23" class="dmain" style="padding: 20px 0 20px 18px">
         <el-table :data="tableData" :size="'mini'" border style="width: 100%">
-          <!-- <el-table-column prop="index" label="序号"> </el-table-column> -->
           <el-table-column prop="spec_value" label="规格类型" />
           <el-table-column prop="spec_value_value" label="规格值" />
           <el-table-column fixed="right">
@@ -349,6 +348,514 @@
         />
       </el-col>
     </el-row>
+    <el-row class="ddiv">
+      <el-col :span="1" class="dtitle">
+        <ul>
+          <li>包</li>
+          <li>装</li>
+          <li>信</li>
+          <li>息</li>
+        </ul></el-col
+      >
+      <el-col :span="23" class="dmain">
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="包装清单" prop="packing_list">
+              <el-input
+                placeholder="包装清单"
+                v-model="ruleForm.packing_list"
+                maxlength="250"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="包装方式" prop="packing_way">
+              <el-input
+                placeholder="包装方式"
+                v-model="ruleForm.packing_way"
+                maxlength="250"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="装箱规格" prop="packing_spec">
+              <el-input
+                placeholder="装箱规格"
+                v-model="ruleForm.packing_spec"
+                maxlength="250"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="装箱重量" prop="packing_weight">
+              <el-input
+                placeholder="装箱重量"
+                v-model="ruleForm.packing_weight"
+                type="number"
+                :min="0"
+                :max="9999999999.99"
+                :step="2"
+              >
+                <template slot="append">g</template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="装箱尺寸" prop="packing_szie">
+              <el-input
+                placeholder="装箱尺寸"
+                v-model="ruleForm.packing_szie"
+                maxlength="250"
+              />
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8">
+            <el-form-item label="商品条形码" prop="good_bar">
+              <el-input
+                placeholder="物流时间"
+                v-model="ruleForm.good_bar"
+                type="number"
+                :min="0"
+                :max="9999999999999"
+                :step="0"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-col>
+    </el-row>
+    <el-row class="ddiv">
+      <el-col :span="1" class="dtitle">
+        <ul>
+          <li>发</li>
+          <li>货</li>
+          <li>信</li>
+          <li>息</li>
+        </ul></el-col
+      >
+      <el-col :span="23" class="dmain">
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="供货区域" prop="supply_area">
+              <el-select
+                v-model="ruleForm.supply_area"
+                filterable
+                clearable
+                style="width: 100%"
+                placeholder="供货区域"
+              >
+                <el-option
+                  v-for="group in options6"
+                  :key="group.id"
+                  :label="group.name"
+                  :value="group.id"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="发货地" prop="delivery_place">
+              <select-area
+                :placeholder="'发货地'"
+                :value="ruleForm.delivery_place"
+                :is-detail="id !== 'add'"
+                :disabled="isDetail"
+                :size="'mini'"
+                @selectChange="selectAreadelivery_place"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="产地" prop="origin_place">
+              <select-area
+                :placeholder="'产地'"
+                :value="ruleForm.origin_place"
+                :size="'mini'"
+                :is-detail="id !== 'add'"
+                :disabled="isDetail"
+                @selectChange="selectAreaorigin_place"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="物流时间" prop="delivery_day">
+              <el-input
+                placeholder="物流时间"
+                v-model="ruleForm.delivery_day"
+                type="number"
+                :min="0"
+                :max="9999999999"
+                :step="0"
+              >
+                <template slot="append">天</template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="供货周期" prop="lead_time">
+              <el-input
+                placeholder="供货周期"
+                v-model="ruleForm.lead_time"
+                type="number"
+                :min="0"
+                :max="9999999999"
+                :step="0"
+              >
+                <template slot="append">天</template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="调样周期" prop="sample_day">
+              <el-input
+                placeholder="调样周期"
+                v-model="ruleForm.sample_day"
+                type="number"
+                :min="0"
+                :max="9999999999"
+                :step="0"
+              >
+                <template slot="append">天</template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-col>
+    </el-row>
+    <el-row class="ddiv">
+      <el-col :span="1" class="dtitle">
+        <ul>
+          <li>图</li>
+          <li>片</li>
+          <li>信</li>
+          <li>息</li>
+        </ul></el-col
+      >
+      <el-col :span="23" class="dmain">
+        <el-row style="padding: 0 0 20px 0">
+          <el-col :span="8">
+            <el-form-item
+              label="缩略图"
+              prop="good_thumb_img"
+              class="activity-upload"
+            >
+              <div class="btnupload" style="position: relative">
+                <img
+                  v-if="ruleForm.good_thumb_img"
+                  :src="ruleForm.good_thumb_img"
+                  class="avatar"
+                />
+                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+                <file-upload
+                  class="Upload"
+                  :disabled="id == '007'"
+                  :accept="'.jpg,.png,.jpeg'"
+                  :multiple="true"
+                  :uploadcondition="beforeAvatarUpload"
+                  @UploadErrorEvent="UploadErrorEventgood_thumb_img"
+                  @UploadSuccessEvent="UploadSuccessEventgood_thumb_img"
+                ></file-upload>
+              </div>
+              <div class="txt-tips fl">
+                <p>尺寸比例:</p>
+                <p>1:1</p>
+              </div>
+            </el-form-item>
+            <!-- <el-form-item
+              label="详情主图"
+              prop="good_img"
+              class="activity-upload"
+            >
+              <div class="btnupload" style="position: relative">
+                <img
+                  v-if="ruleForm.good_img"
+                  :src="ruleForm.good_img"
+                  class="avatar"
+                />
+                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+                <file-upload
+                  class="Upload"
+                  :disabled="id == '007'"
+                  :accept="'.jpg,.png,.jpeg'"
+                  :multiple="true"
+                  :uploadcondition="beforeAvatarUpload"
+                  @UploadErrorEvent="UploadErrorEventgood_img"
+                  @UploadSuccessEvent="UploadSuccessEventgood_img"
+                ></file-upload>
+              </div>
+            </el-form-item> -->
+            <div style="font-size: 12px; color: #606266">
+              <span style="padding: 0 0 0 20px">图片大小:小于1M</span>
+              <span style="padding: 0 0 0 20px">图片类型.jpg/png/jpeg</span>
+            </div>
+          </el-col>
+          <el-col :span="16">
+            <el-form-item label="详情介绍图" prop="good_info_img">
+              <div class="good_info_img-div">
+                <ul v-if="ruleForm.good_info_img" class="clear">
+                  <li
+                    class="img-show-li"
+                    v-viewer
+                    v-for="(img, iindex) in ruleForm.good_info_img"
+                    :key="img + iindex"
+                  >
+                    <img :src="img" alt="" />
+                    <i class="el-icon-close" @click="closeImg(iindex)"></i>
+                  </li>
+                  <li
+                    class="img-upload-li"
+                    v-if="ruleForm.good_info_img.length < 10"
+                  >
+                    <div class="activity-upload">
+                      <div class="btnupload" style="position: relative">
+                        <i class="el-icon-plus avatar-uploader-icon"></i>
+                        <file-upload
+                          class="Upload"
+                          :disabled="id == '007'"
+                          :accept="'.jpg,.png,.jpeg'"
+                          :multiple="true"
+                          :uploadcondition="beforeAvatarUpload"
+                          @UploadErrorEvent="UploadErrorEventgood_info_img"
+                          @UploadSuccessEvent="UploadSuccessEventgood_info_img"
+                        ></file-upload>
+                      </div>
+                    </div>
+                  </li>
+                </ul>
+              </div>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-col>
+    </el-row>
+    <el-row class="ddiv">
+      <el-col :span="1" class="dtitle">
+        <ul style="padding: 40px 0 0 0">
+          <li>固</li>
+          <li>定</li>
+          <li>成</li>
+          <li>本</li>
+        </ul></el-col
+      >
+      <el-col :span="23" class="dmain">
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="证书费" prop="cert_fee">
+              <el-input
+                placeholder="证书费"
+                v-model="ruleForm.cert_fee"
+                type="number"
+                :min="0"
+                :max="9999999999.99"
+                :step="2"
+              >
+                <template slot="append">元</template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="包装费" prop="packing_fee">
+              <el-input
+                placeholder="包装费"
+                v-model="ruleForm.packing_fee"
+                type="number"
+                :min="0"
+                :max="9999999999.99"
+                :step="2"
+              >
+                <template slot="append">元</template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="成本工艺费" prop="cost_fee">
+              <el-input
+                placeholder="成本工艺费"
+                v-model="ruleForm.cost_fee"
+                type="number"
+                :min="0"
+                :max="9999999999.99"
+                :step="2"
+              >
+                <template slot="append">元</template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="加标费" prop="mark_fee">
+              <el-input
+                placeholder="加标费"
+                v-model="ruleForm.mark_fee"
+                type="number"
+                :min="0"
+                :max="9999999999.99"
+                :step="2"
+              >
+                <template slot="append">元</template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="打样费" prop="demo_fee">
+              <el-input
+                placeholder="打样费"
+                v-model="ruleForm.demo_fee"
+                type="number"
+                :min="0"
+                :max="9999999999.99"
+                :step="2"
+              >
+                <template slot="append">元</template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="开模费" prop="open_fee">
+              <el-input
+                placeholder="开模费"
+                v-model="ruleForm.open_fee"
+                type="number"
+                :min="0"
+                :max="9999999999.99"
+                :step="2"
+              >
+                <template slot="append">元</template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="调样费" prop="sample_fee">
+              <el-input
+                placeholder="调样费"
+                v-model="ruleForm.sample_fee"
+                type="number"
+                :min="0"
+                :max="9999999999.99"
+                :step="2"
+              >
+                <template slot="append">元</template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="市场价" prop="market_price">
+              <el-input
+                placeholder="市场价"
+                v-model="ruleForm.market_price"
+                type="number"
+                :min="0"
+                :max="9999999999.99"
+                :step="2"
+              >
+                <template slot="append">元</template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="含税成本合计" prop="nake_price">
+              <el-input
+                placeholder="含税成本合计"
+                v-model="ruleForm.nake_price"
+                type="number"
+                :min="0"
+                :max="9999999999.99"
+                :step="2"
+              >
+                <template slot="append">元</template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-col>
+    </el-row>
+    <el-row class="ddiv">
+      <el-col :span="1" class="dtitle">
+        <ul>
+          <li>阶</li>
+          <li>梯</li>
+          <li>成</li>
+          <li>本</li>
+        </ul></el-col
+      >
+      <el-col :span="23" class="dmain" style="padding-left: 18px">
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="启用阶梯" prop="is_step">
+              <el-select
+                v-model="ruleForm.is_step"
+                filterable
+                clearable
+                style="width: 100%"
+                placeholder="启用阶梯"
+              >
+                <el-option
+                  v-for="group in options5"
+                  :key="group.id"
+                  :label="group.name"
+                  :value="group.id"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-table
+              :data="tableData1"
+              :size="'mini'"
+              border
+              stripe
+              style="width: 100%; margin: 0 0 20px 0"
+            >
+              <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 fixed="right">
+                <template slot="header" slot-scope="scope">
+                  <span>操作</span>
+                  <el-tooltip effect="dark" content="添加阶梯" placement="top">
+                    <i
+                      class="el-icon-circle-plus-outline tb-icon fr"
+                      @click="openCostEdit(-1, {})"
+                    ></i>
+                  </el-tooltip>
+                </template>
+                <template slot-scope="scope">
+                  <el-tooltip effect="dark" content="修改" placement="top">
+                    <i
+                      class="el-icon-edit tb-icon"
+                      @click="openCostEdit(scope.$index, scope.row)"
+                    ></i>
+                  </el-tooltip>
+                  <el-tooltip effect="dark" content="禁/启用" placement="top">
+                    <i
+                      class="el-icon-video-pause tb-icon"
+                      @click="openCostEdit('')"
+                    ></i>
+                  </el-tooltip>
+                </template>
+              </el-table-column>
+            </el-table>
+          </el-col>
+          <el-col :span="24" style="text-align: right">
+            <el-button v-if="id !== '007'" type="primary" @click="submitForm"
+              >保 存
+            </el-button>
+            <el-button @click="showModelThis = false">{{
+              id == "007" ? "关 闭" : "取 消"
+            }}</el-button>
+          </el-col>
+        </el-row>
+        <!-- 弹窗 新增/修改 -->
+        <cost-form-add-edit
+          :index="costmodelIndex"
+          :show-model="costshowModel"
+          :sitem="costsitem"
+          @refresh="costrefreshEdit"
+          @cancel="costshowModel = false"
+        /> </el-col
+    ></el-row>
   </el-form>
 </template>
    <script>
@@ -356,12 +863,23 @@ import asyncRequest from "@/apis/service/goodStore/goodsCost";
 import resToken from "@/mixins/resToken";
 import { mapGetters } from "vuex";
 import baseFormAddEdit from "./baseFormAddEdit";
-import { options1, options2, options3, options4, options5 } from "../columns";
+import costFormAddEdit from "./costFormAddEdit";
+import {
+  options1,
+  options2,
+  options3,
+  options4,
+  options5,
+  options6,
+  options7,
+  rules,
+} from "../columns";
 export default {
   name: "goodsCostAdd",
   mixins: [resToken],
   components: {
     baseFormAddEdit,
+    costFormAddEdit,
   },
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
@@ -379,11 +897,15 @@ export default {
   },
   data() {
     return {
+      costshowModel: false,
+      costmodelIndex: "",
+      costsitem: {},
       showModel: false,
       modelIndex: "",
       is_noble: false,
       sitem: {},
       size: "small",
+
       rulesThis: this.rules,
       activeName: "1",
       loading: false,
@@ -393,144 +915,11 @@ export default {
       options3: options3,
       options4: options4,
       options5: options5,
+      options6: options6,
+      options7: options7,
       ruleForm: {},
-      rules: {
-        cat_id: [
-          {
-            required: true,
-            message: "商品分类",
-            trigger: "change",
-          },
-        ],
-        brandid: [
-          {
-            type: "array",
-            required: false,
-            message: "商品品牌",
-            trigger: "change",
-          },
-        ],
-        noble_weight: [
-          {
-            required: true,
-            message: "贵金属重量为合法数字",
-            trigger: "blur",
-          },
-        ],
-        weight: [
-          {
-            required: true,
-            message: "商品总重量为合法数字",
-            trigger: "blur",
-          },
-        ],
-        good_type: [
-          {
-            required: true,
-            message: "请选择是否定制",
-            trigger: "change",
-          },
-        ],
-        is_stock: [
-          {
-            required: true,
-            message: "请选择是否库存品",
-            trigger: "change",
-          },
-        ],
-        company_id: [
-          {
-            required: true,
-            message: "请选择业务公司",
-            trigger: "change",
-          },
-        ],
-        supplierNo: [
-          {
-            type: "array",
-            required: true,
-            message: "请选择供应商",
-            trigger: "change",
-          },
-        ],
-        is_auth: [
-          {
-            required: true,
-            message: "商品主图",
-            trigger: "change",
-          },
-        ],
-        tax: [
-          {
-            required: true,
-            message: "请选择税率",
-            trigger: "change",
-          },
-        ],
-        good_name: [
-          {
-            required: true,
-            message: "请输入商品名称",
-            trigger: "blur",
-          },
-        ],
-        unit: [
-          {
-            required: true,
-            message: "请输入商品单位",
-            trigger: "blur",
-          },
-        ],
-        is_exclusive: [
-          {
-            required: true,
-            message: "请选择专属类型",
-            trigger: "change",
-          },
-        ],
-        noble_metal: [
-          {
-            required: true,
-            message: "请选择贵金属种类",
-            trigger: "change",
-          },
-        ],
-        is_gold_price: [
-          {
-            required: true,
-            message: "请选择是否启用实时金价",
-            trigger: "change",
-          },
-        ],
-        moq: [
-          {
-            required: true,
-            message: "定制起订量应为合法数字",
-            trigger: "blur",
-          },
-        ],
-        customized: [
-          {
-            required: true,
-            message: "定制工期为合法数字",
-            trigger: "blur",
-          },
-        ],
-        after_sales: [
-          {
-            required: true,
-            message: "售后说明不能为空",
-            trigger: "blur",
-          },
-        ],
-        good_remark: [
-          {
-            required: true,
-            message: "商品备注不能为空",
-            trigger: "blur",
-          },
-        ],
-      },
+      tableData1: [],
+      rules: rules,
     };
   },
   mounted() {
@@ -552,6 +941,11 @@ export default {
       this.sitem = sitem;
       this.showModel = true;
     },
+    openCostEdit(index, sitem) {
+      this.costmodelIndex = index;
+      this.costsitem = sitem;
+      this.costshowModel = true;
+    },
     async initData() {
       this.loading = true;
       const { code, data, message } = await asyncRequest.detail({
@@ -578,18 +972,18 @@ export default {
     },
     resetFormData() {
       this.ruleForm = {
-        cat_id: "",
+        cat_id: ["1", "53"],
         brandid: [],
         noble_weight: "",
-        weight: "",
-        good_type: "",
+        weight: "111",
+        good_type: "0",
         is_stock: "",
-        supplierNo: [],
-        company_id: "",
+        supplierNo: ["GYS-20210520-0001"],
+        company_id: "GSec37220215151111",
         is_auth: "",
         tax: "",
         good_name: "2018春秋新款V领修身丝绒西装女 双排扣复古极简中长款工装外套",
-        unit: "",
+        unit: ["3"],
         is_exclusive: "",
         noble_metal: "",
         is_gold_price: "",
@@ -597,9 +991,88 @@ export default {
         customized: "",
         after_sales: "",
         craft_desc: "",
-        good_remark: "",
+        good_remark: "备注备注",
+        //包装发货/图片
+        packing_list: "",
+        packing_way: "",
+        packing_spec: "",
+        packing_weight: "",
+        packing_szie: "",
+        good_bar: "",
+        supply_area: "",
+        delivery_place: [],
+        origin_place: [],
+        delivery_day: "",
+        lead_time: "",
+        sample_day: "",
+        good_thumb_img: "",
+        // good_img: "",
+        good_info_img: [],
+        //固定阶梯成本
+        cert_fee: "",
+        packing_fee: "",
+        cost_fee: "",
+        mark_fee: "",
+        demo_fee: "",
+        open_fee: "",
+        sample_fee: "",
+        market_price: "",
+        nake_price: "",
+        // b1: [],
       };
     },
+
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          this.loading = true;
+          if (this.tableData.length === 0) {
+            this.$message.warning("请录入商品规格信息!");
+            this.loading = false;
+            return;
+          }
+          if (this.tableData1.length === 0) {
+            this.$message.warning("请录入阶梯成本!");
+            this.loading = false;
+          }
+          let model = JSON.parse(JSON.stringify(this.ruleForm));
+          model.speclist = JSON.parse(JSON.stringify(this.tableData));
+          model.good_ladder = JSON.parse(JSON.stringify(this.tableData1));
+          model.cat_id = model.cat_id[model.cat_id.length - 1];
+          model.brandid = model.brandid.toString();
+          model.supplierNo = model.supplierNo.toString();
+          model.delivery_place = model.delivery_place.toString();
+          model.origin_place = model.origin_place.toString();
+          model.good_info_img = model.good_info_img.toString();
+          model.unit = model.unit.toString();
+          let res = {};
+          // if (this.id === "003") {
+          //   delete model["id"];
+          //   res = await asyncRequest.add(model);
+          // } else {
+          //   res = await asyncRequest.update(model);
+          // }
+          res = await asyncRequest.add(model);
+          console.log(res);
+          this.loading = false;
+          if (res && res.code === 0) {
+            const title = this.id === "add" ? "添加成功!" : "修改成功!";
+            this.$notify.success({
+              title,
+              message: "",
+            });
+            this.showModelThis = false;
+            // 刷新
+            this.$emit("refresh");
+          }
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+
+    //规格编辑修改
     refreshEdit(e) {
       let item = JSON.parse(JSON.stringify(e));
       const {
@@ -613,7 +1086,7 @@ export default {
       if (index + "" === "-1") {
         this.tableData.push(item);
       } else {
-        this.tableData.forEach((i,findex) => {
+        this.tableData.forEach((i, findex) => {
           if (i.spec_id === spec_id) {
             this.tableData[findex].id = id;
             this.tableData[findex].spec_id = spec_id;
@@ -625,6 +1098,35 @@ export default {
       }
       this.showModel = false;
     },
+    //阶梯成本修改
+    costrefreshEdit(e) {
+      let item = JSON.parse(JSON.stringify(e));
+      console.log(item);
+      const { index, id, cost_fee, delivery_fee, min_num, spec_value_value } =
+        item;
+      if (index + "" === "-1") {
+        this.tableData1.push(item);
+      } else {
+        this.tableData1.forEach((i, findex) => {
+          if (i.id === id && findex === parseInt(i.index)) {
+            this.tableData[findex].id = id;
+            this.tableData[findex].cost_fee = cost_fee;
+            this.tableData[findex].delivery_fee = delivery_fee;
+            this.tableData[findex].min_num = min_num;
+            this.tableData[findex].spec_value_value = spec_value_value;
+          }
+        });
+        this.tableData1 = this.tableData1.sort(this.dataSort("min_num"));
+      }
+      this.showModel = false;
+    },
+    dataSort(key) {
+      return function (a, b) {
+        let value1 = a[key];
+        let value2 = b[key];
+        return value1 - value2;
+      };
+    },
     //商品分类选择
     goods_class_change(e) {
       const { value, item } = e;
@@ -655,6 +1157,7 @@ export default {
     },
     //供应商选择
     supplierNosearchChange(e) {
+      console.log(e);
       const { id, code, label } = e;
       if (id) {
         this.ruleForm.supplierNo = [code];
@@ -663,6 +1166,7 @@ export default {
       }
       this.$refs.ruleForm.validateField("supplierNo");
     },
+    //业务企业选择
     company_idsearchChange(e) {
       const { id, code, label } = e;
       if (id) {
@@ -704,128 +1208,95 @@ export default {
       }
       this.$refs.ruleForm.validateField("noble_metal");
     },
-    async submitForm() {
-      await this.$refs.ruleForm.validate(async (valid) => {
-        if (valid) {
-          let change = false;
-          this.mock.forEach((v1) => {
-            if (v1.change && v1.change.length > 0) {
-              change = true;
-            }
-          });
-          if (!change) {
-            this.ruleForm.spec = "规格!";
-            return;
-          } else {
-            this.ruleForm.spec = "";
-            let table = false;
-            let hasnot = false;
-            let stock = [];
-            this.right.specList.forEach((v1) => {
-              if (v1) {
-                v1.forEach((v2) => {
-                  if (v2 && v2.limit && v2.limit.length > 0) {
-                    let list = [];
-                    v2.limit.forEach((v3) => {
-                      if (v3.num != 0 && v3.price != 0) {
-                        table = true;
-                        list.push(v3);
-                      }
-                      if (
-                        (v3.num != 0 && v3.price == 0) ||
-                        (v3.num == 0 && v3.price !== 0)
-                      ) {
-                        hasnot = true;
-                      }
-                    });
-                    if (list.length > 0) {
-                      let model = Object.assign({}, v2);
-                      model.limit = list;
-                      stock.push(model);
-                    }
-                  }
-                });
-              }
-            });
-
-            if (hasnot) {
-              this.ruleForm.table =
-                "起订量与成本价需成对填写,未成对请设为零!";
-            } else {
-              if (!table) {
-                this.ruleForm.table = "至少填写一堆起订量与成本价!";
-              } else {
-                this.ruleForm.table = "";
-                this.loading = true;
-                let obj = JSON.parse(JSON.stringify(this.ruleForm));
-                obj.stock = stock;
-                obj.cat_id = obj.cat_id[obj.cat_id.length - 1];
-                obj.image = obj.image.join();
-                //split(",");
-                console.log(obj);
-                let res = {};
-                if (this.id === "add") {
-                  delete obj["id"];
-                  res = await asyncRequest.add(obj);
-                } else {
-                  res = await asyncRequest.update(obj);
-                }
-                this.loading = false;
-                if (res.code === 0) {
-                  let title = this.id === "add" ? "添加成功" : "修改成功";
-                  this.$notify.success({
-                    title,
-                    message: "",
-                  });
-                  // 刷新
-                  this.$emit("refresh");
-                }
-              }
-            }
-          }
+    //仓库省市区
+    selectAreadelivery_place(e) {
+      this.ruleForm.delivery_place = e;
+      this.$refs.ruleForm.validateField("delivery_place");
+    },
+    //仓库省市区
+    selectAreaorigin_place(e) {
+      this.ruleForm.origin_place = e;
+      this.$refs.ruleForm.validateField("origin_place");
+    },
+    closeImg(index) {
+      this.ruleForm.good_info_img.splice(index, 1);
+      this.$refs.ruleForm.validateField("good_info_img");
+    },
+    //图片上传成功
+    async UploadSuccessEventgood_thumb_img(data) {
+      await this.UploadSuccessEvent(1, data);
+    },
+    // //图片上传成功
+    // async UploadSuccessEventgood_img(data) {
+    //   await this.UploadSuccessEvent(2, data);
+    // },
+    //图片上传成功
+    async UploadSuccessEventgood_info_img(data) {
+      await this.UploadSuccessEvent(3, data);
+    },
+    //图片上传成功
+    async UploadSuccessEvent(type, data) {
+      const { url } = data;
+      if (url === "noToken") {
+        await this.logout();
+      } else {
+        if (type === 1) {
+          this.ruleForm.good_thumb_img = url;
+          this.$refs.ruleForm.validateField("good_thumb_img");
+        } else if (type === 2) {
+          this.ruleForm.good_img = url;
+          this.$refs.ruleForm.validateField("good_img");
         } else {
-          console.log("error submit!!");
-          return false;
+          this.ruleForm.good_info_img.push(url);
+          this.$refs.ruleForm.validateField("good_info_img");
         }
-      });
+        this.$message.success("图片上传成功!");
+      }
     },
-
-    doExchange(arr) {
-      let len = arr.length;
-      // 当数组大于等于2个的时候
-      if (len >= 2) {
-        // 第一个数组的长度
-        let len1 = arr[0].length;
-        // 第二个数组的长度
-        let len2 = arr[1].length;
-        // 2个数组产生的组合数
-        let lenBoth = len1 * len2;
-        //  申明一个新数组
-        let items = new Array(lenBoth);
-        // 申明新数组的索引
-        let index = 0;
-        for (let i = 0; i < len1; i++) {
-          for (let j = 0; j < len2; j++) {
-            if (arr[0][i] instanceof Array) {
-              items[index] = arr[0][i].concat(arr[1][j]);
-            } else {
-              items[index] = [arr[0][i]].concat(arr[1][j]);
-            }
-            index++;
-          }
-        }
-        let newArr = new Array(len - 1);
-        for (let i = 2; i < arr.length; i++) {
-          newArr[i - 1] = arr[i];
-        }
-        newArr[0] = items;
-        return this.doExchange(newArr);
-      } else {
-        return arr[0];
+    //图片上传失败
+    UploadErrorEventgood_thumb_img(res) {
+      this.imgUploadError(1, res);
+    },
+    // //图片上传失败
+    // UploadErrorEventgood_img(res) {
+    //   this.imgUploadError(2, res);
+    // },
+    //图片上传失败
+    UploadErrorEventgood_info_img(res) {
+      this.imgUploadError(3, res);
+    },
+    imgUploadError(type, res) {
+      if (res !== "break") {
+        this.$message.error("图片上传失败!");
+        this.$refs.ruleForm.validateField(
+          type === 1
+            ? "good_thumb_img"
+            : type === 2
+            ? "good_img"
+            : "good_info_img"
+        );
+      }
+    },
+    //判断图片规格
+    beforeAvatarUpload(file) {
+      let isJPG = false;
+      if (
+        file.type === "image/jpg" ||
+        file.type === "image/png" ||
+        file.type === "image/jpeg"
+      ) {
+        isJPG = true;
+      }
+      const isLt2M = file.size / 1024 / 1024 < 1;
+      if (!isJPG) {
+        this.$message.error("图片格式不正确!");
+      }
+      if (!isLt2M) {
+        this.$message.error("图片大小不能超过 1MB!");
       }
+      return isJPG && isLt2M;
     },
   },
-  watch: {},
 };
 </script>
    <style lang="scss" scoped>

+ 0 - 484
src/views/goodStore/goodsCost/components/costForm.vue

@@ -1,484 +0,0 @@
-<template>
-  <el-form
-    :model="ruleForm"
-    status-icon
-    :rules="rulesThis"
-    ref="ruleForm"
-    :size="'mini'"
-    label-width="110px"
-    class="demo-ruleForm"
-  >
-    <el-row>
-      <el-col :span="1" class="dtitle">
-        <ul style="padding: 40px 0 0 0">
-          <li>固</li>
-          <li>定</li>
-          <li>成</li>
-          <li>本</li>
-        </ul></el-col
-      >
-      <el-col :span="23" class="dmain">
-        <el-row>
-          <el-col :span="8">
-            <el-form-item label="证书费" prop="cert_fee">
-              <el-input
-                placeholder="证书费"
-                v-model="ruleForm.cert_fee"
-                type="number"
-                :min="0"
-                :max="9999999999.99"
-                :step="2"
-              >
-                <template slot="append">元</template>
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="包装费" prop="packing_fee">
-              <el-input
-                placeholder="包装费"
-                v-model="ruleForm.packing_fee"
-                type="number"
-                :min="0"
-                :max="9999999999.99"
-                :step="2"
-              >
-                <template slot="append">元</template>
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="成本工艺费" prop="cost_fee">
-              <el-input
-                placeholder="成本工艺费"
-                v-model="ruleForm.cost_fee"
-                type="number"
-                :min="0"
-                :max="9999999999.99"
-                :step="2"
-              >
-                <template slot="append">元</template>
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="加标费" prop="mark_fee">
-              <el-input
-                placeholder="加标费"
-                v-model="ruleForm.mark_fee"
-                type="number"
-                :min="0"
-                :max="9999999999.99"
-                :step="2"
-              >
-                <template slot="append">元</template>
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="打样费" prop="demo_fee">
-              <el-input
-                placeholder="打样费"
-                v-model="ruleForm.demo_fee"
-                type="number"
-                :min="0"
-                :max="9999999999.99"
-                :step="2"
-              >
-                <template slot="append">元</template>
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="开模费" prop="open_fee">
-              <el-input
-                placeholder="开模费"
-                v-model="ruleForm.open_fee"
-                type="number"
-                :min="0"
-                :max="9999999999.99"
-                :step="2"
-              >
-                <template slot="append">元</template>
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="调样费" prop="sample_fee">
-              <el-input
-                placeholder="调样费"
-                v-model="ruleForm.sample_fee"
-                type="number"
-                :min="0"
-                :max="9999999999.99"
-                :step="2"
-              >
-                <template slot="append">元</template>
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="市场价" prop="market_price">
-              <el-input
-                placeholder="市场价"
-                v-model="ruleForm.market_price"
-                type="number"
-                :min="0"
-                :max="9999999999.99"
-                :step="2"
-              >
-                <template slot="append">元</template>
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="含税成本裸价" prop="nake_price">
-              <el-input
-                placeholder="含税成本裸价"
-                v-model="ruleForm.nake_price"
-                type="number"
-                :min="0"
-                :max="9999999999.99"
-                :step="2"
-              >
-                <template slot="append">元</template>
-              </el-input>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-col>
-    </el-row>
-    <el-row class="ddiv">
-      <el-col :span="1" class="dtitle">
-        <ul>
-          <li>阶</li>
-          <li>梯</li>
-          <li>成</li>
-          <li>本</li>
-        </ul></el-col
-      >
-      <el-col :span="23" class="dmain" style="padding-left: 18px">
-        <el-row>
-          <el-col :span="8">
-            <el-form-item label="启用阶梯" prop="is_step">
-              <el-select
-                v-model="ruleForm.is_step"
-                filterable
-                clearable
-                style="width: 100%"
-                placeholder="启用阶梯"
-              >
-                <el-option
-                  v-for="group in options5"
-                  :key="group.id"
-                  :label="group.name"
-                  :value="group.id"
-                />
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="24">
-            <el-table
-              :data="tableData"
-              :size="'mini'"
-              border
-              stripe
-              style="width: 100%"
-            >
-              <el-table-column prop="s1" label="起订量(>=)" />
-              <el-table-column prop="s2" label="成本裸价" />
-              <el-table-column prop="s3" label="成本合计" />
-              <el-table-column prop="s4" label="其中运费" />
-              <el-table-column prop="s5" label="使用状态" />
-              <el-table-column fixed="right">
-                <template slot="header" slot-scope="scope">
-                  <span>操作</span>
-                  <el-tooltip effect="dark" content="添加阶梯" placement="top">
-                    <i
-                      class="el-icon-circle-plus-outline tb-icon fr"
-                      @click="openEdit('add', {})"
-                    ></i>
-                  </el-tooltip>
-                </template>
-                <template slot-scope="scope">
-                  <el-tooltip effect="dark" content="修改" placement="top">
-                    <i class="el-icon-edit tb-icon" @click="openEdit('')"></i>
-                  </el-tooltip>
-                  <el-tooltip effect="dark" content="禁/启用" placement="top">
-                    <i
-                      class="el-icon-video-pause tb-icon"
-                      @click="openEdit('')"
-                    ></i>
-                    <!-- el-icon-video-play -->
-                  </el-tooltip>
-                </template>
-              </el-table-column>
-            </el-table>
-          </el-col>
-        </el-row>
-        <!-- 弹窗 新增/修改 -->
-        <cost-form-add-edit
-          :id="modelId"
-          :show-model="showModel"
-          :sitem="sitem"
-          @refresh="refreshEdit"
-          @cancel="showModel = false"
-        /> </el-col
-    ></el-row>
-  </el-form>
-</template>
-   <script>
-import asyncRequest from "@/apis/service/goodStore/goodsCost";
-import resToken from "@/mixins/resToken";
-import { options7 } from "../columns";
-import { mapGetters } from "vuex";
-import costFormAddEdit from "./costFormAddEdit";
-export default {
-  name: "goodsCostAdd",
-  mixins: [resToken],
-  components: {
-    costFormAddEdit,
-  },
-  computed: {
-    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
-    powers() {
-      let tran =
-        this.$store.getters.btnList.find(
-          (item) => item.menu_route == "goodsCostAdd"
-        ) || {};
-      if (tran && tran.action && tran.action.length > 0) {
-        return tran.action;
-      } else {
-        return [];
-      }
-    },
-  },
-  data() {
-    return {
-      showModel: false,
-      modelId: "000",
-      options7: options7,
-      sitem: {},
-      size: "small",
-      rulesThis: this.rules,
-      activeName: "1",
-      loading: false,
-      tableData: [{ id: 1, s1: "1", s2: "-", s3: "-", s4: "-", s5: "0" }],
-      rules: {
-        cert_fee: [
-          {
-            required: true,
-            message: "证书费应为合法数字",
-            trigger: "blur",
-          },
-        ],
-        packing_fee: [
-          {
-            required: true,
-            message: "包装费应为合法数字",
-            trigger: "blur",
-          },
-        ],
-        cost_fee: [
-          {
-            required: true,
-            message: "成本工艺费应为合法数字",
-            trigger: "blur",
-          },
-        ],
-        mark_fee: [
-          {
-            required: true,
-            message: "加标费应为合法数字",
-            trigger: "blur",
-          },
-        ],
-        demo_fee: [
-          {
-            required: true,
-            message: "打样应为合法数字",
-            trigger: "blur",
-          },
-        ],
-        open_fee: [
-          {
-            required: true,
-            message: "开模费应为合法数字",
-            trigger: "blur",
-          },
-        ],
-        sample_fee: [
-          {
-            required: true,
-            message: "调样费应为合法数字",
-            trigger: "blur",
-          },
-        ],
-        market_price: [
-          {
-            required: true,
-            message: "市场价应为合法数字",
-            trigger: "blur",
-          },
-        ],
-        nake_price: [
-          {
-            required: true,
-            message: "含税成本裸价应为合法数字",
-            trigger: "blur",
-          },
-        ],
-        is_step: {
-          required: true,
-          message: "请选择是否启用阶梯",
-          trigger: "change",
-        },
-      },
-      ruleForm: {},
-    };
-  },
-  mounted() {
-    this.initForm();
-  },
-  methods: {
-    async initForm() {
-      this.loading = true;
-      this.resetFormData();
-      this.rulesThis = this.rules;
-      await this.resetForm();
-      this.loading = false;
-    },
-    handleClick(row) {
-      console.log(row);
-    },
-    refreshEdit(e) {
-      console.log(e);
-    },
-    openEdit(type, sitem) {
-      this.sitem = sitem;
-      this.modelId = type;
-      this.showModel = true;
-    },
-    async initData() {
-      this.loading = true;
-      let res = await asyncRequest.detail({ id: this.id });
-      this.loading = false;
-      if (res.code === 0) {
-        await this.resetForm(res.data);
-      }
-    },
-    async resetForm() {
-      // 重置
-      await this.$nextTick(async () => {
-        if (this.$refs.ruleForm) {
-          this.$refs.ruleForm.resetFields();
-          this.$refs.ruleForm.clearValidate();
-          this.resetFormData();
-        }
-      });
-    },
-    resetFormData() {
-      this.ruleForm = {
-        cert_fee: "",
-        packing_fee: "",
-        cost_fee: "",
-        mark_fee: "",
-        demo_fee: "",
-        open_fee: "",
-        sample_fee: "",
-        market_price: "",
-        nake_price: "",
-        b1: [],
-      };
-    },
-    async submitForm() {
-      await this.$refs.ruleForm.validate(async (valid) => {
-        if (valid) {
-          let change = false;
-          this.mock.forEach((v1) => {
-            if (v1.change && v1.change.length > 0) {
-              change = true;
-            }
-          });
-          if (!change) {
-            this.ruleForm.spec = "规格!";
-            return;
-          } else {
-            this.ruleForm.spec = "";
-            let table = false;
-            let hasnot = false;
-            let stock = [];
-            this.right.specList.forEach((v1) => {
-              if (v1) {
-                v1.forEach((v2) => {
-                  if (v2 && v2.limit && v2.limit.length > 0) {
-                    let list = [];
-                    v2.limit.forEach((v3) => {
-                      if (v3.num != 0 && v3.price != 0) {
-                        table = true;
-                        list.push(v3);
-                      }
-                      if (
-                        (v3.num != 0 && v3.price == 0) ||
-                        (v3.num == 0 && v3.price !== 0)
-                      ) {
-                        hasnot = true;
-                      }
-                    });
-                    if (list.length > 0) {
-                      let model = Object.assign({}, v2);
-                      model.limit = list;
-                      stock.push(model);
-                    }
-                  }
-                });
-              }
-            });
-
-            if (hasnot) {
-              this.ruleForm.table =
-                "起订量与成本价需成对填写,未成对请设为零!";
-            } else {
-              if (!table) {
-                this.ruleForm.table = "至少填写一堆起订量与成本价!";
-              } else {
-                this.ruleForm.table = "";
-                this.loading = true;
-                let obj = JSON.parse(JSON.stringify(this.ruleForm));
-                obj.stock = stock;
-                obj.catid = obj.catid[obj.catid.length - 1];
-                obj.image = obj.image.join();
-                //split(",");
-                console.log(obj);
-                let res = {};
-                if (this.id === "add") {
-                  delete obj["id"];
-                  res = await asyncRequest.add(obj);
-                } else {
-                  res = await asyncRequest.update(obj);
-                }
-                this.loading = false;
-                if (res.code === 0) {
-                  let title = this.id === "add" ? "添加成功" : "修改成功";
-                  this.$notify.success({
-                    title,
-                    message: "",
-                  });
-                  // 刷新
-                  this.$emit("refresh");
-                }
-              }
-            }
-          }
-        } else {
-          console.log("error submit!!");
-          return false;
-        }
-      });
-    },
-  },
-};
-</script>
-   <style lang="scss" scoped>
-</style>
-   

+ 40 - 147
src/views/goodStore/goodsCost/components/costFormAddEdit.vue

@@ -25,79 +25,61 @@
             label-width="80px"
             class="demo-ruleForm"
           >
-            <el-form-item label="起订量" prop="s1">
+            <el-form-item label="起订量" prop="min_num">
               <el-input
                 placeholder="起订量"
-                v-model="ruleForm.s1"
+                v-model="ruleForm.min_num"
                 type="number"
                 :min="0"
                 :max="9999999999"
                 :step="0"
               />
             </el-form-item>
-            <el-form-item label="成本裸价" prop="s2">
+            <el-form-item label="成本合计" prop="nake_fee">
               <el-input
-                placeholder="成本裸价"
-                v-model="ruleForm.s2"
+                placeholder="成本合计"
+                v-model="ruleForm.nake_fee"
                 type="number"
                 :min="0"
-                :max="9999999999"
+                :max="9999999999.99"
                 :step="2"
               >
                 <template slot="append">元</template>
               </el-input>
             </el-form-item>
-            <el-form-item label="成本合计" prop="s2">
+            <el-form-item label="工艺费" prop="cost_fee">
               <el-input
-                placeholder="成本合计"
-                v-model="ruleForm.s2"
+                placeholder="工艺费"
+                v-model="ruleForm.cost_fee"
                 type="number"
                 :min="0"
-                :max="9999999999"
+                :max="9999999999.99"
                 :step="2"
               >
                 <template slot="append">元</template>
               </el-input>
             </el-form-item>
-            <el-form-item label="其中运费" prop="s2">
+
+            <el-form-item label="其中运费" prop="delivery_fee">
               <el-input
                 placeholder="其中运费"
-                v-model="ruleForm.s2"
+                v-model="ruleForm.delivery_fee"
                 type="number"
                 :min="0"
-                :max="9999999999"
+                :max="9999999999.99"
                 :step="2"
               >
                 <template slot="append">元</template>
               </el-input>
             </el-form-item>
-            <el-form-item label="使用状态" prop="s5">
-              <el-select
-                v-model="ruleForm.s5"
-                style="width: 100%"
-                placeholder="使用状态"
-              >
-                <el-option
-                  v-for="item in options"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                >
-                </el-option>
-              </el-select>
-            </el-form-item>
           </el-form>
         </el-col>
-        <el-col :span="24" style="text-align: right; padding-top: 18px">
-          <el-button
-            v-if="id !== 'edit'"
-            :size="'small'"
-            type="primary"
-            @click="submitForm"
+        <el-col :span="24" style="text-align: right">
+          <el-button :size="'small'" type="primary" @click="submitForm"
             >保 存
           </el-button>
           <el-button @click="showModelThis = false" :size="'small'">{{
-            id == "edit" ? "关 闭" : "取 消"
+            "取 消"
           }}</el-button>
         </el-col>
       </el-row>
@@ -105,39 +87,31 @@
   </el-dialog>
 </template>
 <script>
-import asyncRequest from "@/apis/service/goodStore/brand";
 import resToken from "@/mixins/resToken";
 export default {
   name: "brand",
-  props: ["showModel", "id", "sitem"],
+  props: ["showModel", "index", "sitem"],
   mixins: [resToken],
   data() {
     return {
       loading: false,
       title: "",
       showModelThis: this.showModel,
-      options: [
-        { value: "1", label: "启用" },
-        { value: "0", label: "禁用" },
-      ],
       ruleForm: {},
       rulesThis: this.rules,
       rules: {
-        s1: [
+        min_num: [
           { required: true, message: "起订量应为合法数字", trigger: "blur" },
         ],
-        s2: [
-          { required: true, message: "成本裸价应为合法数字", trigger: "blur" },
+        cost_fee: [
+          { required: true, message: "工艺费应为合法数字", trigger: "blur" },
         ],
-        s3: [
+        nake_fee: [
           { required: true, message: "成本合计应为合法数字", trigger: "blur" },
         ],
-        s4: [
+        delivery_fee: [
           { required: true, message: "其中运费应为合法数字", trigger: "blur" },
         ],
-        s5: [
-          { required: true, message: "请选择使用状态", trigger: "change" },
-        ],
       },
     };
   },
@@ -157,126 +131,45 @@ export default {
   methods: {
     async initForm() {
       this.loading = true;
-      this.resetFormData();
-      if (this.id === "add") {
+      await this.resetFormData();
+      console.log(this.index);
+      if (this.index + "" === "-1") {
         this.title = "添加成本阶梯";
-
-        this.rulesThis = this.rules;
-      } else if (this.id === "005") {
-        this.title = "修改成本阶梯";
-        this.rulesThis = this.rules;
       } else {
-        this.title = "成本阶梯详情";
-        this.rulesThis = {};
+        this.title = "修改成本阶梯";
       }
+
       await this.resetForm();
       this.loading = false;
     },
     async resetForm() {
       // 重置
-      await this.$nextTick(() => {
+      await this.$nextTick(async () => {
         if (this.$refs.ruleForm) {
           this.$refs.ruleForm.resetFields();
           this.$refs.ruleForm.clearValidate();
-          this.resetFormData();
+          await this.resetFormData();
         }
       });
     },
-    resetFormData() {
-      const { id, s1, s2, s3, s4, s5 } = this.sitem;
+    async resetFormData() {
+      const { id, min_num, cost_fee, nake_fee, delivery_fee } = this.sitem;
       this.ruleForm = {
         id: id || "",
-        s1: s1 || "",
-        s2: s2 || "",
-        s3: s3 || "",
-        s4: s4 || "",
-        s5: s5 || "0",
+        index: this.index,
+        min_num: min_num || "",
+        cost_fee: cost_fee || "",
+        nake_fee: nake_fee || "",
+        delivery_fee: delivery_fee || "",
       };
     },
-    s1searchChange(e) {
-      const { id, code, label } = e;
-      if (id) {
-        this.ruleForm.s1 = code;
-      } else {
-        this.ruleForm.s1 = "";
-      }
-      this.$refs.ruleForm.validateField("s1");
-      this.getlist();
-    },
-    async getlist() {
-      const { s1 } = this.ruleForm;
-      const { code, data, message } = await asyncRequest.list({
-        s1: s1,
-      });
-      if (code === 0) {
-        this.options = data;
-      } else if (code >= 100 && code <= 104) {
-        await this.logout();
-      } else {
-        this.$message.warning(message);
-      }
-    },
 
     async submitForm() {
       await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
-          this.loading = true;
-          let model = JSON.parse(JSON.stringify(this.ruleForm));
-          let res = {};
-          if (this.id === "003") {
-            delete model["id"];
-            res = await asyncRequest.add(model);
-          } else {
-            res = await asyncRequest.update(model);
-          }
-          this.loading = false;
-          if (res && res.code === 0) {
-            const title = this.id === "add" ? "添加成功!" : "修改成功!";
-            this.$notify.success({
-              title,
-              message: "",
-            });
-            this.showModelThis = false;
-            // 刷新
-            this.$emit("refresh");
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
-          }
-        } else {
-          console.log("error submit!!");
-          return false;
-        }
-      });
-    },
-    async submitForm1() {
-      await this.$refs.ruleForm.validate(async (valid) => {
-        if (valid) {
-          this.loading = true;
-          let model = JSON.parse(JSON.stringify(this.ruleForm));
-          let res = {};
-          if (this.id === "003") {
-            delete model["id"];
-            res = await asyncRequest.add(model);
-          } else {
-            res = await asyncRequest.update(model);
-          }
-          this.loading = false;
-          if (res && res.code === 0) {
-            const title = this.id === "add" ? "添加成功!" : "修改成功!";
-            this.$notify.success({
-              title,
-              message: "",
-            });
-            this.showModelThis = false;
-            // 刷新
-            this.$emit("refresh");
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
-          }
+          this.showModelThis = false;
+          // 刷新
+          this.$emit("refresh", this.ruleForm);
         } else {
           console.log("error submit!!");
           return false;

+ 0 - 679
src/views/goodStore/goodsCost/components/packForm.vue

@@ -1,679 +0,0 @@
-<template>
-  <el-form
-    :model="ruleForm"
-    status-icon
-    :rules="rulesThis"
-    ref="ruleForm"
-    :size="'mini'"
-    label-width="110px"
-    class="demo-ruleForm"
-  >
-    <el-row>
-      <el-col :span="1" class="dtitle">
-        <ul>
-          <li>包</li>
-          <li>装</li>
-          <li>信</li>
-          <li>息</li>
-        </ul></el-col
-      >
-      <el-col :span="23" class="dmain">
-        <el-row>
-          <el-col :span="8">
-            <el-form-item label="包装清单" prop="packing_list">
-              <el-input
-                placeholder="包装清单"
-                v-model="ruleForm.packing_list"
-                maxlength="250"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="包装方式" prop="packing_way">
-              <el-input
-                placeholder="包装方式"
-                v-model="ruleForm.packing_way"
-                maxlength="250"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="装箱规格" prop="packing_spec">
-              <el-input
-                placeholder="装箱规格"
-                v-model="ruleForm.packing_spec"
-                maxlength="250"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="装箱重量" prop="packing_weight">
-              <el-input
-                placeholder="装箱重量"
-                v-model="ruleForm.packing_weight"
-                type="number"
-                :min="0"
-                :max="9999999999.99"
-                :step="2"
-              >
-                <template slot="append">g</template>
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="装箱尺寸" prop="packing_szie">
-              <el-input
-                placeholder="装箱尺寸"
-                v-model="ruleForm.packing_szie"
-                maxlength="250"
-              />
-            </el-form-item>
-          </el-col>
-
-          <el-col :span="8">
-            <el-form-item label="商品条形码" prop="good_bar">
-              <el-input
-                placeholder="物流时间"
-                v-model="ruleForm.good_bar"
-                type="number"
-                :min="0"
-                :max="9999999999999"
-                :step="0"
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-col>
-    </el-row>
-    <el-row class="ddiv">
-      <el-col :span="1" class="dtitle">
-        <ul>
-          <li>发</li>
-          <li>货</li>
-          <li>信</li>
-          <li>息</li>
-        </ul></el-col
-      >
-      <el-col :span="23" class="dmain">
-        <el-row>
-          <el-col :span="8">
-            <el-form-item label="供货区域" prop="supply_area">
-              <el-select
-                v-model="ruleForm.supply_area"
-                filterable
-                clearable
-                style="width: 100%"
-                placeholder="供货区域"
-              >
-                <el-option
-                  v-for="group in options6"
-                  :key="group.id"
-                  :label="group.name"
-                  :value="group.id"
-                />
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="发货地" prop="delivery_place">
-              <select-area
-                :placeholder="'发货地'"
-                :value="ruleForm.delivery_place"
-                :is-detail="id !== 'add'"
-                :disabled="isDetail"
-                :size="'mini'"
-                @selectChange="selectAreadelivery_place"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="产地" prop="origin_place">
-              <select-area
-                :placeholder="'产地'"
-                :value="ruleForm.origin_place"
-                :size="'mini'"
-                :is-detail="id !== 'add'"
-                :disabled="isDetail"
-                @selectChange="selectAreaorigin_place"
-              />
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="物流时间" prop="delivery_day">
-              <el-input
-                placeholder="物流时间"
-                v-model="ruleForm.delivery_day"
-                type="number"
-                :min="0"
-                :max="9999999999"
-                :step="0"
-              >
-                <template slot="append">天</template>
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="供货周期" prop="lead_time">
-              <el-input
-                placeholder="供货周期"
-                v-model="ruleForm.lead_time"
-                type="number"
-                :min="0"
-                :max="9999999999"
-                :step="0"
-              >
-                <template slot="append">天</template>
-              </el-input>
-            </el-form-item>
-          </el-col>
-          <el-col :span="8">
-            <el-form-item label="调样周期" prop="sample_day">
-              <el-input
-                placeholder="调样周期"
-                v-model="ruleForm.sample_day"
-                type="number"
-                :min="0"
-                :max="9999999999"
-                :step="0"
-              >
-                <template slot="append">天</template>
-              </el-input>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-col>
-    </el-row>
-    <el-row class="ddiv">
-      <el-col :span="1" class="dtitle">
-        <ul>
-          <li>图</li>
-          <li>片</li>
-          <li>信</li>
-          <li>息</li>
-        </ul></el-col
-      >
-      <el-col :span="23" class="dmain">
-        <el-row style="padding: 0 0 20px 0">
-          <el-col :span="8">
-            <el-form-item label="缩略图" prop="good_thumb_img" class="activity-upload">
-              <div class="btnupload" style="position: relative">
-                <img v-if="ruleForm.good_thumb_img" :src="ruleForm.good_thumb_img" class="avatar" />
-                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
-                <file-upload
-                  class="Upload"
-                  :disabled="id == '007'"
-                  :accept="'.jpg,.png,.jpeg'"
-                  :multiple="true"
-                  :uploadcondition="beforeAvatarUpload"
-                  @UploadErrorEvent="UploadErrorEventgood_thumb_img"
-                  @UploadSuccessEvent="UploadSuccessEventgood_thumb_img"
-                ></file-upload>
-              </div>
-              <div class="txt-tips fl">
-                <p>尺寸比例:</p>
-                <p>1:1</p>
-              </div>
-            </el-form-item>
-            <el-form-item label="详情主图" prop="good_img" class="activity-upload">
-              <div class="btnupload" style="position: relative">
-                <img v-if="ruleForm.good_img" :src="ruleForm.good_img" class="avatar" />
-                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
-                <file-upload
-                  class="Upload"
-                  :disabled="id == '007'"
-                  :accept="'.jpg,.png,.jpeg'"
-                  :multiple="true"
-                  :uploadcondition="beforeAvatarUpload"
-                  @UploadErrorEvent="UploadErrorEventgood_img"
-                  @UploadSuccessEvent="UploadSuccessEventgood_img"
-                ></file-upload>
-              </div>
-            </el-form-item>
-                 <div style="font-size: 12px; color: #606266">
-            <span style="padding: 0 0 0 20px">图片大小:小于1M</span>
-            <span style="padding: 0 0 0 20px">图片类型.jpg/png/jpeg</span>
-          </div>
-          </el-col>
-          <el-col :span="16">
-            <el-form-item label="详情介绍图" prop="good_info_img">
-              <div class="good_info_img-div">
-                <ul v-if="ruleForm.good_info_img" class="clear">
-                  <li class="img-show-li" v-viewer v-for="(img, iindex) in ruleForm.good_info_img" :key="img + iindex">
-                    <img :src="img" alt="" />
-                    <i class="el-icon-close" @click="closeImg(iindex)"></i>
-                  </li>
-                  <li class="img-upload-li" v-if="ruleForm.good_info_img.length < 10">
-                    <div class="activity-upload">
-                      <div class="btnupload" style="position: relative">
-                        <i class="el-icon-plus avatar-uploader-icon"></i>
-                        <file-upload
-                          class="Upload"
-                          :disabled="id == '007'"
-                          :accept="'.jpg,.png,.jpeg'"
-                          :multiple="true"
-                          :uploadcondition="beforeAvatarUpload"
-                          @UploadErrorEvent="UploadErrorEventgood_info_img"
-                          @UploadSuccessEvent="UploadSuccessEventgood_info_img"
-                        ></file-upload>
-                      </div>
-                    </div>
-                  </li>
-                </ul>
-              </div>
-            </el-form-item>
-          </el-col>
-     
-        </el-row>
-      </el-col>
-    </el-row>
-  </el-form>
-</template>
-   <script>
-import asyncRequest from "@/apis/service/goodStore/goodsCost";
-import resToken from "@/mixins/resToken";
-import { mapGetters } from "vuex";
-import { options6 } from "../columns";
-export default {
-  name: "goodsCostAdd",
-  mixins: [resToken],
-  computed: {
-    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
-    powers() {
-      let tran =
-        this.$store.getters.btnList.find(
-          (item) => item.menu_route == "goodsCostAdd"
-        ) || {};
-      if (tran && tran.action && tran.action.length > 0) {
-        return tran.action;
-      } else {
-        return [];
-      }
-    },
-  },
-  data() {
-    return {
-      size: "small",
-      rulesThis: this.rules,
-      loading: false,
-      options6: options6,
-      ruleForm: {},
-      rules: {
-        packing_list: [
-          {
-            required: true,
-            message: "请输入包装清单",
-            trigger: "blur",
-          },
-        ],
-        packing_way: [
-          {
-            required: true,
-            message: "请输入包装方式",
-            trigger: "blur",
-          },
-        ],
-
-        packing_spec: [
-          {
-            required: true,
-            message: "请输入装箱规格",
-            trigger: "blur",
-          },
-        ],
-        packing_weight: [
-          {
-            required: true,
-            message: "请输入装箱重量",
-            trigger: "blur",
-          },
-        ],
-        packing_szie: [
-          {
-            required: true,
-            message: "请输入装箱尺寸",
-            trigger: "blur",
-          },
-        ],
-        supply_area: [
-          {
-            required: true,
-            message: "请选择供货区域",
-            trigger: "change",
-          },
-        ],
-        delivery_place: [
-          {
-            type: "array",
-            required: true,
-            message: "请选择发货地",
-            trigger: "change",
-          },
-        ],
-        origin_place: [
-          {
-            type: "array",
-            required: true,
-            message: "请选择产地",
-            trigger: "change",
-          },
-        ],
-        delivery_day: [
-          {
-            required: true,
-            message: "请输入物流时间",
-            trigger: "blur",
-          },
-        ],
-        lead_time: [
-          {
-            required: true,
-            message: "请输入供货周期",
-            trigger: "blur",
-          },
-        ],
-        sample_day: [
-          {
-            required: true,
-            message: "请输入调样周期",
-            trigger: "blur",
-          },
-        ],
-        good_thumb_img: [
-          {
-            required: true,
-            message: "商品缩略图",
-            trigger: "change",
-          },
-        ],
-        good_img: [
-          {
-            required: true,
-            message: "商品详情主图",
-            trigger: "change",
-          },
-        ],
-        good_info_img: [
-          {
-            type: "array",
-            required: true,
-            message: "商品详情介绍图",
-            trigger: "change",
-          },
-        ],
-      },
-    };
-  },
-  mounted() {
-    this.initForm();
-  },
-  methods: {
-    async initForm() {
-      this.loading = true;
-      this.resetFormData();
-      this.rulesThis = this.rules;
-      await this.resetForm();
-      this.loading = false;
-    },
-    handleClick(row) {
-      console.log(row);
-    },
-    async initData() {
-      this.loading = true;
-      let res = await asyncRequest.detail({ id: this.id });
-      this.loading = false;
-      if (res.code === 0) {
-        await this.resetForm(res.data);
-      }
-    },
-    async resetForm() {
-      // 重置
-      await this.$nextTick(async () => {
-        if (this.$refs.ruleForm) {
-          this.$refs.ruleForm.resetFields();
-          this.$refs.ruleForm.clearValidate();
-          this.resetFormData();
-        }
-      });
-    },
-    resetFormData() {
-      this.ruleForm = {
-        packing_list: "",
-        packing_way: "",
-        packing_spec: "",
-        packing_weight: "",
-        packing_szie: "",
-        good_bar: "",
-        supply_area: "",
-        delivery_place: [],
-        origin_place: [],
-        delivery_day: "",
-        lead_time: "",
-        sample_day: "",
-        good_thumb_img: "",
-        good_img: "",
-        good_info_img: [],
-      };
-    },
-    //仓库省市区
-    selectAreadelivery_place(e) {
-      this.ruleForm.delivery_place = e;
-      this.$refs.ruleForm.validateField("delivery_place");
-    },
-    //仓库省市区
-    selectAreaorigin_place(e) {
-      this.ruleForm.origin_place = e;
-      this.$refs.ruleForm.validateField("origin_place");
-    },
-    async submitForm() {
-      await this.$refs.ruleForm.validate(async (valid) => {
-        if (valid) {
-          let change = false;
-          this.mock.forEach((v1) => {
-            if (v1.change && v1.change.length > 0) {
-              change = true;
-            }
-          });
-          if (!change) {
-            this.ruleForm.spec = "规格!";
-            return;
-          } else {
-            this.ruleForm.spec = "";
-            let table = false;
-            let hasnot = false;
-            let stock = [];
-            this.right.specList.forEach((v1) => {
-              if (v1) {
-                v1.forEach((v2) => {
-                  if (v2 && v2.limit && v2.limit.length > 0) {
-                    let list = [];
-                    v2.limit.forEach((v3) => {
-                      if (v3.num != 0 && v3.price != 0) {
-                        table = true;
-                        list.push(v3);
-                      }
-                      if (
-                        (v3.num != 0 && v3.price == 0) ||
-                        (v3.num == 0 && v3.price !== 0)
-                      ) {
-                        hasnot = true;
-                      }
-                    });
-                    if (list.length > 0) {
-                      let model = Object.assign({}, v2);
-                      model.limit = list;
-                      stock.push(model);
-                    }
-                  }
-                });
-              }
-            });
-
-            if (hasnot) {
-              this.ruleForm.table =
-                "起订量与成本价需成对填写,未成对请设为零!";
-            } else {
-              if (!table) {
-                this.ruleForm.table = "至少填写一堆起订量与成本价!";
-              } else {
-                this.ruleForm.table = "";
-                this.loading = true;
-                let obj = JSON.parse(JSON.stringify(this.ruleForm));
-                obj.stock = stock;
-                obj.catid = obj.catid[obj.catid.length - 1];
-                obj.image = obj.image.join();
-                //split(",");
-                console.log(obj);
-                let res = {};
-                if (this.id === "add") {
-                  delete obj["id"];
-                  res = await asyncRequest.add(obj);
-                } else {
-                  res = await asyncRequest.update(obj);
-                }
-                this.loading = false;
-                if (res.code === 0) {
-                  let title = this.id === "add" ? "添加成功" : "修改成功";
-                  this.$notify.success({
-                    title,
-                    message: "",
-                  });
-                  // 刷新
-                  this.$emit("refresh");
-                }
-              }
-            }
-          }
-        } else {
-          console.log("error submit!!");
-          return false;
-        }
-      });
-    },
-
-    closeImg(index) {
-      this.ruleForm.good_info_img.splice(index, 1);
-      this.$refs.ruleForm.validateField("good_info_img");
-    },
-    //图片上传成功
-    async UploadSuccessEventgood_thumb_img(data) {
-      await this.UploadSuccessEvent(1, data);
-    },
-    //图片上传成功
-    async UploadSuccessEventgood_img(data) {
-      await this.UploadSuccessEvent(2, data);
-    },
-    //图片上传成功
-    async UploadSuccessEventgood_info_img(data) {
-      await this.UploadSuccessEvent(3, data);
-    },
-    //图片上传成功
-    async UploadSuccessEvent(type, data) {
-      const { url } = data;
-      if (url === "noToken") {
-        await this.logout();
-      } else {
-        if (type === 1) {
-          this.ruleForm.good_thumb_img = url;
-          this.$refs.ruleForm.validateField("good_thumb_img");
-        } else if (type === 2) {
-          this.ruleForm.good_img = url;
-          this.$refs.ruleForm.validateField("good_img");
-        } else {
-          this.ruleForm.good_info_img.push(url);
-          this.$refs.ruleForm.validateField("good_info_img");
-        }
-        this.$message.success("图片上传成功!");
-      }
-    },
-    //图片上传失败
-    UploadErrorEventgood_thumb_img(res) {
-      this.imgUploadError(1, res);
-    },
-    //图片上传失败
-    UploadErrorEventgood_img(res) {
-      this.imgUploadError(2, res);
-    },
-    //图片上传失败
-    UploadErrorEventgood_info_img(res) {
-      this.imgUploadError(3, res);
-    },
-    imgUploadError(type, res) {
-      if (res !== "break") {
-        this.$message.error("图片上传失败!");
-        this.$refs.ruleForm.validateField(
-          type === 1 ? "good_thumb_img" : type === 2 ? "good_img" : "good_info_img"
-        );
-      }
-    },
-    //判断图片规格
-    beforeAvatarUpload(file) {
-      let isJPG = false;
-      if (
-        file.type === "image/jpg" ||
-        file.type === "image/png" ||
-        file.type === "image/jpeg"
-      ) {
-        isJPG = true;
-      }
-      const isLt2M = file.size / 1024 / 1024 < 1;
-      if (!isJPG) {
-        this.$message.error("图片格式不正确!");
-      }
-      if (!isLt2M) {
-        this.$message.error("图片大小不能超过 1MB!");
-      }
-      return isJPG && isLt2M;
-    },
-  },
-};
-</script>
-   <style lang="scss" scoped>
-.goodsCostAdd {
-  .good_info_img-div {
-    ul {
-      float: left;
-      width: 100%;
-
-      li {
-        float: left;
-        width: 102px;
-        height: 102px;
-        overflow: hidden;
-        margin: 0 10px 10px 0;
-        border: 1px solid rgb(220, 223, 230);
-        position: relative;
-        &.img-upload-li {
-          border: 0;
-        }
-        &.img-show-li {
-          img {
-            display: inline-block;
-            width: 100%;
-          }
-          i {
-            position: absolute;
-            width: 20px;
-            height: 20px;
-            font-size: 13px;
-            text-align: center;
-            line-height: 20px;
-            top: 0;
-            right: 0;
-            z-index: 2;
-            color: rgb(220, 223, 230);
-          }
-          &:hover {
-            i {
-              color: #63cbe7;
-              &:hover {
-                cursor: pointer;
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-}
-</style>
-   

+ 0 - 751
src/views/goodStore/goodsCost/index copy.vue

@@ -1,751 +0,0 @@
-<template>
-  <div class="goodsCost pagePadding">
-    <div
-      v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
-    >
-      <el-row style="margin-bottom: 10px">
-        <el-col :span="6" style="width: 316px">
-          <period-date-picker
-            :start="parmValue.start"
-            :end="parmValue.end"
-            :type="1"
-            :width="'147px'"
-            :size="searchSize"
-            @timeReturned="timeReturned($event)"
-          ></period-date-picker>
-        </el-col>
-        <el-col :span="18" id="el-cor-full-style">
-          <el-row :gutter="10">
-            <el-col :span="6">
-              <el-cascader
-                v-model="parmValue.catid"
-                style="width: 100%"
-                filterable
-                :size="searchSize"
-                clearable
-                placeholder="商品分类"
-                :options="catOptions"
-                :props="{ expandTrigger: 'hover', checkStrictly: true }"
-                @change="handleChange"
-              ></el-cascader>
-            </el-col>
-            <el-col :span="6">
-              <el-select
-                v-model="parmValue.status"
-                filterable
-                clearable
-                :size="searchSize"
-                placeholder="请选择状态"
-                style="width: 100%"
-              >
-                <el-option
-                  v-for="item in statusList"
-                  :key="'status' + item.code"
-                  :label="item.name"
-                  :value="item.code"
-                />
-              </el-select>
-            </el-col>
-
-            <el-col :span="6">
-              <el-input
-                :size="searchSize"
-                style="100%"
-                v-model="parmValue.supplier_name"
-                :maxlength="40"
-                placeholder="供货商名称"
-              ></el-input>
-            </el-col>
-            <el-col :span="6">
-              <el-input
-                :size="searchSize"
-                style="100%"
-                v-model="parmValue.good_code"
-                :maxlength="40"
-                placeholder="商品编码"
-              ></el-input>
-            </el-col>
-          </el-row>
-        </el-col>
-      </el-row>
-      <el-row style="margin-bottom: 18px">
-        <el-col :span="6" style="width: 316px">
-          <el-input
-            :size="searchSize"
-            :maxlength="10"
-            placeholder="最低售价"
-            v-model="parmValue.sale_price_start"
-            style="width: 150px"
-          ></el-input>
-          <samp>至</samp>
-          <el-input
-            :size="searchSize"
-            :maxlength="10"
-            placeholder="最高售价"
-            v-model="parmValue.sale_price_end"
-            style="width: 150px"
-          ></el-input>
-        </el-col>
-
-        <el-col :span="18" id="el-cor-full-style">
-          <el-row :gutter="10">
-            <el-col :span="12">
-              <el-input
-                :size="searchSize"
-                v-model="parmValue.goods_name"
-                :maxlength="40"
-                placeholder="商品名称"
-              >
-                <el-button
-                  slot="append"
-                  icon="el-icon-search"
-                  @click="searchList"
-                ></el-button>
-              </el-input>
-            </el-col>
-            <el-col :span="12">
-              <el-button
-                v-if="powers.some((item) => item == '024')"
-                type="warning"
-                class="fl"
-                :size="searchSize"
-                @click="restSearch"
-              >
-                重置
-              </el-button>
-              <el-button
-                v-if="powers.some((item) => item == '002')"
-                type="primary"
-                :size="searchSize"
-                class="fr"
-                style="margin-left: 5px"
-                @click="searchList"
-              >
-                刷新
-              </el-button>
-              <el-button
-                v-if="powers.some((item) => item == '003')"
-                type="success"
-                :size="searchSize"
-                style="float: right"
-                @click="routeGoto('goodsCostAdd', {})"
-              >
-                添加
-              </el-button>
-            </el-col>
-          </el-row></el-col
-        >
-      </el-row>
-      <el-table
-        :data="tableData"
-        stripe
-        v-loading="loading"
-        border
-        :size="size"
-        style="width: 100%"
-      >
-        <el-table-column label="商品信息" align="left" min-width="165">
-          <template slot-scope="item">
-            <div class="good_name_title">
-              {{ item.row.good_name }}
-            </div>
-            <div
-              class="good_name_img"
-              v-if="item.row.galleyList && item.row.galleyList.length > 0"
-            >
-              <img
-                v-for="(img, i) in item.row.galleyList"
-                :key="item.row.id + 'goodimg' + i"
-                :src="img"
-                @click="showGalley(item.row.galleyList, i)"
-                alt=""
-              />
-            </div> </template
-        ></el-table-column>
-        <el-table-column label="供应商信息" show-overflow-tooltip align="left">
-          <template slot-scope="item">
-            <div v-if="item.row.supplier_info">
-              <div class="good_name_title">
-                企业:{{ item.row.supplier_info.company }}
-              </div>
-              <div class="good_name_title">
-                联系人:{{ item.row.supplier_info.name }}
-              </div>
-            </div>
-          </template></el-table-column
-        >
-        <el-table-column
-          prop="good_code"
-          label="商品编码"
-          show-overflow-tooltip
-          align="center"
-        ></el-table-column>
-        <el-table-column
-          prop="catName"
-          label="商品分类"
-          show-overflow-tooltip
-          align="center"
-        ></el-table-column>
-
-        <el-table-column label="状态" show-overflow-tooltip align="center">
-          <template slot-scope="scope">
-            <el-tag
-              v-if="scope.row.status === '1'"
-              type="success"
-              :class="{ 'hover-tag': powers.some((item) => item == '004') }"
-              :size="tablebtnSize"
-              @click="
-                statusConfirm(
-                  scope.row.id,
-                  scope.row.status,
-                  powers.some((item) => item == '026')
-                )
-              "
-            >
-              <i
-                class="el-icon-thumb"
-                v-if="powers.some((item) => item == '026')"
-                style="margin-right: 1px"
-              ></i>
-              销售中</el-tag
-            >
-            <el-tag
-              v-else
-              :class="{ 'hover-tag': powers.some((item) => item == '026') }"
-              :size="tablebtnSize"
-              type="warning"
-              @click="
-                statusConfirm(
-                  scope.row.id,
-                  scope.row.status,
-                  powers.some((item) => item == '026')
-                )
-              "
-            >
-              <i
-                class="el-icon-thumb"
-                v-if="powers.some((item) => item == '026')"
-                style="margin-right: 1px"
-              ></i>
-              已下架</el-tag
-            >
-          </template>
-        </el-table-column>
-        <el-table-column
-          prop="addtime"
-          label="创建时间"
-          show-overflow-tooltip
-          align="center"
-        ></el-table-column>
-        <el-table-column fixed="right" label="操作" align="center">
-          <template slot-scope="scope">
-            <el-link
-              v-if="powers.some((item) => item == '011')"
-              type="primary"
-              style="margin: 0 4px"
-              :underline="false"
-              :size="tablebtnSize"
-              @click="
-                showPrice(
-                  scope.row.LimitPrice,
-                  scope.row.left,
-                  scope.row.right,
-                  scope.row.lang
-                )
-              "
-            >
-              价格
-            </el-link>
-            <el-link
-              v-if="powers.some((item) => item == '012')"
-              type="primary"
-              style="margin: 0 4px"
-              :underline="false"
-              :size="tablebtnSize"
-              @click="copy(scope.row.id)"
-            >
-              复制
-            </el-link>
-            <el-link
-              v-if="
-                scope.row.status === '0' && powers.some((item) => item == '005')
-              "
-              type="primary"
-              style="margin: 0 4px"
-              :underline="false"
-              :size="tablebtnSize"
-              @click="openModal(scope.row.id, false)"
-            >
-              修改
-            </el-link>
-            <el-link
-              v-if="powers.some((item) => item == '006')"
-              type="primary"
-              style="margin: 0 4px"
-              :underline="false"
-              :size="tablebtnSize"
-              @click="deleteById(scope.row.id, scope.row.status)"
-            >
-              删除
-            </el-link>
-          </template>
-        </el-table-column>
-      </el-table>
-      <div
-        class="Pagination"
-        style="text-align: right; margin-top: 10px"
-        v-show="count > 0"
-      >
-        <el-pagination
-          :size="searchSize"
-          @size-change="handleSizeChange"
-          @current-change="handlePageChange"
-          :current-page="parmValue.page"
-          :page-sizes="[10, 15, 20, 30, 40]"
-          :page-size="parmValue.size"
-          layout="total, sizes, prev, pager, next, jumper"
-          :total="count"
-        ></el-pagination>
-      </div>
-    
-   
-  
-    </div>
-    <div v-else>
-      <no-auth></no-auth>
-    </div>
-  </div>
-</template>
-   <script>
-import mixinPage from "@/mixins/elPaginationHandle";
-import asyncRequest from "@/apis/service/goodStore/goodsCost";
-import statusList from "@/assets/js/statusList";
-import { timestampToTime } from "@/utils/validate";
-import { mapGetters } from "vuex";
-import resToken from "@/mixins/resToken";
-export default {
-  name: "goodsCost",
-  mixins: [resToken, mixinPage],
-  
-  computed: {
-    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
-    powers() {
-      let tran =
-        this.$store.getters.btnList.find(
-          (item) => item.menu_route == "goodsCost"
-        ) || {};
-      if (tran && tran.action && tran.action.length > 0) {
-        return tran.action;
-      } else {
-        return [];
-      }
-    },
-  },
-  data() {
-    return {
-      imgList: [],
-      index: 0,
-      showImgModel: false,
-      statusList: statusList,
-      catOptions: [],
-      showLadderPrice: false,
-      loading: false,
-      showModel: false,
-      isDetail: false,
-      modelId: 0,
-      left: {},
-      right: {},
-      lang: "0px",
-      parmValue: {
-        catid: "", //种类id
-        start: "", //起始时间,
-        end: "", //结束时间
-        sale_price_start: "", //最低售价
-        sale_price_end: "", //最高售价
-        status: "",
-        goods_name: "", //商品名称
-        good_code: "", //商品code
-        supplier_name: "", //供货商
-        page: 1, // 页码
-        size: 10, // 每页显示条数
-      },
-      count: 0, // 总条数
-      tableData: [],
-      headLadder: {
-        num: "起订量≥",
-        price: "成本价",
-      },
-    };
-  },
-
-  mounted() {
-    // this.searchList();
-    // this.getAllCat();
-  },
-
-  methods: {
-    restSearch() {
-      this.parmValue = {
-        catid: "", //种类id
-        start: "", //起始时间,
-        end: "", //结束时间
-        sale_price_start: "", //最低售价
-        sale_price_end: "", //最高售价
-        status: "",
-        goods_name: "", //商品名称
-        good_code: "", //商品code
-        supplier_name: "", //供货商
-        page: 1, // 页码
-        size: 10, // 每页显示条数
-      };
-      this.searchList();
-    },
-    async handleChange() {
-      this.parmValue.page = 1;
-      await this.searchList();
-    },
-    async timeReturned(e) {
-      if (e.startTime !== "") {
-        this.parmValue.start = timestampToTime(e.startTime);
-      } else {
-        this.parmValue.start = "";
-      }
-
-      if (e.endTime !== "") {
-        this.parmValue.end = timestampToTime(e.endTime);
-      } else {
-        this.parmValue.end = "";
-      }
-      if (this.parmValue.start !== "" && this.parmValue.end !== "") {
-        this.parmValue.page = 1;
-        await this.searchList();
-      }
-    },
-    openModal(id, isDetail) {
-      if (id !== "add") {
-        this.$message.warning("正在开发中!");
-      } else {
-        this.showModel = true;
-        this.modelId = id;
-        this.isDetail = isDetail;
-      }
-    },
-    showGalley(list, i) {
-      this.imgList = list;
-      this.index = i;
-      this.showImgModel = true;
-    },
-    async copy(id) {
-      let res = await asyncRequest.copy({ id: id });
-      if (res.code === 0) {
-        this.$notify.success({
-          title: "商品复制成功!",
-          message: "",
-        });
-        this.searchList();
-      }
-    },
-    async deleteById(id, status) {
-      if (status === "0") {
-        await this.$confirm("确定要删除该商品?", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
-        })
-          .then(async () => {
-            let res = await asyncRequest.delete({ goodids: id });
-            if (res.code === 0) {
-              this.$notify.success({
-                title: "删除成功",
-                message: "",
-              });
-              this.searchList();
-            }
-          })
-          .catch(() => {
-            console.log("取消");
-          });
-      } else {
-        this.$message.warning("只有已下架的商品才能被删除!");
-      }
-    },
-    showPrice(attr, left, right, lang) {
-      if (attr && attr.length > 0) {
-        this.left = left;
-        this.right = right;
-        this.lang = lang;
-        this.showLadderPrice = true;
-      } else {
-        this.$message.warning("该商品暂无阶梯价格信息!");
-      }
-    },
-    async searchList() {
-      let obj = JSON.parse(JSON.stringify(this.parmValue));
-
-      if (obj.catid === "") {
-        obj.catid = "0";
-      }
-      this.loading = true;
-      let res = await asyncRequest.list(obj);
-      if (res.code === 0 && res.data) {
-        let list = res.data.list;
-
-        list = list.map((v1) => {
-          v1.catName = "";
-          v1.galleyList = v1.galley.split(",");
-          v1.addtime = v1.addtime.replaceAll(".000", "");
-          if (v1 && v1.cat && v1.cat.length > 0) {
-            v1.cat.forEach((v2, index) => {
-              v1.catName += index !== 0 ? "/" + v2.cat_name : v2.cat_name;
-            });
-          } else {
-            v1.catName = "";
-          }
-          if (v1 && v1.LimitPrice && v1.LimitPrice.length > 0) {
-            v1.left = {
-              header: [],
-              spec: [],
-            };
-            v1.right = {
-              header: [],
-              spec: [],
-            };
-            v1.left.header = v1.LimitPrice[0].spec;
-            v1.lang = v1.left.header.length * 100 + "px";
-            let ladderNum = 0;
-            v1.LimitPrice.forEach((a) => {
-              if (a.limit && a.limit.length > ladderNum) {
-                ladderNum = a.limit.length;
-              }
-              if (a.spec && a.spec.length > 0) {
-                v1.left.spec.push(a.spec);
-              }
-            });
-            for (let i = 0; i < ladderNum; i++) {
-              v1.right.header.push(this.headLadder);
-            }
-
-            v1.right.spec = v1.LimitPrice;
-            v1.right.spec.map((v1) => {
-              if (v1.limit && v1.limit.length > 0) {
-                for (let j = 0; j < ladderNum; j++) {
-                  if (!v1.limit[j]) {
-                    v1.limit.push({
-                      begin_num: "",
-                      shop_price: "",
-                    });
-                  }
-                }
-              }
-            });
-          }
-          return v1;
-        });
-        this.tableData = list;
-        this.count = Number(res.data.count);
-      } else {
-        this.tableData = [];
-        this.count = 0;
-      }
-      this.loading = false;
-    },
-    async getAllCat() {
-      const res = await asyncRequest.catAll({});
-      if (res.code === 0 && res.data) {
-        let list = res.data;
-        list.map((v1) => {
-          v1.value = v1.id;
-          v1.label = v1.cat_name;
-          if (v1.child && v1.child.length > 0) {
-            v1.child.map((v2) => {
-              v2.value = v2.id;
-              v2.label = v2.cat_name;
-              if (v2.child && v2.child.length > 0) {
-                v2.child.map((v3) => {
-                  v3.value = v3.id;
-                  v3.label = v3.cat_name;
-                  return v3;
-                });
-                v2.children = v2.child;
-              }
-              return v2;
-            });
-            v1.children = v1.child;
-          }
-          return v1;
-        });
-        this.catOptions = list;
-      }
-    },
-    async statusConfirm(id, status, type) {
-      if (!type) {
-        return;
-      }
-      await this.$confirm(
-        `确定要改为${status === "1" ? "已下架" : "销售中"}?`,
-        {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning",
-        }
-      )
-        .then(async () => {
-          this.loading = true;
-          const model = {
-            goodids: id,
-            status: status === "1" ? "0" : "1",
-          };
-          const res = await asyncRequest.status(model);
-          if (res.code === 0) {
-            this.loading = false;
-            this.$notify.success({
-              title: "状态修改成功!",
-              message: "",
-            });
-            await this.searchList();
-          } else {
-            this.loading = false;
-          }
-        })
-        .catch(() => {
-          console.log("取消");
-        });
-    },
-  },
-};
-</script>
-   <style lang="scss" scoped>
-.goodsCost {
-  $gBC: #dfe6ec;
-  .list-table {
-    position: relative;
-    width: 100%;
-    border-top: 1px solid $gBC;
-    border-left: 1px solid $gBC;
-    .left {
-      position: absolute;
-      top: 0;
-      left: 0;
-      z-index: 2;
-      background: #fff;
-      .header {
-        width: 100%;
-        display: flex;
-        .header-item {
-          width: 100px;
-          flex: 1;
-          padding: 0 10px;
-          height: 50px;
-          line-height: 50px;
-          border-right: 1px solid $gBC;
-          border-bottom: 1px solid $gBC;
-        }
-      }
-      .header-body {
-        width: 100%;
-        position: relative;
-        .header-body-row {
-          width: 100%;
-          display: flex;
-          .heder-body-col {
-            flex: 1;
-            padding: 0 10px;
-            height: 30px;
-            border-right: 1px solid $gBC;
-            border-bottom: 1px solid $gBC;
-            line-height: 30px;
-          }
-        }
-      }
-    }
-    .right {
-      position: relative;
-      width: 100%;
-      display: block;
-      overflow-x: scroll;
-      .header {
-        width: 100%;
-        display: flex;
-        .header-col {
-          min-width: 240px;
-          flex: 1;
-          height: 50px;
-          line-height: 50px;
-
-          // position: relative;
-          .header-col-jieti {
-            height: 50px;
-            line-height: 50px;
-            // position: relative;
-            width: 100%;
-            .header-col-jieti-title {
-              // position: relative;
-              width: 100%;
-              line-height: 25px;
-              border-right: 1px solid $gBC;
-              border-bottom: 1px solid $gBC;
-              height: 25px;
-            }
-            .header-col-jieti-main {
-              // position: relative;
-              width: 100%;
-              .header-col-item {
-                // position: relative;
-                height: 25px;
-                line-height: 25px;
-                width: 50%;
-                border-right: 1px solid $gBC;
-                border-bottom: 1px solid $gBC;
-              }
-            }
-          }
-        }
-      }
-      .right-body {
-        position: relative;
-        .right-body-col {
-          position: relative;
-          width: 100%;
-          display: flex;
-          .right-body-col-item {
-            min-width: 240px;
-            flex: 1;
-
-            position: relative;
-            overflow: hidden;
-            .right-body-col-item-div {
-              position: relative;
-              height: 30px;
-              line-height: 30px;
-              width: 50%;
-              padding: 0 10px;
-              border-right: 1px solid $gBC;
-              border-bottom: 1px solid $gBC;
-            }
-          }
-        }
-      }
-    }
-  }
-  .good_name_img {
-    position: relative;
-    width: 156px;
-    img {
-      position: relative;
-      width: 30px;
-      height: 30px;
-      display: inline-block;
-      border-top: 1px solid #dfe6ec;
-      border-right: 1px solid #dfe6ec;
-      border-bottom: 1px solid #dfe6ec;
-      &:hover {
-        cursor: pointer;
-      }
-      &:first-child {
-        border-left: 1px solid #dfe6ec;
-      }
-    }
-  }
-}
-</style>
-   

+ 2 - 32
src/views/goodStore/goodsCost/index.vue

@@ -164,6 +164,7 @@ import roleLevel from "@/assets/js/roleLevel";
 import mixinPage from "@/mixins/elPaginationHandle";
 import { mapGetters } from "vuex";
 import resToken from "@/mixins/resToken";
+import { listCol } from "./columns";
 export default {
   name: "goodsCost",
   mixins: [mixinPage, resToken],
@@ -218,38 +219,7 @@ export default {
         total: 0,
       },
       // 表格 - 列参数
-      columns: [
-        {
-          prop: "id",
-          label: "ID",
-        },
-        {
-          prop: "goodsCost",
-          label: "单位名称",
-        },
-        {
-          prop: "status",
-          label: "状态",
-          sortable: true,
-          _slot_: "status",
-        },
-        {
-          prop: "creater",
-          label: "创建人",
-        },
-        {
-          prop: "addtime",
-          label: "创建时间",
-          sortable: true,
-        },
-        {
-          prop: "",
-          label: "操作",
-          fixed: "right",
-          _noset_: true,
-          _slot_: "operation",
-        },
-      ],
+      columns: listCol,
     };
   },
   mounted() {