xiaodai2022 2 jaren geleden
bovenliggende
commit
f163d74b74

+ 162 - 161
src/views/orderEntry/orderEnter/columns.js

@@ -1,167 +1,168 @@
 const listCol = [{
-    type: "selection",
-    fixed: "left",
-    _noset_: true
-  },
-  {
-    prop: "status",
-    label: "当前状态",
-    _slot_: "statusTxt",
-    width: "152px",
-  },
-  {
-    prop: "platform_code",
-    label: "平台订单号",
-    width: "152px",
-  },
-  
-  {
-    prop: "platform_time",
-    label: "平台订单下单时间",
-    width: "140px",
-  },
-  {
-    prop: "creater",
-    label: "导入人",
-    width: "140px",
-  },
-  {
-    prop: "addtime",
-    label: "导入时间",
-    width: "140px",
-  },
-  
-  {
-    prop: "sale_source",
-    label: "销售渠道",
-    width: "140px",
-  },
-  {
-    prop: "plat_code",
-    label: "平台商品编号",
-    width: "140px",
-  },
-  {
-    prop: "price",
-    label: "单价(元)",
-    width: "140px",
-  },
-  {
-    prop: "num",
-    label: "数量",
-    width: "140px",
-  },
-  {
-    prop: "po_code",
-    label: "其他单号",
-    width: "140px",
-  },
-  // {
-  //   prop: "before_discount_all_price",
-  //   label: "优惠前总金额",
-  //   width: "140px",
-  // },
-  {
-    prop: "discount_price",
-    label: "订单总金额",
-    width: "140px",
-  },
-  // {
-  //   prop: "after_price",
-  //   label: "商品优惠后的金额",
-  //   width: "140px",
-  // },
-  {
-    prop: "activity_name",
-    label: "优惠活动名称",
-    width: "140px",
-  },
+  type: "selection",
+  fixed: "left",
+  _noset_: true
+},
+{
+  prop: "platform_code",
+  label: "平台订单号",
+  width: "152px",
+},
+{
+  prop: "plat_code",
+  label: "平台商品编号",
+  width: "140px",
+},
+{
+  prop: "status",
+  label: "当前状态",
+  _slot_: "statusTxt",
+  width: "152px",
+},
+{
+  prop: "sale_source",
+  label: "销售渠道",
+  width: "100px",
+},
 
-  {
-    prop: "mode",
-    label: "收费模式",
-    width: "140px",
-  },
-  
-  {
-    prop: "contactor",
-    label: "收货人",
-    width: "140px",
-  },
-  {
-    prop: "mobile",
-    label: "联系电话",
-    width: "140px",
-  },
-  {
-    prop: "addr",
-    label: "联系地址",
-    width: "140px",
-  },
-  {
-    prop: "order_remark",
-    label: "订单备注",
-    width: "140px",
-  },
-  // {
-  //   prop: "",
-  //   label: "订单编号",
-  //   width: "160px",
-  // },
-  // {
-  //   prop: "",
-  //   label: "供应商编码",
-  //   width: "160px",
-  // },
-  // {
-  //   prop: "",
-  //   label: "供应商名称",
-  //   width: "160px",
-  // },
-  // {
-  //   prop: "",
-  //   label: "业务公司编号",
-  //   width: "160px",
-  // },
-  // {
-  //   prop: "",
-  //   label: "业务公司名称",
-  //   width: "160px",
-  // },
-  // {
-  //   prop: "",
-  //   label: "商品编码",
-  //   width: "160px",
-  // },
-  // {
-  //   prop: "",
-  //   label: "商品名称",
-  //   width: "160px",
-  // },
-  // {
-  //   prop: "",
-  //   label: "平台商品编号",
-  //   width: "160px",
-  // },
-  // {
-  //   prop: "",
-  //   label: "单位",
-  //   width: "60px",
-  // },
-  // {
-  //   prop: "",
-  //   label: "录入状态",
-  //   width: "120px",
-  // },
+{
+  prop: "price",
+  label: "单价(元)",
+  width: "100px",
+},
+{
+  prop: "num",
+  label: "数量",
+  width: "100px",
+},
 
-  {
-    prop: "",
-    label: "操作",
-    fixed: "right",
-    _noset_: true,
-    width: "50px",
-    _slot_: "operation",
-  },
+// {
+//   prop: "before_discount_all_price",
+//   label: "优惠前总金额",
+//   width: "140px",
+// },
+{
+  prop: "discount_price",
+  label: "订单总金额",
+  width: "140px",
+},
+// {
+//   prop: "after_price",
+//   label: "商品优惠后的金额",
+//   width: "140px",
+// },
+{
+  prop: "activity_name",
+  label: "优惠活动名称",
+  width: "140px",
+},
+
+{
+  prop: "mode",
+  label: "收费模式",
+  width: "90px",
+},
+
+{
+  prop: "contactor",
+  label: "收货人",
+  width: "60px",
+},
+{
+  prop: "mobile",
+  label: "联系电话",
+  width: "100px",
+},
+{
+  prop: "addr",
+  label: "联系地址",
+  width: "140px",
+},
+{
+  prop: "platform_time",
+  label: "平台订单下单时间",
+  width: "145px",
+},
+{
+  prop: "po_code",
+  label: "其他单号",
+  width: "140px",
+},
+{
+  prop: "creater",
+  label: "导入人",
+  width: "80px",
+},
+{
+  prop: "addtime",
+  label: "导入时间",
+  width: "145px",
+},
+
+{
+  prop: "order_remark",
+  label: "订单备注",
+  width: "140px",
+},
+// {
+//   prop: "",
+//   label: "订单编号",
+//   width: "160px",
+// },
+// {
+//   prop: "",
+//   label: "供应商编码",
+//   width: "160px",
+// },
+// {
+//   prop: "",
+//   label: "供应商名称",
+//   width: "160px",
+// },
+// {
+//   prop: "",
+//   label: "业务公司编号",
+//   width: "160px",
+// },
+// {
+//   prop: "",
+//   label: "业务公司名称",
+//   width: "160px",
+// },
+// {
+//   prop: "",
+//   label: "商品编码",
+//   width: "160px",
+// },
+// {
+//   prop: "",
+//   label: "商品名称",
+//   width: "160px",
+// },
+// {
+//   prop: "",
+//   label: "平台商品编号",
+//   width: "160px",
+// },
+// {
+//   prop: "",
+//   label: "单位",
+//   width: "60px",
+// },
+// {
+//   prop: "",
+//   label: "录入状态",
+//   width: "120px",
+// },
+
+{
+  prop: "",
+  label: "操作",
+  fixed: "right",
+  _noset_: true,
+  width: "50px",
+  _slot_: "operation",
+},
 ]
 
 export {

+ 2 - 12
src/views/orderEntry/orderEnter/index.vue

@@ -182,8 +182,7 @@
           </div>
         </template>
         <template #statusTxt="{ scope }">
-          <!-- <span></span> -->
-          <el-tag :type="statusActiveTag(scope.row.status)" style="margin:auto;">{{ statusActive(scope.row.status) }}</el-tag>
+          <el-tag :size="'mini'" :type="statusActiveTag(scope.row.status)" style="margin:auto;">{{ statusActive(scope.row.status) }}</el-tag>
         </template>
         <template #operation="{ scope }">
           <el-tooltip
@@ -199,15 +198,6 @@
           </el-tooltip>
         </template>
       </ex-table>
-
-      <!-- <el-dialog
-        title="当前可用库存"
-        :visible.sync="centerDialogVisible"
-        width="30%"
-        center
-      >
-        <span>等待数据返回</span>
-      </el-dialog> -->
     </div>
     <div v-else>
       <no-auth></no-auth>
@@ -529,7 +519,7 @@ export default {
 }
 .tableBox {
   width: 100%;
-  margin-top: 20px;
+  // margin-top: 20px;
 }
 /deep/ .setcol-table-lie{
   top: 5px !important;

+ 11 - 10
src/views/orderEntry/orderImport/columns.js

@@ -3,13 +3,14 @@ const columns = [
   {
     prop: "",
     type:"index",
-    width: "50px",
+    fixed: "left",
+    width: "100px",
   },
 
   {
     prop: "platform_code",
     label: "平台订单号",
-    // fixed: "left",
+    
     width: "152px",
   },
   {
@@ -20,12 +21,12 @@ const columns = [
   {
     prop: "platform_time",
     label: "平台订单下单时间",
-    width: "140px",
+    width: "145px",
   },
   {
     prop: "sale_source",
     label: "销售渠道",
-    width: "140px",
+    width: "90px",
   },
   {
     prop: "plat_code",
@@ -35,12 +36,12 @@ const columns = [
   {
     prop: "price",
     label: "单价(元)",
-    width: "140px",
+    width: "110px",
   },
   {
     prop: "num",
     label: "数量",
-    width: "140px",
+    width: "110px",
   },
   // {
   //   prop: "before_discount_all_price",
@@ -50,7 +51,7 @@ const columns = [
   {
     prop: "discount_price",
     label: "订单总金额",
-    width: "140px",
+    width: "110px",
   },
   // {
   //   prop: "after_price",
@@ -65,7 +66,7 @@ const columns = [
   {
     prop: "mode",
     label: "收费模式",
-    width: "140px",
+    width: "90px",
   },
   {
     prop: "order_remark",
@@ -75,12 +76,12 @@ const columns = [
   {
     prop: "contactor",
     label: "收货人",
-    width: "140px",
+    width: "60px",
   },
   {
     prop: "mobile",
     label: "联系电话",
-    width: "140px",
+    width: "110px",
   },
   {
     prop: "addr",

+ 78 - 93
src/views/orderEntry/orderImport/index.vue

@@ -1,46 +1,31 @@
 <template>
-  <div class="box">
-    <div class="con">
-      
-      <div class="tab">
-        <h1></h1>
-          <upload-excel :on-success="handleSuccess" :before-upload="beforeUpload" />
-      <h1 style="color: #0099ff"></h1>
-        <ex-table :columns="columns" :table="table" :data="tableData"> 
-          <el-table-column width="50" type="index" />
-          <template #operation={scope}>
-            <el-tooltip
-            
-            effect="dark"
-            content="删除"
-            placement="top"
-          >
-            <i
-              class="el-icon-delete tb-icon"
-              @click="del(scope)"
-            ></i>
-          </el-tooltip>
-          </template>
-        </ex-table>
-        <div class="btn">
-      <el-button type="primary" @click="submit">提交</el-button>
-      <el-button @click="cancel">取消</el-button>
+  <div class="orderImport pagePadding">
+    <div v-if="tableData && tableData.length > 0" class="tr" style="padding:10px 0 0 0">
+     
+      <el-button @click="cancel" :size="'mini'">取消</el-button>
+       <el-button type="primary" @click="submit" :size="'mini'">提交</el-button>
     </div>
-      </div>
-      
+    <div v-else>
+      <upload-excel :on-success="handleSuccess" :before-upload="beforeUpload" />
     </div>
-    
+    <ex-table :columns="columns" :table="table" :data="tableData" style="margin:15px  0 0 0">
+      <template #operation="{ scope }">
+        <el-tooltip effect="dark" content="删除" placement="top">
+          <i class="el-icon-delete tb-icon" @click="del(scope)"></i>
+        </el-tooltip>
+      </template>
+    </ex-table>
   </div>
 </template>
 
 <script>
 import asyncRequest from "@/apis/service/orderEntry/orderImport";
 import resToken from "@/mixins/resToken";
-import { province_list, city_list, county_list } from "@/assets/js/area-data";
 import { columns } from "./columns";
-import { set } from 'js-cookie';
+
 export default {
   mixins: [resToken],
+  name: "orderImport",
   data() {
     return {
       ruleForm: {
@@ -64,12 +49,10 @@ export default {
       columns: columns,
 
       //按钮锁
-      btnFlag:false,
+      btnFlag: false,
     };
   },
-  mounted(){
-   
-  },
+  mounted() {},
   methods: {
     beforeUpload(file) {
       const isLt1M = file.size / 1024 / 1024 < 1;
@@ -133,32 +116,29 @@ export default {
       // let r = /^\+?[1-9][0-9]*$/;
       // let tableOk = true;
       this.ruleForm.order_addr = [];
-      list.forEach((v1,index) => {
+      list.forEach((v1, index) => {
         let b = Object.values(v1);
         let numFlag = false;
-        
-        try{
-          if(
-            !isNaN(b[5]) && !isNaN(b[6]) && !isNaN(b[7])
-          ){
 
-          }else{
-            this.$message.warning(`excel表格第${index+1}行,单价,数量,总金额必须是数字`);
+        try {
+          if (!isNaN(b[5]) && !isNaN(b[6]) && !isNaN(b[7])) {
+          } else {
+            this.$message.warning(
+              `excel表格第${index + 1}行,单价,数量,总金额必须是数字`
+            );
             numFlag = true;
             throw Error();
-            
           }
 
-
-          if(!Number.isInteger(Number(b[6]))){
-            this.$message.warning(`excel表格第${index+1}行,数量必须是整数`);
+          if (!Number.isInteger(Number(b[6]))) {
+            this.$message.warning(`excel表格第${index + 1}行,数量必须是整数`);
             numFlag = true;
             throw Error();
           }
-        }catch(e){
-
+        } catch (e) {}
+        if (numFlag) {
+          return;
         }
-        if(numFlag){return;}
         // let item = this.get_code(b[3], b[4], b[5]);
         let model = {
           platform_code: b[0] + "",
@@ -189,48 +169,52 @@ export default {
       this.tableData = [];
     },
     //删除
-    del(scope){
-      console.log(scope.$index)
-      this.$confirm('是否删除本条导入数据?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          this.tableData.splice(scope.$index,1)
-          this.$message({    
-            type: 'success',
-            message: '删除成功!'
+    del(scope) {
+      console.log(scope.$index);
+      this.$confirm("是否删除本条导入数据?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.tableData.splice(scope.$index, 1);
+          this.$message({
+            type: "success",
+            message: "删除成功!",
           });
-        }).catch(() => {
+        })
+        .catch(() => {
           this.$message({
-            type: 'info',
-            message: '已取消删除'
-          });          
+            type: "info",
+            message: "已取消删除",
+          });
         });
-      
     },
     //日期转换
     formatDate(numb) {
       const date = new Date(numb);
-        var Y = date.getFullYear() + '-';
-        var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
-        var D = date.getDate() + ' ';
-        // var h = date.getHours() + ':';
-        // var m = date.getMinutes() + ':';
-        // var s = date.getSeconds();
-        return Y+M+D;
+      var Y = date.getFullYear() + "-";
+      var M =
+        (date.getMonth() + 1 < 10
+          ? "0" + (date.getMonth() + 1)
+          : date.getMonth() + 1) + "-";
+      var D = date.getDate() + " ";
+      // var h = date.getHours() + ':';
+      // var m = date.getMinutes() + ':';
+      // var s = date.getSeconds();
+      return Y + M + D;
     },
     //提交
     async submit() {
-      if(this.btnFlag){
-        console.log("拦截点击")
+      if (this.btnFlag) {
+        console.log("拦截点击");
         return;
       }
-      
+
       const model = {
         list: this.tableData,
       };
-       if(model.list.length<=0){
+      if (model.list.length <= 0) {
         this.$message.warning("导入数据不能为空");
         return;
       }
@@ -246,7 +230,7 @@ export default {
       let flag = true;
       let platform_code_arr = [];
       model.list.forEach((item, index) => {
-        platform_code_arr.push(item.platform_code)
+        platform_code_arr.push(item.platform_code);
         //必填判断
         if (flag) {
         } else {
@@ -265,17 +249,20 @@ export default {
       });
 
       //去重锁
-      if(platform_code_arr.length != Array.from(new Set(platform_code_arr)).length){
+      if (
+        platform_code_arr.length !=
+        Array.from(new Set(platform_code_arr)).length
+      ) {
         this.$message.warning(`平台订单号不能重复`);
         return;
       }
-      if(flag){
+      if (flag) {
         //按钮锁开启
         this.btnFlag = true;
-        this.submitHttp(model)
+        this.submitHttp(model);
       }
     },
-    async submitHttp(model) {  
+    async submitHttp(model) {
       const res = await asyncRequest.orderimport(model);
       if (res && res.code === 0) {
         this.$notify.success({
@@ -283,7 +270,6 @@ export default {
           message: "",
         });
         this.tableData = [];
-        
       } else if (res && res.code >= 100 && res.code <= 104) {
         await this.logout();
       } else {
@@ -299,9 +285,9 @@ export default {
 <style lang="scss" scoped>
 .box {
   width: 100%;
-  padding-top: 50px;
+  // padding-top: 50px;
   box-sizing: border-box;
-  height: 100vh;
+  // height: 100vh;
   // overflow: hidden;
   background: #fff;
 }
@@ -311,7 +297,6 @@ export default {
   background: #fff;
   // padding: 50px;
   box-sizing: border-box;
-  
 
   h1 {
     margin-bottom: 20px;
@@ -320,14 +305,14 @@ export default {
     color: #333;
   }
 }
-.tab{
-  width: 100%;
-  overflow: hidden;
-  margin: auto;
-  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
-  padding: 30px;
+// .tab{
+//   width: 100%;
+//   overflow: hidden;
+//   margin: auto;
+//   box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
+//   padding: 30px;
 
-}
+// }
 .btn {
   width: 50%;
   margin: 50px auto 0;