yangfeng
2023-10-17 a63d71177a2899b01da37e5bfc2d498bec5f80be
src/views/sales/subOrder/AddSubOrderDialog.vue
@@ -78,14 +78,17 @@
                      "
                      value-key="number"
                      @select="handleSelectClient('master', $event)"
                      placeholder="请先选择客户名称"
                      :disabled="isAddMaster"
                    ></el-autocomplete>
                    <div class="common-select-btn" @click="selClientClick('master')">
                    <div v-if="!isAddMaster" class="common-select-btn" @click="selClientClick('master')">
                      <i class="el-icon-circle-plus-outline" title="选择"></i>
                    </div>
                    <div
                      v-if="
                        editConfig.infomation.master_order_number &&
                        editConfig.infomation.master_order_number.length > 0
                        editConfig.infomation.master_order_number.length > 0 &&
                        !isAddMaster
                      "
                      class="common-select-btn"
                      @click="clearupClient('master')"
@@ -189,6 +192,7 @@
import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
import WordInput from "@/components/wordInput.vue"
import codeMixin from "@/views/client/followupRecords/mixin/codeMixin"
import { getMasterOrderList } from "@/api/sales/masterOrder"
export default {
  name: "SubOrderDialog",
@@ -209,10 +213,10 @@
  computed: {
    clientList() {
      return this.$store.state.getClientName.clientList
    },
    masterOrderList() {
      return this.$store.state.getClientName.masterOrderList
    }
    // masterOrderList() {
    //   return this.$store.state.getClientName.masterOrderList
    // }
  },
  data() {
    return {
@@ -221,6 +225,7 @@
      editConfig: this.editCommonConfig,
      rules: {
        number: [{ required: true, message: "请输入", trigger: "blur" }],
        master_order_number: [{ required: true, message: "请选择或创建销售总单", trigger: "blur" }],
        client_name: [{ required: true, message: "请选择", trigger: "change" }],
        memberId: [{ required: true, message: "请选择", trigger: "change" }]
      },
@@ -258,12 +263,14 @@
      tableData: [],
      productId: 1,
      addProductArr: [],
      objCode: { name: "", page: 0, pageSize: 0, type: "销售子单编码", codeStandID: "" }
      objCode: { name: "", page: 0, pageSize: 0, type: "销售子单编码", codeStandID: "" },
      isAddMaster: true,
      masterOrderList: []
    }
  },
  created() {
    this.$store.dispatch("geClient")
    this.$store.dispatch("geMaster")
    // this.$store.dispatch("geMaster")
    this.setTableForm()
    this.getCommonData()
    this.formInfo()
@@ -319,6 +326,7 @@
    // 保存
    saveClick(formName) {
      this.$refs[formName].validate((valid) => {
        this.validateFormNumber()
        if (valid) {
          console.log(this.editConfig.infomation)
          for (let i = 0; i < this.tableData.length; i++) {
@@ -377,6 +385,20 @@
    handleClose() {
      this.editConfig.visible = false
    },
    // 获取销售总单
    getMasterList(id) {
      getMasterOrderList({
        page: 0,
        pageSize: 0,
        search_map: {
          client_id: id
        }
      }).then((res) => {
        if (res.code == 200) {
          this.masterOrderList = res.data.list
        }
      })
    },
    // 选择客户相关方法
    querySearchAsync(queryString, cb, value) {
      var restaurants = []
@@ -401,9 +423,15 @@
    handleSelectClient(value, item) {
      if (value === "client") {
        this.clientId = item.id
        this.isAddMaster = false
        this.getMasterList(item.id)
        this.editConfig.infomation.master_order_number = ""
        this.masterId = 0
      } else if (value === "master") {
        this.editConfig.infomation.master_order_number = item.number
        this.masterId = item.id
      }
      this.refresh()
    },
    selClientClick(value) {
      if (value == "client") {
@@ -411,15 +439,19 @@
      } else if (value == "master") {
        this.editSelectMasterConfig.title = "销售总单"
        this.editSelectMasterConfig.editVisible = true
        this.editSelectMasterConfig.clientId = this.clientId
        this.editSelectMasterConfig.tableInfomation = [...this.masterOrderList]
      }
    },
    selClient(row, value) {
      console.log(row)
      if (value == "client") {
        this.editConfig.infomation.client_name = row.name
        this.editConfig.infomation.client_id = row.id
        this.clientId = row.id
        this.isAddMaster = false
        this.getMasterList(row.id)
        this.editConfig.infomation.master_order_number = ""
        this.masterId = 0
      } else if (value == "master") {
        this.editConfig.infomation.master_order_number = row.number
        this.masterId = row.id
@@ -432,6 +464,9 @@
        this.editConfig.infomation.client_name = ""
        this.editConfig.infomation.client_id = 0
        this.clientId = 0
        this.isAddMaster = true
        this.editConfig.infomation.master_order_number = ""
        this.masterId = 0
      } else if (value == "master") {
        this.editConfig.infomation.master_order_number = ""
        this.masterId = 0