24282 7 сар өмнө
parent
commit
28709f058e

+ 117 - 107
src/views/WDLY/jd/refund/index.vue

@@ -18,24 +18,18 @@
       </template>
     </el-dialog>
 
-    <el-dialog title="明细" v-model="detailVisible" width="80%" destroy-on-close>
-      <byTable :source="detailList" :config="detailConfig" :loading="detailLoading" :show-search="false" hidePagination>
-      </byTable>
-    </el-dialog>
-
   </div>
 </template>
 
 <script setup>
 import byTable from "@/components/byTable/index";
 import {computed, getCurrentInstance, ref} from "vue";
+import {ElMessage, ElMessageBox} from "element-plus";
 
 const {proxy} = getCurrentInstance();
 const loading = ref(false);
-const detailLoading = ref(false);
 
 const queryDialogVisible = ref(false);
-const detailVisible = ref(false);
 
 const sourceList = ref({
   data: [],
@@ -46,35 +40,41 @@ const sourceList = ref({
   },
 });
 
-const detailList = ref([]);
-
 const selectConfig = computed(() => {
-  return [];
+  return [
+    {
+      label: "状态",
+      prop: "status",
+      data: [
+        {
+          label: "待确认",
+          value: "0",
+        },
+        {
+          label: "待质检",
+          value: "1",
+        },
+        {
+          label: "部分质检",
+          value: "2",
+        },
+        {
+          label: "已质检",
+          value: "3",
+        },
+      ],
+    },
+  ];
 });
 
 const config = computed(() => {
   return [
     {
       attrs: {
-        label: "商品总数量",
-        prop: "wareCount",
-        align: "left",
-        width: 100
-      },
-    },
-    {
-      attrs: {
         label: "审核状态",
         prop: "statusName",
         align: "left",
-        width: 120
-      },
-    },
-    {
-      attrs: {
-        label: "采销员",
-        prop: "salesPin",
-        align: "left",
+        width: 100
       },
     },
     {
@@ -86,33 +86,10 @@ const config = computed(() => {
     },
     {
       attrs: {
-        label: "申请日期",
-        prop: "applyDateTime",
-        align: "left",
-        width: 160
-      },
-    },
-    {
-      attrs: {
         label: "出库单号",
         prop: "outNo",
         align: "left",
-        width: 130
-      },
-    },
-    {
-      attrs: {
-        label: "退货单号",
-        prop: "refundId",
-        align: "left",
-        width: 130
-      },
-    },
-    {
-      attrs: {
-        label: "供应商名称",
-        prop: "providerName",
-        align: "left",
+        width: 120
       },
     },
     {
@@ -120,43 +97,9 @@ const config = computed(() => {
         label: "出库描述",
         prop: "outTypeDesc",
         align: "left",
-      },
-    },
-    {
-      attrs: {
-        label: "联系人",
-        prop: "contacts",
-        align: "left",
-        width: 120
-      },
-    },
-    {
-      attrs: {
-        label: "操作",
-        align: "center",
-        fixed: "right",
         width: 100
       },
-      renderHTML(row) {
-        return [{
-          attrs: {
-            label: "详情",
-            type: "primary",
-            text: true,
-          },
-          el: "button",
-          click() {
-            detailVisible.value = true
-            getDetail(row.id)
-          },
-        }]
-      },
     },
-  ];
-});
-
-const detailConfig = computed(() => {
-  return [
     {
       attrs: {
         label: "确认收货时间",
@@ -170,15 +113,7 @@ const detailConfig = computed(() => {
         label: "备件条码",
         prop: "partCode",
         align: "left",
-        width: 140
-      },
-    },
-    {
-      attrs: {
-        label: "销售订单号",
-        prop: "saleOrdId",
-        align: "left",
-        width: 140
+        width: 130
       },
     },
     {
@@ -201,7 +136,8 @@ const detailConfig = computed(() => {
       attrs: {
         label: "商品名称",
         prop: "wareName",
-        align: "left"
+        align: "left",
+        minWidth: 200
       },
     },
     {
@@ -218,7 +154,93 @@ const detailConfig = computed(() => {
         prop: "remark",
         align: "left"
       },
-    }
+    },
+    {
+      attrs: {
+        label: "状态",
+        prop: "status",
+        align: "left",
+        width: 80
+      },
+      render(status) {
+        switch (status) {
+          case 0:
+            return '待确认'
+          case 1:
+            return '待质检'
+          case 2:
+            return '部分质检'
+          case 3:
+            return '已质检'
+        }
+        return '未知状态';
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        align: "center",
+        fixed: "right",
+        width: 120
+      },
+      renderHTML(row) {
+        if (row.status === 0) {
+          return [{
+            attrs: {
+              label: "确认收货",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              ElMessageBox.confirm("是否确认收货?", "提示", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning",
+              }).then(() => {
+                loading.value = true;
+                proxy.post("/jdRefundQualityCheck/add", {jdRefundDetailId: row.jdRefundDetailId})
+                    .then(() => {
+                      ElMessage.success("确认收货成功")
+                      getList()
+                    })
+                    .catch(err => {
+                      loading.value = false;
+                    })
+              })
+            },
+          }]
+        }
+
+        if (row.status === 1) {
+          return [{
+            attrs: {
+              label: "撤销确认收货",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              ElMessageBox.confirm("是否撤销确认收货?", "提示", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning",
+              }).then(() => {
+                loading.value = true;
+                proxy.post("/jdRefundQualityCheck/delete", {jdRefundDetailId: row.jdRefundDetailId})
+                    .then(() => {
+                      ElMessage.success("撤销确认收货成功")
+                      getList()
+                    })
+                    .catch(err => {
+                      loading.value = false;
+                    })
+              })
+            },
+          }]
+        }
+      },
+    },
   ];
 });
 
@@ -259,18 +281,6 @@ const handleQuery = () => {
   getList();
 };
 
-const getDetail = (id) => {
-  detailLoading.value = true
-  proxy.get("/jdRefundDetail/getList", {id})
-      .then(({data}) => {
-        console.log(data)
-        detailList.value = data
-      })
-      .finally(_ => {
-        detailLoading.value = false;
-      })
-}
-
 getList();
 
 </script>