snow 1 year ago
parent
commit
a221e51d16

+ 42 - 18
src/components/globalComponents/search-area/main.vue

@@ -30,7 +30,17 @@ import resToken from "@/mixins/resToken";
 export default {
   name: "SearchArea",
   mixins: [resToken],
-  props: ["size", "value", "placeholder", "isDetail", "disabled", "names", "level",'detailSelect'],
+  props: [
+    "size",
+    "value",
+    "placeholder",
+    "isDetail",
+    "disabled",
+    "names",
+    "level",
+    "detailSelect",
+    "searchCode"
+  ],
   /**
    * 属性集合
    * @param {String}        size             : 组件大小            非必填
@@ -53,21 +63,33 @@ export default {
         // page: 1,
         // size: 100,
         level: 3,
-        name: "",
-      },
+        name: ""
+      }
     };
   },
   watch: {
     names: {
-      handler:function (val, old) {
-      // console.log(val, old, this.isDetail, "1");
+      handler: function(val, old) {
+        // console.log(val, old, this.isDetail, "1");
         this.searchName = val;
-        if (this.isDetail && (Array.isArray(this.searchName) && this.searchName[0])) {
-          this.remoteMethod(Array.isArray(this.searchName) ? this.searchName[0] : this.searchName,true);
+
+        console.log(this.searchName);
+        if (
+          this.isDetail &&
+          Array.isArray(this.searchName) &&
+          this.searchName[0]
+        ) {
+          this.remoteMethod(
+            Array.isArray(this.searchName)
+              ? this.searchName[0]
+              : this.searchName,
+            true,
+            this.searchCode
+          );
         }
       },
-      immediate:true
-    },
+      immediate: true
+    }
   },
   mounted() {
     this.options = [];
@@ -77,12 +99,12 @@ export default {
   methods: {
     async selectChange(e) {
       if (e && e.length > 0) {
-        const index = this.options.findIndex((v) => v.code + "" === e[0] + "");
+        const index = this.options.findIndex(v => v.code + "" === e[0] + "");
         if (index !== -1) {
           const { code, search_name, info } = this.options[index];
           const { province, city, area } = info;
           let arr_code = "";
-          let splitLabel = ""
+          let splitLabel = "";
           switch (this.formValue.level + "") {
             case "1":
               arr_code = province.code;
@@ -105,7 +127,7 @@ export default {
             city_code: city.code ?? "",
             area_code: area.code ?? "",
             label: search_name ?? "",
-            splitLabel:splitLabel ?? ""
+            splitLabel: splitLabel ?? ""
           };
           this.$emit("searchChange", model);
         } else {
@@ -115,19 +137,21 @@ export default {
         this.$emit("searchChange", {});
       }
     },
-    async remoteMethod(query,formDetail = false) {
+    async remoteMethod(query, formDetail = false, searchCode) {
       this.selectLoading = true;
       if (query !== "") {
         this.options = [];
-        this.formValue.name = query;
+        this.formValue[searchCode ? "code" : "name"] = query;
         const { code, data, message } = await asyncRequest.list({
           ...this.formValue,
-          level:this.level
+          level: this.level
         });
 
         if (code === 0) {
           this.options = data;
-          if(this.detailSelect && formDetail && data.length > 0){ this.selectChange([data[0].code])}
+          if (this.detailSelect && formDetail && data.length > 0) {
+            this.selectChange([data[0].code]);
+          }
         } else if (code >= 100 && code <= 104) {
           await this.logout();
         } else {
@@ -137,8 +161,8 @@ export default {
         this.options = [];
       }
       this.selectLoading = false;
-    },
-  },
+    }
+  }
 };
 </script>
 

+ 14 - 13
src/components/globalComponents/search-brand/main.vue

@@ -21,8 +21,7 @@
       :label="item.brand_name"
       :value="item.id"
       :disabled="item.status + '' === '0'"
-    >
-    </el-option>
+    ></el-option>
   </el-select>
 </template>
 
@@ -39,7 +38,7 @@ export default {
     "isDetail",
     "disabled",
     "type",
-    "names",
+    "names"
   ],
   /**
    * 属性集合
@@ -66,24 +65,26 @@ export default {
         end: "",
         creater: "",
         status: "",
-        brand_name: "",
-      },
+        brand_name: ""
+      }
     };
   },
   watch: {
-    names: function (val, old) {
+    names: function(val, old) {
       // console.log(val, old, this.isDetail, "1");
       this.searchName = val;
       if (this.isDetail && this.searchName) {
-        this.remoteMethod(this.searchName);
+        this.remoteMethod(
+          Array.isArray(this.searchName) ? this.searchName[0] : this.searchName
+        );
       }
     },
-    isDetail: function (val, old) {
+    isDetail: function(val, old) {
       // console.log(val, old, this.isDetail, "2");
       if (val && this.searchName) {
         this.remoteMethod(this.searchName);
       }
-    },
+    }
   },
   mounted() {
     this.options = [];
@@ -92,12 +93,12 @@ export default {
   methods: {
     async selectChange(e) {
       if (e && e.length > 0) {
-        let index = this.options.findIndex((v) => v.id === e[0]);
+        let index = this.options.findIndex(v => v.id === e[0]);
         if (index !== -1) {
           let model = {
             id: this.options[index].id,
             code: this.options[index].id,
-            label: this.options[index].brand_name,
+            label: this.options[index].brand_name
           };
           this.$emit("searchChange", model);
         } else {
@@ -126,8 +127,8 @@ export default {
         this.options = [];
       }
       this.selectLoading = false;
-    },
-  },
+    }
+  }
 };
 </script>
 

+ 62 - 41
src/components/globalComponents/search-company/index.vue

@@ -27,12 +27,22 @@
 </template>
 
 <script>
-import asyncRequest from '@/apis/components/search-work-company'
-import resToken from '@/mixins/resToken'
+import asyncRequest from "@/apis/components/search-work-company";
+import resToken from "@/mixins/resToken";
 export default {
-  name: 'SearchCompany',
+  name: "SearchCompany",
   mixins: [resToken],
-  props: ['size', 'value', 'placeholder', 'isDetail', 'disabled', 'names', 'type', 'isp', 'noDisabled'],
+  props: [
+    "size",
+    "value",
+    "placeholder",
+    "isDetail",
+    "disabled",
+    "names",
+    "type",
+    "isp",
+    "noDisabled"
+  ],
   /**
    * 属性集合
    * @param {String}        size             : 组件大小            非必填
@@ -51,84 +61,95 @@ export default {
     return {
       options: [],
       selectLoading: false,
-      searchName: ''
-    }
+      searchName: ""
+    };
   },
   watch: {
-    names: function(val, old) {
-      // console.log(val, old, this.isDetail, "1");
-      this.searchName = val
-      if (this.isDetail && this.searchName) {
-        this.remoteMethod(this.searchName, this.isp)
-      }
+    names: {
+      handler: function(val, old) {
+        console.log(val);
+        // console.log(val, old, this.isDetail, "1");
+        this.searchName = val;
+        if (this.isDetail && this.searchName) {
+          this.remoteMethod(this.searchName, this.isp);
+        }
+      },
+      immediate: true
     },
-    isDetail: function(val, old) {
-      // console.log(val, old, this.isDetail, "2");
-      if (val && this.searchName) {
-        this.remoteMethod(this.searchName, this.isp)
-      }
+    isDetail: {
+      handler: {
+        function(val, old) {
+          // console.log(val, old, this.isDetail, "2");
+          if (val && this.searchName) {
+            this.remoteMethod(this.searchName, this.isp);
+          }
+        }
+      },
+      immediate: true
     }
   },
   mounted() {
-    this.options = []
-    this.selectLoading = false
+    this.options = [];
+    this.selectLoading = false;
   },
   methods: {
     async selectChange(e) {
       // console.log(e);
       // console.log("1111" + this.isp);
       if (e && e.length > 0) {
-        const index = this.options.findIndex((v) => v.companyNo === e[0])
+        const index = this.options.findIndex(v => v.companyNo === e[0]);
         if (index !== -1) {
           const model = {
             id: this.options[index].id,
             code: this.options[index].companyNo,
             label: this.options[index].company,
-            isPower: this.options[index].has_account + '' !== '0'
-          }
-          this.$emit('searchChange', model)
+            isPower: this.options[index].has_account + "" !== "0"
+          };
+          this.$emit("searchChange", model);
         } else {
-          this.$emit('searchChange', {})
+          this.$emit("searchChange", {});
         }
       } else {
-        this.$emit('searchChange', {})
+        this.$emit("searchChange", {});
       }
     },
     async remoteMethod(query, types) {
-      this.selectLoading = true
-      if (query !== '') {
-        this.options = []
+      this.selectLoading = true;
+      if (query !== "") {
+        this.options = [];
         const formValue = {
           page: 1,
           size: 100,
           company: query,
-          code: '',
-          is_platform: this.type ? this.type : ''
-        }
-        const { code, data, message } = await asyncRequest.list(formValue)
+          code: "",
+          is_platform: this.type ? this.type : ""
+        };
+        const { code, data, message } = await asyncRequest.list(formValue);
         if (code === 0) {
-          const { list } = data
-          this.options = list
+          const { list } = data;
+          this.options = list;
           if (types) {
             // console.log(this.value);
-            const index = this.options.findIndex((v) => v.companyNo + '' === this.value[0] + '')
+            const index = this.options.findIndex(
+              v => v.companyNo + "" === this.value[0] + ""
+            );
             // console.log(this.options);
             // console.log(index);
             if (index !== -1) {
-              await this.selectChange([this.options[index].companyNo])
+              await this.selectChange([this.options[index].companyNo]);
             }
           }
           // console.log(types);
         } else if (code >= 100 && code <= 104) {
-          await this.logout()
+          await this.logout();
         } else {
-          this.$message.warning(message)
+          this.$message.warning(message);
         }
       } else {
-        this.options = []
+        this.options = [];
       }
-      this.selectLoading = false
+      this.selectLoading = false;
     }
   }
-}
+};
 </script>

+ 45 - 35
src/components/globalComponents/search-unit/main.vue

@@ -26,12 +26,20 @@
 </template>
 
 <script>
-import asyncRequest from '@/apis/components/search-unit'
-import resToken from '@/mixins/resToken'
+import asyncRequest from "@/apis/components/search-unit";
+import resToken from "@/mixins/resToken";
 export default {
-  name: 'SearchUnit',
+  name: "SearchUnit",
   mixins: [resToken],
-  props: ['size', 'value', 'placeholder', 'isDetail', 'disabled', 'type', 'names'],
+  props: [
+    "size",
+    "value",
+    "placeholder",
+    "isDetail",
+    "disabled",
+    "type",
+    "names"
+  ],
   /**
    * 属性集合
    * @param {String}        size             : 组件大小            非必填
@@ -49,71 +57,73 @@ export default {
     return {
       options: [],
       selectLoading: false,
-      searchName: '',
+      searchName: "",
       formValue: {
         page: 1,
         size: 100,
-        start: '',
-        end: '',
-        unit: '',
-        creater: ''
+        start: "",
+        end: "",
+        unit: "",
+        creater: ""
       }
-    }
+    };
   },
   watch: {
     names: function(val, old) {
       // console.log(val, old, this.isDetail, "1");
-      this.searchName = val
+      this.searchName = val;
       if (this.isDetail && this.searchName) {
-        this.remoteMethod(this.searchName)
+        this.remoteMethod(
+          Array.isArray(this.searchName) ? this.searchName[0] : this.searchName
+        );
       }
     }
   },
   mounted() {
-    this.options = []
-    this.selectLoading = false
+    this.options = [];
+    this.selectLoading = false;
   },
   methods: {
     async selectChange(e) {
       if (e && e.length > 0) {
-        const index = this.options.findIndex((v) => v.id + '' === e[0] + '')
-        console.log(index)
+        const index = this.options.findIndex(v => v.id + "" === e[0] + "");
+        console.log(index);
         if (index !== -1) {
           const model = {
-            id: this.options[index].id + '',
-            code: this.options[index].id + '',
-            label: this.options[index].unit + ''
-          }
-          this.$emit('searchChange', model)
+            id: this.options[index].id + "",
+            code: this.options[index].id + "",
+            label: this.options[index].unit + ""
+          };
+          this.$emit("searchChange", model);
         } else {
-          this.$emit('searchChange', {})
+          this.$emit("searchChange", {});
         }
       } else {
-        this.$emit('searchChange', {})
+        this.$emit("searchChange", {});
       }
     },
     async remoteMethod(query) {
-      this.selectLoading = true
-      if (query !== '') {
-        this.options = []
-        this.formValue.unit = query
-        const { code, data, message } = await asyncRequest.list(this.formValue)
+      this.selectLoading = true;
+      if (query !== "") {
+        this.options = [];
+        this.formValue.unit = query;
+        const { code, data, message } = await asyncRequest.list(this.formValue);
 
         if (code === 0) {
-          const { list } = data
-          this.options = list
+          const { list } = data;
+          this.options = list;
         } else if (code >= 100 && code <= 104) {
-          await this.logout()
+          await this.logout();
         } else {
-          this.$message.warning(message)
+          this.$message.warning(message);
         }
       } else {
-        this.options = []
+        this.options = [];
       }
-      this.selectLoading = false
+      this.selectLoading = false;
     }
   }
-}
+};
 </script>
 
 <style></style>

+ 92 - 98
src/views/goodStore/goodsCost/index.vue

@@ -58,14 +58,11 @@
             </el-col>
 
             <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
-              <el-button type="primary" :size="searchSize" @click="searchList">
-                刷新
-              </el-button>
+              <el-button type="primary" :size="searchSize" @click="searchList">刷新</el-button>
             </el-col>
+
             <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
-              <el-button type="warning" :size="searchSize" @click="restSearch">
-                重置
-              </el-button>
+              <el-button type="warning" :size="searchSize" @click="restSearch">重置</el-button>
             </el-col>
           </el-row>
           <el-row>
@@ -157,7 +154,7 @@
                   :value="item.code"
                 />
               </el-select>
-            </el-col> -->
+            </el-col>-->
             <el-col :span="3" style="margin: 0 10px">
               <search-supplier
                 :size="'mini'"
@@ -183,9 +180,7 @@
                 type="success"
                 style="float: right"
                 @click="handleCreate"
-              >
-                添加
-              </el-button>
+              >添加</el-button>
             </el-col>
             <el-col
               :span="3"
@@ -193,12 +188,7 @@
               style="width: 110px; padding: 0 0 0 10px"
               v-if="powers.some((i) => i == '055') && !isSupertube"
             >
-              <el-button
-                :size="searchSize"
-                type="warning"
-                style="float: right"
-                @click="add_online"
-              >
+              <el-button :size="searchSize" type="warning" style="float: right" @click="add_online">
                 <i class="el-icon-circle-plus-outline"></i>
                 <span>商品上线</span>
               </el-button>
@@ -226,7 +216,7 @@
                   :label="opt.label"
                 />
               </el-select>
-            </el-col> -->
+            </el-col>-->
             <el-col :span="4" style="width: 420px">
               <el-input
                 :size="searchSize"
@@ -238,7 +228,8 @@
                   searchList();
                 "
                 placeholder="关键字"
-                ><el-select
+              >
+                <el-select
                   v-model="select"
                   slot="prepend"
                   style="width: 135px"
@@ -254,24 +245,24 @@
                   <!-- <el-option label="业务企业编号" value="3" /> -->
                   <!-- <el-option label="供应商编号" value="4" /> -->
                   <!-- <el-option label="创建人部门" value="5" /> -->
-                </el-select></el-input
-              >
+                </el-select>
+              </el-input>
             </el-col>
           </el-row>
-        </div></template
-      >
+        </div>
+      </template>
 
       <template #spuCode="{ scope }">
-          <div style="display:flex;align-items:center">
-            <el-tooltip placement="top" content="查看商品详情" v-if="powers.includes('007')">
-               <i 
-                class="el-icon-link" 
-                @click="getRouter('goodsCostDetail', scope.row.spuCode)"
-                style="cursor:pointer;margin-right:5px;font-size:16px" 
-              />
-            </el-tooltip>
-            <p>{{scope.row.spuCode}}</p>
-          </div>
+        <div style="display:flex;align-items:center">
+          <el-tooltip placement="top" content="查看商品详情" v-if="powers.includes('007')">
+            <i
+              class="el-icon-link"
+              @click="getRouter('goodsCostDetail', scope.row.spuCode)"
+              style="cursor:pointer;margin-right:5px;font-size:16px"
+            />
+          </el-tooltip>
+          <p>{{scope.row.spuCode}}</p>
+        </div>
       </template>
 
       <template #good_thumb_img="{ scope }">
@@ -284,7 +275,7 @@
           <img
             :src="scope.row.good_thumb_img"
             style="display: inline-block; width: 100%; height: 100%"
-            alt=""
+            alt
           />
         </div>
       </template>
@@ -343,10 +334,7 @@
           content="详情"
           placement="top"
         >
-          <i
-            class="el-icon-view tb-icon"
-            @click="getRouter('goodsCostDetail', scope.row.spuCode)"
-          ></i>
+          <i class="el-icon-view tb-icon" @click="getRouter('goodsCostDetail', scope.row.spuCode)"></i>
         </el-tooltip>
         <el-tooltip
           v-if="
@@ -356,10 +344,7 @@
           content="下线商品"
           placement="top"
         >
-          <i
-            class="el-icon-download tb-icon"
-            @click="showDonlineDlg(scope.row.spuCode)"
-          ></i>
+          <i class="el-icon-download tb-icon" @click="showDonlineDlg(scope.row.spuCode)"></i>
         </el-tooltip>
 
         <!-- scope.row.has_account + '' == '0' && -->
@@ -430,10 +415,7 @@
           content="复制商品"
           placement="top"
         >
-          <i
-            class="el-icon-document-copy tb-icon"
-            @click="good_copy(scope.row.spuCode)"
-          ></i>
+          <i class="el-icon-document-copy tb-icon" @click="good_copy(scope.row.spuCode)"></i>
         </el-tooltip>
 
         <el-tooltip
@@ -506,24 +488,26 @@ export default {
   name: "goodsCost",
   mixins: [mixinPage, resToken, companyHelper],
   components: {
-    addEdit,
+    addEdit
   },
   computed: {
     //组件SIZE设置
     ...mapGetters(["tablebtnSize", "searchSize", "size", "isSupertube"]),
     powers() {
       const tran =
-        this.$store.getters.btnList.find((i) => i.menu_route == "goodsCost") || {};
+        this.$store.getters.btnList.find(i => i.menu_route == "goodsCost") ||
+        {};
       const { action } = tran ?? {};
       return action ?? [];
     },
     ppowers() {
       const tran =
-        this.$store.getters.roleProcess.find((i) => i.process_type === "SPCB") || {};
+        this.$store.getters.roleProcess.find(i => i.process_type === "SPCB") ||
+        {};
       const { action } = tran ?? {};
       console.log(action);
       return action || [];
-    },
+    }
   },
   data() {
     var validate = (rule, value, callback) => {
@@ -541,62 +525,66 @@ export default {
       donline_form: {
         offline_reason: "",
         offline_remark: "",
-        spuCode: "",
+        spuCode: ""
       },
       donline_rules: {
-        offline_reason: [{ validator: validate, required: true, trigger: "blur" }],
-        offline_remark: [{ validator: validate, required: true, trigger: "blur" }],
+        offline_reason: [
+          { validator: validate, required: true, trigger: "blur" }
+        ],
+        offline_remark: [
+          { validator: validate, required: true, trigger: "blur" }
+        ]
       },
       statusList: [
         {
           code: "0",
           name: "新建待审核",
-          type: "",
+          type: ""
         },
         {
           code: "1",
           name: "审核通过",
-          type: "success",
+          type: "success"
         },
         {
           code: "2",
           name: "基础修改待审核",
-          type: "",
+          type: ""
         },
         {
           code: "3",
           name: "成本修改待审核",
-          type: "",
+          type: ""
         },
         {
           code: "4",
           name: "基础修改驳回",
-          type: "danger",
+          type: "danger"
         },
         {
           code: "5",
           name: "成本修改驳回",
-          type: "danger",
+          type: "danger"
         },
         {
           code: "6",
           name: "新建审核驳回",
-          type: "danger",
+          type: "danger"
         },
         {
           code: "7",
           name: "复制商品待编辑",
-          type: "info",
+          type: "info"
         },
         {
           code: "8",
           name: "竞价商品待编辑",
-          type: "info",
-        },
+          type: "info"
+        }
       ],
       isonlineoptions: [
         { id: "0", name: "未上线" },
-        { id: "1", name: "已上线" },
+        { id: "1", name: "已上线" }
       ],
       showModel: false,
       options1,
@@ -618,7 +606,7 @@ export default {
         companyNo: "",
         supplierNo: "",
         isonline: "",
-        company_name: "", //创建人部门
+        company_name: "" //创建人部门
         // creater: "",
       },
       sinput: "",
@@ -629,18 +617,18 @@ export default {
       table: {
         stripe: true,
         border: true,
-        _defaultHeader_: ["setcol"],
+        _defaultHeader_: ["setcol"]
       },
       // 表格 - 分页
       pageInfo: {
         size: 15,
         curr: 1,
-        total: 0,
+        total: 0
       },
       // 表格 - 列参数
       columns: listCol,
       supplierNo: [],
-      brandid: [],
+      brandid: []
     };
   },
   mounted() {
@@ -657,7 +645,7 @@ export default {
       this.pageInfo = {
         size: size,
         curr: page,
-        total: 0,
+        total: 0
       };
       //多选条件
       this.select = this.parmValue.select;
@@ -688,7 +676,7 @@ export default {
         page: 1,
         size: 100,
         type: "8",
-        status: "3",
+        status: "3"
       });
       if (res && res.code === 0 && res.data) {
         const { list } = res.data;
@@ -703,7 +691,7 @@ export default {
       if (toRouter && queryId) {
         let model = {
           id: queryId,
-          type: "view",
+          type: "view"
         };
 
         //有多选框的条件
@@ -712,7 +700,7 @@ export default {
         //
         let routerModel = {
           options: JSON.parse(JSON.stringify(this.parmValue)),
-          router: this.$route.path,
+          router: this.$route.path
         };
         model.preModel = JSON.stringify(routerModel);
 
@@ -730,7 +718,7 @@ export default {
       this.pageInfo = {
         size: 15,
         curr: 1,
-        total: 0,
+        total: 0
       };
       this.parmValue = {
         page: 1, // 页码
@@ -746,18 +734,20 @@ export default {
         good_type: "",
         isonline: "",
         companyNo: "",
-        supplierNo: "",
+        supplierNo: ""
       };
       this.searchList();
     },
     async wantto(isonline, spuCode, ntype, wtype) {
-      const { code, data, message } = await asyncRequest.checkIsUpdate({ spuCode });
+      const { code, data, message } = await asyncRequest.checkIsUpdate({
+        spuCode
+      });
       if (code === 0) {
         const { is_allow_update } = data;
         if (is_allow_update + "" === "1") {
           this.routeGoto("goodsCostDetail", {
             id: spuCode,
-            type: wtype === "2" ? "editBase" : wtype === "3" ? "editCoin" : "",
+            type: wtype === "2" ? "editBase" : wtype === "3" ? "editCoin" : ""
           });
         } else {
           if (isonline + "" === "1") {
@@ -810,19 +800,19 @@ export default {
       await this.$confirm(`确定要复制该商品?`, {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(async () => {
           this.loading = true;
           const model = {
-            spuCode: spuCode,
+            spuCode: spuCode
           };
           const res = await asyncRequest.copy(model);
           if (res && res.code === 0) {
             this.loading = false;
             this.$notify.success({
               title: "复制商品成功!",
-              message: "",
+              message: ""
             });
             await this.searchList();
           } else if (res && res.code >= 100 && res.code <= 104) {
@@ -842,23 +832,26 @@ export default {
      * @param {String} status 0-禁用 1-启用
      */
     async changeStatus(id, status) {
-      await this.$confirm(`确定要改为${status + "" === "1" ? "禁用" : "启用"}?`, {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
+      await this.$confirm(
+        `确定要改为${status + "" === "1" ? "禁用" : "启用"}?`,
+        {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }
+      )
         .then(async () => {
           this.loading = true;
           const model = {
             id: id,
-            status: status + "" === "1" ? "0" : "1",
+            status: status + "" === "1" ? "0" : "1"
           };
           const res = await asyncRequest.status(model);
           if (res && res.code === 0) {
             this.loading = false;
             this.$notify.success({
               title: "状态修改成功!",
-              message: "",
+              message: ""
             });
             await this.searchList();
           } else if (res && res.code >= 100 && res.code <= 104) {
@@ -876,17 +869,17 @@ export default {
       await this.$confirm("确定要删除?", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning",
+        type: "warning"
       })
         .then(async () => {
           const model = {
-            codes: [code],
+            codes: [code]
           };
           const res = await asyncRequest.delete(model);
           if (res && res.code === 0) {
             this.$notify.success({
               title: "删除成功",
-              message: "",
+              message: ""
             });
             this.searchList();
           } else if (res && res.code >= 100 && res.code <= 104) {
@@ -915,16 +908,17 @@ export default {
       item.companyNo = this.select === "3" ? this.sinput : "";
       item.supplierNo = this.select === "4" ? this.sinput : "";
       item.company_name = this.select === "5" ? this.sinput : ""; // 部门
-      item.cat_id = item.cat_id.length > 0 ? item.cat_id[item.cat_id.length - 1] : "";
+      item.cat_id =
+        item.cat_id.length > 0 ? item.cat_id[item.cat_id.length - 1] : "";
       const res = await asyncRequest.list({
         ...item,
         supplierNo: Array.isArray(this.supplierNo) ? this.supplierNo[0] : "",
-        needRela: true,
+        needRela: true
       });
 
       if (res && res.code === 0 && res.data) {
         this.tableData = res.data.list;
-        this.tableData.forEach((a) => {
+        this.tableData.forEach(a => {
           a.cat_name = "";
           let list = a.cat_info || [];
           list.forEach((b, i) => {
@@ -958,7 +952,7 @@ export default {
         return;
       }
       let isok = true;
-      this.changeList.forEach((e) => {
+      this.changeList.forEach(e => {
         if (String(e.status) !== "1") {
           isok = false;
         }
@@ -975,14 +969,14 @@ export default {
       this.donline_form = {
         offline_reason: "",
         offline_remark: "",
-        skuCode: "",
+        skuCode: ""
       };
       this.donline_form.spuCode = spuCode;
       // this.donlineDlg(spuCode)
     },
     //商品下线原因 确定
     async donlineDlg() {
-      await this.$refs.donline_Form.validate(async (valid) => {
+      await this.$refs.donline_Form.validate(async valid => {
         if (valid) {
           this.dialogFormVisible = false;
           this.get_donline(this.donline_form.spuCode);
@@ -999,7 +993,7 @@ export default {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
-        center: true,
+        center: true
       })
         .then(async () => {
           this.loading = true;
@@ -1009,7 +1003,7 @@ export default {
             this.loading = false;
             this.$notify.success({
               title: res.message,
-              message: "",
+              message: ""
             });
             await this.searchList();
           } else if (res && res.code >= 100 && res.code <= 104) {
@@ -1022,8 +1016,8 @@ export default {
         .catch(async () => {
           console.log("取消");
         });
-    },
-  },
+    }
+  }
 };
 </script>
 

+ 15 - 6
src/views/sellOut/filing/config/columns.js

@@ -83,12 +83,12 @@ export const options13 = [
 ];
 
 const statusOptions = [
-  { value: "0", label: "待审核" },
-  { value: "1", label: "审核失败" },
-  { value: "2", label: "审核中可转单" },
-  { value: "3", label: "转单成功" },
-  { value: "4", label: "转单失败" },
-  { value: "5", label: "取消转单" },
+  { value: "0", label: "待审核判断合规" },
+  { value: "1", label: "不合规" },
+  { value: "2", label: "合规待转单" },
+  { value: "3", label: "部分转单" },
+  { value: "4", label: "全部转单" },
+  { value: "5", label: "取消转单" }
 ];
 
 export const editColumns = [
@@ -701,6 +701,13 @@ const validate_good_name = (rule, value, callback) => {
   }
 };
 const rules = {
+  attachment:[
+    {
+      required: true,
+      message: "请选择附件",
+      trigger: "blur",
+    }
+  ],
   companyName: [
     {
       required: true,
@@ -1071,6 +1078,8 @@ const other_ruleForm = {
   is_diff: "0",
 };
 const ruleForm1 = {
+  customerName:"",
+  fill_url:"",
   companyName: "泰康",
   supplierNo: [],
   customerCode: [],

+ 226 - 136
src/views/sellOut/filing/cpns/baseForm.vue

@@ -21,15 +21,13 @@
             />
           </el-form-item>
         </el-col>
+
         <el-col :span="6">
           <el-form-item label="总数量" prop="num">
-            <el-input
-              placeholder="总数量"
-              :disabled="type === 'view'"
-              v-model="ruleForm.num"
-            />
+            <el-input placeholder="总数量" :disabled="type === 'view'" v-model="ruleForm.num" />
           </el-form-item>
         </el-col>
+
         <el-col :span="6">
           <el-form-item label="总价" class="clear">
             <el-input disabled :value="Number(total).toFixed(2)" />
@@ -43,26 +41,56 @@
             <search-work-company
               :disabled="true"
               :value="ruleForm.customerCode"
+              :names="ruleForm.customerName"
               :placeholder="'业务公司'"
+              :isDetail="true"
               :size="'mini'"
               @searchChange="company_idsearchChange"
             />
           </el-form-item>
           <el-form-item label="供应商" prop="supplierNo">
-            <!-- :names="supplierName"
-                :isDetail="type !== 'add'"
-                :isp="this.type !== 'view'" -->
             <search-supplier
-              :is-detail="true"
+              :isDetail="true"
               :value="ruleForm.supplierNo"
-              :names="supplierName"
+              :names="ruleForm.supplierName"
               :placeholder="'供应商'"
               :disabled="type === 'view'"
               :size="'mini'"
               @searchChange="supplierNosearchChange"
             />
           </el-form-item>
+          <el-form-item label="附件" prop="fill_url">
+            <div v-if="ruleForm.fill_url" class="clearfix">
+              <a :href="ruleForm.fill_url" download="凭证文件">点击下载</a>
+
+              <el-link
+                :underline="false"
+                @click="ruleForm.fill_url = ''"
+                type="warning"
+                style="margin: 0 0 0 16px"
+              >删除</el-link>
+            </div>
+
+            <div class="activity-upload" v-else>
+              <div class="btnupload" style="position: relative">
+                <i class="el-icon-plus avatar-uploader-icon"></i>
+                <file-upload-pdf
+                  class="Upload"
+                  :accept="'.xlsx,.xls,.pdf,.zip,.rar,.7z'"
+                  :multiple="false"
+                  :uploadcondition="beforeOtherUpload"
+                  @UploadErrorEvent="UploadErrorOtherproof_url"
+                  @UploadSuccessEvent="UploadSuccessOtherproof_url"
+                />
+              </div>
+              <div class="txt-tips fl">
+                <p>建议大小:小于5MB</p>
+                <p>文件格式:.xlsx,.xls,.pdf,.zip,.rar,.7z</p>
+              </div>
+            </div>
+          </el-form-item>
         </el-col>
+
         <el-col :span="12">
           <el-row>
             <el-col :span="7">
@@ -126,34 +154,26 @@
               </el-form-item>
             </el-col>
             <el-col :span="7">
-              <el-form-item
-                :label="ruleForm.is_determine_price === '1' ? '采购裸价' : '销售单价'"
-              >
+              <el-form-item :label="ruleForm.is_determine_price === '1' ? '采购裸价' : '销售单价'">
                 <el-input
                   v-if="ruleForm.is_determine_price === '1'"
                   :disabled="true"
                   v-model="ruleForm.cgd_charge"
-                  :placeholder="'采购裸价'" />
-                <el-input
-                  v-else
-                  :disabled="true"
-                  v-model="ruleForm.price"
-                  :placeholder="'销售单价'"
-              /></el-form-item>
+                  :placeholder="'采购裸价'"
+                />
+                <el-input v-else :disabled="true" v-model="ruleForm.price" :placeholder="'销售单价'" />
+              </el-form-item>
             </el-col>
           </el-row>
           <el-row>
             <el-col :span="7">
               <el-form-item prop="type" label="确定" label-width="60px">
-                <el-select
-                  v-model="ruleForm.type"
-                  style="width: 100%"
-                  :disabled="type === 'view'"
-                >
+                <el-select v-model="ruleForm.type" style="width: 100%" :disabled="type === 'view'">
                   <el-option value="1" label="服务费金额" />
                   <el-option value="0" label="服务费比例" />
-                </el-select> </el-form-item
-            ></el-col>
+                </el-select>
+              </el-form-item>
+            </el-col>
             <el-col :span="10">
               <el-form-item
                 label="服务费比例"
@@ -234,11 +254,8 @@
             </el-col>
             <el-col :span="17">
               <el-form-item label="订单总金额" label-width="100px">
-                <el-input
-                  :disabled="true"
-                  v-model="ruleForm.total"
-                  :placeholder="'订单总金额'"
-              /></el-form-item>
+                <el-input :disabled="true" v-model="ruleForm.total" :placeholder="'订单总金额'" />
+              </el-form-item>
             </el-col>
           </el-row>
         </el-col>
@@ -252,8 +269,9 @@
                 :disabled="type === 'view'"
                 v-model="ruleForm.good_name"
                 placeholder="商品名称"
-              /> </el-form-item
-          ></el-col>
+              />
+            </el-form-item>
+          </el-col>
           <el-col :span="16">
             <el-row>
               <el-col :span="14">
@@ -262,7 +280,7 @@
                     :value="ruleForm.cat_id"
                     :placeholder="'分类'"
                     :size="'mini'"
-                    :names="cat_id_name"
+                    :names="ruleForm.cat_id_name"
                     :disabled="type === 'view' || ruleForm.customerCode.length === 0"
                     :company-no="ruleForm.customerCode"
                     :isDetail="true"
@@ -277,7 +295,7 @@
                     :size="'mini'"
                     :disabled="type === 'view'"
                     :isDetail="true"
-                    :names="brand_name"
+                    :names="ruleForm.brand_name"
                     :placeholder="'品牌'"
                     @searchChange="brand_idsearchChange"
                   />
@@ -291,7 +309,7 @@
                         :value="ruleForm.unit_id"
                         :size="'mini'"
                         :isDetail="true"
-                        :names="unit_name"
+                        :names="ruleForm.unit_name"
                         :disabled="type === 'view'"
                         :placeholder="'单位'"
                         @searchChange="unitsearchChange"
@@ -390,6 +408,8 @@
                     size="mini"
                     :placeholder="'产地'"
                     :level="3"
+                    :searchCode="true"
+                    :names="ruleForm.origin_place_codes"
                     @searchChange="selectAreaoriginChange($event)"
                   />
                 </el-form-item>
@@ -461,12 +481,7 @@
               <el-table-column fixed="right" width="88px" v-if="type !== 'view'">
                 <template slot="header" slot-scope="scope">
                   <span>操作</span>
-                  <el-tooltip
-                    class="item"
-                    effect="dark"
-                    content="添加规格类型"
-                    placement="top"
-                  >
+                  <el-tooltip class="item" effect="dark" content="添加规格类型" placement="top">
                     <i
                       class="el-icon-circle-plus-outline fr"
                       style="font-size: 18px; margin-top: 2px"
@@ -476,16 +491,10 @@
                 </template>
                 <template slot-scope="scope">
                   <el-tooltip effect="dark" content="修改" placement="top">
-                    <i
-                      class="el-icon-edit tb-icon"
-                      @click="openEdit(scope.$index, scope.row)"
-                    ></i>
+                    <i class="el-icon-edit tb-icon" @click="openEdit(scope.$index, scope.row)"></i>
                   </el-tooltip>
                   <el-tooltip effect="dark" v-if="!scope.row.isMust" placement="top">
-                    <i
-                      class="el-icon-delete tb-icon"
-                      @click="openDelete(scope.$index)"
-                    ></i>
+                    <i class="el-icon-delete tb-icon" @click="openDelete(scope.$index)"></i>
                   </el-tooltip>
                 </template>
               </el-table-column>
@@ -550,8 +559,7 @@
                     :key="item + index"
                     :label="item"
                     :value="item"
-                  >
-                  </el-option>
+                  ></el-option>
                 </el-select>
               </el-form-item>
             </el-col>
@@ -562,8 +570,7 @@
                   maxlength="100"
                   :disabled="type === 'view'"
                   v-model="ruleForm.other_config"
-                >
-                </el-input>
+                ></el-input>
               </el-form-item>
             </el-col>
           </el-row>
@@ -577,8 +584,7 @@
             maxlength="500"
             :disabled="type === 'view'"
             v-model="ruleForm.remark"
-          >
-          </el-input>
+          ></el-input>
         </el-form-item>
         <el-form-item label="工艺说明" prop="cost_desc">
           <el-input
@@ -586,8 +592,7 @@
             maxlength="500"
             :disabled="type === 'view'"
             v-model="ruleForm.cost_desc"
-          >
-          </el-input>
+          ></el-input>
         </el-form-item>
       </el-col>
 
@@ -660,7 +665,7 @@ import {
   options11,
   rules,
   ruleForm1,
-  other_ruleForm,
+  other_ruleForm
 } from "../config/columns";
 
 export default {
@@ -668,14 +673,15 @@ export default {
   mixins: [resToken, companyHelper],
   props: ["showModel", "id", "type", "sitem", "askItem", "newTime", "editId"],
   components: {
-    baseFormAddEdit,
+    baseFormAddEdit
   },
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size", "business_companyNo"]),
     powers() {
       const tran =
-        this.$store.getters.btnList.find((item) => item.menu_route == "goodsCostAdd") ||
-        {};
+        this.$store.getters.btnList.find(
+          item => item.menu_route == "goodsCostAdd"
+        ) || {};
       const { action } = tran ?? {};
       return action ?? [];
     },
@@ -683,14 +689,14 @@ export default {
       const { is_determine_price, expect_service, num } = this.ruleForm;
       const prop = is_determine_price === "1" ? "price" : "cgd_charge";
       return accMul(add_sum(this.ruleForm[prop], expect_service), num);
-    },
+    }
   },
   watch: {
-    newTime: function (val) {
+    newTime: function(val) {
       if (val) {
         this.initForm();
       }
-    },
+    }
   },
 
   data() {
@@ -728,11 +734,11 @@ export default {
       options9: options9,
       options10: options10,
       options11: options11,
-      ruleForm: ruleForm1,
+      ruleForm: { ...ruleForm1 },
       rules,
 
       //成本合算
-      newPrice: 0,
+      newPrice: 0
     };
   },
 
@@ -740,6 +746,54 @@ export default {
     this.initForm();
   },
   methods: {
+    // 其他文件上传成功
+    async UploadSuccessOtherproof_url(data) {
+      const { url } = data;
+      if (url === "noToken") {
+        await this.logout();
+      } else {
+        this.ruleForm.fill_url = url;
+
+        this.$message.success("文件成功!");
+      }
+    },
+
+    //其他文件上传失败
+    UploadErrorOtherproof_url(res) {
+      if (res !== "break") {
+        this.set_proof_url();
+        this.$message.error("文件上传失败!");
+      }
+    },
+
+    //判断其他文件规格
+    beforeOtherUpload(file) {
+      console.log(file);
+      let isJPG = false;
+      if (
+        file.type === "application/vnd.ms-excel" ||
+        file.type ===
+          "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
+        file.type === "application/pdf" ||
+        file.type === "application/x-zip-compressed"
+      ) {
+        isJPG = true;
+      }
+      let name = file.name;
+      let list = name.split(".");
+      if (list[list.length - 1] === "rar" || list[list.length - 1] === "7z") {
+        isJPG = true;
+      }
+
+      const isLt2M = file.size / 1024 / 1024 < 5;
+      if (!isJPG) {
+        this.$message.error("文件格式不正确!");
+      }
+      if (!isLt2M) {
+        this.$message.error("文件大小不能超过 5MB!");
+      }
+      return isJPG && isLt2M;
+    },
     //图片悬浮删除
     closeImg(index, key) {
       this.ruleForm[key].splice(index, 1);
@@ -747,24 +801,10 @@ export default {
     },
     async initForm() {
       this.loading = true;
-      // this.resetFormData();
       this.rulesThis = this.rules;
       await this.resetForm();
-
-      //贵金属校验
-      //   this.setrules();
-
       this.loading = false;
-      //调用成本合算计算函数
-      //   this.$refs.ruleForm.clearValidate([
-      //     "tax",
-      //     "cat_id",
-      //     "brand_id",
-      //     "supply_area",
-      //     "pay_way",
-      //   ]);
     },
-
     number_change(e, key) {
       console.log("----" + e + "--" + key);
       this.ruleForm[key] = e + "" || "0";
@@ -862,11 +902,13 @@ export default {
           const { spec } = data;
           if (spec && spec.length > 0) {
             if (this.spec_tableData && this.spec_tableData.length > 0) {
-              this.spec_tableData.forEach((c) => {
+              this.spec_tableData.forEach(c => {
                 c.isMust = false;
               });
               spec.forEach((a, ai) => {
-                let findex = this.spec_tableData.findIndex((b) => b.specid === a.id);
+                let findex = this.spec_tableData.findIndex(
+                  b => b.specid === a.id
+                );
                 if (findex !== -1) {
                   this.spec_tableData[findex].isMust = true;
                 } else {
@@ -877,7 +919,7 @@ export default {
                     spec_name: a.spec_name,
                     isMust: true,
                     spec_value_name: "",
-                    spec_value_id: "",
+                    spec_value_id: ""
                   });
                 }
               });
@@ -890,7 +932,7 @@ export default {
                   spec_name: a.spec_name,
                   isMust: true,
                   spec_value_name: "",
-                  spec_value_id: "",
+                  spec_value_id: ""
                 };
                 this.spec_tableData.push(model);
               });
@@ -918,7 +960,7 @@ export default {
     },
 
     async submitForm() {
-      await this.$refs.ruleForm.validate(async (valid) => {
+      await this.$refs.ruleForm.validate(async valid => {
         if (valid) {
           if (!this.loading) {
             this.loading = true;
@@ -939,7 +981,7 @@ export default {
             const {
               is_determine_price,
               expect_service,
-              expect_service_proportion,
+              expect_service_proportion
             } = this.ruleForm;
             const prop = is_determine_price === "1" ? "price" : "cgd_charge";
             const label = is_determine_price === "1" ? "销售价" : "裸价";
@@ -983,10 +1025,10 @@ export default {
             model.spec_list = [];
             model.supplierNo = model.supplierNo.toString();
             let list = JSON.parse(JSON.stringify(this.spec_tableData));
-            list.forEach((a) => {
+            list.forEach(a => {
               let am = {
                 spec_id: a.specid,
-                spec_value_id: a.spec_value_id,
+                spec_value_id: a.spec_value_id
               };
               model.spec_list.push(am);
             });
@@ -998,13 +1040,14 @@ export default {
               res = await asyncRequest.good_update(model);
             }
 
-            const { code, data, message } = await this.useResHandle(res);
+            const { code } = await this.useResHandle(res);
+
             this.loading = false;
             if (code === 0) {
               const title = this.type === "add" ? "新建成功!" : "修改成功!";
               this.$notify.success({
                 title: title,
-                message: "",
+                message: ""
               });
               this.showModelThis = false;
               this.$router.push("/supplierSellOut/supplierFiling");
@@ -1025,7 +1068,7 @@ export default {
           price,
           cgd_charge,
           is_determine_price,
-          expect_service_proportion,
+          expect_service_proportion
         } = this.ruleForm;
         const prop = is_determine_price === "1" ? "price" : "cgd_charge";
         if (!expect_service_proportion) return;
@@ -1038,7 +1081,10 @@ export default {
         this.ruleForm.expect_service =
           Number(this.ruleForm[prop]) === 0 || !this.ruleForm[prop]
             ? "0"
-            : accMul(accDiv(expect_service_proportion, 100), this.ruleForm[prop]);
+            : accMul(
+                accDiv(expect_service_proportion, 100),
+                this.ruleForm[prop]
+              );
         this.$refs.ruleForm.validate("expect_service");
         this.$forceUpdate();
       }
@@ -1048,7 +1094,12 @@ export default {
       if (this.$refs && this.$refs.ruleForm) {
         this.ruleForm.expect_service = e;
         this.$refs.ruleForm.validateField("expect_service");
-        const { price, cgd_charge, is_determine_price, expect_service } = this.ruleForm;
+        const {
+          price,
+          cgd_charge,
+          is_determine_price,
+          expect_service
+        } = this.ruleForm;
         if (!expect_service) return;
         const prop = is_determine_price === "1" ? "price" : "cgd_charge";
         const label = is_determine_price === "1" ? "销售价" : "裸价";
@@ -1078,6 +1129,84 @@ export default {
 
           if (this.type === "add") {
             this.ruleForm.customerCode = this.currentCompany;
+          } else if (this.type === "edit") {
+            this.loading = true;
+            const { code, data } = await asyncRequest.detail({
+              id: this.$route.query.id
+            });
+            this.loading = false;
+            if (code !== 0) return;
+
+            const {
+              companyName,
+              num,
+              is_determine_price,
+              customerCode,
+              customerName,
+              supplierName,
+              supplierNo,
+              cgd_charge,
+              price,
+              service_charge,
+              service_proportion,
+              good_name,
+              cat_info,
+              brand_name,
+              brand_id,
+              unit_id,
+              unit_name,
+              tax,
+              weight,
+              preservation_day,
+              delivery_day,
+              make_day,
+              origin_place,
+              delivery_place,
+              supply_area,
+              pay_way,
+              remark,
+              cost_desc,
+              good_img,
+              specinfo
+            } = data;
+
+            this.ruleForm = {
+              ...ruleForm1,
+              is_determine_price: is_determine_price || "",
+              companyName: companyName || "",
+              num: num || "",
+              customerCode: customerCode || "",
+              customerName: customerName || "",
+              supplierName: supplierName || "",
+              supplierNo: supplierNo ? [supplierNo] : "",
+              cgd_charge: cgd_charge || "",
+              service_charge: service_charge || "",
+              service_proportion: service_proportion || "",
+              cat_id: cat_info ? [cat_info[cat_info.length - 1].id] : "",
+              cat_id_name: cat_info
+                .map(({ name }, index) => (index === 0 ? name : `_${name}`))
+                .join(""),
+              good_name: good_name || "",
+              price: price || "",
+              brand_name: brand_name ? [brand_name] : "",
+              brand_id: brand_id ? [brand_id] : "",
+              unit_id: unit_id ? [unit_id] : "",
+              unit_name: unit_name ? [unit_name] : "",
+              tax: tax || "",
+              weight: weight || "",
+              preservation_day: preservation_day || "",
+              delivery_day: delivery_day || "",
+              make_day: make_day || "",
+              origin_place: origin_place || "",
+              delivery_place: delivery_place || "",
+              supply_area: supply_area || "",
+              pay_way: pay_way || "",
+              remark: remark || "",
+              cost_desc: cost_desc || "",
+              good_img: good_img || []
+            };
+
+            this.spec_tableData = specinfo;
           }
         }
       });
@@ -1256,47 +1385,8 @@ export default {
         this.$message.error("图片大小不能超过 1MB!");
       }
       return isJPG && isLt2M;
-    },
-    resetFormData() {
-      this.status = "";
-      this.is_noble = false;
-      this.cat_id_name = "";
-      this.brand_name = "";
-      this.unit_name = "";
-      this.ruleForm = {
-        companyName: "泰康",
-        supplierNo: [],
-        customerCode: [],
-        is_determine_price: "0",
-        num: "300",
-        cgd_charge: "100",
-        price: "0",
-        expect_service_proportion: "10",
-        expect_service: "0",
-        good_name: "1",
-        origin_place: [],
-        delivery_place: [],
-        cat_id: [],
-        brand_id: [],
-        unit_id: [],
-        weight: "0.000",
-        tax: "1",
-        supply_area: "1",
-        pay_way: "1",
-        send_way: "1",
-        preservation_day: "1", //有效期
-        delivery_day: "0", //物流时间
-        make_day: "0", //生产工期
-        gold_weight: "0.000",
-        noble_metal: "1",
-        config: [],
-        other_config: "1",
-        remark: "1",
-        cost_desc: "1",
-        good_img: ["0"],
-      };
-    },
-  },
+    }
+  }
 };
 </script>
 <style lang="scss" scoped>

+ 165 - 0
src/views/sellOut/filing/cpns/complianceForm.vue

@@ -0,0 +1,165 @@
+<template>
+  <el-form ref="formRef" label-width="110px" :rules="rules" :model="ruleForm">
+    <el-row>
+      <el-col :span="12">
+        <el-form-item label="是否合规" prop="is_check">
+          <el-select v-model="ruleForm.is_check" size="mini" style="width:100%">
+            <el-option
+              v-for="option in options"
+              :key="option.value"
+              :value="option.value"
+              :label="option.label"
+            />
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="所属平台" prop="platform_id">
+          <search-terrace
+            :value="ruleForm.platform_id"
+            :names="ruleForm.platform_name"
+            :disabled="false"
+            :size="'mini'"
+            :is_show="'1'"
+            :placeholder="'所属平台'"
+            @searchChange="platform_idsearchChange"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="客户公司" prop="companyCode">
+          <search-customer
+            :value="ruleForm.companyCode"
+            :names="ruleForm.companyName"
+            :placeholder="'客户名称'"
+            :size="'mini'"
+            :is-detail="ruleForm.companyName"
+            @searchChange="customerChange"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="12">
+        <el-form-item label="平台商品编号" prop="plat_code">
+          <el-select v-model="ruleForm.plat_code" size="mini" style="width:100%">
+            <el-option
+              v-for="option in options"
+              :key="option.value"
+              :value="option.value"
+              :label="option.label"
+            />
+          </el-select>
+        </el-form-item>
+      </el-col>
+
+      <el-col>
+        <el-form-item label="备注" prop="remark">
+          <el-input v-model="ruleForm.remark" type="textarea" />
+        </el-form-item>
+      </el-col>
+
+      <el-col :span="24">
+        <div style="width:100%;display:flex;justify-content:flex-end;margin-bottom:10px">
+          <el-button type="primary" size="mini" @click="onSubmit">保存</el-button>
+        </div>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      ruleForm: {
+        companyName: "",
+        companyCode: "",
+        platform_name: "",
+        platform_id: "",
+        label: "",
+        plat_code: ""
+      },
+      options: [
+        {
+          value: "0",
+          label: "不合规"
+        },
+        {
+          value: "1",
+          label: "合规"
+        }
+      ]
+    };
+  },
+  computed: {
+    rules() {
+      const { is_check } = this.ruleForm;
+      return {
+        companyCode: [
+          {
+            required: Number(is_check) === 0,
+            message: "请选择客户公司",
+            trigger: "chnage"
+          }
+        ],
+        platform_id: [
+          {
+            required: Number(is_check) === 1,
+            message: "请选择所属平台",
+            trigger: "chnage"
+          }
+        ],
+        is_check: [
+          {
+            required: true,
+            message: "请选择所属平台",
+            trigger: "chnage"
+          }
+        ],
+        companyCode: [
+          {
+            required: Number(is_check) === 1,
+            message: "请选择客户公司",
+            trigger: "chnage"
+          }
+        ],
+        plat_code: [
+          {
+            required: Number(is_check) === 1,
+            message: "请输入平台商品编号",
+            trigger: "chnage"
+          }
+        ],
+        remark: [
+          {
+            required: Number(is_check) === 0,
+            message: "请输入备注",
+            trigger: "chnage"
+          }
+        ]
+      };
+    }
+  },
+  methods: {
+    async platform_idsearchChange(e) {
+      console.log(e);
+      const { code, label } = e;
+      this.ruleForm.platform_id = code ? [code] : "";
+      this.ruleForm.platform_name = label ? [label] : "";
+      this.$refs.ruleForm.validateField("platform_id");
+    },
+    async customerChange(e) {
+      const { code } = e;
+      this.ruleForm.companyCode = code ? [code] : [];
+      this.ruleForm.companyName = e.label;
+      this.$refs.ruleForm.validateField("companyCode");
+    },
+    async onSubmit() {
+      try {
+        await this.$refs.formRef.validate();
+      } catch (e) {
+        console.log(e);
+      }
+    }
+  }
+};
+</script>

+ 43 - 44
src/views/sellOut/filing/cpns/exam-form.vue

@@ -10,8 +10,8 @@
     class="demo-ruleForm"
   >
     <el-row>
-      <el-col :span="12"
-        ><el-form-item label="客户名称" prop="companyCode">
+      <el-col :span="12">
+        <el-form-item label="客户名称" prop="companyCode">
           <search-customer
             :value="ruleForm.companyCode"
             :names="ruleForm.companyName"
@@ -19,10 +19,11 @@
             :size="'mini'"
             :isDetail="ruleForm.companyName"
             @searchChange="customerChange"
-        /></el-form-item>
+          />
+        </el-form-item>
       </el-col>
-      <el-col :span="12"
-        ><el-form-item label="服务费" prop="service_charge" style="padding-bottom:1px">
+      <el-col :span="12">
+        <el-form-item label="服务费" prop="service_charge" style="padding-bottom:1px">
           <digital-input
             :values="ruleForm.service_charge"
             :placeholder="'服务费'"
@@ -52,8 +53,8 @@
         </el-form-item>
       </el-col>
 
-      <el-col :span="12"
-        ><el-form-item label="服务费比例" prop="service_proportion" style="padding-bottom:1px">
+      <el-col :span="12">
+        <el-form-item label="服务费比例" prop="service_proportion" style="padding-bottom:1px">
           <digital-input
             :values="ruleForm.service_proportion"
             :placeholder="'服务费比例'"
@@ -80,14 +81,7 @@
         </el-form-item>
       </el-col>
       <el-col :span="12">
-        <el-button
-          v-if="!disabled"
-          :size="'mini'"
-          type="primary"
-          class="fr"
-          @click="submitForm"
-          >保 存
-        </el-button>
+        <el-button v-if="!disabled" :size="'mini'" type="primary" class="fr" @click="submitForm">保 存</el-button>
       </el-col>
     </el-row>
   </el-form>
@@ -98,7 +92,7 @@ import {
   add_sum, //加法精算
   accSub, //减法精算
   accMul, //乘法精算
-  accDiv, //除法精算
+  accDiv //除法精算
 } from "@/utils/validate";
 export default {
   name: "exam-form",
@@ -119,7 +113,7 @@ export default {
   data() {
     return {
       loading: false,
-      isInit:true,
+      isInit: true,
       is_determine_price: "",
       cgd_charge: "",
       price: "",
@@ -132,7 +126,7 @@ export default {
         service_proportion: "",
         plat_code: "",
         platform_id: "",
-        platform_name: "",
+        platform_name: ""
       },
       rulesThis: this.rules,
       rules: {
@@ -141,28 +135,30 @@ export default {
             required: true,
             type: "array",
             message: "请选择企业客户",
-            trigger: "change",
-          },
+            trigger: "change"
+          }
         ],
 
-        service_charge: [{ required: true, message: "请输入服务费", trigger: "blur" }],
+        service_charge: [
+          { required: true, message: "请输入服务费", trigger: "blur" }
+        ],
         service_proportion: [
-          { required: true, message: "请输入服务费比例", trigger: "blur" },
+          { required: true, message: "请输入服务费比例", trigger: "blur" }
         ],
         platform_id: [
           {
             required: true,
             message: "请选择平台",
-            trigger: "change",
-          },
-        ],
-      },
+            trigger: "change"
+          }
+        ]
+      }
     };
   },
   watch: {
-    newTime: function () {
+    newTime: function() {
       this.initForm();
-    },
+    }
   },
   mounted() {
     this.initForm();
@@ -194,14 +190,16 @@ export default {
             expect_service,
             expect_service_proportion,
             platform_id,
-            platform_name,
+            platform_name
           } = this.sitem;
 
           this.cgd_charge = cgd_charge;
           this.price = price;
           const service = status + "" === "0" ? expect_service : service_charge;
           const proportion =
-            status + "" === "0" ? expect_service_proportion : service_proportion;
+            status + "" === "0"
+              ? expect_service_proportion
+              : service_proportion;
 
           this.is_determine_price = is_determine_price;
           this.ruleForm = {
@@ -212,8 +210,9 @@ export default {
             service_charge: service ? service : "0",
             service_proportion: proportion ? proportion : "0",
             plat_code,
-            platform_id: platform_id && platform_id + "" !== "0" ? platform_id : "",
-            platform_name,
+            platform_id:
+              platform_id && platform_id + "" !== "0" ? platform_id : "",
+            platform_name
           };
         }
       });
@@ -223,18 +222,18 @@ export default {
       const { code, label } = e;
       this.ruleForm.companyCode = code ? [code] : [];
       this.ruleForm.companyName = label ? label : "";
-       this.$refs.ruleForm && this.$refs.ruleForm.validateField("companyCode");
+      this.$refs.ruleForm && this.$refs.ruleForm.validateField("companyCode");
     },
     platform_codesearchChange(e) {
       const { id, label } = e;
       this.ruleForm.platform_id = id;
       this.ruleForm.platform_name = label ? label : "";
-       this.$refs.ruleForm && this.$refs.ruleForm.validateField("platform_id");
+      this.$refs.ruleForm && this.$refs.ruleForm.validateField("platform_id");
     },
     async number_change(e, key) {
-      if(Number(this.ruleForm[key]).toFixed(2) === Number(e).toFixed(2)) {
-        return
-      }     
+      if (Number(this.ruleForm[key]).toFixed(2) === Number(e).toFixed(2)) {
+        return;
+      }
       this.ruleForm[key] = e + "" || "0";
       this.$refs.ruleForm && this.$refs.ruleForm.validateField(key);
       await this.num(key);
@@ -257,7 +256,7 @@ export default {
       if (key === "service_proportion") {
         rate = this.ruleForm.service_proportion ?? "0" * 1;
       }
-      
+
       if (is_sale && key === "service_charge") {
         if (qrdAdd <= serAdd) {
           this.$message.error("服务费不能大于等于销售单价!");
@@ -298,18 +297,18 @@ export default {
         }
         qrdAdd = accDiv(cgdAdd, accSub(100, rate));
         serAdd = accSub(Number(qrdAdd).toFixed(2), cgdAdd);
-        console.log(serAdd)
+        console.log(serAdd);
 
         await this.set_number_change("service_charge", serAdd);
       }
     },
     async set_number_change(key, value) {
       this.ruleForm[key] = value + "" || "0";
-       this.$refs.ruleForm && this.$refs.ruleForm.validateField(key);
+      this.$refs.ruleForm && this.$refs.ruleForm.validateField(key);
     },
     async submitForm() {
-      console.log(this.ruleForm)
-      await this.$refs.ruleForm.validate(async (valid) => {
+      console.log(this.ruleForm);
+      await this.$refs.ruleForm.validate(async valid => {
         if (valid) {
           this.$emit("searchChange", this.ruleForm);
         } else {
@@ -317,8 +316,8 @@ export default {
           return false;
         }
       });
-    },
-  },
+    }
+  }
 };
 </script>
 

+ 50 - 48
src/views/sellOut/filing/detail.vue

@@ -3,7 +3,7 @@
     <el-tabs v-model="activeTabs">
       <el-tab-pane name="1" :label="title">
         <el-collapse v-model="collapses">
-          <el-collapse-item v-if="type === 'add'" name="1" :title="title">
+          <el-collapse-item v-if="type === 'add' || type === 'edit'" name="1" :title="title">
             <base-form :id="id" :type="type" />
           </el-collapse-item>
 
@@ -11,27 +11,23 @@
             v-else
             ref="baseForm"
             :sitem="sitem"
-            @change-status="handleChangeStatus"
             @change-num="handleChangeNum"
+            @change-status="handleChangeStatus"
             @change-order-code="handleChangeOrderCode"
-            @change-detail="(det) => {sitem = det;status = det.status}"
+            @change-detail="(detail) => 
+              {sitem = detail;
+              status = detail.status}
+            "
           />
 
-          <el-collapse-item v-if="(status == '0' || status == '2') && !isSupertube" title="审批" name="2">
-            <exam-forms
-              v-if="newTime !== ''"
-              :new-time="newTime"
-              :sitem="sitem"
-              @searchChange="examFormSubmit($event, '')"
-            />
+          <el-collapse-item
+            name="2"
+            title="是否合规设置"
+            v-if="!isSupertube && type !== 'add' && type !== 'edit'"
+          >
+            <compliance-form />
           </el-collapse-item>
 
-          <!-- <tempalte v-if="status === '2'">
-            <el-collapse-item name="3" title="待转单">
-              <wait-transferred :id="id" :num="num" @refresh="handleRefresh" />
-            </el-collapse-item>
-          </tempalte> -->
-
           <el-collapse-item v-if="status === '3'" name="4" title="发货单">
             <shipment-request :order-code="orderCode" />
           </el-collapse-item>
@@ -42,78 +38,84 @@
 </template>
 
 <script>
-// import WaitTransferred from './cpns/wait-transferred.vue'
-import ShipmentRequest from './cpns/shipment-request.vue'
-import baseDetail from './cpns/baseDetail.vue'
-import BaseForm from './cpns/baseForm.vue'
-import ExamForms from './cpns/exam-form.vue'
-import asyncRequest from '@/apis/service/sellOut/filing'
-import { mapGetters } from 'vuex'
+import ShipmentRequest from "./cpns/shipment-request.vue";
+import asyncRequest from "@/apis/service/sellOut/filing";
+import ComplianceForm from "./cpns/complianceForm.vue";
+import baseDetail from "./cpns/baseDetail.vue";
+import ExamForms from "./cpns/exam-form.vue";
+import BaseForm from "./cpns/baseForm.vue";
+import { mapGetters } from "vuex";
 
 export default {
   components: {
     BaseForm,
     ExamForms,
     baseDetail,
-    // WaitTransferred,
+    ComplianceForm,
     ShipmentRequest
   },
   data() {
     return {
+      activeTabs: "1",
+      collapses: ["1", "2", "3", "4"],
       loading: false,
-      activeTabs: '1',
-      collapses: ['1', '2', '3', '4'],
-      status: '',
+      orderCode: "",
+      status: "",
       sitem: {},
-      orderCode: '',
-      num: '0'
-    }
+      num: "0"
+    };
   },
   computed: {
-    ...mapGetters(['isSupertube']),
+    ...mapGetters(["isSupertube"]),
     title() {
-      return this.id && this.id !== 'add' ? '报备单详情' : '新建报备单'
+      const mapTitle = {
+        add: "新建报备单",
+        view: "报备单详情",
+        edit: "编辑报备单"
+      };
+
+      return mapTitle[this.$route.query.type];
     },
     type() {
-      return this.id && this.id !== 'add' ? 'view' : 'add'
+      return this.$route.query.type;
     },
     id() {
-      return this.$route.query.id
+      return this.$route.query.id;
     },
     getNewTime() {
-      this.newTime = new Date().valueOf()
+      this.newTime = new Date().valueOf();
     }
   },
   methods: {
     async examFormSubmit({ companyCode, ...rest } = {}) {
-      const { id } = this.$route.query
-      this.loading = true
+      const { id } = this.$route.query;
+      this.loading = true;
       await asyncRequest.status({
         ...rest,
         id,
         companyCode: Array.isArray(companyCode) ? companyCode[0] : companyCode
-      })
-      await this.$refs.baseForm.initData()
-      this.loading = false
-      console.log(this.loading)
+      });
+      await this.$refs.baseForm.initData();
+      this.loading = false;
+      console.log(this.loading);
       // this.handleRefresh()
     },
     handleChangeStatus(status) {
-      this.status = status
+      this.status = status;
     },
     handleChangeOrderCode(orderCode) {
-      this.orderCode = orderCode
+      this.orderCode = orderCode;
     },
     async handleRefresh() {
-      this.loading = true
-      this.$refs.baseForm.initData()
-      this.loading = false
+      this.loading = true;
+      this.$refs.baseForm.initData();
+      this.loading = false;
     },
     handleChangeNum(num) {
-      this.num = num
+      this.num = num;
     }
   }
-}
+};
 </script>
 
 <style lang="scss" scoped>

+ 33 - 43
src/views/sellOut/filing/index.vue

@@ -67,14 +67,10 @@
                 type="primary"
                 style="float: right; margin-left: 5px"
                 @click="searchList"
-              >
-                刷新
-              </el-button>
+              >刷新</el-button>
             </el-col>
             <el-col :span="4" style="width: 66px; float: right">
-              <el-button type="warning" class="fr" :size="searchSize" @click="restSearch">
-                重置
-              </el-button>
+              <el-button type="warning" class="fr" :size="searchSize" @click="restSearch">重置</el-button>
             </el-col>
           </el-row>
           <el-row>
@@ -90,9 +86,7 @@
                     type: 'add',
                   })
                 "
-              >
-                添加
-              </el-button>
+              >添加</el-button>
             </el-col>
             <el-col :span="4" style="margin-top: 15px">
               <search-customer
@@ -130,16 +124,11 @@
       </template>
 
       <template #good_img="{ scope }">
-        <div
-          v-if="scope.row.good_img"
-          style="width: 20px; height: 20px"
-          class="hover"
-          v-viewer
-        >
+        <div v-if="scope.row.good_img" style="width: 20px; height: 20px" class="hover" v-viewer>
           <img
             :src="scope.row.good_img"
             style="display: inline-block; width: 100%; height: 100%"
-            alt=""
+            alt
           />
         </div>
       </template>
@@ -156,15 +145,15 @@
 
       <template #operation="{ scope }">
         <el-tooltip effect="dark" content="详情" placement="top">
+          <i class="el-icon-view tb-icon" @click="getRouter('/sellOut/filingDetail', scope.row.id)"></i>
+        </el-tooltip>
+
+        <el-tooltip effect="dark" content="修改" placement="top">
           <i
-            class="el-icon-view tb-icon"
-            @click="getRouter('/sellOut/filingDetail', scope.row.id)"
+            class="el-icon-edit tb-icon"
+            @click="getRouter('/sellOut/filingDetail', scope.row.id,'edit')"
           ></i>
         </el-tooltip>
-
-        <!-- <el-tooltip effect="dark" content="取消转单" placement="top">
-          <i v-if="String(scope.row.status) !== '3' && String(scope.row.status) !== '5'" class="el-icon-refresh-right tb-icon" @click="handleCancel(scope.row.id)"></i>
-        </el-tooltip> -->
       </template>
     </ex-table>
   </div>
@@ -185,21 +174,21 @@ export default {
   components: {},
   computed: {
     ...mapGetters([
-      "tablebtnSize",
-      "searchSize",
-      "size",
       "business_companyNo",
+      "tablebtnSize",
       "isSupertube",
+      "searchSize",
+      "size"
     ]),
     maxNo() {
       return this.business_companyNo;
-    },
+    }
   },
 
   watch: {
     maxNo(val, oldval) {
       this.restSearch();
-    },
+    }
   },
   data() {
     return {
@@ -215,7 +204,7 @@ export default {
       input: "",
       timeOBJ: {
         start_date: "", //起始时间
-        end_date: "", // 结束时间
+        end_date: "" // 结束时间
       },
       // 状态
       statusOptions: statusOptions,
@@ -228,7 +217,7 @@ export default {
       parmValue: {
         companyCode: [],
         start_date: "", //新建起始时间
-        end_date: "", // 新建结束时间
+        end_date: "" // 新建结束时间
       },
       tableData: [],
       passwordModel: false,
@@ -240,16 +229,16 @@ export default {
       table: {
         stripe: true,
         border: true,
-        _defaultHeader_: ["setcol"],
+        _defaultHeader_: ["setcol"]
       },
       // 表格 - 分页
       pageInfo: {
         size: 15,
         curr: 1,
-        total: 0,
+        total: 0
       },
       // 表格 - 列参数
-      columns: columns,
+      columns: columns
     };
   },
   mounted() {
@@ -262,7 +251,7 @@ export default {
       this.pageInfo = {
         size: size,
         curr: page,
-        total: 0,
+        total: 0
       };
       //多选条件
       this.select = this.parmValue.select;
@@ -273,11 +262,12 @@ export default {
   },
 
   methods: {
-    getRouter(toRouter, queryId) {
+    getRouter(toRouter, queryId, type) {
       console.log(toRouter, queryId);
       if (toRouter && queryId) {
         let model = {
           id: queryId,
+          type
         };
 
         //有多选框的条件
@@ -287,7 +277,7 @@ export default {
 
         let routerModel = {
           options: JSON.parse(JSON.stringify(this.parmValue)),
-          router: this.$route.path,
+          router: this.$route.path
         };
         model.preModel = JSON.stringify(routerModel);
 
@@ -312,14 +302,14 @@ export default {
     },
     showal(list, message, code) {
       let htmlList = "<ul>";
-      list.forEach((v) => {
+      list.forEach(v => {
         htmlList += `<li>${code !== "" ? v[code] : v}</li>`;
       });
       htmlList += "</ul>";
       this.$notify({
         title: message,
         dangerouslyUseHTMLString: true,
-        message: htmlList,
+        message: htmlList
       });
     },
     restSearch() {
@@ -329,7 +319,7 @@ export default {
       this.wsm_supplierNo = [];
       this.timeOBJ = {
         start_date: "", //起始时间
-        end_date: "", // 结束时间
+        end_date: "" // 结束时间
       };
       this.parmValue = {
         filingCode: "", // 报备单编码
@@ -347,13 +337,13 @@ export default {
         orderCode: "", //订单编号
         company_name: "", //部门
         page: 1, // 页码
-        size: 15, // 每页显示条数
+        size: 15 // 每页显示条数
       };
       // 表格 - 分页
       this.pageInfo = {
         size: 15,
         curr: 1,
-        total: 0,
+        total: 0
       };
       this.searchList();
     },
@@ -380,7 +370,7 @@ export default {
         ...this.timeOBJ,
         companyCode: Array.isArray(this.parmValue.companyCode)
           ? this.parmValue.companyCode[0]
-          : this.parmValue.companyCode,
+          : this.parmValue.companyCode
       });
       const { code, data } = await this.useResHandle(res);
       if (code === 0) {
@@ -403,8 +393,8 @@ export default {
         this.parmValue.page = 1;
         this.searchList();
       }
-    },
-  },
+    }
+  }
 };
 </script>
 <style lang="scss" scoped>

+ 158 - 78
src/views/supplierSellOut/supplierFiling/cpns/wait-transferred.vue

@@ -1,5 +1,18 @@
 <template>
   <div>
+    <div style="display:flex;margin-bottom: 10px">
+      <p style="width:80px">
+        <span style="color:red">*</span>&nbsp;客户公司
+      </p>
+      <search-customer
+        :value="ruleForm.companyCode"
+        :names="ruleForm.companyName"
+        :placeholder="'客户公司'"
+        :size="'mini'"
+        @searchChange="customerChange"
+      />
+    </div>
+
     <el-form ref="formRef" :model="editCacheData" :rules="rules">
       <el-table border size="mini" :data="list" max-height="300px">
         <el-table-column label="收货总数" prop="receipt_quantity">
@@ -23,7 +36,12 @@
         <el-table-column label="收货联系电话" prop="mobile">
           <template slot-scope="scope">
             <el-form-item v-if="scope.$index === editIndex" prop="mobile">
-              <el-input v-model="editCacheData.mobile" size="mini" placeholder="收货联系电话" maxlength="11" />
+              <el-input
+                v-model="editCacheData.mobile"
+                size="mini"
+                placeholder="收货联系电话"
+                maxlength="11"
+              />
             </el-form-item>
             <span v-else>{{ scope.row.mobile }}</span>
           </template>
@@ -63,7 +81,12 @@
             </el-tooltip>
 
             <el-tooltip placement="top" content="手动添加地址">
-              <el-button size="mini" type="text" icon="el-icon-circle-plus-outline" @click="handlePushAddress" />
+              <el-button
+                size="mini"
+                type="text"
+                icon="el-icon-circle-plus-outline"
+                @click="handlePushAddress"
+              />
             </el-tooltip>
           </template>
 
@@ -75,8 +98,19 @@
               icon="el-icon-circle-check"
               @click="handleSave()"
             />
-            <el-button v-else size="mini" type="text" icon="el-icon-edit" @click="handleSetEdit(scope.$index)" />
-            <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.$index)" />
+            <el-button
+              v-else
+              size="mini"
+              type="text"
+              icon="el-icon-edit"
+              @click="handleSetEdit(scope.$index)"
+            />
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-delete"
+              @click="handleDelete(scope.$index)"
+            />
           </template>
         </el-table-column>
       </el-table>
@@ -93,154 +127,200 @@
 </template>
 
 <script>
-import InAddressModal from '@/components/in-address-modal'
-import { addressRules } from './../config/rules'
-import { utils, writeFile } from 'xlsx'
-import asyncRequest from '@/apis/service/sellOut/filing'
+import InAddressModal from "@/components/in-address-modal";
+import { addressRules } from "./../config/rules";
+import { utils, writeFile } from "xlsx";
+import asyncRequest from "@/apis/service/sellOut/filing";
 
 const defaultAddressData = {
-  receipt_quantity: '',
-  addr_code_name: '',
-  contactor: '',
-  addr_code: '',
-  mobile: '',
-  addr: ''
-}
+  receipt_quantity: "",
+  addr_code_name: "",
+  contactor: "",
+  addr_code: "",
+  mobile: "",
+  addr: ""
+};
 
 export default {
   components: {
     InAddressModal
   },
-  props: ['id', 'num'],
+  props: ["id", "num"],
   data() {
     return {
+      ruleForm: {
+        companyName: "",
+        companyCode: ""
+      },
       list: [],
       editIndex: -1,
       loading: false,
       showModal: false,
       rules: addressRules,
-      editCacheData: { ...defaultAddressData }
-    }
+      editCacheData: { ...defaultAddressData },
+      companyName: ""
+    };
   },
   methods: {
     handleShowModal() {
-      this.showModal = true
+      this.showModal = true;
     },
 
     handleSetEdit(index) {
       if (this.editIndex >= 0) {
-        this.$message.warning('当前已有地址在编辑,请保存后再试!')
-        return
+        this.$message.warning("当前已有地址在编辑,请保存后再试!");
+        return;
       }
-      this.editIndex = index
+      this.editIndex = index;
 
-      const { contactor, receipt_quantity, mobile, addr_code, addr, addr_code_name } = this.list[index]
+      const {
+        contactor,
+        receipt_quantity,
+        mobile,
+        addr_code,
+        addr,
+        addr_code_name
+      } = this.list[index];
 
       this.editCacheData = {
-        contactor, receipt_quantity, mobile, addr_code, addr, addr_code_name
-      }
+        contactor,
+        receipt_quantity,
+        mobile,
+        addr_code,
+        addr,
+        addr_code_name
+      };
     },
 
     downloadTemplate() {
-      const data = Array(20).fill(0).map(() => ({
-        '收货总数': '1',
-        '收货联系人': '张三',
-        '收货联系电话': '17878787878',
-        '收货省名称': '北京市',
-        '收货市名称': '北京市',
-        '收货区名称': '东城区',
-        '详细地址': 'xxx街道xxx号'
-      }))
-
-      const workBook = utils.book_new()
-      const workSheet = utils.json_to_sheet(data)
-      utils.book_append_sheet(workBook, workSheet, 'sheet')
+      const data = Array(20)
+        .fill(0)
+        .map(() => ({
+          收货总数: "1",
+          收货联系人: "张三",
+          收货联系电话: "17878787878",
+          收货省名称: "北京市",
+          收货市名称: "北京市",
+          收货区名称: "东城区",
+          详细地址: "xxx街道xxx号"
+        }));
+
+      const workBook = utils.book_new();
+      const workSheet = utils.json_to_sheet(data);
+      utils.book_append_sheet(workBook, workSheet, "sheet");
 
       // 导出模板
-      writeFile(workBook, '收货模板.xlsx', {
-        bookType: 'xlsx'
-      })
+      writeFile(workBook, "收货模板.xlsx", {
+        bookType: "xlsx"
+      });
     },
     handleDelete(index) {
-      this.list.splice(index, 1)
-      if (this.editIndex >= 0) this.editIndex = -1
+      this.list.splice(index, 1);
+      if (this.editIndex >= 0) this.editIndex = -1;
     },
 
     handleSave() {
       this.$refs.formRef.validate(async isValid => {
-        if (!isValid) return
+        if (!isValid) return;
 
-        const { addr_code } = this.editCacheData
-        const { data, code } = await asyncRequest.addrall({ code: addr_code[addr_code.length - 1] })
+        const { addr_code } = this.editCacheData;
+        const { data, code } = await asyncRequest.addrall({
+          code: addr_code[addr_code.length - 1]
+        });
 
         if (Number(code) === 0) {
-          this.editCacheData.addr_code_name = data.province.name + '/' + data.city.name + '/' + data.area.name
+          this.editCacheData.addr_code_name =
+            data.province.name + "/" + data.city.name + "/" + data.area.name;
         }
 
-        this.$set(this.list, this.editIndex, this.editCacheData)
-        this.editCacheData = { ...defaultAddressData }
-        this.editIndex = -1
-      })
+        this.$set(this.list, this.editIndex, this.editCacheData);
+        this.editCacheData = { ...defaultAddressData };
+        this.editIndex = -1;
+      });
     },
 
-    handleRefresh(data) {
-      const _data = data.list.map(({ addr, addr_code, contactor, mobile, receipt_quantity, addr_code_name }) => ({
-        addr,
-        addr_code,
-        contactor, mobile,
-        receipt_quantity,
-        addr_code_name
-      }))
+    customerChange(evt) {
+      const { code, label } = evt;
+
+      this.ruleForm = {
+        companyCode: code ? [code] : "",
+        companyName: label ? [label] : ""
+      };
+    },
 
-      this.list = [...this.list, ..._data]
-      this.showModal = false
+    handleRefresh(data) {
+      const _data = data.list.map(
+        ({
+          addr,
+          addr_code,
+          contactor,
+          mobile,
+          receipt_quantity,
+          addr_code_name
+        }) => ({
+          addr,
+          addr_code,
+          contactor,
+          mobile,
+          receipt_quantity,
+          addr_code_name
+        })
+      );
+
+      this.list = [...this.list, ..._data];
+      this.showModal = false;
     },
 
     handlePushAddress() {
       if (this.editIndex >= 0) {
-        this.$message.warning('当前已有地址在编辑,请保存后再试!')
-        return
+        this.$message.warning("当前已有地址在编辑,请保存后再试!");
+        return;
       }
 
-      this.list.push({ ...defaultAddressData })
-      this.editIndex = this.list.length - 1
+      this.list.push({ ...defaultAddressData });
+      this.editIndex = this.list.length - 1;
     },
 
     handleInAddrChange(e) {
-      this.editCacheData['addr_code'] = e
+      this.editCacheData["addr_code"] = e;
     },
 
     async handleSubmit() {
+      if (!this.ruleForm.companyCode) {
+        this.$message.warning("请选择客户公司");
+        return;
+      }
+
       if (this.editIndex !== -1) {
-        this.$message.warning('当前已有地址在编辑,请保存后再试!')
-        return
+        this.$message.warning("当前已有地址在编辑,请保存后再试!");
+        return;
       }
 
       if (this.list.length === 0) {
-        this.$message.warning('至少填写一条记录!')
-        return
+        this.$message.warning("至少填写一条记录!");
+        return;
       }
 
       const currentNum = this.list.reduce((current, prev) => {
-        return Number(current) + Number(prev.receipt_quantity)
-      }, 0)
+        return Number(current) + Number(prev.receipt_quantity);
+      }, 0);
 
       if (Number(this.num) > currentNum) {
-        this.$message.warning('收货数量小于销售数量!')
-        return
+        this.$message.warning("收货数量小于销售数量!");
+        return;
       }
 
       const { data, code, message } = await asyncRequest.transfer({
         id: this.id,
         addr_list: this.list
-      })
+      });
 
       if (Number(code) === 0) {
-        this.$emit('refresh')
+        this.$emit("refresh");
       } else {
-        this.$message.error(message)
+        this.$message.error(message);
       }
     }
   }
-}
+};
 </script>

+ 31 - 31
src/views/supplierSellOut/supplierFiling/detail.vue

@@ -30,9 +30,9 @@
                 @searchChange="examFormSubmit($event, '')"
               />
             </el-collapse-item>
-          </template> -->
+          </template>-->
 
-          <tempalte v-if="status === '2' && !isSupertube">
+          <tempalte v-if="true && !isSupertube">
             <el-collapse-item name="3" title="待转单">
               <wait-transferred :id="id" :num="num" @refresh="handleRefresh" />
             </el-collapse-item>
@@ -50,13 +50,13 @@
 </template>
 
 <script>
-import WaitTransferred from './cpns/wait-transferred.vue'
-import ShipmentRequest from './cpns/shipment-request.vue'
-import baseDetail from './cpns/baseDetail.vue'
-import BaseForm from './cpns/baseForm.vue'
+import WaitTransferred from "./cpns/wait-transferred.vue";
+import ShipmentRequest from "./cpns/shipment-request.vue";
+import baseDetail from "./cpns/baseDetail.vue";
+import BaseForm from "./cpns/baseForm.vue";
 // import ExamForms from './cpns/exam-form.vue'
-import asyncRequest from '@/apis/service/sellOut/filing'
-import { mapGetters } from 'vuex'
+import asyncRequest from "@/apis/service/sellOut/filing";
+import { mapGetters } from "vuex";
 
 export default {
   components: {
@@ -69,58 +69,58 @@ export default {
   data() {
     return {
       loading: false,
-      activeTabs: '1',
-      collapses: ['1', '2', '3', '4'],
-      status: '',
+      activeTabs: "1",
+      collapses: ["1", "2", "3", "4"],
+      status: "",
       sitem: {},
-      orderCode: '',
-      num: '0'
-    }
+      orderCode: "",
+      num: "0"
+    };
   },
   computed: {
-    ...mapGetters(['isSupertube']),
+    ...mapGetters(["isSupertube"]),
     title() {
-      return this.id && this.id !== 'add' ? '报备单详情' : '新建报备单'
+      return this.id && this.id !== "add" ? "报备单详情" : "新建报备单";
     },
     type() {
-      return this.id && this.id !== 'add' ? 'view' : 'add'
+      return this.id && this.id !== "add" ? "view" : "add";
     },
     id() {
-      return this.$route.query.id
+      return this.$route.query.id;
     },
     getNewTime() {
-      this.newTime = new Date().valueOf()
+      this.newTime = new Date().valueOf();
     }
   },
   methods: {
     async examFormSubmit({ companyCode, ...rest } = {}) {
-      const { id } = this.$route.query
-      this.loading = true
+      const { id } = this.$route.query;
+      this.loading = true;
       await asyncRequest.status({
         ...rest,
         id,
         companyCode: Array.isArray(companyCode) ? companyCode[0] : companyCode
-      })
+      });
 
-      await this.$refs.baseForm.initData()
-      this.loading = false
+      await this.$refs.baseForm.initData();
+      this.loading = false;
     },
     handleChangeStatus(status) {
-      this.status = status
+      this.status = status;
     },
     handleChangeOrderCode(orderCode) {
-      this.orderCode = orderCode
+      this.orderCode = orderCode;
     },
     async handleRefresh() {
-      this.loading = true
-      await this.$refs.baseForm.initData()
-      this.loading = false
+      this.loading = true;
+      await this.$refs.baseForm.initData();
+      this.loading = false;
     },
     handleChangeNum(num) {
-      this.num = num
+      this.num = num;
     }
   }
-}
+};
 </script>
 
 <style lang="scss" scoped>