| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="销售机会" prop="sale_chance_name" |
| | | :rules="[{ required: autoCodeHeadersObj.xsjh=='yes'?true:false, validator: this.checkChance, trigger: 'change' }]"> |
| | | :rules="[{ required: autoCodeHeadersObj.Xsjh=='yes'?true:false, validator: this.checkChance, trigger: 'change' }]"> |
| | | <div class="custom-name"> |
| | | <el-autocomplete |
| | | v-model="editConfig.infomation.sale_chance_name" |
| | |
| | | <CommonFormTableView |
| | | :show-summary="showSummary" |
| | | pageName="quotation" |
| | | :addTypeIdMultiple="true" |
| | | :product-table-list="productTableList" |
| | | @inputContent="inputContent" |
| | | @addProductClick="addProductClick" |
| | | @getSelectArray="getSelectArray" |
| | | @emptyProductClick="emptyProductClick" |
| | | @recalculateProductClick="recalculateProductClick" |
| | | @clearupProduct="clearupProduct" |
| | |
| | | this.setTableForm() |
| | | this.getCommonData() |
| | | this.formInfo() |
| | | this.getUseSystemSet({modeType:'bjd'}) |
| | | }, |
| | | watch: { |
| | | "editConfig.visible"(val) { |
| | |
| | | if (this.isNoProduct) { |
| | | this.$message.error("产品名称不能为空") |
| | | } else { |
| | | for (let i = 0; i < this.tableData.length; i++) { |
| | | if (this.tableData[i].cost||Number(this.tableData[i].cost)==0) { |
| | | let reg = /^\+?[1-9]\d*$/; |
| | | if(!reg.test(this.tableData[i].cost)){ |
| | | this.$message.error("成本单价需要填写大于0的2位小数!") |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | const params = this.saveParams() |
| | | console.log(params) |
| | | if (this.editConfig.title === "新建") { |
| | | getAddQuotation(params).then((res) => { |
| | | console.log(res) |
| | |
| | | name: "", |
| | | number: "", |
| | | price: 0, |
| | | cost:'', |
| | | profit:'', |
| | | margin:'', |
| | | total: 0, |
| | | unit: "" |
| | | } |
| | |
| | | { label: "产品编号", prop: "number" }, |
| | | { label: "单位", prop: "unit" }, |
| | | { label: "销售单价", prop: "price", inputFloat: true, isRequird: true }, |
| | | { label: "成本单价", prop: "cost",inputFloat: true }, |
| | | { label: "成本单价", prop: "cost",input: true }, |
| | | { label: "毛利", prop: "profit" }, |
| | | { label: "毛利率", prop: "margin",min:90}, |
| | | { label: "毛利率(%)", prop: "margin",min:90}, |
| | | { label: "数量", prop: "amount", inputNumber: true, isRequird: true }, |
| | | { label: "价税合计", prop: "total", inputFloat: true } |
| | | ] |
| | |
| | | }, |
| | | // 产品新增 |
| | | 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, |
| | | // cost:'', |
| | | // profit:'', |
| | | // margin:'', |
| | | // total: 0, |
| | | // unit: "" |
| | | // }) |
| | | // this.showSummary.show = true |
| | | }, |
| | | // 新增方式修改 |
| | | getSelectArray(val){ |
| | | if(val.length>0){ |
| | | val.map((item, index) => { |
| | | item.productId = this.tableData.length + index+1 |
| | | }) |
| | | } |
| | | this.tableData=this.tableData.concat(val); |
| | | this.productTableList.tableData=this.tableData |
| | | this.showSummary.show = true |
| | | }, |
| | | // 产品清空 |
| | |
| | | name: "", |
| | | number: "", |
| | | price: 0, |
| | | cost:'', |
| | | profit:'', |
| | | margin:'', |
| | | total: 0, |
| | | unit: "" |
| | | } |
| | |
| | | if (this.editConfig.infomation.sale_chance_name && this.editConfig.infomation.sale_chance_name.length > 0) { |
| | | callback() |
| | | } else { |
| | | if(this.autoCodeHeadersObj.xsjh=='yes'){ |
| | | if(this.autoCodeHeadersObj.Xsjh=='yes'){ |
| | | callback(new Error("请选择销售机会")) |
| | | }else{ |
| | | callback() |