xiaodai2022 2 jaren geleden
bovenliggende
commit
2ed9ab2b37

+ 1 - 1
src/assets/js/btnList.js

@@ -76,7 +76,7 @@ const btnList = [
   { code: "075", name: "编辑支持品牌" },
   { code: "076", name: "启/禁用支持品牌" },
   { code: "077", name: "删除支持品牌" },
-  { code: "078", name: "再次发起审核流程" },
+  { code: "078", name: "再次发起上线" },
   { code: "079", name: "下线商品" },
   { code: "080", name: "库管发货" },
   { code: "081", name: "添加发货申请" },

+ 7 - 1
src/views/orderEntry/orderConfirm/index.vue

@@ -838,13 +838,19 @@ export default {
         {
           prop: "platform_name",
           label: "客户名称",
+          span: 12,
+        },
+         {
+          prop: "platform_name",
+          label: "导入目标平台",
           span: 6,
         },
+
         {
           prop: "error_msg",
           label: "解析失败原因",
           _slot_: "error_msg",
-          span: 6,
+          span: 18,
         },
       ],
 

+ 65 - 65
src/views/orderEntry/orderEnter/index.vue

@@ -75,12 +75,10 @@
                 >
               </el-col>
 
-           
-            
               <el-col
                 :span="2"
                 class="fr"
-                style="width: 107px; padding: 0 0 0 10px"
+                style="width: 130px; padding: 0 0 0 10px"
                 v-if="
                   powers &&
                   powers.length > 0 &&
@@ -93,31 +91,12 @@
                   class="btn"
                   size="mini"
                   ><a href="./static/C端订单导入模板.xlsx"
-                    >下载模板</a
+                    >下载导入模板</a
                   ></el-button
                 >
               </el-col>
-              <el-col
-                :span="2"
-                class="fr"
-                style="width: 101px"
-                v-if="
-                  powers &&
-                  powers.length > 0 &&
-                  powers.some((item) => item == '085')
-                "
-              >
-                <el-button
-                  size="mini"
-                  type="primary"
-                  icon="el-icon-share"
-                  class="btn"
-                  @click="selectStock"
-                  >关联库存</el-button
-                >
-              </el-col>
             </el-row>
-            <el-row >
+            <el-row style="padding: 0 0 10px 0">
               <el-col :span="6" style="width: 230px">
                 <search-terrace
                   :value="parmValue.platform_id"
@@ -127,7 +106,7 @@
                   :placeholder="'导入目标平台'"
                   @searchChange="platform_codesearchChange"
               /></el-col>
-              <el-col :span="8" style="width: 352px;padding:0 0 0 10px">
+              <el-col :span="8" style="width: 352px; padding: 0 0 0 10px">
                 <periodDatePickerActive
                   :start="parmValue.addtime_start"
                   :end="parmValue.addtime_end"
@@ -137,7 +116,37 @@
                   @timeReturned="addtime"
                 />
               </el-col>
-              <el-col :span="10" style="width: 352px;padding:0 0 0 10px">
+              <el-col
+                :span="2"
+                class="fr"
+                style="width: 66px; padding: 0 0 0 10px"
+              >
+                <el-button type="warning" class="btn" @click="reset" size="mini"
+                  >重置</el-button
+                >
+              </el-col>
+              <el-col
+                :span="2"
+                class="fr"
+                style="width: 130px; padding: 0 0 0 10px"
+                v-if="
+                  powers &&
+                  powers.length > 0 &&
+                  powers.some((item) => item == '085')
+                "
+              >
+                <el-button
+                  size="mini"
+                  type="primary"
+                  icon="el-icon-share"
+                  class="btn"
+                  @click="selectStock"
+                  >批量关联库存</el-button
+                >
+              </el-col>
+            </el-row>
+            <el-row>
+              <el-col :span="10" style="width: 400px">
                 <el-input
                   v-model="inputValue"
                   :size="searchSize"
@@ -148,42 +157,46 @@
                   "
                   placeholder="关键字"
                 >
-                 <el-select
-                  style="width:120px"
-                  @change="
-                 
-                    pageInfo.curr = 1;
-                    parmValue.page = 1;
-                    searchList();
-                  "
-                  slot="prepend"
-                  :size="searchSize"
-                  v-model="selectValue"
-                >
-                  <el-option
-                    v-for="item in selectValueArr"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
+                  <el-select
+                    style="width: 120px"
+                    @change="
+                      pageInfo.curr = 1;
+                      parmValue.page = 1;
+                      searchList();
+                    "
+                    slot="prepend"
+                    :size="searchSize"
+                    v-model="selectValue"
                   >
-                  </el-option>
-                </el-select>
+                    <el-option
+                      v-for="item in selectValueArr"
+                      :key="item.value"
+                      :label="item.label"
+                      :value="item.value"
+                    >
+                    </el-option>
+                  </el-select>
                 </el-input>
               </el-col>
-
               <el-col
                 :span="2"
                 class="fr"
                 style="width: 66px; padding: 0 0 0 10px"
+                v-if="powers.some((item) => item == '006')"
               >
-                <el-button type="warning" class="btn" @click="reset" size="mini"
-                  >重置</el-button
+                <el-button
+                  size="mini"
+                  type="danger"
+                  class="btn"
+                  @click="batchDel"
+                  >删除</el-button
                 >
               </el-col>
-                <el-col
+
+              <el-col
                 :span="2"
                 class="fr"
-                style="width: 91px; padding: 0 0 0 10px"
+                style="width: 130px; padding: 0 0 0 10px"
                 v-if="
                   powers &&
                   powers.length > 0 &&
@@ -194,22 +207,9 @@
                   class="btn entry"
                   @click="entry"
                   size="mini"
+                  icon="el-icon-upload"
                   type="success"
-                  >订单导入</el-button
-                >
-              </el-col>
-                 <el-col
-                :span="2"
-                class="fr"
-                style="width: 66px; padding: 0 0 0 10px"
-                v-if="powers.some((item) => item == '006')"
-              >
-                <el-button
-                  size="mini"
-                  type="danger"
-                  class="btn"
-                  @click="batchDel"
-                  >删除</el-button
+                  >平台订单导入</el-button
                 >
               </el-col>
             </el-row>

+ 95 - 43
src/views/orderEntry/orderImport/index.vue

@@ -1,41 +1,51 @@
 <template>
   <div class="orderImport pagePadding" v-loading="loading">
-    <div
-      v-if="tableData && tableData.length > 0"
-      class="tr"
-      style="padding: 10px 0 0 0"
-    >
+  
+    <div class="tr" style="padding: 10px 0 0 0"   v-if="tableData && tableData.length > 0">
       <el-form
         ref="ruleForm"
         :model="ruleForm"
         status-icon
         :size="'mini'"
         :rules="rulesThis"
-        label-width="80px"
+        label-width="120px"
         class="demo-ruleForm"
       >
         <el-row>
-          <el-col :span="12">
-            <el-form-item label="订单所在平台" prop="username">
-              <el-input
-                v-model="ruleForm.username"
-                maxlength="100"
-                :disabled="isDetail"
+          <el-col :span="8">
+            <el-form-item label="导入目标平台" prop="platform_id">
+              <search-terrace
+                :value="ruleForm.platform_id"
+                :disabled="false"
+                :size="'mini'"
+                :isDetail="false"
+                :placeholder="'导入目标平台'"
+                @searchChange="platform_codesearchChange"
               />
             </el-form-item>
           </el-col>
 
-          <el-col :span="12">
-            <el-button type="primary" @click="submit" :size="'mini'" class="fl"
+          <el-col :span="16" class="tr">
+            <el-button
+              type="primary"
+              @click="submit"
+              :size="'mini'"
+              class="fr"
+              style="margin: 0 0 0 10px"
               >提交</el-button
             >
-            <el-button @click="cancel" :size="'mini'" class="fl"
+            <el-button
+              @click="resetForm"
+              :size="'mini'"
+              class="fr"
+              style="margin: 0 0 0 10px"
               >取消</el-button
             >
           </el-col>
         </el-row>
       </el-form>
     </div>
+    
     <div v-else>
       <upload-excel :on-success="handleSuccess" :before-upload="beforeUpload" />
     </div>
@@ -60,7 +70,7 @@ export default {
   data() {
     return {
       ruleForm: {
-        order_addr: [], //收货地址
+        platform_id: "",
       },
       // 表格 - 参数
       table: {
@@ -76,6 +86,16 @@ export default {
         curr: 1,
         total: 0,
       },
+      rulesThis: this.rules,
+      rules: {
+        platform_id: [
+          {
+            required: true,
+            message: "请选择导入目标平台",
+            trigger: "change",
+          },
+        ],
+      },
       loading: false,
       // 表格 - 列参数
       columns: columns,
@@ -87,8 +107,30 @@ export default {
       editBtnFlag: false,
     };
   },
-  mounted() {},
+  mounted() {
+    this.resetForm();
+  },
   methods: {
+    async resetForm() {
+      this.loading = false;
+      this.rulesThis = this.rules;
+      this.tableData = [];
+      // 重置
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
+          this.ruleForm = {
+            platform_id: "", // 账号
+          };
+        }
+      });
+    },
+    platform_codesearchChange(e) {
+      const { id } = e;
+      this.ruleForm.platform_id = id || "";
+      this.$refs.ruleForm.validateField("platform_id");
+    },
     beforeUpload(file) {
       const isLt1M = file.size / 1024 / 1024 < 1;
       if (isLt1M) {
@@ -175,37 +217,47 @@ export default {
       }
       // console.log(this.tableData);
     },
-    //取消
-    cancel() {
-      this.tableData = [];
-    },
 
     //提交
     async submit() {
-      if (!this.loading) {
-        this.loading = true;
-        if (this.tableData.length === 0) {
-          this.$message.warning("导入数据不能为空");
-          this.loading = false;
-          return;
-        }
-        let model = {
-          list: this.tableData,
-        };
-        const { code, data, message } = await asyncRequest.orderimport(model);
-        this.loading = false;
-        if (code === 0) {
-          this.$notify.success({
-            title: "导入成功!",
-            message: "",
-          });
-          this.tableData = [];
-        } else if (code >= 100 && code <= 104) {
-          await this.logout();
+      await this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          if (!this.loading) {
+            this.loading = true;
+            if (this.tableData.length === 0) {
+              this.$message.warning("导入数据不能为空");
+              this.loading = false;
+              return;
+            }
+            const { platform_id } = this.ruleForm;
+            let list = JSON.parse(JSON.stringify(this.tableData));
+            list.forEach((a) => {
+              a.platform_id = platform_id;
+            });
+            let model = {
+              list: list,
+            };
+            const { code, data, message } = await asyncRequest.orderimport(
+              model
+            );
+            this.loading = false;
+            if (code === 0) {
+              this.$notify.success({
+                title: "导入成功!",
+                message: "",
+              });
+              await this.resetForm();
+            } else if (code >= 100 && code <= 104) {
+              await this.logout();
+            } else {
+              this.$message.warning(message);
+            }
+          }
         } else {
-          this.$message.warning(message);
+          console.log("error submit!!");
+          return false;
         }
-      }
+      });
     },
   },
 };