新建销售子单和新建销售明细单-产品管理-添加、编辑、删除产品数据处理和保存时数据处签约实际默认设置
3个文件已修改
164 ■■■■■ 已修改文件
src/views/sales/salesDetails/AddSalesDetailsDialog.vue 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sales/salesDetails/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sales/subOrder/AddSubOrderDialog.vue 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sales/salesDetails/AddSalesDetailsDialog.vue
@@ -198,11 +198,7 @@
                      :disabled=" isView"
                    ></el-autocomplete>
                    <!-- !isAddQuatation && editConfig.infomation.sale_chance_name &&-->
                    <div
                      v-if=" !isView"
                      class="common-select-btn"
                      @click="selClientClick('quotation')"
                    >
                    <div v-if="!isView" class="common-select-btn" @click="selClientClick('quotation')">
                      <i class="el-icon-circle-plus-outline" title="选择"></i>
                    </div>
                    <!-- !isAddQuatation && -->
@@ -568,7 +564,7 @@
  },
  data() {
    return {
      dialogWidth: "50%",
      dialogWidth: "60%",
      editConfig: this.editCommonConfig,
      rules: {
        client_name: [{ required: true, message: "请选择客户名称", trigger: "change" }],
@@ -721,17 +717,17 @@
    saveClick(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          for (let i = 0; i < this.tableData.length; i++) {
            if (this.tableData[i].name.length === 0) {
              this.isNoProduct = true
              break
            } else {
              this.isNoProduct = false
            }
          }
          if (this.isNoProduct) {
            this.$message.error("请选择产品")
          } else {
          // for (let i = 0; i < this.tableData.length; i++) {
          //   if (this.tableData[i].name.length === 0) {
          //     this.isNoProduct = true
          //     break
          //   } else {
          //     this.isNoProduct = false
          //   }
          // }
          // if (this.isNoProduct) {
          //   this.$message.error("请选择产品")
          // } else {
            for (let i = 0; i < this.tableData.length; i++) {
              if (this.tableData[i].cost) {
                let reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
@@ -768,14 +764,20 @@
              })
            }
          }
        } else {
          console.log("error submit")
          return false
        }
        // } else {
        //   console.log("error submit")
        //   return false
        // }
      })
    },
    saveParams() {
      let data = this.editConfig.infomation
      let products = []
      this.tableData.map((item) => {
        if (item.number.length > 0) {
          products.push(item)
        }
      })
      let commonParam = {
        address: data.address || "",
        addressee: data.addressee || "",
@@ -785,7 +787,7 @@
        memberId: data.memberId || 0,
        number: data.number || "",
        phone: data.phone || "",
        products: this.tableData,
        products: products,
        remark: data.remark || "",
        saleChanceId: this.saleChanceId || 0,
        saleType: data.saleType || 0,
@@ -828,7 +830,7 @@
        if (res.code == 200) {
          console.log(res)
          this.quotationList = res.data.list
          this.count=res.data.count;
          this.count = res.data.count
          if (value === "全部产品") {
            // this.quotationList.map((item) => {
            // if (item.id === this.editConfig.infomation.quotationId) {
@@ -948,7 +950,7 @@
          this.editSelCommonConfig.tableInfomation = [...this.quotationList]
        }else{
           // 反向选择
          this.editSelCommonConfig.isRequest = true;
          this.editSelCommonConfig.isRequest = true
        }
        this.editSelCommonConfig.editVisible = true
      }
@@ -956,10 +958,10 @@
    selClient(row, value) {
      if (value === "client") {
        this.editConfig.infomation.sale_chance_name = ""
        this.saleChanceId=''
        this.saleChanceId = ""
        this.editConfig.infomation.subbill_name = ""
        // 清空报价单
        this.editConfig.infomation.quotation_number =''
        this.editConfig.infomation.quotation_number = ""
        this.editConfig.infomation.client_name = row.name
        this.clientId = row.id
        this.getSaleChanceList(row)
@@ -970,7 +972,7 @@
        this.clientId = row.client.id
        this.saleChanceId = row.id
        // 清空报价单
        this.editConfig.infomation.quotation_number =''
        this.editConfig.infomation.quotation_number = ""
        this.isAddQuatation = false
        this.getQuotation(row.id)
      } else if (value === "subbill") {
@@ -1052,8 +1054,9 @@
      }
      this.productTableList = {
        tableData: this.tableData,
        isReturn: true,
        tableColumn: [
          { label: "#", prop: "productId", width: 40 },
          // { label: "#", prop: "productId", width: 40 },
          { label: "产品名称", prop: "name", productName: true, isRequird: true, min: 110 },
          { label: "规格", prop: "specs" },
          { label: "型号", prop: "type" },
@@ -1070,9 +1073,9 @@
    },
    // 产品列表输入
    inputContent(val, prop, row) {
      this.productId = row.productId
      // this.productId = row.productId
      this.tableData.map((item) => {
        if (item.productId === row.productId) {
        if (item.number === row.number) {
          item[prop] = val
        }
      })
@@ -1097,13 +1100,18 @@
      // this.showSummary.show = true
    },
    // 新增方式修改
    getSelectArray(val) {
      if (val.length > 0) {
        val.map((item, index) => {
          item.productId = this.tableData.length + index + 1
        })
    getSelectArray(val, index) {
      if (this.tableData.length == 1 && this.tableData[0].number.length == 0) {
        this.tableData = []
      }
      if (index < this.tableData.length) {
        this.tableData.splice(index, 1)
        val.map((item, ind) => {
          this.tableData.splice(index + ind, 0, item)
        })
      } else {
      this.tableData = this.tableData.concat(val)
      }
      this.productTableList.tableData = this.tableData
      this.showSummary.show = true
    },
src/views/sales/salesDetails/index.vue
@@ -535,6 +535,7 @@
      console.log(this.addConfig)
      this.editConfig.infomation = {
        ...this.addConfig,
        signTime: new Date().toLocaleDateString(),
        currency: "人民币",
        sale_chance_name: "",
        subbill_name: "",
src/views/sales/subOrder/AddSubOrderDialog.vue
@@ -167,9 +167,11 @@
          <div class="product-view">
            <CommonFormTableView
              :show-summary="showSummary"
              :addTypeIdMultiple="true"
              :product-table-list="productTableList"
              @inputContent="inputContent"
              @addProductClick="addProductClick"
              @getSelectArray="getSelectArray"
              @emptyProductClick="emptyProductClick"
              @recalculateProductClick="recalculateProductClick"
              @clearupProduct="clearupProduct"
@@ -346,17 +348,17 @@
      this.$refs[formName].validate((valid) => {
        if (valid) {
          console.log(this.editConfig.infomation)
          for (let i = 0; i < this.tableData.length; i++) {
            if (this.tableData[i].name.length === 0) {
              this.isNoProduct = true
              break
            } else {
              this.isNoProduct = false
            }
          }
          if (this.isNoProduct) {
            this.$message.error("产品名称不能为空")
          } else {
          // for (let i = 0; i < this.tableData.length; i++) {
          //   if (this.tableData[i].name.length === 0) {
          //     this.isNoProduct = true
          //     break
          //   } else {
          //     this.isNoProduct = false
          //   }
          // }
          // if (this.isNoProduct) {
          //   this.$message.error("产品名称不能为空")
          // } else {
            const params = this.saveParams()
            if (this.editConfig.title === "新建") {
              getAddSubOrder(params).then((res) => {
@@ -378,21 +380,27 @@
              })
            }
          }
        } else {
          console.log("error submit")
          return false
        }
        // } else {
        //   console.log("error submit")
        //   return false
        // }
      })
    },
    saveParams() {
      let data = this.editConfig.infomation
      let products = []
      this.tableData.map((item) => {
        if (item.number.length > 0) {
          products.push(item)
        }
      })
      let params = {
        id: this.editConfig.title === "新建" ? 0 : data.id,
        clientId: this.clientId || 0,
        masterOrderId: this.masterId || 0,
        memberId: data.memberId || 0,
        number: data.number || "",
        product: this.tableData,
        product: products,
        codeStandID: data.ID
      }
      return params
@@ -515,8 +523,9 @@
      }
      this.productTableList = {
        tableData: this.tableData,
        isReturn: true,
        tableColumn: [
          { label: "#", prop: "productId", width: 40 },
          // { label: "#", prop: "productId", width: 40 },
          { label: "产品名称", prop: "name", productName: true, isRequird: true },
          { label: "产品编号", prop: "number" },
          { label: "数量", prop: "amount", inputNumber: true, isRequird: true },
@@ -528,27 +537,43 @@
    },
    // 产品列表输入
    inputContent(val, prop, row) {
      this.productId = row.productId
      // this.productId = row.productId
      this.tableData.map((item) => {
        if (item.productId === row.productId) {
        if (item.number === row.number) {
          item[prop] = val
        }
      })
    },
    // 产品新增
    addProductClick() {
      this.productId++
      this.tableData.push({
        productId: this.productId,
        id: 0,
        amount: 0,
        desc: "",
        name: "",
        number: "",
        price: 0,
        total: 0,
        unit: ""
      // this.productId++
      // this.tableData.push({
      //   productId: this.productId,
      //   id: 0,
      //   amount: 0,
      //   desc: "",
      //   name: "",
      //   number: "",
      //   price: 0,
      //   total: 0,
      //   unit: ""
      // })
      // this.showSummary.show = true
    },
    // 新增方式修改
    getSelectArray(val, index) {
      if (this.tableData.length == 1 && this.tableData[0].number.length == 0) {
        this.tableData = []
      }
      if (index < this.tableData.length) {
        this.tableData.splice(index, 1)
        val.map((item, ind) => {
          this.tableData.splice(index + ind, 0, item)
      })
      } else {
        this.tableData = this.tableData.concat(val)
      }
      this.productTableList.tableData = this.tableData
      this.showSummary.show = true
    },
    //  产品清空