| | |
| | | :show-summary="showSummary" |
| | | :recalculateShow="false" |
| | | :product-table-list="productTableList" |
| | | sign="purchase" |
| | | @inputContent="inputContent" |
| | | @getSummaries="getSummaries" |
| | | @addProductClick="addProductClick" |
| | | @emptyProductClick="emptyProductClick" |
| | | @clearupProduct="clearupProduct" |
| | |
| | | v-model="editConfig.infomation.wholeDiscountType" |
| | | placeholder="请选择" |
| | | filterable |
| | | @change="getTotal" |
| | | > |
| | | <el-option label="百分比降价" :value="1"></el-option> |
| | | <el-option label="直接降价" :value="2"></el-option> |
| | |
| | | <el-input |
| | | v-model="editConfig.infomation.wholeDiscount" |
| | | size="mini" |
| | | :disabled="editConfig.infomation.wholeDiscountType?false:true" |
| | | @change="getTotal" |
| | | placeholder="请填写" |
| | | ></el-input> |
| | | </el-form-item> |
| | |
| | | v-model="editConfig.infomation.priceAdjustmentType" |
| | | placeholder="请选择" |
| | | filterable |
| | | @change="getTotal" |
| | | > |
| | | <el-option label="增加" :value="1"></el-option> |
| | | <el-option label="减少" :value="2"></el-option> |
| | |
| | | <el-input |
| | | v-model="editConfig.infomation.priceAdjustment" |
| | | size="mini" |
| | | :disabled="editConfig.infomation.priceAdjustmentType?false:true" |
| | | @change="getTotal" |
| | | placeholder="请填写" |
| | | ></el-input> |
| | | </el-form-item> |
| | |
| | | </div> |
| | | <div class="table-bottom-item"> |
| | | <div class="table-bottom-l">合计</div> |
| | | <div class="table-bottom-r">{{ editConfig.infomation.realTotalPrice }}</div> |
| | | <div class="table-bottom-r">{{ total }}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | wholeDiscount: [ |
| | | { |
| | | required: false, |
| | | message: "请填写", |
| | | message: "请填写0-100的数字", |
| | | trigger: "change", |
| | | }, |
| | | { validator: this.validatorNum, trigger: "change" }, |
| | |
| | | show: true, |
| | | total: false, |
| | | sumProp: ["price", "total"], |
| | | multiply:['amount','price'], |
| | | titleProp: [ |
| | | "编号", |
| | | "产品名称", |
| | |
| | | "描述", |
| | | ], |
| | | mergeNumber: 4, |
| | | totalName:'小计' |
| | | }, |
| | | editSelectSupplierConfig: { |
| | | editVisible: false, |
| | |
| | | plcBrandList:[], |
| | | editRow:{ |
| | | isDefault:'pin' |
| | | } |
| | | }, |
| | | total:0, |
| | | totalTwo:0, |
| | | }; |
| | | }, |
| | | created() { |
| | | this.setTableForm(); |
| | | this.handleGetBomKindDictList(); |
| | | }, |
| | | computed: { |
| | | }, |
| | |
| | | immediate:true, |
| | | handler:function(){ |
| | | |
| | | this.setTableForm(); |
| | | this.handleGetBomKindDictList(true); |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | validatorNum(rule, value, callback) { |
| | | if (value) { |
| | | if (value == undefined || value == null) { |
| | | if(this.editConfig.infomation.wholeDiscountType==1){ |
| | | if(value==undefined||value==null||(!value&&value!=0)){ |
| | | callback(new Error("请输入有效数字")); |
| | | } else { |
| | | var reg = /^\+?[0-9]\d*$/; |
| | | var reg=/^\+?[0-9]\d*$/ |
| | | if (!reg.test(value)) { |
| | | callback(new Error("请填写不小于0的数字")); |
| | | callback(new Error('请填写0-100的数字')) |
| | | } else { |
| | | callback(); |
| | | if(Number(value)>100){ |
| | | callback(new Error('请填写0-100的数字')) |
| | | }else{ |
| | | callback() |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | callback(); |
| | | this.validatorNumThree(rule, value, callback) |
| | | } |
| | | }, |
| | | validatorNumThree(rule, value, callback){ |
| | |
| | | }, |
| | | // PLC配置 |
| | | handleGetBomKindDictList(val) { |
| | | console.log(val,'val') |
| | | getPurchaseType().then((res) => { |
| | | this.plcBrandList = res.data; |
| | | this.setTableForm() |
| | | if (val) { |
| | | for (let i in this.plcBrandList) { |
| | | if (this.plcBrandList[i][this.editRow.isDefault]) { |
| | |
| | | }, |
| | | saveParams() { |
| | | let data =JSON.parse(JSON.stringify(this.editConfig.infomation)); |
| | | |
| | | if(this.editConfig.infomation.wholeDiscountType==2&&this.editConfig.infomation.wholeDiscount){ |
| | | if(Number(this.editConfig.infomation.wholeDiscount)>Number(this.totalTwo)){ |
| | | this.$message.error('直接降价不能超过价税合计的总和!') |
| | | return true; |
| | | } |
| | | } |
| | | let params = { |
| | | productList:this.tableData, |
| | | purchase:{ |
| | |
| | | name:data.name||'', |
| | | deliveryDate:data.deliveryDate||'', |
| | | contact:data.contact, |
| | | wholeDiscountType:data.wholeDiscountType, |
| | | wholeDiscount:Number(data.wholeDiscount), |
| | | priceAdjustmentType:data.priceAdjustmentType, |
| | | priceAdjustment:Number(data.priceAdjustment), |
| | | realTotalPrice:data.realTotalPrice||'', |
| | | wholeDiscountType:data.wholeDiscountType?data.wholeDiscountType:0, |
| | | wholeDiscount:data.wholeDiscount?Number(data.wholeDiscount):0, |
| | | priceAdjustmentType:data.priceAdjustmentType?data.priceAdjustmentType:0, |
| | | priceAdjustment:data.priceAdjustment?Number(data.priceAdjustment):0, |
| | | realTotalPrice:this.total?Number(this.total):0, |
| | | totalPrice:this.totalTwo?Number(this.totalTwo):0, |
| | | } |
| | | }; |
| | | if(data.ID){ |
| | |
| | | { |
| | | label: "产品名称", |
| | | prop: "name", |
| | | min: 170, |
| | | min: 180, |
| | | productName: true, |
| | | isRequird: true, |
| | | }, |
| | | { label: "产品编号", prop: "number" }, |
| | | { label: "产品编号", prop: "number", min: 150,}, |
| | | { label: "计量单位", prop: "unit" }, |
| | | { label: "规格型号", prop: "specifications" }, |
| | | { label: "数量", prop: "amount", inputNumber: true, isRequird: true }, |
| | |
| | | inputFloat: true, |
| | | isRequird: true, |
| | | }, |
| | | { label: "价税合计", prop: "total", inputFloat: true }, |
| | | { label: "价税合计", prop: "total", inputFloat: true,disabled:true,multiply:true, }, |
| | | { label: "描述", prop: "remark", input: true }, |
| | | ], |
| | | }; |
| | | this.handleGetBomKindDictList(true); |
| | | this.toal=this.editConfig.infomation.realTotalPrice |
| | | |
| | | }, |
| | | // 产品列表输入 |
| | | inputContent(val, prop, row) { |
| | |
| | | item[prop] = val; |
| | | } |
| | | }); |
| | | |
| | | }, |
| | | getSummaries(total){ |
| | | this.totalTwo= JSON.parse(JSON.stringify(total)); |
| | | this.total=total; |
| | | this.getTotal() |
| | | }, |
| | | getTotal(){ |
| | | let prie=0 |
| | | if(this.editConfig.infomation.priceAdjustmentType==1){ |
| | | prie=Number(this.editConfig.infomation.priceAdjustment) |
| | | }else if(this.editConfig.infomation.priceAdjustmentType==2){ |
| | | prie=(-1)*Number(this.editConfig.infomation.priceAdjustment) |
| | | }else{ |
| | | prie=0 |
| | | } |
| | | let t=0 |
| | | if(this.editConfig.infomation.wholeDiscountType==1){ |
| | | t=this.totalTwo*Number(this.editConfig.infomation.wholeDiscount)/100 |
| | | }else if(this.editConfig.infomation.wholeDiscountType==2){ |
| | | t=Number(this.editConfig.infomation.wholeDiscount) |
| | | }else{ |
| | | t=0 |
| | | } |
| | | this.total=this.totalTwo-t+Number(prie) |
| | | }, |
| | | // 产品新增 |
| | | addProductClick() { |