销售明细单如果报价单必填则产品只能选择和报价单关联的,如果报价单非必填则可以选择所有产品
| | |
| | | <template> |
| | | <div class="page-view"> |
| | | <el-form ref="form" :model="tableList" :show-message="false" label-position="right"> |
| | | {{ tableList.tableData }} |
| | | <el-table |
| | | ref="fromTable" |
| | | :data="tableList.tableData" |
| | |
| | | :disabled="!isOperate" |
| | | @change=" |
| | | (val) => { |
| | | commonInputChange(val, item.prop, scope.row) |
| | | commonInputChange(val, item.prop, scope.row,scope) |
| | | } |
| | | " |
| | | ></el-input> |
| | |
| | | style="width: 100%; margin-right: 5px" |
| | | @change=" |
| | | (val) => { |
| | | commonInputChange(val, item.prop, scope.row) |
| | | commonInputChange(val, item.prop, scope.row,scope) |
| | | } |
| | | " |
| | | ></el-input-number> |
| | |
| | | style="width: 100%; margin-right: 5px" |
| | | @change=" |
| | | (val) => { |
| | | commonInputChange(val, item.prop, scope.row) |
| | | commonInputChange(val, item.prop, scope.row,scope) |
| | | } |
| | | " |
| | | ></el-input-number> |
| | |
| | | {{ (scope.row.price&&scope.row.cost)?Number(scope.row.price)-Number(scope.row.cost):'' }} |
| | | </template> |
| | | <template v-if="pageName=='quotation'&&item.prop=='margin'"> |
| | | {{ (scope.row.price&&scope.row.cost)?((Number(scope.row.price)-Number(scope.row.cost))*100/Number(scope.row.cost)).toFixed(2)+'%':'' }} |
| | | {{ (scope.row.price&&scope.row.cost)?((Number(scope.row.price)-Number(scope.row.cost))*100/Number(scope.row.cost)).toFixed(2):'' }} |
| | | </template> |
| | | <template v-else> |
| | | {{ scope.row[item.prop] }} |
| | |
| | | style="width: 100%; margin-right: 5px" |
| | | @change=" |
| | | (val) => { |
| | | commonInputChange(val, item.prop, scope.row) |
| | | commonInputChange(val, item.prop, scope.row,scope) |
| | | } |
| | | " |
| | | ></el-input-number> |
| | |
| | | add() { |
| | | this.$emit("addProductClick") |
| | | }, |
| | | commonInputChange(val, prop, row) { |
| | | console.log(val, prop) |
| | | console.log(row) |
| | | commonInputChange(val, prop, row,scope) { |
| | | if (prop === "amount") { |
| | | this.tableList.tableData.map((ite) => { |
| | | if (ite.name === row.name) { |
| | |
| | | } |
| | | }) |
| | | } |
| | | if(this.pageName=='quotation'&&prop=='cost'&&scope.row.cost){ |
| | | let value=scope.row.cost |
| | | let reg2 = |
| | | /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/; |
| | | if (!reg2.test(value)||value==0) { |
| | | this.$message.error("成本单价需要填写大于0的2位小数!") |
| | | } |
| | | this.$forceUpdate() |
| | | } |
| | | this.$emit("inputContent", val, prop, row) |
| | | }, |
| | | // 清空 |
| | |
| | | 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) |
| | |
| | | { 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 } |
| | | ] |
| | |
| | | :show-summary="showSummary" |
| | | pageName="quotation" |
| | | :isOperate="((autoCodeHeadersObj.bjd=='yes'&&editConfig.infomation.quotation_number)||autoCodeHeadersObj.bjd!='yes')?true:false" |
| | | :quotationNumber="editConfig.infomation.quotation_number" |
| | | :quotationNumber="autoCodeHeadersObj.bjd=='yes'?editConfig.infomation.quotation_number:''" |
| | | :product-table-list="productTableList" |
| | | @inputContent="inputContent" |
| | | @addProductClick="addProductClick" |
| | |
| | | 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() |
| | | if (this.editConfig.title === "新建") { |
| | | getAddSalesDetails(params).then((res) => { |
| | |
| | | { label: "产品编号", prop: "number" }, |
| | | { label: "单位", prop: "unit" }, |
| | | { label: "销售单价", prop: "price",inputFloat: !isBjdRequird, isRequird: true }, |
| | | { label: "成本单价", prop: "cost",inputFloat: !isBjdRequird}, |
| | | { label: "成本单价", prop: "cost",input: !isBjdRequird}, |
| | | { label: "毛利", prop: "profit" }, |
| | | { label: "毛利率", prop: "margin",min:90}, |
| | | { label: "毛利率(%)", prop: "margin",min:90}, |
| | | { label: "数量", prop: "amount", inputNumber: true, isRequird: true }, |
| | | { label: "价税合计", prop: "total" } |
| | | ] |