Browse Source

添加关闭订单功能

lex 1 year ago
parent
commit
6b9928fb1c
1 changed files with 33 additions and 7 deletions
  1. 33 7
      src/views/oms/order/index.vue

+ 33 - 7
src/views/oms/order/index.vue

@@ -192,12 +192,13 @@
               @click="handleViewOrder(scope.$index, scope.row)"
               >查看订单</el-button
             >
-            <!-- <el-button
+            <el-button
               size="mini"
+              type="danger"
               @click="handleCloseOrder(scope.$index, scope.row)"
-              v-show="scope.row.status === 0 || scope.row.status === 6"
+              v-show="scope.row.status === 0 || scope.row.status === 1 || scope.row.status === 2"
               >关闭订单</el-button
-            > -->
+            >
             <el-button
               size="mini"
               @click="handleDeliveryOrder(scope.$index, scope.row)"
@@ -206,6 +207,7 @@
             >
              <el-button
               size="mini"
+              type="success"
               @click="handleOverOrder(scope.$index, scope.row)"
               v-show="scope.row.status === 1"
               >完成订单</el-button
@@ -372,6 +374,14 @@ export default {
           label: "APP订单",
           value: 1,
         },
+        {
+          label: "学校采购",
+          value: 2,
+        },
+        {
+          label: "个人订单",
+          value: 3,
+        },
       ],
       operateOptions: [
         {
@@ -466,9 +476,25 @@ export default {
       this.$router.push({ path: "/oms/orderDetail", query: { id: row.id } });
     },
     handleCloseOrder(index, row) {
-      this.closeOrder.dialogVisible = true;
-      this.closeOrder.content = "";
-      this.closeOrder.orderIds = [row.id];
+      // this.closeOrder.dialogVisible = true;
+      // this.closeOrder.content = "";
+      // this.closeOrder.orderIds = [row.id];
+      //
+      const message = row.status === 2 ? '该订单已发货,关闭后将自动返还库存?' :'是否要关闭订单?'
+      this.$confirm(message, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        updateOrderSuccess({ ids: [row.id], status: 4 }).then((response) => {
+          this.$message({
+            message: "关闭成功!",
+            type: "success",
+            duration: 1000,
+          });
+          this.getList();
+        });
+      });
     },
     handleDeliveryOrder(index, row) {
       let listItem = this.covertOrder(row);
@@ -487,7 +513,7 @@ export default {
         // let obj = {
         //   ids:ids.join(',')
         // }
-        updateOrderSuccess([row.id]).then((response) => {
+        updateOrderSuccess({ ids: [row.id], status: 3 }).then((response) => {
           this.$message({
             message: "完成成功!",
             type: "success",