24282 6 months ago
parent
commit
f83d4f5cc7

BIN
public/static/jdRefundCheckProduct.xlsx


BIN
public/static/jdRefundConfirm.xlsx


+ 74 - 1
src/views/WDLY/jd/refund/index.vue

@@ -1,7 +1,8 @@
 <template>
   <div class="tenant">
     <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading"
-             :selectConfig="selectConfig" @get-list="getList" @moreSearch="() => queryDialogVisible = true">
+             :selectConfig="selectConfig" :action-list="actionConfig" @get-list="getList"
+             @moreSearch="() => queryDialogVisible = true">
     </byTable>
 
     <!--高级搜索-->
@@ -18,6 +19,25 @@
       </template>
     </el-dialog>
 
+    <el-dialog title="Excel导入" v-model="openExcelDialog" width="600" v-loading="loading">
+      <div v-loading="excelLoading">
+        <el-button @click="downloadTemplate" type="primary" style="margin-bottom: 10px">Excel模板下载</el-button>
+        <el-upload :action="actionUrl + '/jdRefund/confirmExcelImport'" :headers="headers"
+                   :before-upload="useImportExcelStore().updateRequestHeaders"
+                   :on-success="handleSuccessOne" :on-progress="handleProgress" :show-file-list="false"
+                   :on-error="handleError" accept=".xls, .xlsx">
+          <el-button type="primary">点击导入</el-button>
+        </el-upload>
+      </div>
+
+      <template #footer>
+        <el-button @click="openExcelDialog = false" size="large">取 消</el-button>
+        <el-button type="primary" @click=" openExcelDialog = false" size="large">
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+
   </div>
 </template>
 
@@ -25,12 +45,19 @@
 import byTable from "@/components/byTable/index";
 import {computed, getCurrentInstance, ref} from "vue";
 import {ElMessage, ElMessageBox} from "element-plus";
+import useImportExcelStore from "@/store/modules/importExcel";
+
+const actionUrl = import.meta.env.VITE_APP_BASE_API;
 
 const {proxy} = getCurrentInstance();
 const loading = ref(false);
 
 const queryDialogVisible = ref(false);
 
+const openExcelDialog = ref(false);
+const excelLoading = ref(false);
+const headers = computed(() => useImportExcelStore().requestHeaders);
+
 const sourceList = ref({
   data: [],
   pagination: {
@@ -40,6 +67,16 @@ const sourceList = ref({
   },
 });
 
+const actionConfig = computed(() => {
+  return [
+    {
+      text: 'Excel导入',
+      action: () => {
+        openExcelDialog.value = true;
+      },
+    }]
+})
+
 const selectConfig = computed(() => {
   return [
     {
@@ -269,6 +306,42 @@ const handleQuery = () => {
   getList();
 };
 
+const downloadTemplate = () => {
+  fetch("/static/jdRefundConfirm.xlsx")
+      .then((res) => res.blob())
+      .then((res) => {
+        const url = window.URL.createObjectURL(res);
+        let filename = "京东售后退货确认收货导入模板.xlsx";
+        const link = document.createElement("a");
+        link.style.display = "none";
+        link.href = url;
+        link.setAttribute("download", filename);
+        document.body.appendChild(link);
+        link.click();
+      });
+};
+
+const handleSuccessOne = (res) => {
+  if (res.code !== 200) {
+    ElMessage.error(`导入失败:${res.msg}`)
+  } else {
+    ElMessage.success(`导入成功`);
+    openExcelDialog.value = false;
+    getList();
+  }
+  excelLoading.value = false;
+};
+
+const handleProgress = () => {
+  excelLoading.value = true;
+};
+
+const handleError = (err) => {
+  ElMessage.error(`导入失败:${err}`)
+  openExcelDialog.value = false;
+  excelLoading.value = false;
+};
+
 getList();
 
 </script>

+ 66 - 3
src/views/WDLY/salesMange/jdReGoodsInspection/CheckProduct.vue

@@ -8,9 +8,9 @@
         选择产品
       </el-button>
 
-      <!--      <el-button type="primary" @click="openExcel" style="margin-bottom: 10px">-->
-      <!--        导入Excel-->
-      <!--      </el-button>-->
+      <el-button type="primary" @click="() => openExcelDialog = true" style="margin-bottom: 10px">
+        导入产品
+      </el-button>
 
       <el-table :data="list">
         <el-table-column prop="productCustomCode" label="物品编码"/>
@@ -109,12 +109,32 @@
       </template>
     </el-dialog>
 
+    <el-dialog title="Excel导入" v-model="openExcelDialog" width="600" v-loading="loading">
+      <div v-loading="excelLoading">
+        <el-button @click="downloadTemplate" type="primary" style="margin-bottom: 10px">Excel模板下载</el-button>
+        <el-upload :action="actionUrl + '/jdRefundNotQualityCheck/excelList'" :headers="headers"
+                   :before-upload="useImportExcelStore().updateRequestHeaders"
+                   :on-success="handleSuccessOne" :on-progress="handleProgress" :show-file-list="false"
+                   :on-error="handleError" accept=".xls, .xlsx">
+          <el-button type="primary">点击导入</el-button>
+        </el-upload>
+      </div>
+
+      <template #footer>
+        <el-button @click="openExcelDialog = false" size="large">取 消</el-button>
+        <el-button type="primary" @click=" openExcelDialog = false" size="large">
+          确 定
+        </el-button>
+      </template>
+    </el-dialog>
+
   </div>
 </template>
 <script setup>
 import byTable from "@/components/byTable/index";
 import {computed, getCurrentInstance, ref} from "vue";
 import {ElMessage} from "element-plus";
+import useImportExcelStore from "@/store/modules/importExcel";
 
 const {proxy} = getCurrentInstance();
 
@@ -133,6 +153,11 @@ const productPagination = ref({
   pageSize: 10,
 })
 
+const actionUrl = import.meta.env.VITE_APP_BASE_API;
+const openExcelDialog = ref(false);
+const excelLoading = ref(false);
+const headers = computed(() => useImportExcelStore().requestHeaders);
+
 const productConfig = computed(() => {
   return [
     {
@@ -246,6 +271,44 @@ const submitForm = () => {
 }
 
 
+const downloadTemplate = () => {
+  fetch("/static/jdRefundCheckProduct.xlsx")
+      .then((res) => res.blob())
+      .then((res) => {
+        const url = window.URL.createObjectURL(res);
+        let filename = "京东退货质检导入模板.xlsx";
+        const link = document.createElement("a");
+        link.style.display = "none";
+        link.href = url;
+        link.setAttribute("download", filename);
+        document.body.appendChild(link);
+        link.click();
+      });
+};
+
+const handleSuccessOne = (res) => {
+  if (res.code !== 200) {
+    ElMessage.error(`导入失败:${res.msg}`)
+  } else {
+    ElMessage.success(`导入成功`);
+    openExcelDialog.value = false;
+
+    console.log(res)
+    list.value = res.data
+
+  }
+  excelLoading.value = false;
+};
+
+const handleProgress = () => {
+  excelLoading.value = true;
+};
+
+const handleError = (err) => {
+  ElMessage.error(`导入失败:${err}`)
+  openExcelDialog.value = false;
+  excelLoading.value = false;
+};
 
 defineExpose({open})
 </script>