From 23d80c1b64f23ede237ab8e89ebc2ee2aaf43f26 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期三, 19 七月 2023 19:32:10 +0800
Subject: [PATCH] 销售模块接口联调

---
 src/views/service/serviceFollowup/AddServiceFollowupDialog.vue |   83 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 82 insertions(+), 1 deletions(-)

diff --git a/src/views/service/serviceFollowup/AddServiceFollowupDialog.vue b/src/views/service/serviceFollowup/AddServiceFollowupDialog.vue
index ba384cf..22cbcf8 100644
--- a/src/views/service/serviceFollowup/AddServiceFollowupDialog.vue
+++ b/src/views/service/serviceFollowup/AddServiceFollowupDialog.vue
@@ -165,6 +165,8 @@
 
 <script>
 import CommonSelectView from "@/components/makepager/CommonSelectView"
+import { getAllData } from "@/api/client/client"
+import { getAddSubOrder, getUpdateSubOrder } from "@/api/sales/subOrder"
 export default {
   name: "AddServiceFollowupDialog",
   props: {
@@ -215,8 +217,87 @@
       ]
     }
   },
-  created() {},
+  created() {
+    this.getCommonData()
+  },
   methods: {
+    getCommonData() {
+      getAllData()
+        .then((res) => {
+          this.memberOptions = res.data.member
+        })
+        .catch((err) => {
+          console.log(err)
+        })
+    },
+    // 淇濆瓨
+    saveClick(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          console.log(this.editConfig.infomation)
+          const params = this.saveParams()
+          console.log(params)
+          if (this.editConfig.title === "鏂板缓") {
+            getAddSubOrder(params)
+              .then((res) => {
+                console.log(res)
+                this.editConfig.visible = false
+                if (res.code === 200) {
+                  this.$message({
+                    message: "娣诲姞鎴愬姛",
+                    type: "success"
+                  })
+                  this.$parent.getData()
+                }
+              })
+              .catch((err) => {
+                console.log(err)
+              })
+          } else {
+            getUpdateSubOrder(params)
+              .then((res) => {
+                console.log(res)
+                this.editConfig.visible = false
+                if (res.code === 200) {
+                  this.$message({
+                    message: "缂栬緫鎴愬姛",
+                    type: "success"
+                  })
+                  this.$parent.getData()
+                }
+              })
+              .catch((err) => {
+                console.log(err)
+              })
+          }
+        } else {
+          console.log("error submit")
+          return false
+        }
+      })
+    },
+    saveParams() {
+      let data = this.editConfig.infomation
+      let params = {
+        id: this.editConfig.title === "鏂板缓" ? 0 : data.id,
+        clientId: data.clientId || 0,
+        masterOrderId: data.masterOrderId || 0,
+        memberId: data.memberId || 0,
+        number: data.number || "",
+        product: [
+          {
+            amount: 0,
+            desc: "",
+            id: 0,
+            name: "",
+            number: "",
+            price: 0,
+            total: 0
+          }
+        ]
+      }
+      return params
+    },
     handleClose() {
       this.editConfig.visible = false
     },

--
Gitblit v1.8.0