소스 검색

收货地址模块接口已全部对接完成

hzj18279462576@163.com 9 달 전
부모
커밋
4b75875d8b
4개의 변경된 파일310개의 추가작업 그리고 12개의 파일을 삭제
  1. 1 1
      src/utils/httpRequest.js
  2. 305 10
      src/views/deliveryAddress/deliveryAddress.vue
  3. 3 1
      src/views/mission/mission.vue
  4. 1 0
      src/views/servicePackage/servicePackage.vue

+ 1 - 1
src/utils/httpRequest.js

@@ -46,7 +46,7 @@ http.interceptors.response.use(
     }
     // console.log(
     //   decrypt(
-    //     urlSafeBase64Decode("RPX3_v1bTP4fLfrEMWHegP8rSwSecprw4V9bjXLnqKU=")
+    //     urlSafeBase64Decode("VoOvrGkObjpwTxh9fnFHWLZa4RM1RG34gaxRoGoPmoG2fl8iJmTFqAYeA8_KoWVfwy94Je0aw_uTqgBxRgbs6Q==")
     //   ),
     //   "11111111111111111111111111"
     // );

+ 305 - 10
src/views/deliveryAddress/deliveryAddress.vue

@@ -71,18 +71,26 @@
       </el-button>
     </div>
     <div style="margin:5px 0 15px 0;">
-      <el-button size="mini" type="primary" icon="document" @click="cleans"
+      <el-button
+        :disabled="!isAuth('deliveryAddress:import')"
+        size="mini"
+        type="primary"
+        icon="document"
+        @click="daoruCheck"
         >导入
       </el-button>
       <el-button
+      :disabled="!isAuth('deliveryAddress:export')"
         style="margin-left:15px;"
         size="mini"
-        type="primary"
+        type="warning"
         icon="document"
-        @click="cleans"
-        >导出
+        @click="exportList"
+      >
+        导出Excel
       </el-button>
       <el-button
+      :disabled="!isAuth('deliveryAddress:add')"
         style="margin-left:15px;"
         size="mini"
         type="primary"
@@ -118,23 +126,23 @@
       <el-table-column prop="enableFlag" label="是否启用" width="80">
         <template slot-scope="scope">
           <el-switch
+          :disabled="!isAuth('deliveryAddress:update')"
             v-model="scope.row.status"
             @change="changeType($event, scope.row)"
-            :disabled="!isAuth('integral:update')"
             active-value="1"
             inactive-value="0"
           >
           </el-switch>
         </template>
       </el-table-column>
-      <el-table-column prop="updateTime" label="创建时间" width="160">
+      <el-table-column prop="createTime" label="创建时间" width="160">
       </el-table-column>
       <el-table-column fixed="right" label="操作" width="180">
         <template slot-scope="scope">
           <el-button
             size="mini"
             type="primary"
-            :disabled="!isAuth('integral:update')"
+            :disabled="!isAuth('deliveryAddress:update')"
             @click="updates(scope.row)"
             style="margin: 3px;"
             >修改
@@ -142,7 +150,7 @@
           <el-button
             size="mini"
             type="danger"
-            :disabled="!isAuth('integral:delete')"
+            :disabled="!isAuth('deliveryAddress:delete')"
             @click="deleteuser(scope.row)"
             style="margin: 3px;"
             v-if="scope.row.id != 14"
@@ -168,7 +176,7 @@
       title="新增收货地址"
       :visible.sync="addDialog"
       center
-      width="30%"
+      width="600px"
     >
       <el-form :model="addForm">
         <el-form-item label="骑手站点:" :label-width="formLabelWidth">
@@ -252,6 +260,98 @@
         >
       </div>
     </el-dialog>
+
+    <!-- 导出限制 -->
+    <el-dialog
+      custom-class="export"
+      :visible.sync="exportVisible"
+      center
+      :title="exportTitle"
+      :close-on-click-modal="false"
+    >
+      <div class="con" v-show="exportFlag == 1">
+        <img src="../../assets/img/error.png" alt="" />
+        <span
+          style="font-size:20px;color: #000;font-weight: 800;margin: 18px 0 5px;"
+          >当前导出条数超过50000条,暂不支持导出</span
+        >
+        <span style="font-size:14px;color: #808080;"
+          >(注:数据中的图片、附件只能以链接的形式导出)</span
+        >
+      </div>
+      <div class="con" v-show="exportFlag == 2">
+        <img class="gundong" src="../../assets/img/loading.png" alt="" />
+        <span
+          style="font-size:20px;color: #000;font-weight: 800;margin: 18px 0 5px;"
+          >导出中...</span
+        >
+        <span style="font-size:14px;color: #808080;"
+          >(注:请到个人导出记录查看并下载)</span
+        >
+      </div>
+      <div class="con" v-show="exportFlag == 3">
+        <img src="../../assets/img/success.png" alt="" />
+        <span
+          style="font-size:20px;color: #000;font-weight: 800;margin: 18px 0 5px;"
+          >导出成功</span
+        >
+        <span style="font-size:14px;color: #808080;"
+          >(注:请到个人导出记录查看并下载)</span
+        >
+      </div>
+      <div class="con" v-show="exportFlag == 4">
+        <img class="gundong" src="../../assets/img/loading.png" alt="" />
+        <span
+          style="font-size:20px;color: #000;font-weight: 800;margin: 18px 0 5px;"
+          >版本迭代中,导出暂时无法使用</span
+        >
+      </div>
+      <div class="btn">
+        <el-button type="primary" @click="exportAffirm">确定</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 导入 -->
+    <el-dialog
+      custom-class="daoru"
+      :visible.sync="daoruVisible"
+      center
+      title="导入收货地址"
+      :close-on-click-modal="false"
+      width="700px"
+    >
+      <div style="margin-bottom: 55px;">
+        <el-button
+          style="margin-bottom: 20px;"
+          type="warning"
+          @click="daoruTemplate"
+          >导入模板下载</el-button
+        >
+        <el-upload
+          class="upload-demo"
+          drag
+          ref="upload"
+          v-model="daoruFile"
+          :http-request="daoruChange"
+          action="#"
+          :before-upload="daoruBeforeUpload"
+          :on-remove="handleRemove"
+        >
+          <!-- <el-button type="primary">点击上传</el-button> -->
+          <i class="el-icon-upload"></i>
+          <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+          <div class="el-upload__tip" slot="tip">
+            只能上传execl文件
+          </div>
+        </el-upload>
+      </div>
+      <div class="btn" style="display: flex;flex-direction: row-reverse;">
+        <el-button type="primary" @click="daoruAffirm">确定</el-button>
+        <el-button @click="daoruCancel" style="margin-right: 20px;"
+          >取消</el-button
+        >
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -304,7 +404,15 @@ export default {
         lat: "", //维度不能为空
         status: "", //启用状态;1启用、0禁用
         sort: "" //排序不能为空
-      }
+      },
+
+      // 导出限制
+      exportTitle: "导出错误",
+      exportVisible: false,
+      exportFlag: 1, //1 超出限制  2导出中
+
+      daoruVisible: false,
+      daoruFile: []
     };
   },
   methods: {
@@ -607,6 +715,161 @@ export default {
           }
         });
       }
+    },
+
+    exportList() {
+      console.log(this.tableData.totalCount, "导出条数");
+      this.exportTitle = "导出";
+      // this.exportFlag = 4;
+      this.exportVisible = true;
+      if (this.tableData.totalCount >= 50000) {
+        this.exportTitle = "导出错误";
+        this.exportFlag = 1;
+      } else {
+        this.exportTitle = "导出";
+        this.exportFlag = 2;
+        this.exportVisible = true;
+        var userId = this.$cookie.get("userId");
+        this.$http({
+          url: this.$http.adornUrl("admin/export/exportShippingAddress"),
+          method: "get",
+          // responseType: "blob",
+          params: this.$http.adornParams({
+            // 'page': page,
+            // 'size': this.size,
+            userId: userId,
+            addressDetail: this.search.addressDetail,
+            status: this.search.status,
+            stationId: this.search.stationId,
+            startTime: this.search.createTime[0],
+            endTime: this.search.createTime[1]
+          })
+        }).then(({ data }) => {
+          console.log(data, "导出");
+          if (data.code == 0) {
+            this.exportTitle = "导出成功";
+            this.exportFlag = 3;
+          }
+          // let blob = new Blob([data], {
+          //   type:
+          //     "application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
+          // });
+          // if (window.navigator.msSaveOrOpenBlob) {
+          //   navigator.msSaveBlob(blob);
+          // } else {
+          //   let url = window.URL.createObjectURL(blob);
+          //   let elink = document.createElement("a");
+          //   elink.download = "订单列表.xlsx";
+          //   elink.style.display = "none";
+          //   elink.href = url;
+          //   document.body.appendChild(elink);
+          //   elink.click();
+          //   document.body.removeChild(elink);
+          // }
+        });
+      }
+    },
+    exportAffirm() {
+      this.exportVisible = false;
+    },
+
+    daoruCheck() {
+      this.daoruVisible = true;
+      this.daoruFile = [];
+      this.$nextTick(() => {
+        this.$refs.upload.clearFiles();
+      });
+    },
+    // 导入模板下载
+    daoruTemplate() {
+      this.$http({
+        url: this.$http.adornUrl(
+          "admin/inside-address/downloadInsideAddressExcel"
+        ),
+        method: "get",
+        params: this.$http.adornParams()
+      }).then(({ data }) => {
+        console.log(data, "导出");
+        const link = document.createElement("a");
+        link.href = data.data;
+        // link.download = "模板文件.xlsx"; // 设置下载后的文件名
+        link.target = "_blank"; // 在新标签页中打开
+        document.body.appendChild(link);
+        link.click();
+        document.body.removeChild(link);
+      });
+    },
+    // 确定导入
+    daoruAffirm() {
+      console.log(this.daoruFile, "导入收货地址");
+
+      let formData = new FormData();
+      formData.append("file", this.daoruFile);
+      this.$http({
+        url: this.$http.adornUrl("admin/inside-address/import"),
+        method: "post",
+        // headers: {
+        //   'Content-Type': 'multipart/form-data'
+        // },
+        data: formData
+      }).then(({ data }) => {
+        console.log(data, "导入收货地址");
+        if (data.code == 0) {
+          this.$message({
+            message: "操作成功",
+            type: "success",
+            duration: 1500,
+            onClose: () => {
+              this.addDialog = false;
+              this.dataSelect();
+            }
+          });
+        } else {
+          this.$message({
+            message: data.msg,
+            type: "error",
+            duration: 1500,
+            onClose: () => {}
+          });
+        }
+      });
+    },
+    daoruCancel() {
+      this.daoruVisible = false;
+      this.$refs.upload.clearFiles();
+    },
+    // 导入文件
+    daoruChange(file) {
+      console.log(file, "上传成功");
+      this.daoruFile = file.file;
+    },
+    daoruBeforeUpload(file) {
+      console.log(file, "上传之前");
+      // 检查文件类型
+      const isExcel =
+        file.type ===
+          "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
+        file.type === "application/vnd.ms-excel";
+
+      // 检查文件数量
+      const isSingleFile = this.daoruFile ? this.daoruFile.length === 0 : true;
+
+      if (!isExcel) {
+        this.$message.error("只能上传Excel文件!");
+        return false;
+      }
+
+      if (!isSingleFile) {
+        this.$message.error("只能上传一个文件!");
+        return false;
+      }
+
+      return true;
+      // return this.$processImage(this, file, false); // 导入图片处理
+    },
+    // 文件移除处理
+    handleRemove(file, fileList) {
+      this.daoruFile = [];
     }
   },
   mounted() {
@@ -707,4 +970,36 @@ export default {
   color: rgba(255, 255, 255, 1);
   text-align: center;
 }
+
+/* 导出限制 */
+.export {
+  width: 500px;
+}
+.export .con {
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+  align-items: center;
+  margin-bottom: 20px;
+}
+.export .con .gundong {
+  animation: gundong 3s linear infinite;
+}
+@keyframes gundong {
+  /* from表示动画的开始位置,也可以使用0%来表示。 */
+  from {
+    transform: rotate(0deg);
+  }
+  /* to表示动画的结束位置,也可以使用100%来表示。 */
+  to {
+    transform: rotate(360deg);
+  }
+}
+.export img {
+  width: 70px;
+}
+.export .btn {
+  display: flex;
+  flex-direction: row-reverse;
+}
 </style>

+ 3 - 1
src/views/mission/mission.vue

@@ -607,7 +607,9 @@
               <span style="color: #999;" v-if="scope.row.status === 5"
                 >已取消</span
               >
-              <span style="color: #999;" v-if="scope.row.status === 6">制作中</span>
+              <span style="color: #999;" v-if="scope.row.status === 6"
+                >制作中</span
+              >
               <span style="color: #999;" v-if="scope.row.status === 7"
                 >商家待接单</span
               >

+ 1 - 0
src/views/servicePackage/servicePackage.vue

@@ -1844,4 +1844,5 @@ export default {
 .setRule {
   width: 600px;
 }
+
 </style>